⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientinfor.cpp

📁 关于客户关系管理系统的源码
💻 CPP
字号:
// ClientInfor.cpp: implementation of the CClientInfor class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ClientRelationship.h"
#include "ClientInfor.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CClientInfor::CClientInfor()
{

}

CClientInfor::~CClientInfor()
{

}
CString		CClientInfor::GetClientID()
{
	return clientID;
}

CString		CClientInfor::GetClientName()
{
	return clientName;
}

COleDateTime	CClientInfor::GetBookinDate()
{
	return bookinDate;
}

CString		CClientInfor::GetClientLevel()
{
	return clientLevel;
}

CString		CClientInfor::GetContactPerson()
{
	return contactPerson;
}

CString		CClientInfor::GetArea()
{
	return area;
}

CString		CClientInfor::GetAddress()
{
	return address;
}

CString		CClientInfor::GetPostcode()
{
	return postcode;
}

CString		CClientInfor::GetTelephone()
{
	return telephone;
}

CString		CClientInfor::GetFax()
{
	return fax;
}

CString		CClientInfor::GetWebSite()
{
	return webSite;
}

CString		CClientInfor::GetEMail()
{
	return eMail;
}

CString		CClientInfor::GetRemark()
{
	return remark;
}

CString		CClientInfor::GetManageRange()
{
	return manageRange;
}

CString		CClientInfor::GetManageProduct()
{
	return manageProduct;
}

CString		CClientInfor::GetAccountBank()
{
	return accountBank;
}

CString		CClientInfor::GetAccount()
{
	return account;
}

CString		CClientInfor::GetTaxNO()
{
	return taxNO;
}

COleDateTime	CClientInfor::GetRegisterDate()
{
	return registerDate;
}

float		CClientInfor::GetRegisterFund()
{
	return registerFund;
}

CString		CClientInfor::GetScale()
{
	return scale;
}

CString		CClientInfor::GetIndustryCharacter()
{
	return industryCharacter;
}

float		CClientInfor::GetAllFunds()
{
	return allFunds;
}

CString		CClientInfor::GetClientCharacter()
{
	return clientCharacter;
}

void	CClientInfor::SetClientID(CString vClientID)
{
	clientID=vClientID;
}

void 	CClientInfor::SetClientName(CString vClientName)
{
	clientName=vClientName;
}

void 	CClientInfor::SetBookinDate(COleDateTime vBookinDate)
{
	bookinDate=vBookinDate;
}

void 	CClientInfor::SetClientLevel(CString vClientLevel)
{
	clientLevel=vClientLevel;
}

void 	CClientInfor::SetContactPerson(CString vContactPerson)
{
	contactPerson=vContactPerson;
}

void 	CClientInfor::SetArea(CString vArea)
{
	area=vArea;
}

void 	CClientInfor::SetAddress(CString vAddress)
{
	address=vAddress;
}

void 	CClientInfor::SetPostcode(CString vPostcode)
{
	postcode=vPostcode;
}

void 	CClientInfor::SetTelephone(CString vTelephone)
{
	telephone=vTelephone;
}

void 	CClientInfor::SetFax(CString vFax)
{
	fax=vFax;
}

void 	CClientInfor::SetWebSite(CString vWebSite)
{
	webSite=vWebSite;
}

void 	CClientInfor::SetEMail(CString vEMail)
{
	eMail=vEMail;
}

void 	CClientInfor::SetRemark(CString vRemark)
{
	remark=vRemark;
}

void 	CClientInfor::SetManageRange(CString vManageRange)
{
	manageRange=vManageRange;
}

void 	CClientInfor::SetManageProduct(CString vManageProduct)
{
	manageProduct=vManageProduct;
}

void 	CClientInfor::SetAccountBank(CString vAccountBank)
{
	accountBank=vAccountBank;
}

void 	CClientInfor::SetAccount(CString vAccount)
{
	account=vAccount;
}

