📄 opponentcontact.cpp
字号:
// OpponentContact.cpp: implementation of the COpponentContact class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "OpponentContact.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
COpponentContact::COpponentContact()
{
}
COpponentContact::~COpponentContact()
{
}
COleDateTime COpponentContact::GetContactDate()
{
return contactDate;
}
CString COpponentContact::GetOpponentID()
{
return opponentID;
}
CString COpponentContact::GetContactID()
{
return contactID;
}
CString COpponentContact::GetContactAddress()
{
return contactAddress;
}
CString COpponentContact::GetBussinessResource()
{
return bussinessResource;
}
CString COpponentContact::GetProductName()
{
return productName;
}
float COpponentContact::GetPrice()
{
return price;
}
int COpponentContact::GetNum()
{
return num;
}
float COpponentContact::GetTotal()
{
return total;
}
CString COpponentContact::GetOurStaff()
{
return ourStaff;
}
CString COpponentContact::GetClientStaff()
{
return clientStaff;
}
CString COpponentContact::GetRemark()
{
return remark;
}
void COpponentContact::SetContactDate(COleDateTime vContactDate)
{
contactDate=vContactDate;
}
void COpponentContact::SetOpponentID(CString vOpponentID)
{
opponentID=vOpponentID;
}
void COpponentContact::SetContactID(CString vContactID)
{
contactID=vContactID;
}
void COpponentContact::SetContactAddress(CString vContactAddress)
{
contactAddress=vContactAddress;
}
void COpponentContact::SetBussinessResource(CString vBussinessResource)
{
bussinessResource=vBussinessResource;
}
void COpponentContact::SetProductName(CString vProductName)
{
productName=vProductName;
}
void COpponentContact::SetPrice(float vPrice)
{
price=vPrice;
}
void COpponentContact::SetNum(int vNum)
{
num=vNum;
}
void COpponentContact::SetTotal(float vTotal)
{
total=vTotal;
}
void COpponentContact::SetOurStaff(CString vOurStaff)
{
ourStaff=vOurStaff;
}
void COpponentContact::SetClientStaff(CString vClientStaff)
{
clientStaff=vClientStaff;
}
void COpponentContact::SetRemark(CString vRemark)
{
remark=vRemark;
}
void COpponentContact::sqlInsert()
{
CString strSQL;
strSQL="select * from opponentContact";
_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("recordID",_variant_t(contactID.Left(25)));
m_pRecordset->PutCollect("opponentID",_variant_t(opponentID.Left(25)));
m_pRecordset->PutCollect("contactDate",_variant_t(contactDate));
m_pRecordset->PutCollect("contactAddress",_variant_t(contactAddress.Left(50)));
m_pRecordset->PutCollect("businessResource",_variant_t(bussinessResource.Left(50)));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(25)));
m_pRecordset->PutCollect("price",_variant_t(price));
str.Format("%d",num);
m_pRecordset->PutCollect("num",_variant_t(str));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(50)));
m_pRecordset->Update();
}
}
void COpponentContact::sqlUpdate(CString cOpponentID,CString cContactID)
{
CString strSQL;
strSQL="select * from opponentContact where opponentID='";
strSQL=strSQL+cOpponentID+"' and recordID='"+cContactID+"'";
_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(!(m_pRecordset->adoEOF))
{
CString str;
m_pRecordset->PutCollect("contactDate",_variant_t(contactDate));
m_pRecordset->PutCollect("contactAddress",_variant_t(contactAddress.Left(50)));
m_pRecordset->PutCollect("businessResource",_variant_t(bussinessResource.Left(50)));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(25)));
m_pRecordset->PutCollect("price",_variant_t(price));
str.Format("%d",num);
m_pRecordset->PutCollect("num",_variant_t(str));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(50)));
m_pRecordset->Update();
}
}
void COpponentContact::sqlDelete(CString cOpponentID,CString cContactID)
{
CString strSQL;
strSQL="delete from opponentContact where opponentID='";
strSQL=strSQL+cOpponentID+"' and recordID='"+cContactID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void COpponentContact::GetData(CString cOpponentID,CString cContactID)
{
CString strSQL;
strSQL="select * from opponentContact where opponentID='";
strSQL=strSQL+cOpponentID+"' and recordID='"+cContactID+"'";
_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))
{
CString str;
contactID= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("recordID"));
opponentID= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentID"));
contactDate= m_pRecordset->GetCollect("contactDate");
contactAddress= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactAddress"));
bussinessResource= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("businessResource"));
productName= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName"));
price= m_pRecordset->GetCollect("price");
num= atoi(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
total= m_pRecordset->GetCollect("total");
clientStaff= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientStaff"));
ourStaff= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("ourStaff"));
remark= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -