📄 contractclass.cpp
字号:
// ContractClass.cpp: implementation of the CContractClass class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "ContractClass.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CContractClass::CContractClass()
{
}
CContractClass::~CContractClass()
{
}
CString CContractClass::GetContractID()
{
return contractID;
}
CString CContractClass::GetContractName()
{
return contractName;
}
COleDateTime CContractClass::GetFormDate()
{
return formDate;
}
CString CContractClass::GetProductName()
{
return productName;
}
CString CContractClass::GetStandard()
{
return standard;
}
CString CContractClass::GetModel()
{
return model;
}
CString CContractClass::GetUnit()
{
return unit;
}
float CContractClass::GetTotal()
{
return total;
}
CString CContractClass::GetClientName()
{
return clientName;
}
CString CContractClass::GetClientStaff()
{
return clientStaff;
}
CString CContractClass::GetOurStaff()
{
return ourStaff;
}
CString CContractClass::GetThirdStaff()
{
return thirdStaff;
}
COleDateTime CContractClass::GetEffectiveDate()
{
return effectiveDate;
}
COleDateTime CContractClass::GetEndDate()
{
return endDate;
}
CString CContractClass::GetRemark()
{
return remark;
}
void CContractClass::SetContractID(CString vContractID)
{
contractID=vContractID;
}
void CContractClass::SetContractName(CString vContractName)
{
contractName=vContractName;
}
void CContractClass::SetFormDate(COleDateTime vFormDate)
{
formDate=vFormDate;
}
void CContractClass::SetProductName(CString vProductName)
{
productName=vProductName;
}
void CContractClass::SetStandard(CString vStandard)
{
standard=vStandard;
}
void CContractClass::SetModel(CString vModel)
{
model=vModel;
}
void CContractClass::SetUnit(CString vUnit)
{
unit=vUnit;
}
void CContractClass::SetTotal(float vTotal)
{
total=vTotal;
}
void CContractClass::SetClientName(CString vClientName)
{
clientName=vClientName;
}
void CContractClass::SetClientStaff(CString vClientStaff)
{
clientStaff=vClientStaff;
}
void CContractClass::SetOurStaff(CString vOurStaff)
{
ourStaff=vOurStaff;
}
void CContractClass::SetThirdStaff(CString vThirdStaff)
{
thirdStaff=vThirdStaff;
}
void CContractClass::SetEffectiveDate(COleDateTime vEffectiveDate)
{
effectiveDate=vEffectiveDate;
}
void CContractClass::SetEndDate(COleDateTime vEndDate)
{
endDate=vEndDate;
}
void CContractClass::SetRemark(CString vRemark)
{
remark=vRemark;
}
void CContractClass::sqlInsert()
{
CString strSQL;
strSQL="select * from contract";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->AddNew();
CString str;
m_pRecordset->PutCollect("contractID",_variant_t(contractID.Left(25)));
m_pRecordset->PutCollect("contractName",_variant_t(contractName.Left(50)));
m_pRecordset->PutCollect("formDate",_variant_t(formDate));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(50)));
m_pRecordset->PutCollect("model",_variant_t(model.Left(25)));
m_pRecordset->PutCollect("unit",_variant_t(unit.Left(50)));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("clientName",_variant_t(clientName.Left(50)));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("thirdStaff",_variant_t(thirdStaff.Left(50)));
m_pRecordset->PutCollect("effectiveDate",_variant_t(effectiveDate));
m_pRecordset->PutCollect("endDate",_variant_t(endDate));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(50)));
m_pRecordset->Update();
}
}
void CContractClass::sqlDelete(CString vContractID)
{
CString strSQL;
strSQL="delete from contract where contractID='";
strSQL=strSQL+vContractID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CContractClass::sqlUpdate(CString vContractID)
{
CString strSQL;
strSQL="select * from contract where contractID='";
strSQL=strSQL+vContractID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->PutCollect("contractName",_variant_t(contractName.Left(50)));
m_pRecordset->PutCollect("formDate",_variant_t(formDate));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(50)));
m_pRecordset->PutCollect("model",_variant_t(model.Left(25)));
m_pRecordset->PutCollect("unit",_variant_t(unit.Left(50)));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("clientName",_variant_t(clientName.Left(50)));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("thirdStaff",_variant_t(thirdStaff.Left(50)));
m_pRecordset->PutCollect("effectiveDate",_variant_t(effectiveDate));
m_pRecordset->PutCollect("endDate",_variant_t(endDate));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(50)));
m_pRecordset->Update();
}
}
void CContractClass::GetData(CString vContractID)
{
CString strSQL;
strSQL="select * from contract where contractID='";
strSQL=strSQL+vContractID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
contractName=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contractName"));
formDate=m_pRecordset->GetCollect("formDate");
productName=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName"));
standard=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("standard"));
model=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("model"));
unit=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("unit"));
total=atof(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("total")));
clientName=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientName"));
clientStaff=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientStaff"));
ourStaff=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("ourStaff"));
thirdStaff=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("thirdStaff"));
effectiveDate=m_pRecordset->GetCollect("effectiveDate");
endDate=m_pRecordset->GetCollect("endDate");
remark=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -