📄 inactiveserinfodlg.cpp
字号:
// InActiveSerInfoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MinistryPerson.h"
#include "InActiveSerInfoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
InActiveSerInfoDlg::InActiveSerInfoDlg(CWnd* pParent /*=NULL*/)
: CDialog(InActiveSerInfoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(InActiveSerInfoDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void InActiveSerInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(InActiveSerInfoDlg)
DDX_Control(pDX, IDC_COMBO_IAS_DEPART, m_Cmb_IAS_Depart);
DDX_Control(pDX, IDC_COMBO_IAS_COMPANY, m_Cmb_IAS_Company);
DDX_Control(pDX, IDC_CHECK_IAS, m_CtrlCheck);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(InActiveSerInfoDlg, CDialog)
//{{AFX_MSG_MAP(InActiveSerInfoDlg)
ON_BN_CLICKED(IDC_BUTTON_IAS_SAVE, OnButtonIasSave)
ON_BN_CLICKED(IDC_BUTTON_IAS_MODIFY, OnButtonIasModify)
ON_BN_CLICKED(IDC_CHECK_IAS, OnCheckIas)
ON_CBN_SELCHANGE(IDC_COMBO_IAS_COMPANY, OnSelchangeComboIasCompany)
ON_BN_CLICKED(IDC_RADIO_IAS_HAVE, OnRadioIasHave)
ON_BN_CLICKED(IDC_RADIO_IAS_NOTHAVE, OnRadioIasNothave)
ON_CBN_SELCHANGE(IDC_COMBO_IAS_NEWPROPERTY, OnSelchangeComboIasNewproperty)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// InActiveSerInfoDlg message handlers
BOOL InActiveSerInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if (!g_bQueryToShow)
{
GetDlgItem(IDC_BUTTON_IAS_SAVE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_IAS_MODIFY)->EnableWindow(FALSE);
((CButton*)GetDlgItem(IDC_RADIO_IAS_HAVE))->SetCheck(1);
CtrlStatus_InActiveSer(TRUE, FALSE);
IniAllTimePicker();
InitReadyCompany(&m_Cmb_IAS_Company);
InitReadyDepart(&m_Cmb_IAS_Depart);
GetWorkYears(g_In_nID, g_In_strIDCard);
m_bSaveNotModify_InActiveSer = TRUE;
}
else // 查询状态 调出“基本信息”时
{
GetDlgItem(IDC_BUTTON_IAS_SAVE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_IAS_MODIFY)->EnableWindow(TRUE);
CtrlStatus_InActiveSer(FALSE, FALSE);
InitReadyCompany(&m_Cmb_IAS_Company);
InitReadyDepart(&m_Cmb_IAS_Depart);
GetInActSerInfoFromDB();
GetWorkYears(g_nEmployee_ID, g_strEmployee_IDCard);
if (m_bFixContract)
{
GetLeftContractT(g_nEmployee_ID, g_strEmployee_IDCard);
}
m_bSaveNotModify_InActiveSer = FALSE;
}
return TRUE;
}
/*********************************************************************
函数说明: 保存按钮
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::OnButtonIasSave()
{
if (!CheckAllInfo_InAS())
{
return;
}
if (!m_bSaveNotModify_InActiveSer)
{
if (g_bQueryToShow)
{
IasModify(g_nEmployee_ID, g_strEmployee_IDCard);
}
else
{
IasModify(g_In_nID, g_In_strIDCard);
}
}
else
{
IasSave(g_In_nID, g_In_strIDCard); // 保存
}
}
/*********************************************************************
函数说明: 修改按钮
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::OnButtonIasModify()
{
CtrlStatus_InActiveSer(TRUE, TRUE);
m_bSaveNotModify_InActiveSer = FALSE;
GetDlgItem(IDC_BUTTON_IAS_SAVE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_IAS_MODIFY)->EnableWindow(FALSE);
}
/*********************************************************************
函数说明: 保存
函数参数:
*********************************************************************/
BOOL InActiveSerInfoDlg::IasSave(int nKeyID, CString strKeyIDCard)
{
CADOOperation ADOdbo;
CString SQL;
SQL.Format("insert into Employee_InActiveSer_Table \
values (%d, '%s', \
'%s', '%s', '%s', '%s', '%s', '%s', \
'%s', '%s', '%s', '%s', \
'%s', '%s', '%s', '%s', '%s')",
nKeyID, strKeyIDCard,
m_In_Company, m_In_Department, m_In_Duty, m_In_DutyLevel, m_In_Address, m_In_NewProperty,
m_In_EmployType, m_In_InDueFormT, m_In_EmployPro, m_In_WorkAge,
m_In_ContractBegT, m_In_ContractEndT, m_In_ContractRemT, m_In_Remark, m_strFixContract);
ADOdbo.OpenRecordset(SQL);
ADOdbo.CloseRecorset();
SQL.Format("insert into Employee_SpecialPost_Table \
values (%d, '%s', \
'%s', '%s', '%s', '%s', \
'%s', '%s', '%s', '%s', \
'%s', '%s', '%s', '%s')",
nKeyID, strKeyIDCard,
m_Sp_JoinTime1, m_Sp_LeaveTime1, m_Sp_Address1, m_Sp_Position1,
m_Sp_JoinTime2, m_Sp_LeaveTime2, m_Sp_Address2, m_Sp_Position2,
m_Sp_JoinTime3, m_Sp_LeaveTime3, m_Sp_Address3, m_Sp_Position3);
ADOdbo.OpenRecordset(SQL);
ADOdbo.CloseRecorset();
if (m_bFixContract)
{
GetLeftContractT(nKeyID, strKeyIDCard);
}
CtrlStatus_InActiveSer(FALSE, FALSE);
GetDlgItem(IDC_BUTTON_IAS_SAVE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_IAS_MODIFY)->EnableWindow(TRUE);
MessageBox("员工 【任职信息】 录入成功!", "成功", MB_OK | MB_ICONEXCLAMATION);
return TRUE;
}
/*********************************************************************
函数说明: 修改按钮
函数参数:
*********************************************************************/
BOOL InActiveSerInfoDlg::IasModify(int nKeyID, CString strKeyIDCard)
{
CADOOperation ADOdbo;
CString SQL;
CString strFields[] = {"employee_ID", "employee_IDCard"};
CString strRetValue[2];
strRetValue[0] = "NOID";
strRetValue[1] = "NOIDCARD";
SQL.Format("select employee_ID, employee_IDCard from Employee_InActiveSer_Table \
where employee_ID = %d and employee_IDCard = '%s'", nKeyID, strKeyIDCard);
ADOdbo.OpenRecordset(SQL);
ADOdbo.GetFieldsValue(strFields, 2, strRetValue, FALSE);
ADOdbo.CloseRecorset();
if (strRetValue[0] == "NOID" && strRetValue[1] == "NOIDCARD")
{
IasSave(nKeyID, strKeyIDCard);
return TRUE;
}
SQL.Format("update Employee_InActiveSer_Table \
set InActiveSer_Company = '%s', InActiveSer_Department = '%s', InActiveSer_Duty = '%s', \
InActiveSer_DutyLevel = '%s', InActiveSer_Address = '%s', InActiveSer_NewProperty = '%s', \
InActiveSer_EmployType = '%s', InActiveSer_InDueFormTime = '%s', InActiveSer_EmployPro = '%s', \
InActiveSer_WorkAge = '%s', InActiveSer_ContractBegT = '%s', InActiveSer_ContractEndT = '%s', \
InActiveSer_ContractRemT = '%s', InActiveSer_Remark = '%s', InActiveSer_FixContract = '%s' \
where employee_ID = %d AND employee_IDCard = '%s'",
m_In_Company, m_In_Department, m_In_Duty,
m_In_DutyLevel, m_In_Address, m_In_NewProperty,
m_In_EmployType, m_In_InDueFormT, m_In_EmployPro,
m_In_WorkAge, m_In_ContractBegT, m_In_ContractEndT,
m_In_ContractRemT, m_In_Remark, m_strFixContract,
nKeyID, strKeyIDCard);
ADOdbo.OpenRecordset(SQL);
ADOdbo.CloseRecorset();
SQL.Format("update Employee_SpecialPost_Table \
set SpecialPost_JoinTime1 = '%s', SpecialPost_LeaveTime1 = '%s', SpecialPost_Address1 = '%s', SpecialPost_Position1 = '%s', \
SpecialPost_JoinTime2 = '%s', SpecialPost_LeaveTime2 = '%s', SpecialPost_Address2 = '%s', SpecialPost_Position2 = '%s', \
SpecialPost_JoinTime3 = '%s', SpecialPost_LeaveTime3 = '%s', SpecialPost_Address3 = '%s', SpecialPost_Position3 = '%s' \
where employee_ID = %d AND employee_IDCard = '%s'",
m_Sp_JoinTime1, m_Sp_LeaveTime1, m_Sp_Address1, m_Sp_Position1,
m_Sp_JoinTime2, m_Sp_LeaveTime2, m_Sp_Address2, m_Sp_Position2,
m_Sp_JoinTime3, m_Sp_LeaveTime3, m_Sp_Address3, m_Sp_Position3,
nKeyID, strKeyIDCard);
ADOdbo.OpenRecordset(SQL);
ADOdbo.CloseRecorset();
CtrlStatus_InActiveSer(FALSE, FALSE);
GetDlgItem(IDC_BUTTON_IAS_SAVE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_IAS_MODIFY)->EnableWindow(TRUE);
MessageBox("员工 【任职信息】 修改成功!", "成功", MB_OK | MB_ICONEXCLAMATION);
return TRUE;
}
/*********************************************************************
函数说明: 有无特殊工作
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::OnCheckIas()
{
if (!m_CtrlCheck.GetCheck())
{
CtrlStatus_InActiveSer(TRUE, FALSE);
}
else
{
CtrlStatus_InActiveSer(TRUE, TRUE);
}
}
/*********************************************************************
函数说明: 初始化时间显示
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::IniAllTimePicker()
{
SYSTEMTIME sysTime = {0};
sysTime.wYear = 1900;
sysTime.wMonth = 1;
sysTime.wDay = 1;
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_INDUEFORMTIME))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_CONTRACTBEGT))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_CONTRACTENDT))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME1))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME2))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME3))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME1))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME2))->SetTime(&sysTime);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME3))->SetTime(&sysTime);
}
/*********************************************************************
函数说明: 使内容可以编辑
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::CtrlStatus_InActiveSer(BOOL bStatus, BOOL bMore)
{
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_COMPANY))->EnableWindow(bStatus);
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_DEPART))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_ADDRESS))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_EMPLOYTYPE))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_EMPLOYPRO))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_DUTY))->EnableWindow(bStatus);
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_DUTYLEVEL))->EnableWindow(bStatus);
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_NEWPROPERTY))->EnableWindow(bStatus);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_INDUEFORMTIME))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_WORKAGE))->EnableWindow(bStatus);
GetDlgItem(IDC_RADIO_IAS_HAVE)->EnableWindow(bStatus);
GetDlgItem(IDC_RADIO_IAS_NOTHAVE)->EnableWindow(bStatus);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_CONTRACTBEGT))->EnableWindow(bStatus);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_IAS_CONTRACTENDT))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_CONTRACTREMT))->EnableWindow(bStatus);
((CEdit*)GetDlgItem(IDC_EDIT_IAS_REMARK))->EnableWindow(bStatus);
GetDlgItem(IDC_CHECK_IAS)->EnableWindow(bStatus);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME1))->EnableWindow(bMore);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME2))->EnableWindow(bMore);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_JOINTIME3))->EnableWindow(bMore);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME1))->EnableWindow(bMore);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME2))->EnableWindow(bMore);
((CDateTimeCtrl*)GetDlgItem(IDC_DTP_SPEP_LEAVETIME3))->EnableWindow(bMore);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -