C++课程设计--高校人员信息管理系统(MFC)

课设题目

高校人员信息管理系统

课设要求

设计内容
        某高校有四类员工:教师、实验员、行政人员,教师兼行政人员:共有的
信息包括:编号、姓名、性别、出生日期等。其中,教师还包含信息:所在系
部、专业、职称;实验员还包含信息:所在实验室、职务;行政人员还包含信
息:政治面貌、职称等。功能要求:

  1. 用户管理
  2. 人 员信息的录入、修改和删除(要有删除提示),要求员工的编号要 唯一
  3. 根据编号、姓名等查询个人信息
  4. 显示当前系统中所有记录
  5. 能根据多种参数进行人员的统计,如四类人员数量以及总数,统计男、女员工数量等
  6. 数据导入和导出

程序运行界面

在这里插入图片描述
在这里插入图片描述

部分源码

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哈哈~

发布了155 篇原创文章 · 获赞 110 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/weixin_44225182/article/details/104046331