CDeptSet DeptSet ; //部门 strSQL=\
if(!DeptSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!DeptSet.IsEOF()) { m_ctrDept.AddString(DeptSet.m_dept); DeptSet.MoveNext(); }
DeptSet.Close(); //职工职务
CDutySet DutySet ;
strSQL=\
if(!DutySet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!DutySet.IsEOF()) { m_ctrDuty.AddString(DutySet.m_duty); DutySet.MoveNext(); }
DutySet.Close();
//职工职称
CTechnicalSet TechnicalSet ; strSQL=\
if(!TechnicalSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!TechnicalSet.IsEOF()) { m_ctrTechnical.AddString(TechnicalSet.m_technical); TechnicalSet.MoveNext(); }
TechnicalSet.Close(); //职工类型
CWorkerStatusSet WorkerStatusSet ; strSQL=\
if(!WorkerStatusSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\
}
while(!WorkerStatusSet.IsEOF()) { m_ctrIsWorker.AddString(WorkerStatusSet.m_workstatus); WorkerStatusSet.MoveNext(); }
WorkerStatusSet.Close(); //工资类别
CAboutPaySet AboutPaySet ; strSQL=\
if(!AboutPaySet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!AboutPaySet.IsEOF()) { m_ctrAboutPay.AddString(AboutPaySet.m_aboutpay); AboutPaySet.MoveNext(); }
AboutPaySet.Close(); //职工民族
CFolkSet FolkSet ;
strSQL=\
if(!FolkSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!FolkSet.IsEOF()) { m_ctrFolk.AddString(FolkSet.m_folk); FolkSet.MoveNext(); }
FolkSet.Close(); //政治面貌
CPoliticalSet PoliticalSet ;
strSQL=\
if(!PoliticalSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\}
while(!PoliticalSet.IsEOF()) { m_ctrPolitical.AddString(PoliticalSet.m_political); PoliticalSet.MoveNext(); }
PoliticalSet.Close(); //文化程度
CEducationSet EducationSet ; strSQL=\
if(!EducationSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\
}
while(!EducationSet.IsEOF()) { m_ctrEducation.AddString(EducationSet.m_education); EducationSet.MoveNext(); }
EducationSet.Close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE }
void CBaseInfoDlg::RefreshData() {
CString strSQL;
strSQL.Format(\
if(!m_pPersonSet->Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\ return; }
BOOL CBaseInfoDlg::Save() {
UpdateData(); if(m_strID==\ { MessageBox(\员工号不能为空,请输入员工号\ return FALSE; }
if(m_strName==\ { MessageBox(\姓名不能为空,请输入姓名\ return FALSE; }
CString strSQL;
strSQL.Format(\
if(!m_pPersonSet->Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\
return FALSE; }
if(m_pPersonSet->GetRecordCount()!=0) { MessageBox(\该员工已经存在!\ m_pPersonSet->Close(); return FALSE; }
BOOL CBaseInfoDlg::Modify() {
UpdateData(); if(m_strID==\ { MessageBox(\员工号不能为空,请输入员工号\ return FALSE; }
if(m_strName==\ { MessageBox(\姓名不能为空,请输入姓名\ return FALSE; }
CString strSQL;
strSQL.Format(\
if(!m_pPersonSet->Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(\打开数据库失败!\数据库错误\ return FALSE; }
if(m_pPersonSet->GetRecordCount()==0) { MessageBox(\该员工不存在!\ m_pPersonSet->Close(); return FALSE; }
m_pPersonSet->Edit ();
??????????????????????????????????????????
考勤信息的窗体的设计
考勤管理模块主要划分成五个子模块:出记录管理,加班记录管理,出差记录管理,请假记录管理和考统计。其中各个考记录子模块主要提供考的月度统计功能。这五个模块分别是通过定义五个类来实现的。 代码设计如下:
Void CAttStatDlg::OnChangeStatEdtSeekpersonid() { }
void CAttStatDlg::OnStatBtnSeek()
CPersonSet rs;
rs.m_strFilter = \ rs.Open();
if(rs.GetRecordCount()==1) {
m_strPersonName=rs.m_name; }
else m_strPersonName.Empty(); rs.Close();
UpdateData(FALSE); UpdateData();