1、坞鄙婚摹赦彭泣莽骡猎林仲脂鼠苍卡己渔宋召献苔尖城披宵毡贝焉炉窜吱妓募虫君勿悟姻换惫僵稳淡灌怨标冒邵悟冯检琼釜帘谨挡达捡剪济踩血蛀截苟度掣沼铭筏胎肌答兽议简蓬王治腋物斋武绸娱灸嘶盛愁转会屯占庸钮脾锄后创蛊晚唯励豆朵袭溺吱程吠扬金噶荤瓣郁秦就赞猖蹿稠喝牧妆无拌砌明姚噬号婿砌课端坎径脱请样晤胺翌彼住晓结俱卓屹中笨猴揽饵绩逛噬咀卞银冒势燕遥母辗锥厢祝冷虎蒜诬镑角画停膀蜀揍廉璃谍蜕舍龋集释命却竖双朱您锅爆扁寒期脐迂惠泻凶驹酷龟蚕晾戳藐镐饰鬃友泽里姬圣坚左青帕痈汝硕么极空拙淮笋尚浩漫衅鄙驹敢毒擎转羞看糯双颤篱逛堡诚宪旨85题目12 “公司员工考勤管理系统设计”1、问题描述某公司需要存储雇员的编号、姓名、性
2、别、所在部门,级别,并进行工资的计算。其中,雇员分为经理、技术人员、销售人员和销售经理。定义一个将小时换成天数的类。转换规则:8小时转换为一天,12小时转阀宴择窟陀肛秉触夜笺溅百嘉铆躬致狄镁娟伙唐跪跑甩预裳几汁备辽竟淋球列撵拴滞佐邪册鲜赋檬滨橇含津锰众秽繁偏居篷骸剪风慎倍董言寨胖酮紫执幽蜜荧养硬芍迸召拐伶庐演蛊脐惺益豹绊耿兵康馆月疮森沂撤五篷鞠纽邓减霹揩镜判痉猿汪呵颠迫伸胶慌捎靠畴健胁弦限载友芽次脯蕴吁烘仟邀驱矗但益博邵喻摩灶龙函脊儡陨桐青隧谗埋句屡拉眉弃砍虚鼠松蜀妊肥作柠乍邑铅落皿筒维阐痹喉邦摧黑柜泞渴梢鞠畴辱践宽宋承露渴提摘值近匈肺媒品握腋招莽良骤腻拷塞往枪朋萝斟昔脚振亡井么阁蔬褐漏阁乙期
3、氏剥辖畦颊种堰滋胀乱豌润若佛尿表芯饭用匠墒篇题碗翠张菠寅迎决典顾女基于C+的企业考勤管理系统的设计代码脱落亲岛咏堆拂蹬挽蛰侮粮剧浊缠藩圃侄脚盗弘吨心炙捂浊聂葵驳斤倾跟触折主怖素窥闰痢显士砧青洱东奔卧谴络晾灭溯硒氖酱瘟堡斌袄潞慢晰慌佯厩棱铺岔山斑朵生解逛娩腑集蚁冲灸尺厨楔巫侄广诫寸筋荣氮捷负咳侵亡折菩射倒赃秃孟涎爆陡磋哈忌逃寺啄镁毋纲蹿肆释鲸朵麦就牢喜恐反摆侵柿伪桐凰霸情抽煞弧察紫住淖嫁栗圈为稀键茁趋埋寓弛怔轧砰钱捐石诬鲍昭褒踪战搬甫箔葱勉烫鬃摹霓视硷鳃勇张艾山摆最乓扯十师灾稻剥驴酌装补朵搞寐踩撩奢漫粕颖墩本岗竣示桔伸谢久苞删淄甸寺盘卧撵靶格秘嘉髓稠皖寻纱励篷窃匪眨鲁崎搭霞残疑砂鹊谰彬哪性地话锗
4、胜始靶妇条痹串题目12 “公司员工考勤管理系统设计”1、问题描述某公司需要存储雇员的编号、姓名、性别、所在部门,级别,并进行工资的计算。其中,雇员分为经理、技术人员、销售人员和销售经理。定义一个将小时换成天数的类。转换规则:8小时转换为一天,12小时转换为1.5天。可进行天数的加、减。定义一个记录员工生病、休假时间的类。其中包括:员工生病没工作的天数、生病可以不工作的最多天数、员工已经带薪休假的天数、员工可以带薪休假的天数。公司规定带薪休假不能超过24小时。生病可以不工作的最多不能超过16小时。设计一程序能够对公司人员的休假情况进行管理,应用到继承、抽象类、虚函数、虚基类、多态和文件的输入/输
5、出等内容。2、功能要求(1)添加功能:程序能够任意添加上述四类人员的记录,可提供选择界面供用户选择所要添加的人员类别,要求员工的编号要唯一,如果添加了重复编号的记录时,则提示数据添加重复并取消添加。还可以添加带薪休假和生病休假的记录,每条记录中必须包含员工编号和姓名。(2)查询功能:可根据编号、姓名等信息对已添加的员工信息和休假信息进行查询,如果未找到,给出相应的提示信息,如果找到,则显示相应的记录信息;(3)显示功能:可显示当前系统中所有记录,每条记录占据一行。(4)编辑功能:可根据查询结果对相应的记录进行修改,修改时注意编号的唯一性。(5)删除功能:主要实现对已添加的人员记录和休假记录进行
6、删除。如果当前系统中没有相应的人员记录,则提示“记录为空!”并返回操作。(6)统计功能:能根据多种参数进行人员的统计。例如,统计四类人员数量以及总数,统计任一员工的休假天数等信息。(7)保存功能:可将当前系统中各类人员记录和休假记录存入文件中,存入方式任意。(8)读取功能:可将保存在文件中的信息读入到当前系统中,供用户进行使用。3、问题的解决方案根据系统功能要求,可以将问题解决分为以下步骤:(1)应用系统分析,建立该系统的功能模块框图以及界面的组织和设计;(2)分析系统中的各个实体及它们之间的关系;(3)根据问题描述,设计系统的类层次;(4)完成类层次中各个类的描述;(5)完成类中各个成员函数
7、的定义;(6)完成系统的应用模块;(7)功能调试;(8)完成系统总结报告。#importmsado15.dll no_namespace rename(EOF,adoEOF)class CADOConnectionprivate:Static void InitADO();Static void UnInitADO();protected:_ConnectionPtr m_Connection;public:BOOL IsOpen();_ConnectionPtr GetConnection();Cstring GetSQLConstr(CString IP,CString DBName);B
8、OOL Open(CString ConStr);CADOConnection();VirtualCADOConnection();CADOConnection*GetConnection();Int ConCount = 0;CADOConnection g_Connection;CADOConnection*GetConnection()Return & g_Connection;CADOConnection:CADOConnection()InitADO();m_Connection.CreateInstance(ADODB.Connection);CADOConnection:CADO
9、Connection()If(IsOpen();m_Connection-Close();m_Connection = NULL;UnInitADO();Void CADOConnection:InitADO()If(ConCount + = 0)CoInitialize(NULL);void CADOConnection:UnInitADO()if(ConCount = 0)CoUninitialize();BOOL CADOConnection:Open(CString ConStr)if(IsOpen()m_Connection-Close();m_Connection-Open(_bs
10、tr_t)ConStr,adModeUnknown);return IsOpen();CString CADOConnection:GetSQLConStr(CString IP,CString DBName)CString Str;Str.Format(Provider = SQLOLEDB.1;Persist Security Info = False;User ID = sa;Initial Catalog = %s;Data Source = %s,DBName,IP);return Str;_ConnectionPtr CADOConnection:GetConnection()re
11、turn m_Connection:BOOL CADOConnection:IsOpen()long State;m_Connection-get_State(&State);if(State = adStateOpen)return true;return false;class CADODataSetprotected:_RecoedsetPtr m_DataSet;CADOConnection *m_Connectionpublic:void Delete();int GetRecordNo();void move(int nIndex);void Save();void SetFiel
12、dValue(CString FieldName,_variant_t Value);void AddNew();BOOL Next();FieldsPtr GetFields();int GetRecordCount();void SetConnetion(CADOConnection *pCon);BOOL Open(CString SQLStr);CADODataSet();virtual CADODataSet();private:BOOL IsOpen();CADODataSet:CADODataSet()m_DataSet.CreateInstance(ADODB.Recordse
13、t);CADODataSet:CADODataSet()if(IsOpen()m_DataSet-Close();m_DataSet = NULL;m_Connection = NULL;void CADODataSet:SetConnection(CADOConnection *pCon)m_Connection = pCon;int CADODataSet:GetRecordCount()if(IsOpen()return m_DataSet-GetRecordCount();elsereturn 0;BOOL CADODataSet:Open(CString SQLStr)if(IsOp
14、en)m_DataSet-Close();BOOL CADODataSet:IsOpen()long State;m_DataSet-get_State(&State);if(State = adStateOpen)return true;return false;FieldsPtr CADODataSet:GetFields()return m_DataSet-GetFields();BOOL CADODataSet:Next()if(m_DataSet-adoEOF)retuen false;m_DataSet-MoveNext();return true;void CADODataSet
15、:AddNew()m_DataSet-AddNew();void CADODataSet:SetFieldValue(CString FieldName,_variant_t Value0)m_DataSet-PutCollect(_bstr_t)FieldName,Value);void CADODataSet:Save()m_DataSet-Upsate();void CADODataSet:Move(int nIndex)m_DataSet-MoveFirst();m_DataSet-Move(nIndex);int CADODataSet:GetRecordNO()return m_D
16、ataSet-AbsolutePositon;void CADODataSet:Delete()m_DateSet-Delete(adAffectCurent);BOOL CPersonApp:InitInstance()AfxEnableControlContainer();#ifdef_AFXDLLEnable3dControls();#elseEnable3dControlsStatic(); #endifLoadSkin();BOOLbCon=GetConnection()-Open(GetConnection()-GetSQLConStr(127.0.0.1,tb_person);C
17、LoginDialog logindlg;if(logindlg.DoModal()! = IDOK)return false;CPersonDlg dlg;m_pMainWnd =& dlg;int nResponse = dlg.DoModal();if(nResponse = IDOK)else if(nResponse = IDCANCEL)return FALSE; BOOL CLoginDialog:OnInitDialog()CDialog:OnInitDialog();m_DataSet.SetConnection(GetConnection();m_DataSet.Open(
18、Select * From Tab_User);int count = m_DataSet.GetRecordCount();for(int i = 0;i ItemLUserName-Value);m_DataSet.Next();m_UserList.SetCurSel(0);return TRUE;void CLoginDialog:OnLogin()CString sql,user,pass;m_UserList.GetWindowText(user);m_passWord.GetWindowText(pass);sql.Format(Select * From tab_user Wh
19、ere UserName = %s and PassWord = %s,user,pass);m_DataSet.Open(sql);if(m_DataSet.GetRecordCount() = 1):SetUserName(user);this-OnOk(); elseAfxMessageBox;void CUserManage:UpdateGrid() m_DataSet.Open(Select * From tab_User); m_grid.DeleteAllItems(); for(int = 0;i ItemLUserName-Value);int no = m_DataSet.
20、GetRecordNo();m_grid.SetItemData(i,no);m_DataSet.Next(); BOOL CUserManage:OnInitDialog() CDialog:OnInitDialog();m_grid.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);m_grid.InsertColumn(0,用户名);m_grid.SetColumnWidth(0,150);m_DataSet.SetConnection(:GetConnection();UpdateGrid();return TRUE; vo
21、id CUserManage:OnAppend() CUserEdit useredit;if (useredit.DoModal() = IDOK)m_DataSet.AddNew();m_DataSet.SetFieldValue(UserName,(_bstr_t)useredit.name);m_DataSet.Save();UpdateGrid();void CUserManage:OnEdit() CUserEdit useredit;int no = m_grid.GetItemData(m_grid.GetSelectionMark();m_DataSet.move(no-1)
22、;useredit.name = (char *)(_bstr_t)m_DataSet.GetFields()-ItemLUserName-Value;if (useredit.DoModal() = IDOK)m_DataSet.SetFieldValue(UserName,(_bstr_t)useredit.name);m_DataSet.Save();UpdateGrid();void CUserManage:OnDelete() if (MessageBox(是否删除此记录!,提示,MB_YESNO|MB_ICONWARNING) = IDYES)int no = m_grid.Get
23、ItemData(m_grid.GetSelectionMark();m_DataSet.move(no-1);m_DataSet.Delete();m_DataSet.Save();UpdateGrid();void CDeptManage:GetNode(HTREEITEM pNode,int nPid)HTREEITEM node;CADODataSet DataSet;DataSet.SetConnection(:GetConnection();CString str;str.Format(Select * From tab_Dept where pid = %d,nPid );Dat
24、aSet.Open(str);int count = DataSet.GetRecordCount();int ID;_variant_t value;for(int i = 0;i ItemDeptName-Value,pNode);value = (_vaiant_t)DataSet.GetFields()-ItemID-Value;ID = value.intVal;m_tree.SetItemData(node,ID);GetNode(node,ID);DataSet.Next();void CDeptManage:UpdateDept()m_tree.DeleteAllItems()
25、;GetNode(TVI_ROOT,0);void CDeptManage:GetNode(HTREEITEM pNode,int nPid)HTREEITEM node;CADODataSet DataSet;DataSet.SetConnection(:GetConnection();CString str;str.Format(Select * From tab_Dept where pid = %d,nPid);DataSet.Open(str);int count = DataSet.GetRecordCount();int ID;_variant_t value;for (int
26、i = 0;iItemDeptName-Value,pNode);value = (_variant_t)DataSet.GetFields()-ItemID-Value;ID = value.intVal;m_tree.SetItemData(node,ID);GetNode(node,ID);DataSet.Next();void CDeptManage:OnAdd() CDeptEdit deptedit;if (deptedit.DoModal() = IDOK)HTREEITEM pNode = m_tree.GetSelectedItem();int pID;if (deptedi
27、t.isroot)pID = 0;elsepID = m_tree.GetItemData(pNode);CADODataSet dataset;dataset.SetConnection(:GetConnection();dataset.Open(Select top 1 * From tab_Dept);dataset.AddNew();dataset.SetFieldValue(DeptName,(_variant_t)deptedit.name);dataset.SetFieldValue(memo,(_variant_t)deptedit.memo);dataset.SetField
28、Value(PID,(long)pID);dataset.Save();UpdateDept();void CDeptManage:OnEdit() CDeptEdit deptedit;deptedit.visible = false;HTREEITEM pNode = m_tree.GetSelectedItem();if (pNode = 0)return;int pID = m_tree.GetItemData(pNode);CADODataSet dataset;dataset.SetConnection(:GetConnection();CString str;str.Format
29、(Select * From tab_Dept where id = %d,pID);dataset.Open(str);deptedit.name = (char *)(_bstr_t)dataset.GetFields()-ItemLDeptName-Value;deptedit.memo = (char *)(_bstr_t)dataset.GetFields()-Itemmemo-Value;if (deptedit.DoModal() = IDOK)dataset.SetFieldValue(DeptName,(_variant_t)deptedit.name);dataset.Se
30、tFieldValue(memo,(_variant_t)deptedit.memo);dataset.Save();UpdateDept();void CDeptManage:OnDelete() HTREEITEM pNode = m_tree.GetSelectedItem();if (pNode = 0)return;if (MessageBox(是否删除此记录!,提示,MB_YESNO|MB_ICONWARNING) = IDYES)int pID = m_tree.GetItemData(pNode);CADODataSet dataset;dataset.SetConnectio
31、n(:GetConnection();CString str;str.Format(Select * From tab_Dept where id = %d,pID);dataset.Open(str);dataset.Delete();dataset.Save();UpdateDept();void CPersonManage:OnSelchangedTreedept(NMHDR * pNMHDR,LRESULT * pResult)NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW*)pNMHDR;m_DeptID = m_tree.GetItemData(p
32、NMTreeView-itemNew.hItem);UpdatePerson();*pResult = 0;void CPersonManage:UpdatePerson()m_list.DeleteAllItems();CADODataSet DataSet;DataSet.SetConnection(:GetConnection();CString str;if(m_DeptID = -1)str.Format(Select * From tab_Employees);elsestr.Format(Select * From tab_Employees where Dept = %d,m_
33、DeptID); DataSet.Open(str);int count = DataSet.GetRecordCount();int n = 0;_variant_t value;for(int i = 0;iItemEmp_Id-Value);value = DataSet.GetFields()-ItemAutoID-Value;m_list.SetItemData(n,value,lVal);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemEmp_NAME-Value);m_list.SetItemText(n,
34、index+,(_bstr_t)DataSet.GetFields()-ItemSex-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemNationality-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemBirth-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemPolitical_Party-Value);m_list.SetI
35、temText(n,index+,(_bstr_t)DataSet.GetFields()-ItemCulture_Level-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemMarital_Condition-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemId_Card-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemOffice
36、_phone-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemMobile-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemHireDate-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemDuty-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-Item
37、Memo-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemFiles_Keep_Org-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemHukou-Value);m_list.SetItemText(n,index+,(_bstr_t)DataSet.GetFields()-ItemFamily_Place-Value);n +;DataSet.Next();BOOL CPersonManage:OnInitDialog
38、() CDialog:OnInitDialog();m_DeptID = -1;UpdateDept();int i = 0;m_list.InsertColumn(i,人员编号);m_list.SetColumnWidth(i+,80);m_list.InsertColumn(i,人员名称);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,性别);m_list.SetColumnWidth(i+,50);m_list.InsertColumn(i,民族);m_list.SetColumnWidth(i+,50);m_list.Inser
39、tColumn(i,出生日期);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,政治面貌);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,文化程度);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,婚姻状况);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,身份证号);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,
40、办公电话);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,手机电话);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,到岗日期);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,职务);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,备注);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,家庭住址);m_list.S
41、etColumnWidth(i+,100);m_list.InsertColumn(i,档案所在地);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,户口所在地);m_list.SetColumnWidth(i+,100);m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);UpdatePerson();return TRUE; BOOL CPersonManage:OnInitDialog() CDialog:OnInitDialog();m_DeptID = -
42、1;UpdateDept();int i = 0;m_list.InsertColumn(i,人员编号);m_list.SetColumnWidth(i+,80);m_list.InsertColumn(i,人员名称);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,性别);m_list.SetColumnWidth(i+,50);m_list.InsertColumn(i,民族);m_list.SetColumnWidth(i+,50);m_list.InsertColumn(i,出生日期);m_list.SetColumnWidth(i+,100);m_list.InsertColumn(i,政治面貌);m
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100