📄 inactiveserinfodlg.cpp
字号:
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_ADRESS1))->EnableWindow(bMore);
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_ADRESS2))->EnableWindow(bMore);
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_ADRESS3))->EnableWindow(bMore);
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_POSITION1))->EnableWindow(bMore);
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_POSITION2))->EnableWindow(bMore);
((CEdit*)GetDlgItem(IDC_EDIT_SPEP_POSITION3))->EnableWindow(bMore);
}
/*********************************************************************
函数说明: 显示任职信息
函数参数: nID 员工编号
*********************************************************************/
void InActiveSerInfoDlg::GetInActSerInfoFromDB()
{
CADOOperation ADOdbo;
CString SQL;
CString strFields[] = {""};
CString strFieldsValue[17] = {""}; // 任职信息所有字段有17个
int nFieldsCount = 17;
SQL.Format("select * from Employee_InActiveSer_Table \
where employee_ID = %d AND employee_IDCard = '%s'",
g_nEmployee_ID, g_strEmployee_IDCard);
ADOdbo.OpenRecordset(SQL);
ADOdbo.GetFieldsValue(strFields, nFieldsCount, strFieldsValue, TRUE);
ADOdbo.CloseRecorset();
CFuncOper FunOper;
FunOper.SetFieldValueToCCombox(this, IDC_COMBO_IAS_COMPANY, strFieldsValue[2]);
FunOper.SetFieldValueToCCombox(this, IDC_COMBO_IAS_DEPART, strFieldsValue[3]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_DUTY, strFieldsValue[4]);
FunOper.SetFieldValueToCCombox(this, IDC_COMBO_IAS_DUTYLEVEL, strFieldsValue[5]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_ADDRESS, strFieldsValue[6]);
FunOper.SetFieldValueToCCombox(this, IDC_COMBO_IAS_NEWPROPERTY, strFieldsValue[7]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_EMPLOYTYPE, strFieldsValue[8]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_IAS_INDUEFORMTIME, strFieldsValue[9]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_EMPLOYPRO, strFieldsValue[10]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_WORKAGE, strFieldsValue[11]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_IAS_CONTRACTBEGT, strFieldsValue[12]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_IAS_CONTRACTENDT, strFieldsValue[13]);
FunOper.SetFieldValueToCTime(this, IDC_EDIT_IAS_CONTRACTREMT, strFieldsValue[14]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_IAS_REMARK, strFieldsValue[15]);
if ("有固定合同" == strFieldsValue[16])
{
m_bFixContract = TRUE;
((CButton*)GetDlgItem(IDC_RADIO_IAS_HAVE))->SetCheck(TRUE);
}
else
{
m_bFixContract = FALSE;
((CButton*)GetDlgItem(IDC_RADIO_IAS_NOTHAVE))->SetCheck(TRUE);
GetDlgItem(IDC_DTP_IAS_CONTRACTENDT)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_DTP_IAS_CONTRACTREMT)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC_IAS_CONET)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC_IAS_CONRT)->ShowWindow(SW_HIDE);
}
CString strSPValue[14] = {""}; // 特殊岗位信息所有字段有14个
int nSPCount = 14;
SQL.Format("select * from Employee_SpecialPost_Table \
where employee_ID = %d AND employee_IDCard = '%s'",
g_nEmployee_ID, g_strEmployee_IDCard);
ADOdbo.OpenRecordset(SQL);
ADOdbo.GetFieldsValue(strFields, nSPCount, strSPValue, TRUE);
ADOdbo.CloseRecorset();
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_JOINTIME1, strSPValue[2]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_LEAVETIME1, strSPValue[3]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_ADRESS1, strSPValue[4]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_POSITION1, strSPValue[5]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_JOINTIME2, strSPValue[6]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_LEAVETIME2, strSPValue[7]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_ADRESS2, strSPValue[8]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_POSITION2, strSPValue[9]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_JOINTIME3, strSPValue[10]);
FunOper.SetFieldValueToCTime(this, IDC_DTP_SPEP_LEAVETIME3, strSPValue[11]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_ADRESS3, strSPValue[12]);
FunOper.SetFieldValueToCEdit(this, IDC_EDIT_SPEP_POSITION3, strSPValue[13]);
}
/*********************************************************************
函数说明: 显示已经存在的“单位”
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::InitReadyCompany(CComboBox *pCombox)
{
CADOOperation ADOdbo;
CString strComp;
ADOdbo.OpenTable("Search_Table"); // 打开“搜索”表
if (ADOdbo.IsLastRow())
{
ADOdbo.CloseTable();
return;
}
// 得到单位名
pCombox->ResetContent();
pCombox->AddString("请选择单位");
ADOdbo.MoveFirst();
ADOdbo.GetItemContentStr("Search_Company", CADOOperation::ADO_TYPE_STRING, &strComp);
pCombox->AddString(strComp);
DWORD dwRecCount = (ADOdbo.GetRecordCount() - 1);
ADOdbo.CloseTable();
CString SQL;
SQL.Format("SELECT Search_Company FROM Search_Table WHERE 1=1");
ADOdbo.OpenRecordset(SQL);
ADOdbo.MoveFirst();
for (DWORD i = 2; i <= dwRecCount; i++)
{
CString strCompOne;
ADOdbo.MoveTo(i - 1);
ADOdbo.GetItemContentStr("Search_Company", CADOOperation::ADO_TYPE_STRING, &strComp);
strCompOne = strComp;
// 拿出MoveTo的内容,依次和其前面的比较
ADOdbo.MoveFirst();
for (DWORD j = 2; j <= i; j++)
{
ADOdbo.GetItemContentStr("Search_Company", CADOOperation::ADO_TYPE_STRING, &strComp);
if (strCompOne == strComp)
{
ADOdbo.MoveFirst();
break;
}
else
{
ADOdbo.MoveNext();
}
}
if (j > i)
{
pCombox->AddString(strCompOne);
}
ADOdbo.MoveFirst();
}
ADOdbo.CloseRecorset();
pCombox->SetCurSel(0);
return;
}
/*********************************************************************
函数说明: 显示“部门”组合框内容
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::InitReadyDepart(CComboBox *pDept)
{
CADOOperation ADODepart;
CString strDepart;
CString strComp;
CString strIndex;
CString SQL;
int nIndex = ((CComboBox*)GetDlgItem(IDC_COMBO_IAS_COMPANY))->GetCurSel(); // 选中的“单位”的项数
int nBuff = ((CComboBox*)GetDlgItem(IDC_COMBO_IAS_COMPANY))->GetLBTextLen(nIndex); // 该项内容大小
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_COMPANY))->GetLBText(nIndex, strComp.GetBuffer(nBuff)); // 获取该项内容
strComp.ReleaseBuffer();
strIndex = strComp.GetBuffer(0);
SQL.Format("SELECT Search_Depart FROM Search_Table WHERE Search_Company = '%s'", strIndex);
ADODepart.OpenRecordset(SQL);
if (ADODepart.IsLastRow())
{
ADODepart.CloseRecorset();
return;
}
pDept->AddString("请选择部门");
ADODepart.MoveFirst();
do
{
ADODepart.GetItemContentStr("Search_Depart", CADOOperation::ADO_TYPE_STRING, &strDepart);
pDept->AddString(strDepart);
ADODepart.MoveNext();
} while (!ADODepart.IsLastRow());
ADODepart.CloseRecorset();
pDept->SetCurSel(0);
return;
}
/*********************************************************************
函数说明: 单位选择的变化,部门变化
函数参数:
*********************************************************************/
void InActiveSerInfoDlg::OnSelchangeComboIasCompany()
{
((CComboBox*)GetDlgItem(IDC_COMBO_IAS_DEPART))->ResetContent(); // 清空“部门”组合框的内容
InitReadyDepart(&m_Cmb_IAS_Depart);
}
/*********************************************************************
函数说明: 所有填写内容的 合法性 检查
函数参数:
*********************************************************************/
BOOL InActiveSerInfoDlg::CheckAllInfo_InAS()
{
if (!g_bQueryToShow)
{
if (g_In_nID == 0 && g_In_strIDCard == "")
{
MessageBox("按照正确的录入顺序,请您先填写【基本信息】页面内容 ", "提示", MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
}
CFuncOper FunOper;
if (!FunOper.CheckType_CComBox(this, IDC_COMBO_IAS_COMPANY, "【所属单位】", m_In_Company))
{
return FALSE;
}
if (m_In_Company == "请选择单位")
{
MessageBox("请选择【工作单位】 ", "提示", MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
if (!FunOper.CheckType_CComBox(this, IDC_COMBO_IAS_DEPART, "【部门】", m_In_Department))
{
return FALSE;
}
if (m_In_Department == "请选择部门")
{
MessageBox("请选择【部门】 ", "提示", MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_ADDRESS, "【工作地点】", m_In_Address, TRUE))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_EMPLOYTYPE, "【员工类别】", m_In_EmployType, TRUE))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_EMPLOYPRO, "【员工性质】", m_In_EmployPro, TRUE))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_DUTY, "【职务】", m_In_Duty, FALSE))
{
return FALSE;
}
if (!FunOper.CheckType_CComBox(this, IDC_COMBO_IAS_DUTYLEVEL, "【职级】", m_In_DutyLevel))
{
return FALSE;
}
if (!FunOper.CheckType_CComBox(this, IDC_COMBO_IAS_NEWPROPERTY, "【职工属性】", m_In_NewProperty))
{
return FALSE;
}
if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_IAS_INDUEFORMTIME, m_In_InDueFormT))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_WORKAGE, "【工龄】", m_In_WorkAge, TRUE))
{
return FALSE;
}
m_bFixContract = ((CButton*)GetDlgItem(IDC_RADIO_IAS_HAVE))->GetCheck();
if (m_bFixContract) // 有固定的合同
{
if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_IAS_CONTRACTENDT, m_In_ContractEndT))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_CONTRACTREMT, "【合同剩余时间】", m_In_ContractRemT, TRUE))
{
return FALSE;
}
m_strFixContract = "有固定合同";
}
else
{
m_In_ContractEndT = "1911-11-11";
m_In_ContractRemT = "无固定合同";
m_strFixContract = "无固定合同";
}
if (!FunOper.CheckType_CTimePicker(this, IDC_DTP_IAS_CONTRACTBEGT, m_In_ContractBegT))
{
return FALSE;
}
if (!FunOper.CheckType_CEdit(this, IDC_EDIT_IAS_REMARK, "【合同备注】", m_In_Remark, TRUE))
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -