📄 clientproduct.cpp
字号:
// ClientProduct.cpp: implementation of the CClientProduct class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "ClientProduct.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CClientProduct::CClientProduct()
{
}
CClientProduct::~CClientProduct()
{
}
COleDateTime CClientProduct::GetBeginDate()
{
return beginDate;
}
COleDateTime CClientProduct::GetEndDate()
{
return endDate;
}
CString CClientProduct::GetClientID()
{
return clientID;
}
CString CClientProduct::GetProductID()
{
return productID;
}
CString CClientProduct::GetProductName()
{
return productName;
}
CString CClientProduct::GetStandard()
{
return standard;
}
float CClientProduct::GetPrice()
{
return price;
}
int CClientProduct::GetNum()
{
return num;
}
CString CClientProduct::GetUnit()
{
return unit;
}
float CClientProduct::GetTotal()
{
return total;
}
CString CClientProduct::GetManageRange()
{
return manageRange;
}
CString CClientProduct::GetOurStaff()
{
return ourStaff;
}
CString CClientProduct::GetClientStaff()
{
return clientStaff;
}
CString CClientProduct::GetRemark()
{
return remark;
}
void CClientProduct::SetBeginDate(COleDateTime vBeginDate)
{
beginDate=vBeginDate;
}
void CClientProduct::SetEndDate(COleDateTime vEndDate)
{
endDate=vEndDate;
}
void CClientProduct::SetClientID(CString vClientID)
{
clientID=vClientID;
}
void CClientProduct::SetProductID(CString vProductID)
{
productID=vProductID;
}
void CClientProduct::SetProductName(CString vProductName)
{
productName=vProductName;
}
void CClientProduct::SetStandard(CString vStandard)
{
standard=vStandard;
}
void CClientProduct::SetPrice(float vPrice)
{
price=vPrice;
}
void CClientProduct::SetNum(int vNum)
{
num=vNum;
}
void CClientProduct::SetUnit(CString vUnit)
{
unit=vUnit;
}
void CClientProduct::SetTotal(float vTotal)
{
total=vTotal;
}
void CClientProduct::SetManageRange(CString vManageRange )
{
manageRange=vManageRange;
}
void CClientProduct::SetOurStaff(CString vOurStaff)
{
ourStaff=vOurStaff;
}
void CClientProduct::SetClientStaff(CString vClientStaff)
{
clientStaff=vClientStaff;
}
void CClientProduct::SetRemark(CString vRemark)
{
remark=vRemark;
}
void CClientProduct::sqlInsert()
{
CString strSQL;
strSQL="select * from clientProduct";
_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("clientID",_variant_t(clientID.Left(25)));
m_pRecordset->PutCollect("productID",_variant_t(productID.Left(25)));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("beginDate",_variant_t(beginDate));
m_pRecordset->PutCollect("endDate",_variant_t(endDate));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(50)));
// m_pRecordset->PutCollect("model",_variant_t(model.Left(50)));
m_pRecordset->PutCollect("price",_variant_t(price));
str.Format("%d",num);
m_pRecordset->PutCollect("num",_variant_t(str));
m_pRecordset->PutCollect("unit",_variant_t(unit.Left(50)));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("range",_variant_t(manageRange.Left(100)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(100)));
m_pRecordset->Update();
}
}
void CClientProduct::sqlUpdate(CString cClientID,CString productID)
{
CString strSQL;
strSQL="select * from clientProduct where clientID='";
strSQL=strSQL+cClientID+"' and productID='"+productID+"'";
_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;
m_pRecordset->PutCollect("clientID",_variant_t(clientID.Left(25)));
m_pRecordset->PutCollect("productID",_variant_t(productID.Left(25)));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("beginDate",_variant_t(beginDate));
m_pRecordset->PutCollect("endDate",_variant_t(endDate));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(50)));
// m_pRecordset->PutCollect("model",_variant_t(model.Left(50)));
m_pRecordset->PutCollect("price",_variant_t(price));
str.Format("%d",num);
m_pRecordset->PutCollect("num",_variant_t(str));
m_pRecordset->PutCollect("unit",_variant_t(unit.Left(50)));
m_pRecordset->PutCollect("total",_variant_t(total));
m_pRecordset->PutCollect("range",_variant_t(manageRange.Left(100)));
m_pRecordset->PutCollect("ourStaff",_variant_t(ourStaff.Left(50)));
m_pRecordset->PutCollect("clientStaff",_variant_t(clientStaff.Left(50)));
m_pRecordset->PutCollect("remark",_variant_t(remark.Left(100)));
m_pRecordset->Update();
}
}
void CClientProduct::sqlDelete(CString cClientID,CString productID)
{
CString strSQL;
strSQL="delete from clientProduct where clientID='";
strSQL=strSQL+cClientID+"' and productID='"+productID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CClientProduct::GetData(CString cClientID,CString productID)
{
CString strSQL;
strSQL="select * from clientProduct where clientID='";
strSQL=strSQL+cClientID+"' and productID='"+productID+"'";
_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;
productName= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName"));
beginDate= m_pRecordset->GetCollect("beginDate");
endDate= m_pRecordset->GetCollect("endDate");
standard= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("standard"));
// model= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("model"));
price= m_pRecordset->GetCollect("price");
num= (m_pRecordset->GetCollect("num")).intVal;
unit= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("unit"));
total= m_pRecordset->GetCollect("total");
manageRange= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("range"));
ourStaff= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("ourStaff"));
clientStaff= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientStaff"));
remark= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -