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

📄 clientinforform.cpp

📁 关于客户关系管理系统的源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// ClientInforForm.cpp : implementation file
//

#include "stdafx.h"
#include "ClientRelationship.h"
#include "ClientInforForm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClientInforForm dialog


CClientInforForm::CClientInforForm(CWnd* pParent /*=NULL*/)
	: CDialog(CClientInforForm::IDD, pParent)
{
	//{{AFX_DATA_INIT(CClientInforForm)
	m_clientID = _T("");
	m_clientName = _T("");
	m_bookinDate = COleDateTime::GetCurrentTime();
	m_clientLevel = _T("");
	m_contactPerson = _T("");
	m_area = _T("");
	m_address = _T("");
	m_postcode = _T("");
	m_telephone = _T("");
	m_fax = _T("");
	m_webSite = _T("");
	m_eMail = _T("");
	m_remark = _T("");
	m_manageRange = _T("");
	m_manageProduct = _T("");
	m_accountBank = _T("");
	m_account = _T("");
	m_taxNO = _T("");
	m_registerDate = COleDateTime::GetCurrentTime();
	m_registerFund = 0.0f;
	m_scale = _T("");
	m_industryCharacter = _T("");
	m_allFunds = 0.0f;
	m_clientCharacter = _T("");

	is_search=0;
	//}}AFX_DATA_INIT
}


void CClientInforForm::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CClientInforForm)
	DDX_Control(pDX, IDC_area, m_areaCombo);
	DDX_Control(pDX, IDC_LIST1, m_list);
	DDX_Text(pDX, IDC_clientID, m_clientID);
	DDX_Text(pDX, IDC_clientName, m_clientName);
	DDX_DateTimeCtrl(pDX, IDC_bookinDate, m_bookinDate);
	DDX_CBString(pDX, IDC_clientLevel, m_clientLevel);
	DDX_Text(pDX, IDC_contactPerson, m_contactPerson);
	DDX_CBString(pDX, IDC_area, m_area);
	DDX_Text(pDX, IDC_address, m_address);
	DDX_Text(pDX, IDC_postcode, m_postcode);
	DDX_Text(pDX, IDC_telephone, m_telephone);
	DDX_Text(pDX, IDC_fax, m_fax);
	DDX_Text(pDX, IDC_webSite, m_webSite);
	DDX_Text(pDX, IDC_eMail, m_eMail);
	DDX_Text(pDX, IDC_remark, m_remark);
	DDX_Text(pDX, IDC_manageRange, m_manageRange);
	DDX_Text(pDX, IDC_manageProduct, m_manageProduct);
	DDX_Text(pDX, IDC_accountBank, m_accountBank);
	DDX_Text(pDX, IDC_account, m_account);
	DDX_Text(pDX, IDC_taxNO, m_taxNO);
	DDX_DateTimeCtrl(pDX, IDC_registerDate, m_registerDate);
	DDX_Text(pDX, IDC_registerFund, m_registerFund);
	DDX_CBString(pDX, IDC_scale, m_scale);
	DDX_CBString(pDX, IDC_industryCharacter, m_industryCharacter);
	DDX_Text(pDX, IDC_allFunds, m_allFunds);
	DDX_CBString(pDX, IDC_clientCharacter, m_clientCharacter);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CClientInforForm, CDialog)
	//{{AFX_MSG_MAP(CClientInforForm)
	ON_BN_CLICKED(IDC_add, OnAdd)
	ON_BN_CLICKED(IDC_delete, OnDelete)
	ON_BN_CLICKED(IDC_modify, OnModify)
	ON_BN_CLICKED(IDC_save, OnSave)
	ON_BN_CLICKED(IDC_cancelation, OnCancelation)
	ON_BN_CLICKED(IDC_exit, OnExit)
	ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CClientInforForm message handlers

void CClientInforForm::OnAdd() 
{
	flag=1;  //设置保存标志,表示新加
	//分别为每个控件变量赋初始值
	m_clientName = _T("");
	m_bookinDate = COleDateTime::GetCurrentTime();
	m_clientLevel = _T("");
	m_contactPerson = _T("");
	m_area = _T("");
	m_address = _T("");
	m_postcode = _T("");
	m_telephone = _T("");
	m_fax = _T("");
	m_webSite = _T("");
	m_eMail = _T("");
	m_remark = _T("");
	m_manageRange = _T("");
	m_manageProduct = _T("");
	m_accountBank = _T("");
	m_account = _T("");
	m_taxNO = _T("");
	m_registerDate = COleDateTime::GetCurrentTime();
	m_registerFund = 0.0f;
	m_scale = _T("");
	m_industryCharacter = _T("");
	m_allFunds = 0.0f;
	m_clientCharacter = _T("");
	//设置除了客户编号外的编辑框均可用
	tx_clientID->EnableWindow(false);
	tx_clientName->EnableWindow(true);
	tx_bookinDate->EnableWindow(true);
	tx_clientLevel->EnableWindow(true);
	tx_contactPerson->EnableWindow(true);
	tx_area->EnableWindow(true);
	tx_address->EnableWindow(true);
	tx_postcode->EnableWindow(true);
	tx_telephone->EnableWindow(true);
	tx_fax->EnableWindow(true);
	tx_webSite->EnableWindow(true);
	tx_eMail->EnableWindow(true);
	tx_remark->EnableWindow(true);
	tx_manageRange->EnableWindow(true);
	tx_manageProduct->EnableWindow(true);
	tx_accountBank->EnableWindow(true);
	tx_account->EnableWindow(true);
	tx_taxNO->EnableWindow(true);
	tx_registerDate->EnableWindow(true);
	tx_registerFund->EnableWindow(true);
	tx_scale->EnableWindow(true);
	tx_industryCharacter->EnableWindow(true);
	tx_allFunds->EnableWindow(true);
	tx_clientCharacter->EnableWindow(true);
    //
	bt_add->EnableWindow(false);//添加按钮不可用
	bt_cancelation->EnableWindow(true);//取消按钮可用
	bt_delete->EnableWindow(false);//删除按钮不可用
	bt_save->EnableWindow(true); //保存按钮可用

	CString m_formID;
	//获取当前的客户编号
	int formID=((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->GetCollect("clientID").intVal;
	//为客户编号设定格式
	if(formID<10)
		m_formID.Format("KH0000%d",formID);
	else if(formID<100&&formID>9)
		m_formID.Format("KH000%d",formID);
	else if(formID<1000&&formID>99)
		m_formID.Format("KH00%d",formID);

	CString str;
	str.Format("%d",formID+1);  //下一个可用的客户编号
	((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->PutCollect("clientID",_variant_t(str));
	((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->Update();

	m_clientID=m_formID;
	
	UpdateData(false);   //将数据更新到对话框
	
}

void CClientInforForm::OnDelete() 
{
	UpdateData(true);
	CClientInfor client;  //构造CClientInfor的对象
	client.sqlDelete(m_clientID); //调用CClientInfor类的sqlDelete()方法
	//删除后为对话框控件变量赋默认值
	m_clientID = _T("");
	m_clientName = _T("");
	m_bookinDate = COleDateTime::GetCurrentTime();
	m_clientLevel = _T("");
	m_contactPerson = _T("");
	m_area = _T("");
	m_address = _T("");
	m_postcode = _T("");
	m_telephone = _T("");
	m_fax = _T("");
	m_webSite = _T("");
	m_eMail = _T("");
	m_remark = _T("");
	m_manageRange = _T("");
	m_manageProduct = _T("");
	m_accountBank = _T("");
	m_account = _T("");
	m_taxNO = _T("");
	m_registerDate = COleDateTime::GetCurrentTime();
	m_registerFund = 0.0f;
	m_scale = _T("");
	m_industryCharacter = _T("");
	m_allFunds = 0.0f;
	m_clientCharacter = _T("");
    //所有的编辑框均不可用
	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);

⌨️ 快捷键说明

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