void 	CClientInfor::SetTaxNO(CString vTaxNO)
{
	taxNO=vTaxNO;
}

void 	CClientInfor::SetRegisterDate(COleDateTime vRegisterDate)
{
	registerDate=vRegisterDate;
}

void 	CClientInfor::SetRegisterFund(float vRegisterFund)
{
	registerFund=vRegisterFund;
}

void 	CClientInfor::SetScale(CString vScale)
{
	scale=vScale;
}

void 	CClientInfor::SetIndustryCharacter(CString vIndustryCharacter)
{
	industryCharacter=vIndustryCharacter;
}

void 	CClientInfor::SetAllFunds(float vAllFunds)
{
	allFunds=vAllFunds;
}

void 	CClientInfor::SetClientCharacter(CString vClientCharacter)
{
	clientCharacter=vClientCharacter;
}

void	CClientInfor::sqlInsert()
{	
	CString strSQL;

	strSQL="select * from client";   //构造查询的SQL语句
	_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("bookinDate",_variant_t(bookinDate));   //登记日期
		m_pRecordset->PutCollect("clientLevel",_variant_t(clientLevel.Left(50))); //客户级别
		m_pRecordset->PutCollect("clientName",_variant_t(clientName.Left(50)));  //单位名称
		m_pRecordset->PutCollect("contactPerson",_variant_t(contactPerson.Left(50))); //联系人
		m_pRecordset->PutCollect("areaID",_variant_t(area.Left(25)));  //地区
		m_pRecordset->PutCollect("address",_variant_t(address.Left(50))); //地址
		m_pRecordset->PutCollect("postcode",_variant_t(postcode.Left(50)));  //邮编
		m_pRecordset->PutCollect("telephone",_variant_t(telephone.Left(50)));  //电话
		m_pRecordset->PutCollect("fax",_variant_t(fax.Left(50)));  //传真
		m_pRecordset->PutCollect("webSite",_variant_t(webSite.Left(50)));  //网址
		m_pRecordset->PutCollect("eMail",_variant_t(eMail.Left(50)));  //eMail
		m_pRecordset->PutCollect("remark",_variant_t(remark.Left(100))); //备注
		m_pRecordset->PutCollect("manageRange",_variant_t(manageRange.Left(50)));  //经营范围
		m_pRecordset->PutCollect("manageProduct",_variant_t(manageProduct.Left(50)));  //经营产品
		m_pRecordset->PutCollect("accountBank",_variant_t(accountBank.Left(50)));  //开户银行
		m_pRecordset->PutCollect("account",_variant_t(account.Left(50)));  //帐号
		m_pRecordset->PutCollect("taxNO",_variant_t(taxNO.Left(50)));  //税号
		m_pRecordset->PutCollect("registerDate",_variant_t(registerDate));  //注册日期
		m_pRecordset->PutCollect("registerFund",_variant_t(registerFund));  //注册资金
		m_pRecordset->PutCollect("scale",_variant_t(scale.Left(50)));  //企业规模
		m_pRecordset->PutCollect("industryCharacter",_variant_t(industryCharacter.Left(50)));  //行业性质
		m_pRecordset->PutCollect("allFunds",_variant_t(allFunds));  //总资产
		m_pRecordset->PutCollect("clientCharacter",_variant_t(clientCharacter.Left(50)));  //性质		

		m_pRecordset->Update();  //更新数据库
	}
}

