📄 opponentproduct.cpp
字号:
// OpponentProduct.cpp: implementation of the COpponentProduct class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "OpponentProduct.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
COpponentProduct::COpponentProduct()
{
}
COpponentProduct::~COpponentProduct()
{
}
COleDateTime COpponentProduct::GetIssueDate()
{
return issueDate;
}
CString COpponentProduct::GetOpponentID()
{
return opponentID;
}
CString COpponentProduct::GetProductID()
{
return productID;
}
CString COpponentProduct::GetProductName()
{
return productName;
}
CString COpponentProduct::GetProductShortenedName()
{
return productShortenedName;
}
CString COpponentProduct::GetStandard()
{
return standard;
}
float COpponentProduct::GetPrice()
{
return price;
}
CString COpponentProduct::GetModel()
{
return model;
}
CString COpponentProduct::GetMarketQuota()
{
return marketQuota;
}
CString COpponentProduct::GetMarketFlection()
{
return marketFlection;
}
CString COpponentProduct::GetMarketProspect()
{
return marketProspect;
}
CString COpponentProduct::GetFunction()
{
return function;
}
void COpponentProduct::SetIssueDate(COleDateTime vIssueDate)
{
issueDate=vIssueDate;
}
void COpponentProduct::SetOpponentID(CString vOpponentID)
{
opponentID=vOpponentID;
}
void COpponentProduct::SetProductID(CString vProductID)
{
productID=vProductID;
}
void COpponentProduct::SetProductName(CString vProductName)
{
productName=vProductName;
}
void COpponentProduct::SetProductShortenedName(CString vProductShortenedName)
{
productShortenedName=vProductShortenedName;
}
void COpponentProduct::SetStandard(CString vStandard)
{
standard=vStandard;
}
void COpponentProduct::SetPrice(float vPrice)
{
price=vPrice;
}
void COpponentProduct::SetModel(CString vModel)
{
model=vModel;
}
void COpponentProduct::SetMarketQuota(CString vMarketQuota)
{
marketQuota=vMarketQuota;
}
void COpponentProduct::SetMarketFlection(CString vMarketFlection)
{
marketFlection=vMarketFlection;
}
void COpponentProduct::SetMarketProspect(CString vMarketProspect)
{
marketProspect=vMarketProspect;
}
void COpponentProduct::SetFunction(CString vFunction)
{
function=vFunction;
}
void COpponentProduct::sqlInsert()
{
CString strSQL;
strSQL="select * from opponentProduct";
_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("productID",_variant_t(productID.Left(25)));
m_pRecordset->PutCollect("opponentID",_variant_t(opponentID.Left(25)));
m_pRecordset->PutCollect("issueDate",_variant_t(issueDate));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("productShortenedName",_variant_t(productShortenedName.Left(50)));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(25)));
m_pRecordset->PutCollect("model",_variant_t(model.Left(50)));
m_pRecordset->PutCollect("price",_variant_t(price));
m_pRecordset->PutCollect("marketQuota",_variant_t(marketQuota.Left(100)));
m_pRecordset->PutCollect("marketFlection",_variant_t(marketFlection.Left(100)));
m_pRecordset->PutCollect("marketProspect",_variant_t(marketProspect.Left(100)));
m_pRecordset->PutCollect("function",_variant_t(function.Left(100)));
m_pRecordset->Update();
}
}
void COpponentProduct::sqlDelete(CString cOpponentID,CString cProductID)
{
CString strSQL;
strSQL="delete from opponentProduct where opponentID='";
strSQL=strSQL+cOpponentID+"' and productID='"+cProductID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void COpponentProduct::sqlUpdate(CString cOpponentID,CString cProductID)
{
CString strSQL;
strSQL="select * from opponentProduct where opponentID='";
strSQL=strSQL+cOpponentID+"' and productID='"+cProductID+"'";
_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("productID",_variant_t(productID.Left(25)));
m_pRecordset->PutCollect("opponentID",_variant_t(opponentID.Left(25)));
m_pRecordset->PutCollect("issueDate",_variant_t(issueDate));
m_pRecordset->PutCollect("productName",_variant_t(productName.Left(50)));
m_pRecordset->PutCollect("productShortenedName",_variant_t(productShortenedName.Left(50)));
m_pRecordset->PutCollect("standard",_variant_t(standard.Left(25)));
m_pRecordset->PutCollect("model",_variant_t(model.Left(50)));
m_pRecordset->PutCollect("price",_variant_t(price));
m_pRecordset->PutCollect("marketQuota",_variant_t(marketQuota.Left(50)));
m_pRecordset->PutCollect("marketFlection",_variant_t(marketFlection.Left(50)));
m_pRecordset->PutCollect("marketProspect",_variant_t(marketProspect.Left(50)));
m_pRecordset->PutCollect("function",_variant_t(function.Left(50)));
m_pRecordset->Update();
}
}
void COpponentProduct::GetData(CString cOpponentID,CString cProductID)
{
CString strSQL;
strSQL="select * from opponentProduct where opponentID='";
strSQL=strSQL+cOpponentID+"' and productID='"+cProductID+"'";
_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;
productID= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productID"));
opponentID= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentID"));
issueDate= m_pRecordset->GetCollect("issueDate");
productName= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productName"));
productShortenedName= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("productShortenedName"));
standard= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("standard"));
model= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("model"));
price= m_pRecordset->GetCollect("price");
marketQuota= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("marketQuota"));
marketFlection= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("marketFlection"));
marketProspect= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("marketProspect"));
function= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("function"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -