




已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
三、主要类与实现(在此仅介绍科研项目管理)主要类Class Project();科研项目管理类Class Project_input();科研项目信息增加类Class Project_search();科研项目信息查询类Class Project_delete();科研项目信息删除类实现部分/ Project.cpp : implementation file/#include stdafx.h#include 通用高校科研管理系统.h#include Project.h#include Project_input.h#include Project_search.h#include MENU.h#include Project_delete.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endifstruct CPro1/创建一个CResearcher结构体用于储存科研人员的所有属性CString number;CString name;CString level;CString person;CString fee;CString jwork;CString ywork;CString date;CString state;CString content;CPro1 *p;/ CProject dialogCProject:CProject(CWnd* pParent /*=NULL*/): CDialog(CProject:IDD, pParent)CPro1 *p=new CPro1;bool flg=1;CStdioFile file(科研项目信息.txt,CFile:modeRead);/读取r_information.txt中的数据 flg=file.ReadString(p-number);while(flg)flg=file.ReadString(p-name);flg=file.ReadString(p-level);flg=file.ReadString(p-person);flg=file.ReadString(p-fee);flg=file.ReadString(p-jwork);flg=file.ReadString(p-ywork);flg=file.ReadString(p-date);flg=file.ReadString(p-state);flg=file.ReadString(p-content);m_position.AddTail(p);p=new CPro1;flg=file.ReadString(p-number);file.Close();/AFX_DATA_INIT(CProject)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INITvoid CProject:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CProject)DDX_Control(pDX, IDC_LIST1, m_list1);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CProject, CDialog)/AFX_MSG_MAP(CProject)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON10, OnButton10)ON_BN_CLICKED(IDC_BUTTON3, OnButton3)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CProject message handlersBOOL CProject:OnInitDialog() CDialog:OnInitDialog();m_list1.SetExtendedStyle(LVS_EX_FLATSB| LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE| LVS_EX_GRIDLINES);m_list1.InsertColumn(0,项目编号,LVCFMT_RIGHT,76);m_list1.InsertColumn(1,项目名称,LVCFMT_CENTER,76);m_list1.InsertColumn(2,项目级别,LVCFMT_CENTER,76);m_list1.InsertColumn(3,课题负责人,LVCFMT_RIGHT,76);m_list1.InsertColumn(4,总经费,LVCFMT_RIGHT,76);m_list1.InsertColumn(5,甲方单位,LVCFMT_RIGHT,76);m_list1.InsertColumn(6,乙方单位,LVCFMT_RIGHT,76);m_list1.InsertColumn(7,完成日期,LVCFMT_RIGHT,76);m_list1.InsertColumn(8,目前状态,LVCFMT_CENTER,76);m_list1.InsertColumn(9,合同内容,LVCFMT_CENTER,76); UpdateData();POSITION pos; m_list1.DeleteAllItems();pos=m_position.GetHeadPosition();for(int i=0;pos!=NULL;i+)p=(CPro1*)m_position.GetNext(pos);m_list1.InsertItem(i,p-number);m_list1.SetItemText(i,1,p-name);m_list1.SetItemText(i,2,p-level);m_list1.SetItemText(i,3,p-person);m_list1.SetItemText(i,4,p-fee);m_list1.SetItemText(i,5,p-jwork);m_list1.SetItemText(i,6,p-ywork);m_list1.SetItemText(i,7,p-date);m_list1.SetItemText(i,8,p-state);m_list1.SetItemText(i,9,p-content);/ TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should return FALSEvoid CProject:OnButton1() / TODO: Add your control notification handler code here CDialog:OnOK();CProject_input m_menu;m_menu.DoModal();void CProject:OnButton10() / TODO: Add your control notification handler code here CDialog:OnOK();CProject_search m_menu;m_menu.DoModal();void CProject:OnButton3() / TODO: Add your control notification handler code here CDialog:OnOK();CMENU m_menu;m_menu.DoModal();void CProject:OnButton2() / TODO: Add your control notification handler code here CDialog:OnOK();CProject_delete m_menu;m_menu.DoModal();/ Project_input.cpp : implementation file/#include stdafx.h#include 通用高校科研管理系统.h#include Project_input.h#include Project.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CProject_input dialogCProject_input:CProject_input(CWnd* pParent /*=NULL*/): CDialog(CProject_input:IDD, pParent)/AFX_DATA_INIT(CProject_input)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INITvoid CProject_input:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CProject_input)/ NOTE: the ClassWizard will add DDX and DDV calls here/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CProject_input, CDialog)/AFX_MSG_MAP(CProject_input)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON5, OnButton5)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CProject_input message handlersvoid CProject_input:OnButton1() / TODO: Add your control notification handler code hereCString str1,str2,str3,str4,str5,str8,str9,str10,str11,str12;GetDlgItem(IDC_EDIT1)-GetWindowText(str1);GetDlgItem(IDC_EDIT2)-GetWindowText(str2);GetDlgItem(IDC_EDIT3)-GetWindowText(str3);GetDlgItem(IDC_EDIT4)-GetWindowText(str4);GetDlgItem(IDC_EDIT5)-GetWindowText(str5);GetDlgItem(IDC_EDIT8)-GetWindowText(str8);GetDlgItem(IDC_EDIT9)-GetWindowText(str9);GetDlgItem(IDC_EDIT10)-GetWindowText(str10);GetDlgItem(IDC_EDIT11)-GetWindowText(str11);GetDlgItem(IDC_EDIT12)-GetWindowText(str12);if(str1=)MessageBox(请输入项目编号);return;if(str2=)MessageBox(请输入项目名称);return;if(str3=)MessageBox(请输入项目级别);return;if(str4=)MessageBox(请输入课题负责人);return;if(str5=)MessageBox(请输入总经费);return;if(str8=)MessageBox(请输入甲方单位);return;if(str9=)MessageBox(请输入乙方单位);return;if(str10=)MessageBox(请输入完成日期);return;if(str11=)MessageBox(请输入目前状态);return;if(str12=)MessageBox(请输入合同内容);return;CStdioFile mFile,mfile;mFile.Open(科研项目信息显示.txt,CFile:modeCreate|CFile:modeNoTruncate|CFile:modeWrite);mfile.Open(科研项目信息.txt,CFile:modeCreate|CFile:modeNoTruncate|CFile:modeWrite);/if(mFile=NULL)/return;mFile.SeekToEnd();mFile.WriteString(str1+t);mFile.SeekToEnd();mFile.WriteString(str2+t);mFile.SeekToEnd();mFile.WriteString(str3+t);mFile.SeekToEnd();mFile.WriteString(str4+t);mFile.SeekToEnd();mFile.WriteString(str5+t);mFile.SeekToEnd();mFile.WriteString(str8+t);mFile.SeekToEnd();mFile.WriteString(str9+t);mFile.SeekToEnd();mFile.WriteString(str10+t);mFile.SeekToEnd();mFile.WriteString(str11+t);mFile.SeekToEnd();mFile.WriteString(str12+n);mFile.Close;mfile.SeekToEnd();mfile.WriteString(str1+n);mfile.SeekToEnd();mfile.WriteString(str2+n);mfile.SeekToEnd();mfile.WriteString(str3+n);mfile.SeekToEnd();mfile.WriteString(str4+n);mfile.SeekToEnd();mfile.WriteString(str5+n);mfile.SeekToEnd();mfile.WriteString(str8+n);mfile.SeekToEnd();mfile.WriteString(str9+n);mfile.SeekToEnd();mfile.WriteString(str10+n);mfile.SeekToEnd();mfile.WriteString(str11+n);mfile.SeekToEnd();mfile.WriteString(str12+n);mfile.Close;MessageBox(添加成功!);void CProject_input:OnButton5() / TODO: Add your control notification handler code here CDialog:OnOK();CProject m_menu;m_menu.DoModal();/ Project_search.cpp : implementation file/#include stdafx.h#include 通用高校科研管理系统.h#include Project_search.h#include Project.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endifstruct CPro/创建一个CResearcher结构体用于储存科研人员的所有属性CString number;CString name;CString level;CString person;CString fee;CString jwork;CString ywork;CString date;CString state;CString content;CPro *p;/ CProject_search dialogCProject_search:CProject_search(CWnd* pParent /*=NULL*/): CDialog(CProject_search:IDD, pParent)CPro *p=new CPro;bool flg=1;CStdioFile file(科研项目信息.txt,CFile:modeRead);/读取r_information.txt中的数据 flg=file.ReadString(p-number);while(flg)flg=file.ReadString(p-name);flg=file.ReadString(p-level);flg=file.ReadString(p-person);flg=file.ReadString(p-fee);flg=file.ReadString(p-jwork);flg=file.ReadString(p-ywork);flg=file.ReadString(p-date);flg=file.ReadString(p-state);flg=file.ReadString(p-content);m_position.AddTail(p);p=new CPro;flg=file.ReadString(p-number);file.Close();/AFX_DATA_INIT(CProject_search)m_edit1 = _T();m_edit10 = _T();m_edit11 = _T();m_edit12 = _T();m_edit2 = _T();m_edit4 = _T();m_edit5 = _T();m_edit6 = _T();m_edit7 = _T();m_edit8 = _T();m_edit9 = _T();/AFX_DATA_INITvoid CProject_search:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CProject_search)DDX_Text(pDX, IDC_EDIT1, m_edit1);DDX_Text(pDX, IDC_EDIT10, m_edit10);DDX_Text(pDX, IDC_EDIT11, m_edit11);DDX_Text(pDX, IDC_EDIT12, m_edit12);DDX_Text(pDX, IDC_EDIT2, m_edit2);DDX_Text(pDX, IDC_EDIT4, m_edit4);DDX_Text(pDX, IDC_EDIT5, m_edit5);DDX_Text(pDX, IDC_EDIT6, m_edit6);DDX_Text(pDX, IDC_EDIT7, m_edit7);DDX_Text(pDX, IDC_EDIT8, m_edit8);DDX_Text(pDX, IDC_EDIT9, m_edit9);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CProject_search, CDialog)/AFX_MSG_MAP(CProject_search)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CProject_search message handlersvoid CProject_search:OnButton2() / TODO: Add your control notification handler code here UpdateData();POSITION pos;bool flg=0;pos=m_position.GetHeadPosition();while(pos!=NULL)p=(CPro*)m_position.GetNext(pos);if(m_edit1=p-number)/对输如信息的检索m_edit2=p-number;m_edit4=p-name;m_edit5=p-level; m_edit6=p-person;m_edit7=p-fee;m_edit8=p-jwork;m_edit9=p-ywork; m_edit10=p-date;m_edit11=p-state; m_edit12=p-content;UpdateData(0);flg=1;break;if(!flg)m_edit1 = ;m_edit2 = ;m_edit4 = ;m_edit5 = ;m_edit6 = ;m_edit7 = ;m_edit8 = ;m_edit9 = ;m_edit10 = ;m_edit11 = ;m_edit12 = ;UpdateData(0);MessageBox(没有此科研人员!);void CProject_search:OnButton1() / TODO: Add your control notification handler code hereCDialog:OnOK();CProject m_project;m_project.DoModal();/ Project_delete.cpp : implementation file/#include stdafx.h#include 通用高校科研管理系统.h#include Project_delete.h#include Project.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endifstruct CPro2/创建一个CResearcher结构体用于储存科研人员的所有属性CString number;CString name;CString level;CString person;CString fee;CString jwork;CString ywork;CString date;CString state;CString content;CPro2 *p;/ CProject_delete dialogCProject_delete:CProject_delete(CWnd* pParent /*=NULL*/): CDialog(CProject_delete:IDD, pParent)CPro2 *p=new CPro2;bool flg=1;CStdioFile file(科研项目信息.txt,CFile:modeRead);/读取r_information.txt中的数据 flg=file.ReadString(p-number);while(flg)flg=file.ReadString(p-name);flg=file.ReadString(p-level);flg=file.ReadString(p-person);flg=file.ReadString(p-fee);flg=file.ReadString(p-jwork);flg=file.ReadString(p-ywork);flg=file.ReadString(p-date);flg=file.ReadString(p-state);flg=file.ReadString(p-content);m_position.AddTail(p);p=new CPro2;flg=file.ReadString(p-number);file.Close();/AFX_DATA_INIT(CProject_delete)m_edit1 = _T();m_edit2 = _T();/AFX_DATA_INITvoid CProject_delete:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CProject_delete)DDX_Text(pDX, IDC_EDIT1, m_edit1);DDX_Text(pDX, IDC_EDIT2, m_edit2);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CProject_delete, CDialog)/AFX_MSG_MAP(CProject_delete)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON3, OnButton3)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CProject_delete message handlersvoid CProject_delete:OnButton2() / TODO: Add your control notification handler code hereUpdateData();
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 民法典专题知识培训课件
- 公安考试题及答案
- 2024镇江市丹阳市延陵镇社区工作者招聘考试试题
- 2024鞍山市铁东区湖南街道社区工作者招聘考试试题
- 甘肃省武威第八中学2026届高一化学第一学期期末考试试题含解析
- 危重症患者抢救制度考试试题(附答案)
- 2025年有害生物防治员初级理论知识考核试题及答案
- 2025兽医实验室试题及答案
- 2025年科研管理与学术道德考试试题及答案
- 车间升降门安全知识培训课件
- 《建筑装饰设计收费》
- 设备预防性维修管理
- 去极端化自我剖析
- 生殖伦理培训课件
- 船舶压载水取样与检测技术
- 【种植活动中培养幼儿自主探究的实践研究4100字(论文)】
- 飞蚊症护理的课件
- 金融工程.郑振龙(全套课件560P)
- 古典诗歌的生命情怀
- 2017版小学科学课程标准思维导图
- 第十一章-异常分娩-1产力异常
评论
0/150
提交评论