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

📄 opponentstaffform.cpp

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

#include "stdafx.h"
#include "ClientRelationship.h"
#include "OpponentStaffForm.h"
#include "OpponentStaff.h"

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

/////////////////////////////////////////////////////////////////////////////
// COpponentStaffForm dialog


COpponentStaffForm::COpponentStaffForm(CWnd* pParent /*=NULL*/)
	: CDialog(COpponentStaffForm::IDD, pParent)
{
	//{{AFX_DATA_INIT(COpponentStaffForm)
	m_staffID = _T("");
	m_staffName = _T("");
	m_sex = _T("");
	m_birthday = COleDateTime::GetCurrentTime();
	m_nationality = _T("");
	m_marriageCondition = _T("");
	m_partyFeature = _T("");
	m_educationLevel = _T("");
	m_graduateSchool = _T("");
	m_telephone = _T("");
	m_postcode = _T("");
	m_mobile = _T("");
	m_QQ = _T("");
	m_eMail = _T("");
	m_department = _T("");
	m_positionTitle = _T("");
	m_duty = _T("");
	m_address = _T("");
	m_favourite = _T("");
	m_remark = _T("");
	//}}AFX_DATA_INIT
}


void COpponentStaffForm::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(COpponentStaffForm)
	DDX_Control(pDX, IDC_department, m_departmentCombo);
	DDX_Control(pDX, IDC_LIST2, m_staffList);
	DDX_Control(pDX, IDC_LIST1, m_opponentList);
	DDX_Text(pDX, IDC_staffID, m_staffID);
	DDX_Text(pDX, IDC_staffName, m_staffName);
	DDX_CBString(pDX, IDC_sex, m_sex);
	DDX_DateTimeCtrl(pDX, IDC_birthday, m_birthday);
	DDX_CBString(pDX, IDC_nationality, m_nationality);
	DDX_CBString(pDX, IDC_marriageCondition, m_marriageCondition);
	DDX_CBString(pDX, IDC_partyFeature, m_partyFeature);
	DDX_CBString(pDX, IDC_educationLevel, m_educationLevel);
	DDX_Text(pDX, IDC_graduateSchool, m_graduateSchool);
	DDX_Text(pDX, IDC_telephone, m_telephone);
	DDX_Text(pDX, IDC_postcode, m_postcode);
	DDX_Text(pDX, IDC_mobile, m_mobile);
	DDX_Text(pDX, IDC_QQ, m_QQ);
	DDX_Text(pDX, IDC_eMail, m_eMail);
	DDX_CBString(pDX, IDC_department, m_department);
	DDX_Text(pDX, IDC_positionTitle, m_positionTitle);
	DDX_Text(pDX, IDC_duty, m_duty);
	DDX_Text(pDX, IDC_address, m_address);
	DDX_Text(pDX, IDC_favourit, m_favourite);
	DDX_Text(pDX, IDC_remark, m_remark);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(COpponentStaffForm, CDialog)
	//{{AFX_MSG_MAP(COpponentStaffForm)
	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_LIST2, OnClickList2)
	ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COpponentStaffForm message handlers

void COpponentStaffForm::OnAdd() 
{
	CString m_formID;
	int formID=((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->GetCollect("opponentStaffID").intVal;
	if(formID<10)
		m_formID.Format("JZDSCP0000%d",formID);
	else if(formID<100&&formID>9)
		m_formID.Format("JZDSCP000%d",formID);
	else if(formID<1000&&formID>99)
		m_formID.Format("JZDSCP00%d",formID);

	CString str;
	str.Format("%d",formID+1);
	((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->PutCollect("opponentStaffID",_variant_t(str));
	((CClientRelationshipApp*)AfxGetApp())->m_pIDRecordset->Update();
	
	m_staffID = m_formID;
	m_staffName = _T("");
	m_sex = _T("");
	m_birthday = COleDateTime::GetCurrentTime();
	m_nationality = _T("");
	m_marriageCondition = _T("");
	m_partyFeature = _T("");
	m_educationLevel = _T("");
	m_graduateSchool = _T("");
	m_telephone = _T("");
	m_postcode = _T("");
	m_mobile = _T("");
	m_QQ = _T("");
	m_eMail = _T("");
	m_department = _T("");
	m_positionTitle = _T("");
	m_duty = _T("");
	m_address = _T("");
	m_favourite = _T("");
	m_remark = _T("");

	tx_staffID->EnableWindow(false);
	tx_staffName->EnableWindow(true);
	tx_sex->EnableWindow(true);
	tx_birthday->EnableWindow(true);
	tx_nationality->EnableWindow(true);
	tx_marriageCondition->EnableWindow(true);
	tx_partyFeature->EnableWindow(true);
	tx_educationLevel->EnableWindow(true);
	tx_graduateSchool->EnableWindow(true);
	tx_telephone->EnableWindow(true);
	tx_postcode->EnableWindow(true);
	tx_mobile->EnableWindow(true);
	tx_QQ->EnableWindow(true);
	tx_eMail->EnableWindow(true);
	tx_department->EnableWindow(true);
	tx_positionTitle->EnableWindow(true);
	tx_duty->EnableWindow(true);
	tx_address->EnableWindow(true);
	tx_favourite->EnableWindow(true);
	tx_remark->EnableWindow(true);

	bt_add->EnableWindow(false);
	bt_delete->EnableWindow(false);
	bt_modify->EnableWindow(false);
	bt_save->EnableWindow(true);
	bt_cancelation->EnableWindow(true);

	flag=1;

	UpdateData(false);
	
}

void COpponentStaffForm::OnDelete() 
{
	UpdateData(true);
	COpponentStaff opponentStaff;
	opponentStaff.sqlDelete(m_opponentID,m_staffID);

	m_staffID = _T("");
	m_staffName = _T("");
	m_sex = _T("");
	m_birthday = COleDateTime::GetCurrentTime();
	m_nationality = _T("");
	m_marriageCondition = _T("");
	m_partyFeature = _T("");
	m_educationLevel = _T("");
	m_graduateSchool = _T("");
	m_telephone = _T("");
	m_postcode = _T("");
	m_mobile = _T("");
	m_QQ = _T("");
	m_eMail = _T("");
	m_department = _T("");
	m_positionTitle = _T("");
	m_duty = _T("");
	m_address = _T("");
	m_favourite = _T("");
	m_remark = _T("");

	Refresh();

	tx_staffID->EnableWindow(false);
	tx_staffName->EnableWindow(false);
	tx_sex->EnableWindow(false);
	tx_birthday->EnableWindow(false);
	tx_nationality->EnableWindow(false);
	tx_marriageCondition->EnableWindow(false);
	tx_partyFeature->EnableWindow(false);
	tx_educationLevel->EnableWindow(false);
	tx_graduateSchool->EnableWindow(false);
	tx_telephone->EnableWindow(false);
	tx_postcode->EnableWindow(false);
	tx_mobile->EnableWindow(false);
	tx_QQ->EnableWindow(false);
	tx_eMail->EnableWindow(false);
	tx_department->EnableWindow(false);
	tx_positionTitle->EnableWindow(false);
	tx_duty->EnableWindow(false);
	tx_address->EnableWindow(false);
	tx_favourite->EnableWindow(false);
	tx_remark->EnableWindow(false);

	bt_add->EnableWindow(true);
	bt_delete->EnableWindow(false);
	bt_modify->EnableWindow(false);
	bt_save->EnableWindow(false);
	bt_cancelation->EnableWindow(false);
	
	UpdateData(false);
}

void COpponentStaffForm::OnModify() 
{

	tx_staffID->EnableWindow(false);
	tx_staffName->EnableWindow(true);
	tx_sex->EnableWindow(true);
	tx_birthday->EnableWindow(true);
	tx_nationality->EnableWindow(true);
	tx_marriageCondition->EnableWindow(true);
	tx_partyFeature->EnableWindow(true);
	tx_educationLevel->EnableWindow(true);
	tx_graduateSchool->EnableWindow(true);
	tx_telephone->EnableWindow(true);
	tx_postcode->EnableWindow(true);
	tx_mobile->EnableWindow(true);
	tx_QQ->EnableWindow(true);
	tx_eMail->EnableWindow(true);
	tx_department->EnableWindow(true);
	tx_positionTitle->EnableWindow(true);
	tx_duty->EnableWindow(true);
	tx_address->EnableWindow(true);
	tx_favourite->EnableWindow(true);
	tx_remark->EnableWindow(true);

	bt_add->EnableWindow(false);
	bt_delete->EnableWindow(false);
	bt_modify->EnableWindow(false);
	bt_save->EnableWindow(true);
	bt_cancelation->EnableWindow(false);

	flag=2;

	UpdateData(false);
}

void COpponentStaffForm::OnSave() 
{
	UpdateData(true);
	COpponentStaff opponentStaff;

	opponentStaff.SetOpponentID(m_opponentID);
	opponentStaff.SetStaffID(m_staffID);
	opponentStaff.SetStaffName(m_staffName);
	opponentStaff.SetSex(m_sex);
	opponentStaff.SetBirthday(m_birthday);
	opponentStaff.SetNationality(m_nationality);
	opponentStaff.SetMarriageCondition(m_marriageCondition);
	opponentStaff.SetPartyFeature(m_partyFeature);
	opponentStaff.SetEducationLevel(m_educationLevel);
	opponentStaff.SetGraduateSchool(m_graduateSchool);
	opponentStaff.SetTelephone(m_telephone);
	opponentStaff.SetPostcode(m_postcode);
	opponentStaff.SetMobile(m_mobile);
	opponentStaff.SetQQ(m_QQ);
	opponentStaff.SetEMail(m_eMail);
	opponentStaff.SetDepartment(m_department);
	opponentStaff.SetPositionTitle(m_positionTitle);
	opponentStaff.SetDuty(m_duty);
	opponentStaff.SetAddress(m_address);
	opponentStaff.SetFavourite(m_favourite);
	opponentStaff.SetRemark(m_remark);
	
	if(flag==1)
	{
		opponentStaff.sqlInsert();

		int i=m_staffList.GetItemCount();
		CString str;
		m_staffList.InsertItem(i,m_staffID);
		m_staffList.SetItemText(i,1,m_staffName);
		m_staffList.SetItemText(i,2,m_sex);
		str.Format("%d-%d-%d",m_birthday.GetYear(),m_birthday.GetMonth(),m_birthday.GetDay());
		m_staffList.SetItemText(i,3,str);
		m_staffList.SetItemText(i,4,m_nationality);
		m_staffList.SetItemText(i,5,m_marriageCondition);
		m_staffList.SetItemText(i,6,m_partyFeature);
		m_staffList.SetItemText(i,7,m_educationLevel);
		m_staffList.SetItemText(i,8,m_graduateSchool);
		m_staffList.SetItemText(i,9,m_telephone);
		m_staffList.SetItemText(i,10,m_postcode);
		m_staffList.SetItemText(i,11,m_mobile);
		m_staffList.SetItemText(i,12,m_QQ);
		m_staffList.SetItemText(i,13,m_eMail);
		m_staffList.SetItemText(i,14,m_department);
		m_staffList.SetItemText(i,15,m_positionTitle);
		m_staffList.SetItemText(i,16,m_duty);
		m_staffList.SetItemText(i,17,m_address);
		m_staffList.SetItemText(i,18,m_favourite);
		m_staffList.SetItemText(i,19,m_remark);
	}
	else if(flag==2)
	{
		opponentStaff.sqlUpdate(m_opponentID,m_staffID);
		Refresh();
	}

	tx_staffID->EnableWindow(false);
	tx_staffName->EnableWindow(false);
	tx_sex->EnableWindow(false);
	tx_birthday->EnableWindow(false);
	tx_nationality->EnableWindow(false);
	tx_marriageCondition->EnableWindow(false);
	tx_partyFeature->EnableWindow(false);
	tx_educationLevel->EnableWindow(false);
	tx_graduateSchool->EnableWindow(false);
	tx_telephone->EnableWindow(false);
	tx_postcode->EnableWindow(false);
	tx_mobile->EnableWindow(false);
	tx_QQ->EnableWindow(false);
	tx_eMail->EnableWindow(false);
	tx_department->EnableWindow(false);
	tx_positionTitle->EnableWindow(false);
	tx_duty->EnableWindow(false);
	tx_address->EnableWindow(false);
	tx_favourite->EnableWindow(false);
	tx_remark->EnableWindow(false);

	bt_add->EnableWindow(true);
	bt_delete->EnableWindow(true);
	bt_modify->EnableWindow(true);
	bt_save->EnableWindow(false);
	bt_cancelation->EnableWindow(false);
	
	UpdateData(false);
}

void COpponentStaffForm::OnCancelation() 
{
	m_staffID = _T("");
	m_staffName = _T("");
	m_sex = _T("");
	m_birthday = COleDateTime::GetCurrentTime();
	m_nationality = _T("");
	m_marriageCondition = _T("");
	m_partyFeature = _T("");
	m_educationLevel = _T("");
	m_graduateSchool = _T("");
	m_telephone = _T("");
	m_postcode = _T("");
	m_mobile = _T("");
	m_QQ = _T("");
	m_eMail = _T("");
	m_department = _T("");
	m_positionTitle = _T("");
	m_duty = _T("");
	m_address = _T("");
	m_favourite = _T("");
	m_remark = _T("");

	tx_staffID->EnableWindow(false);
	tx_staffName->EnableWindow(false);
	tx_sex->EnableWindow(false);

⌨️ 快捷键说明

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