37、办公室日常管理信息系统内容摘要:

(select * from password where user=39。 %s39。 ,m_strUser)。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 return。 } if(()) {//增加新用户 //判断用户是否已经存在 if(()!=0) { ()。 MessageBox(该用户已经存 在。 )。 return。 } ()。 = m_strUser。 = m_strPass。 = m_bIsAdmin。 ()。 MessageBox(用户添加成功。 请记住用户名和密码。 )。 ()。 } else {//修改用户信息 //判断用户是否不存在 if(()==0) { ()。 MessageBox(该用户不存在。 请更新数据库 )。 return。 } ()。 = m_strUser。 = m_strPass。 = m_bIsAdmin。 ()。 MessageBox(用户修改成功。 请记住用户名和密码。 )。 ()。 } (FALSE)。 //更新用户列表 RefreshData()。 } void CUserDlg::OnButtonCancel() { // TODO: Add your control notification handler code here m_strUser =。 m_strPass =。 m_strRePass =。 m_bIsAdmin = FALSE。 (FALSE)。 UpdateData(FALSE)。 } 主窗体 1. 主体框架:使用 MFC AppWizard 创建一个单文档结构的应用程序工程,建立起系统主体框架,生成应用程序类( CmanagerApp) ,文档类( CmanagerDoc) ,视图类( CmanagerView)和主框架类( CmainFram) . 2. 菜单和工具栏:根据系统的 总体设计中功能模块的划分,使用资源编辑器创建系统菜单和工具栏。 3. 背景图:通过修改系统的视图类 Paintg 事件处理函数 OnPaint()来实现加载背景图,其具体代码如下: void CManagerView::OnPaint() { CPaintDC* pDC=new CPaintDC(this)。 // device context for painting CBitmap bmp。 RECT Rect。 RECT RectView。 POINT ptSize。 CDC dcmem。 BITMAP bm。 int b = (IDB_BITMAP_BG)。 //将位图取出; (pDC)。 //创建兼容设备上下文。 (amp。 bmp)。 //用设备上下文选择位图; (pDCGetMapMode())。 //设置映射方式; GetObject(, sizeof(BITMAP), (LPSTR)amp。 bm)。 //映射位图; GetClientRect(amp。 Rect)。 =。 =。 pDCDPtoLP((LPPOINT)amp。 ptSize,1)。 //设备单元 to 逻辑单元。 GetClientRect(amp。 RectView)。 CRect RectBmp = RectView。 if(( ) ) //位图宽度容纳不下; { = + ( ) / 2。 =。 } else { =。 =。 } if(( ) ) { = + ( ) / 2。 =。 } else { =。 =。 } pDCStretchBlt(, , ,\ , amp。 dcmem, 0, 0, , ,\ SRCCOPY)。 ()。 } 职工基本信息模块及界面设计 可以添加员工基本信息,员工编号,员工姓名,学历,专业„„等等。 代码设如下: CDeptSet DeptSet。 //部门 strSQL=select * from dept。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //职工职务 CDutySet DutySet。 strSQL=select * from duty。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //职工职称 CTechnicalSet TechnicalSet。 strSQL=select * from technical。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //职工类型 CWorkerStatusSet WorkerStatusSet。 strSQL=select * from status。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //工资类别 CAboutPaySet AboutPaySet。 strSQL=select * from aboutpay。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //职工民族 CFolkSet FolkSet。 strSQL=select * from folk。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //政治面貌 CPoliticalSet PoliticalSet。 strSQL=select * from political。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 //文化程度 CEducationSet EducationSet。 strSQL=select * from education。 if(!(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 } while(!()) { ()。 ()。 } ()。 return TRUE。 // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CBaseInfoDlg::RefreshData() { CString strSQL。 (select * from person where ID=39。 %s39。 ,m_strID)。 if(!m_pPersonSetOpen(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 return。 } BOOL CBaseInfoDlg::Save() { UpdateData()。 if(m_strID==) { MessageBox(员工号不 能为空,请输入员工号 )。 return FALSE。 } if(m_strName==) { MessageBox(姓名不能为空,请输入姓名 )。 return FALSE。 } CString strSQL。 (select * from person where ID=39。 %s39。 ,m_strID)。 if(!m_pPersonSetOpen(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库错误 ,MB_OK)。 return FALSE。 } if(m_pPersonSetGetRecordCount()!=0) { MessageBox(该员工已经存在。 )。 m_pPersonSetClose()。 return FALSE。 } BOOL CBaseInfoDlg::Modify() { UpdateData()。 if(m_strID==) { MessageBox(员工号不能为空,请输入员工号 )。 return FALSE。 } if(m_strName==) { MessageBox(姓名不能为空,请输入姓名 )。 return FALSE。 } CString strSQL。 (select * from person where ID=39。 %s39。 ,m_strID)。 if(!m_pPersonSetOpen(AFX_DB_USE_DEFAULT_TYPE,strSQL)) { MessageBox(打开数据库失败 !,数据库 错误 ,MB_OK)。 return FALSE。 } if(m_pPersonSetGetRecordCount()==0) { MessageBox(该员工不存在。 )。 m_pPersonSetClose()。 return FALSE。 } m_pPersonSetEdit ()。 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„ 考勤信息的窗体的设计 考勤管理模块主要划分成五个子模块:出记录管理,加班记录管理 ,出差记录管理,请假记录管理和考统计。 其中各个考记录子模块主要提供考的月度统计功能。 这五个模块分别是通过定义五个类来实现的。 代码设计如下: Void CAttStatDlg::OnChangeStatEdtSeekpersonid() { UpdateData()。 CPersonSet rs。 = ID=39。 + m_strPersonID。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。