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

📄 clientinforform.cpp

📁 关于客户关系管理系统的源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		m_list.SetItemText(i,2,str);
		m_list.SetItemText(i,3,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientLevel")));//客户级别
		m_list.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactPerson")));//联系人
		m_list.SetItemText(i,5, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("areaID")));//地区
		m_list.SetItemText(i,6, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));//地址
		m_list.SetItemText(i,7, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("postcode")));//邮编
		m_list.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("telephone")));//电话
		m_list.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("fax"))); //传真
		m_list.SetItemText(i,10, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("webSite")));//网址
		m_list.SetItemText(i,11, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("eMail")));//eMail
		m_list.SetItemText(i,12, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark")));//备注
		m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageRange")));//经营范围
		m_list.SetItemText(i,14,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageProduct")));//经营产品
		m_list.SetItemText(i,15, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("accountBank")));//开户银行
		m_list.SetItemText(i,16, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("account"))); //银行帐号
		m_list.SetItemText(i,17, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("taxNO")));  //税号
		COleDateTime registerDate=m_pRecordset->GetCollect("registerDate");//注册日期
		str.Format("%d-%d-%d",registerDate.GetYear(),registerDate.GetMonth(),registerDate.GetDay());  //将注册日期转换成字符串  
		m_list.SetItemText(i,18, str);
		m_list.SetItemText(i,19, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("registerFund")));//注册资金
		m_list.SetItemText(i,20, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("scale")));//规模
		m_list.SetItemText(i,21, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("industryCharacter")));//行业特征
		m_list.SetItemText(i,22, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("allFunds")));//总资产
		m_list.SetItemText(i,23, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientCharacter")));//性质
	
		i++;
		m_pRecordset->MoveNext();  //记录集指针向后移动
	}
	//获取控件可用性控制变量的值
	tx_clientID=GetDlgItem(IDC_clientID); //客户编号
	tx_clientName=GetDlgItem(IDC_clientName); //单位名称
	tx_bookinDate=GetDlgItem(IDC_bookinDate);  //登记日期
	tx_clientLevel=GetDlgItem(IDC_clientLevel);  //客户级别
	tx_contactPerson=GetDlgItem(IDC_contactPerson);  //联系人
	tx_area=GetDlgItem(IDC_area);  //地区
	tx_address=GetDlgItem(IDC_address); //地址
	tx_postcode=GetDlgItem(IDC_postcode); //邮编
	tx_telephone=GetDlgItem(IDC_telephone);  //电话
	tx_fax=GetDlgItem(IDC_fax); //传真
	tx_webSite=GetDlgItem(IDC_webSite); //网址
	tx_eMail=GetDlgItem(IDC_eMail);  //eMail
	tx_remark=GetDlgItem(IDC_remark);  //备注
	tx_manageRange=GetDlgItem(IDC_manageRange);  //经营范围
	tx_manageProduct=GetDlgItem(IDC_manageProduct); //经营产品
	tx_accountBank=GetDlgItem(IDC_accountBank);  //开户银行
	tx_account=GetDlgItem(IDC_account);  //银行帐号
	tx_taxNO=GetDlgItem(IDC_taxNO);  //税号
	tx_registerDate=GetDlgItem(IDC_registerDate);  //注册日期
	tx_registerFund=GetDlgItem(IDC_registerFund);  //注册资金
	tx_scale=GetDlgItem(IDC_scale);  //规模
	tx_industryCharacter=GetDlgItem(IDC_industryCharacter);  //行业性质
	tx_allFunds=GetDlgItem(IDC_allFunds);  //总资产
	tx_clientCharacter=GetDlgItem(IDC_clientCharacter);  //性质

	bt_add=GetDlgItem(IDC_add);  //添加
	bt_cancelation=GetDlgItem(IDC_cancelation);  //取消
	bt_delete=GetDlgItem(IDC_delete);  //删除
	bt_save=GetDlgItem(IDC_save);  //保存
	bt_modify=GetDlgItem(IDC_modify);  //修改
	
    //设定控件的初始可用性
	tx_clientID->EnableWindow(false);
	tx_clientName->EnableWindow(false);
	tx_bookinDate->EnableWindow(false);
	tx_clientLevel->EnableWindow(false);
	tx_contactPerson->EnableWindow(false);
	tx_area->EnableWindow(false);
	tx_address->EnableWindow(false);
	tx_postcode->EnableWindow(false);
	tx_telephone->EnableWindow(false);
	tx_fax->EnableWindow(false);
	tx_webSite->EnableWindow(false);
	tx_eMail->EnableWindow(false);
	tx_remark->EnableWindow(false);
	tx_manageRange->EnableWindow(false);
	tx_manageProduct->EnableWindow(false);
	tx_accountBank->EnableWindow(false);
	tx_account->EnableWindow(false);
	tx_taxNO->EnableWindow(false);
	tx_registerDate->EnableWindow(false);
	tx_registerFund->EnableWindow(false);
	tx_scale->EnableWindow(false);
	tx_industryCharacter->EnableWindow(false);
	tx_allFunds->EnableWindow(false);
	tx_clientCharacter->EnableWindow(false);
 
	if(is_search==0)  //被菜单调用
	{
		bt_add->EnableWindow(true);
		bt_cancelation->EnableWindow(false);
		bt_delete->EnableWindow(false);
		bt_save->EnableWindow(false);
		bt_modify->EnableWindow(false);
	}
	else if(is_search==1)  //被查询对话框调用
	{
		CClientInfor clientInfo;  //CClientInfor对象
		clientInfo.GetData(m_clientID); //获取改对象的信息
        //将CClientInfo对象的值
		m_clientName = clientInfo.GetClientName();  //单位名称
		m_bookinDate = clientInfo.GetBookinDate();  //登记日期
		m_clientLevel = clientInfo.GetClientLevel();  //客户级别
		m_contactPerson = clientInfo.GetContactPerson(); //联系人
		m_area = clientInfo.GetArea();  //地区
		m_address = clientInfo.GetAddress();  //地址
		m_postcode = clientInfo.GetPostcode(); //邮编
		m_telephone = clientInfo.GetTelephone(); //电话
		m_fax = clientInfo.GetFax();  //传真
		m_webSite = clientInfo.GetWebSite(); //网址
		m_eMail = clientInfo.GetEMail(); //eMail
		m_remark = clientInfo.GetRemark(); //备注
		m_manageRange = clientInfo.GetManageRange();//经营范围
		m_manageProduct = clientInfo.GetManageProduct(); //经营产品
		m_accountBank = clientInfo.GetAccountBank();  //开户银行
		m_account = clientInfo.GetAccount();  //银行帐号
		m_taxNO = clientInfo.GetTaxNO();  //税号
		m_registerDate = clientInfo.GetRegisterDate();//注册日期
		m_registerFund = clientInfo.GetRegisterFund(); //注册资金
		m_scale = clientInfo.GetScale(); //规模
		m_industryCharacter = clientInfo.GetIndustryCharacter();//行业性质
		m_allFunds = clientInfo.GetAllFunds(); //总资产
		m_clientCharacter = clientInfo.GetClientCharacter();  //性质
		
        //设定按钮的可用性
		bt_add->EnableWindow(true);
		bt_cancelation->EnableWindow(false);
		bt_delete->EnableWindow(true);
		bt_save->EnableWindow(false);
		bt_modify->EnableWindow(true);
	}
	
	UpdateData(false);  //将数据更新到对话框
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CClientInforForm::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	POSITION pos = m_list.GetFirstSelectedItemPosition();//获取单击的位置
	if(pos)
	{
		int nFirstSelItem = m_list.GetNextSelectedItem(pos);//获取单击的条目位置
		m_clientID=m_list.GetItemText(nFirstSelItem,0);//获取单击的条目对应的clientID
	}
	CClientInfor clientInfo;
	clientInfo.GetData(m_clientID);//指定clientID的情况下,为对象获取数据
    //将CClientInfor对象的值赋给对话框中对应的变量
	m_clientName = clientInfo.GetClientName(); //单位名称
	m_bookinDate = clientInfo.GetBookinDate(); //登记日期
	m_clientLevel = clientInfo.GetClientLevel(); //客户级别
	m_contactPerson = clientInfo.GetContactPerson(); //联系人
	m_area = clientInfo.GetArea();  //地区
	m_address = clientInfo.GetAddress(); //地址
	m_postcode = clientInfo.GetPostcode(); //邮编
	m_telephone = clientInfo.GetTelephone(); //电话
	m_fax = clientInfo.GetFax(); //传真
	m_webSite = clientInfo.GetWebSite(); //网址
	m_eMail = clientInfo.GetEMail();  //eMail
	m_remark = clientInfo.GetRemark(); //备注信息
	m_manageRange = clientInfo.GetManageRange(); //经营范围
	m_manageProduct = clientInfo.GetManageProduct(); //经营产品
	m_accountBank = clientInfo.GetAccountBank();//开户银行
	m_account = clientInfo.GetAccount(); //帐号
	m_taxNO = clientInfo.GetTaxNO();//税号
	m_registerDate = clientInfo.GetRegisterDate();//注册日期
	m_registerFund = clientInfo.GetRegisterFund();//注册资金
	m_scale = clientInfo.GetScale(); //规模
	m_industryCharacter = clientInfo.GetIndustryCharacter();//行业性质
	m_allFunds = clientInfo.GetAllFunds();//总资产
	m_clientCharacter = clientInfo.GetClientCharacter();//性质

	UpdateData(false);//将数据更新到对话框
    //设定按钮的可用性
	bt_modify->EnableWindow(true);
	bt_modify->EnableWindow(true);
	bt_delete->EnableWindow(true);
	bt_save->EnableWindow(false);
	bt_cancelation->EnableWindow(false);	
	*pResult = 0;
}


void CClientInforForm::Refresh()
{
	m_list.DeleteAllItems();
	CString strSQL;
	//为组合框中添加数据项
	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));	
	strSQL="select * from client "; //构造客户查询的SQL语句
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);//打开查询记录集对象
	int i=0;
	//将查询结果记录集中的
	while(!(m_pRecordset->adoEOF))
	{  
		CString str;
		m_list.InsertItem(i, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientID")));//客户编号
		m_list.SetItemText(i,1, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientName")));//单位名称
		COleDateTime bookinDate = m_pRecordset->GetCollect("bookinDate");  //登记日期
		str.Format("%d-%d-%d",bookinDate.GetYear(),bookinDate.GetMonth(),bookinDate.GetDay());  //将日期转换成字符串显示
		m_list.SetItemText(i,2,str);
		m_list.SetItemText(i,3,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientLevel")));//客户级别
		m_list.SetItemText(i,4, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("contactPerson")));//联系人
		m_list.SetItemText(i,5, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("areaID")));//地区
		m_list.SetItemText(i,6, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("address")));//地址
		m_list.SetItemText(i,7, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("postcode")));//邮编
		m_list.SetItemText(i,8, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("telephone")));//电话
		m_list.SetItemText(i,9, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("fax"))); //传真
		m_list.SetItemText(i,10, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("webSite")));//网址
		m_list.SetItemText(i,11, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("eMail")));//eMail
		m_list.SetItemText(i,12, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark")));//备注
		m_list.SetItemText(i,13, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageRange")));//经营范围
		m_list.SetItemText(i,14,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("manageProduct")));//经营产品
		m_list.SetItemText(i,15, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("accountBank")));//开户银行
		m_list.SetItemText(i,16, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("account"))); //银行帐号
		m_list.SetItemText(i,17, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("taxNO")));  //税号
		COleDateTime registerDate=m_pRecordset->GetCollect("registerDate");//注册日期
		str.Format("%d-%d-%d",registerDate.GetYear(),registerDate.GetMonth(),registerDate.GetDay());  //将注册日期转换成字符串  
		m_list.SetItemText(i,18, str);
		m_list.SetItemText(i,19, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("registerFund")));//注册资金
		m_list.SetItemText(i,20, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("scale")));//规模
		m_list.SetItemText(i,21, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("industryCharacter")));//行业特征
		m_list.SetItemText(i,22, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("allFunds")));//总资产
		m_list.SetItemText(i,23, ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientCharacter")));//性质
	
		i++;
		m_pRecordset->MoveNext();  //记录集指针向后移动
	}
}

⌨️ 快捷键说明

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