void	CClientInfor::sqlUpdate(CString cClientID)
{
	CString strSQL;

	strSQL="select * from client where clientID='";
	strSQL=strSQL+cClientID+"'";   //构造查询出满足条件的客户的SQL语句
	_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("clientID",_variant_t(clientID.Left(25))); //客户编号
		m_pRecordset->PutCollect("bookinDate",_variant_t(bookinDate));  //登记日期
			m_pRecordset->PutCollect("clientLevel",_variant_t(clientLevel.Left(50)));//客户级别
	   	m_pRecordset->PutCollect("clientName",_variant_t(clientName));//单位名称
//AfxMessageBox("1");		m_pRecordset->PutCollect("contactPerson",_variant_t(contactPerson.Left(50)));//联系人
//		m_pRecordset->PutCollect("areaID",_variant_t(area));//地区
		m_pRecordset->PutCollect("address",_variant_t(address));//地址
			m_pRecordset->PutCollect("postcode",_variant_t(postcode.Left(50)));//邮编
		m_pRecordset->PutCollect("telephone",_variant_t(telephone.Left(50)));  //电话
		m_pRecordset->PutCollect("fax",_variant_t(fax.Left(50)));  //传真
		m_pRecordset->PutCollect("webSite",_variant_t(webSite.Left(50)));  //网址
		m_pRecordset->PutCollect("eMail",_variant_t(eMail.Left(50)));  //eMail
		m_pRecordset->PutCollect("remark",_variant_t(remark.Left(100)));  //备注
		m_pRecordset->PutCollect("manageRange",_variant_t(manageRange.Left(50)));  //经营范围
		m_pRecordset->PutCollect("manageProduct",_variant_t(manageProduct.Left(50)));  //经营产品
		m_pRecordset->PutCollect("accountBank",_variant_t(accountBank.Left(50)));  //开户银行
		m_pRecordset->PutCollect("account",_variant_t(account.Left(50)));  //帐号
	m_pRecordset->PutCollect("taxNO",_variant_t(taxNO.Left(50)));  //税号
		m_pRecordset->PutCollect("registerDate",_variant_t(registerDate));  //注册日期
		m_pRecordset->PutCollect("registerFund",_variant_t(registerFund));  //这册资金
		m_pRecordset->PutCollect("scale",_variant_t(scale.Left(50)));  //规模
		m_pRecordset->PutCollect("industryCharacter",_variant_t(industryCharacter.Left(50)));  //行业性质
		m_pRecordset->PutCollect("allFunds",_variant_t(allFunds));  //总资产
		m_pRecordset->PutCollect("clientCharacter",_variant_t(clientCharacter.Left(50)));  //性质		

		m_pRecordset->Update();  //更新数据库
	}
}

void	CClientInfor::sqlDelete(CString cClientID)
{
	CString strSQL;
	strSQL="delete from client where clientID='";
	strSQL=strSQL+cClientID+"'";   //构造删除记录的sql语句
	(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);//执行sql语句
}

void    CClientInfor::GetData(CString cClientID)
{
	CString strSQL;

	strSQL="select * from client where clientID='";
	strSQL=strSQL+cClientID+"'";  //构造查询语句
	_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;
		clientID = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientID"));  //客户编号
		clientName = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientName")); //单位名称
		bookinDate = m_pRecordset->GetCollect("bookinDate");  //登记日期
		clientLevel = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientLevel"));  //客户级别
		contactPerson = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactPerson"));  //联系人
		area = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("areaID"));  //地区
		address = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address"));  //地址
		postcode = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("postcode"));  //邮编
		telephone = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("telephone")); //电话
		fax = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("fax"));  //传真
		webSite = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("webSite"));  //网址
		eMail = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("eMail"));  //eMail
		remark = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark"));  //备注
		manageRange = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageRange"));  //经营范围
		manageProduct = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageProduct"));  //经营产品
		accountBank = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("accountBank"));  //开户银行
		account = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("account")); //帐号
		taxNO = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("taxNO"));  //税号
		registerDate = m_pRecordset->GetCollect("registerDate");  //注册日期
		registerFund = atof(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("registerFund")));  //注册资金
		scale = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("scale")); //规模
		industryCharacter = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("industryCharacter"));  //行业性质
		allFunds = atof(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("allFunds")));  //总资产
		clientCharacter = ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientCharacter"));  //性质

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -