課設題目
高校人員信息管理系統
課設要求
設計內容
某高校有四類員工:教師、實驗員、行政人員,教師兼行政人員:共有的
信息包括:編號、姓名、性別、出生日期等。其中,教師還包含信息:所在系
部、專業、職稱;實驗員還包含信息:所在實驗室、職務;行政人員還包含信
息:政治面貌、職稱等。功能要求:
- 用戶管理
- 人 員信息的錄入、修改和刪除(要有刪除提示),要求員工的編號要 唯一
- 根據編號、姓名等查詢個人信息
- 顯示當前系統中所有記錄
- 能根據多種參數進行人員的統計,如四類人員數量以及總數,統計男、女員工數量等
- 數據導入和導出
程序運行界面
部分源碼
void CMainDlg::OnButton1()
{
// TODO: Add your control notification handler code here
MessageBox("數據導入成功");
show();
}
void CMainDlg::OnButton8()
{
// TODO: Add your control notification handler code here
MessageBox("數據導出成功");
}
void CMainDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CString id,name,sex,date,depart,major,type,labname,post,politics,title,kind;
GetDlgItem(IDC_COMBO2)->GetWindowText(kind);
if(kind=="")
{
MessageBox("請先選擇員工種類");
return;
}
GetDlgItem(IDC_EDIT1)->GetWindowText(id);
GetDlgItem(IDC_EDIT2)->GetWindowText(name);
GetDlgItem(IDC_EDIT3)->GetWindowText(depart);
GetDlgItem(IDC_EDIT4)->GetWindowText(major);
GetDlgItem(IDC_EDIT5)->GetWindowText(type);
GetDlgItem(IDC_EDIT6)->GetWindowText(labname);
GetDlgItem(IDC_EDIT7)->GetWindowText(post);
GetDlgItem(IDC_EDIT8)->GetWindowText(politics);
GetDlgItem(IDC_EDIT9)->GetWindowText(title);
GetDlgItem(IDC_COMBO1)->GetWindowText(sex);
GetDlgItem(IDC_EDIT10)->GetWindowText(date);
int num = readteach();
for(int i =0;i<num;i++)
{
if(strcmp(id,teach[i].id)==0)
{
MessageBox("該編號員工已存在,不能重複添加");
return;
}
}
num = readlab();
for(i=0;i<num;i++)
{
if(strcmp(id,lab[i].id)==0)
{
MessageBox("該編號員工已存在,不能重複添加");
return;
}
}
num = readadmin();
for(i=0;i<num;i++)
{
if(strcmp(id,admin[i].id)==0)
{
MessageBox("該編號員工已存在,不能重複添加");
return;
}
}
if(kind=="教師")
{
if(id==""||name==""||sex==""||depart==""||major==""||type==""||date=="")
{
MessageBox("請先完善信息");
return;
}
ofstream file;
file.open("teacher.txt",ios::app);
file<<id.GetBuffer(0)<<" "<<name.GetBuffer(0)<<" "<<sex.GetBuffer(0)<<" "<<date.GetBuffer(0)<<" "<<depart.GetBuffer(0)<<" "<<major.GetBuffer(0)<<" "<<type.GetBuffer(0)<<endl;
file.close();
MessageBox("添加成功");
show();
}
if(kind=="實驗員")
{
if(id==""||name==""||sex==""||labname==""||post==""||date=="")
{
MessageBox("請先完善信息");
return;
}
ofstream file;
file.open("laber.txt",ios::app);
file<<id.GetBuffer(0)<<" "<<name.GetBuffer(0)<<" "<<sex.GetBuffer(0)<<" "<<date.GetBuffer(0)<<" "<<labname.GetBuffer(0)<<" "<<post.GetBuffer(0)<<endl;
file.close();
MessageBox("添加成功");
show();
}
if(kind.Find("行政人員")!=-1)
{
if(id==""||name==""||sex==""||politics==""||title==""||date=="")
{
MessageBox("請先完善信息");
return;
}
ofstream file;
file.open("admin.txt",ios::app);
file<<id.GetBuffer(0)<<" "<<name.GetBuffer(0)<<" "<<sex.GetBuffer(0)<<" "<<date.GetBuffer(0)<<" "<<politics.GetBuffer(0)<<" "<<title.GetBuffer(0)<<endl;
file.close();
MessageBox("添加成功");
show();
}
}
void CMainDlg::showall()
{
GetDlgItem(IDC_EDIT3)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT4)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT5)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT6)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT7)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT8)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT9)->EnableWindow(TRUE);
}
項目源碼
需要源碼的小夥伴請前往
微信公衆號:海轟Pro
回覆: 海轟
O(∩_∩)O哈哈~