人事管理系统源代码

合集下载

高校人事管理系统C++程序设计源代码

高校人事管理系统C++程序设计源代码

目录新建一个头文件类,名字为:Person.h,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。

(2)头文件: (2)源文件: (2)新建一个头文件类,名字为:Person.h,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。

头文件:#include <iostream>#include <fstream>using namespace std;//基类class Person{public:char name[20];char sex[6];int age;char zzmm[10];char zgxl[10];int rzsj;int lysj;int gongzi;virtual void add(){cout<<"姓名:";cin>>name;cout<<"性别:";cin>>sex;cout<<"年龄:";cin>>age;cout<<"工资:";cin>>gongzi;cout<<"政治面貌:";cin>>zzmm;cout<<"最高学历:";cin>>zgxl;cout<<"任职时间:";cin>>rzsj;cout<<"来院时间:";cin>>lysj;}virtual void show(){cout<<"姓名:"<<name<<endl<<"性别:"<<sex<<endl<<"年龄:"<<age<<endl<<"工资:"<<gongzi<<endl<<"政治面貌:"<<zzmm<<endl<<"最高学历:"<<zgxl<<endl<<"任职时间:"<<rzsj<<endl<<"来院时间:"<<lysj<<endl;}virtual void save(fstream &f){f<<name<<" "<<sex<<" "<<age<<" "<<gongzi<<" "<<zzmm<<" "<<zgxl<<" "<<rzsj<<" "<<lysj<<" ";}virtual void read(fstream &f){f>>name>>sex>>age>>gongzi>>zzmm>>zgxl>>rzsj>>lysj;}};//行政人员class xzry:virtual public Person{public:char zhiwu[10];char jibie[10];int NOxz;void add(int &num1){num1++;NOxz=num1;cout<<"行政人员编号:"<<NOxz<<endl;Person::add();cout<<"职务:";cin>>zhiwu;cout<<"级别:";cin>>jibie;}void show(){cout<<"行政人员编号:"<<NOxz<<endl;Person::show();cout<<"职务:"<<zhiwu<<endl<<"级别:"<<jibie<<endl;}virtual void save(fstream &f){f<<NOxz<<" "; //记录正在输入的行政人员编号Person::save(f);f<<zhiwu<<" "<<jibie<<" "<<endl;}virtual void read(fstream &f){Person::read(f);f>>zhiwu>>jibie;}};//教师class jiaoshi:virtual public Person{public:char zhiwu[10];char zhicheng[10];int NOjs;void add(int &num2){num2++;NOjs=num2;cout<<"教师编号:"<<NOjs<<endl; Person::add();cout<<"职务:";cin>>zhiwu;cout<<"职称:";cin>>zhicheng;}void show(){cout<<"教师编号:"<<NOjs<<endl;Person::show();cout<<"职务:"<<zhiwu<<endl<<"职称:"<<zhicheng<<endl; }virtual void save(fstream &f){f<<NOjs<<" ";Person::save(f);f<<zhiwu<<" "<<zhicheng<<endl;}virtual void read(fstream &f){Person::read(f);f>>zhiwu>>zhicheng;}};//一般员工class ybyg:virtual public Person{public:char zhiwu[10];int NOyb;void add(int &num3){num3++;NOyb=num3;cout<<"一般员工编号:"<<NOyb<<endl; Person::add();cout<<"职务:";cin>>zhiwu;}void show(){cout<<"一般员工编号:"<<NOyb<<endl; Person::show();cout<<"职务:"<<zhiwu<<endl;}virtual void save(fstream &f){f<<NOyb<<" ";Person::save(f);f<<zhiwu<<" "<<endl;}virtual void read(fstream &f){Person::read(f);f>>zhiwu;}};//退休员工class tuixiu:virtual public Person //退休人员{public:int tuixiusj;int NOtx;void add(int &num4){num4++;NOtx=num4;cout<<"退休员工编号:"<<NOtx<<endl;Person::add();cout<<"退休时间:";cin>>tuixiusj;}void show(){cout<<"退休员工编号:"<<NOtx<<endl;Person::show();cout<<"退休时间:"<<tuixiusj<<endl; }virtual void save(fstream &f){f<<NOtx<<" ";Person::save(f);f<<tuixiusj<<" "<<endl;}virtual void read(fstream &f){Person::read(f);f>>tuixiusj;}};源文件:#include "Person.h"#include "string.h"#include <iostream>#include <fstream>using namespace std;int i1=0,i2=0,i3=0,i4=0; //定义总数int n1=0,n2=0,n3=0,n4=0; //定义编号xzry xz[100]; //定义行政人员100人jiaoshi js[100]; //定义教师人员100人ybyg yb[100]; //定义一般员工100人tuixiu tx[100]; //定义退休人员100人void addPerson(); //添加学院工作人员函数void FileSave(); //信息保存函数void FileRead(); //读取文件函数void findChange(); //查询并编辑工作人员信息函数void Delete(int j,int k); //删除函数void editPer(int v,int z); //编辑工作人员信息void findName(); //根据姓名查询函数void findNO(); //根据编号查询函数void tongji(); //统计函数//主函数void main(){FileRead();n1=i1;n2=i2;n3=i3;n4=i4;int a;while(1){cout<<"**********欢迎进入高校人事管理系统**************"<<endl; cout<<"* 输入选项进行选择*"<<endl; cout<<"* *"<<endl; cout<<"* 1、添加学院工作人员*"<<endl; cout<<"* 2、查询*"<<endl; cout<<"* 编辑*"<<endl; cout<<"* 删除工作人员信息*"<<endl; cout<<"* 3、人员统计*"<<endl;cout<<"* 4、退出程序*"<<endl; cout<<"* *"<<endl; cout<<"************************************************"<<endl; cout<<endl;cout<<"请选择:";cin>>a;system("cls");if (a==1){ addPerson(); }else if (a==2){ findChange(); }else if (a==3){ tongji(); }else if (a==4){ break; }else{cout<<"输入有误!请重试!"<<endl;cout<<endl;system ("pause");system ("cls");continue;}}}//添加学院工作人员函数void addPerson(){int b;while(1){cout<<"*******请选择人员工作岗位*********"<<endl; cout<<"* 1、行政人员*"<<endl; cout<<"* 2、教师*"<<endl; cout<<"* 3、一般员工*"<<endl; cout<<"* 4 、退休人员*"<<endl; cout<<"* 5、保存并退出*"<<endl; cout<<"**********************************"<<endl; cout<<endl<<"要添加请选择,不添加请选退出:"; cin>>b; cout<<endl;system("cls");if (b==1) //添加行政人员{xz[i1].add(n1);}else if(b==2) //添加教师{js[i2].add(n2);i2++;}else if(b==3) //添加一般员工{yb[i3].add(n3);i3++;}else if(b==4) //添加退休人员{tx[i4].add(n4);i4++;}else if(b==5){FileSave();break;}{cout<<"输入有误!请重试!"<<endl;cout<<endl;system ("pause");system ("cls");continue;}}}//信息保存函数void FileSave(){int k;fstream file;file.open("data.dat", ios::out);file<<i1<<endl; //保存已输入的行政人员总数for(k=0;k<i1;k++)xz[k].save(file);file<<endl;file<<i2<<endl; //保存已输入的教师人员总数for(k=0;k<i2;k++)js[k].save(file);file<<endl;file<<i3<<endl; //保存已输入的一般员工总数for(k=0;k<i3;k++)yb[k].save(file);file<<endl;file<<i4<<endl; //保存已输入的退休人员总数for(k=0;k<i4;k++)tx[k].save(file);file<<endl;file.close();}//读取文件函数void FileRead(){int k;fstream file;file.open("data.dat", ios::in);file>>i1; //读取行政人员总数for(k=0;k<i1;k++){file>>xz[k].NOxz; //读取行政人员编号xz[k].read(file);}file>>i2; //读取教师人员总数for(k=0;k<i2;k++){file>>js[k].NOjs; //读取教师人员编号js[k].read(file);}file>>i3; //读取一般员工总数for(k=0;k<i3;k++){file>>yb[k].NOyb; //读取一般员工编号yb[k].read(file);}file>>i4; //读取退休人员总数for(k=0;k<i4;k++){file>>tx[k].NOtx; //读取退休人员编号tx[k].read(file);}file.close();}//查询并编辑工作人员信息void findChange(){int e;while(1){cout<<"****************************"<<endl;cout<<"* 1、编号查询*"<<endl;cout<<"* 2、姓名查询*"<<endl; cout<<"* 3、退出*"<<endl; cout<<"****************************"<<endl; cout<<"请选择:";cin>>e; cout<<endl;system("cls");if (e==1){findNO();}else if (e==2){findName();}else if (e==3){break;}else{cout<<"输入有误!请重试!"<<endl;system ("pause");system ("cls");continue;}}}//根据编号查询函数void findNO(){int f,g,z;int h;while(1){cout<<"========请输入查询人所在的分类========"<<endl; cout<<" 1、行政人员"<<endl;cout<<" 2、教师人员"<<endl;cout<<" 3、一般员工"<<endl;cout<<" 4、退休人员"<<endl;cout<<" 5、退出"<<endl;cout<<"==================================== =="<<endl;cout<<"请输入:";cin>>f;cout<<endl;system("cls");if (f==1)cout<<"========行政人员查询========"<<endl; cout<<"请输入查询的编号:";cin>>g;for(int t1=0;t1< i1;t1++){if(xz[t1].NOxz==g){h=g-1;xz[h].show();z=1;editPer(g,z); //是否编辑Delete(g,z); //是否删除}}}else if (f==2){cout<<"========教师人员查询========"<<endl; cout<<"请输入查询的编号:";cin>>g;for(int t2=0;t2< i2;t2++){if(js[t2].NOjs==g)h=g-1;js[h].show();z=2;editPer(g,z); //是否编辑Delete(g,z); //是否删除}}}else if (f==3){cout<<"========一般员工查询========"<<endl; cout<<"请输入查询的编号:";cin>>g;for(int t3=0;t3< i3;t3++){if(yb[t3].NOyb==g){h=g-1;yb[h].show();z=3;editPer(g,z); //是否编辑Delete(g,z); //是否删除}}else if (f==4){cout<<"========退休人员查询========"<<endl; cout<<"请输入查询的编号:";cin>>g;for(int t4=0;t4< i4;t4++){if(tx[t4].NOtx==g){h=g-1;tx[h].show();z=4;editPer(g,z); //是否编辑Delete(g,z); //是否删除}}}else if (f==5){break;}elsecout<<"输入有误!请重试!"<<endl;system ("pause");system ("cls");continue;}}}//根据姓名查询函数void findName(){char s;char nam[20];int x;while(1){cout<<"=========正在通过姓名进行查询========="<<endl<<endl;cout<<"请输入查询的姓名:";cin>>nam;for(int t=0;t<(i1+i2+i3+i4);t++){if(strcmp(xz[t].name,nam)==0){xz[t].show();x=1;editPer(xz[t].NOxz,x); //是否编辑Delete(xz[t].NOxz,x); //是否删除cout<<endl;}else if(strcmp(js[t].name,nam)==0){js[t].show();x=2;editPer(js[t].NOjs,x); //是否编辑Delete(js[t].NOjs,x); //是否删除cout<<endl;}else if(strcmp(yb[t].name,nam)==0){yb[t].show();x=3;editPer(yb[t].NOyb,x); //是否编辑Delete(yb[t].NOyb,x); //是否删除cout<<endl;}else if(strcmp(tx[t].name,nam)==0){tx[t].show();x=4;editPer(tx[t].NOtx,x); //是否编辑Delete(tx[t].NOtx,x); //是否删除cout<<endl;}elsecontinue;}cout<<"是否继续查询或修改(y/n)"<<endl;cin>>s;if(s=='y'||s=='Y') continue;else break;}}//编辑工作人员信息void editPer(int v,int z){char su1;char su2;n1=v-1;n2=v-1;n3=v-1;n4=v-1;while(1){cout<<endl<<"是否进行修改(y/n)"<<endl; cin>>su1;if(su1=='y'||su1=='Y'){if(z==1){xz[n1].add(n1);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==2){js[n2].add(n2);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==3){yb[n3].add(n3);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==4){tx[n4].add(n4);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}}else break;break;}}//删除函数void Delete(int j,int k){char su4;int jg=j;n1=j;n2=j;n3=j;n4=j;while(1){cout<<endl<<"是否删除(y/n)"<<endl;cin>>su4;if(su4=='y'||su4=='Y'){if(k==1){for(;n1<i1;n1++){xz[n1-1]=xz[n1]; //删除搜索的行政人员信息xz[n1-1].NOxz--; //信息删除后编号重排}i1--;FileSave();cout<<"=====你所查询编号为"<<jg<<"的行政人员信息已删除====="<<endl<<endl;system("pause");system("cls");}if(k==2){for(;n2<i2;n2++){js[n2-1]=js[n2]; //删除搜索的教师信息js[n2-1].NOjs--; //信息删除后编号重排}i2--;FileSave();cout<<"=====你所查询编号为"<<jg<<"的教师信息已删除====="<<endl<<endl;system("pause");system("cls");}if(k==3){for(;n3<i3;n3++){yb[n3-1]=yb[n3]; //删除搜索的一般员工信息yb[n3-1].NOyb--; //信息删除后编号重排}i3--;FileSave();cout<<"=====你所查询编号为"<<jg<<"的一般员工信息已删除====="<<endl<<endl;system("pause");system("cls");}if(k==4){for(;n4<i4;n4++){tx[n4-1]=tx[n4]; //删除搜索的退休员工信息tx[n4-1].NOtx--; //信息删除后编号重排}i4--;FileSave();cout<<"=====你所查询编号为"<<jg<<"的退休员工信息已删除====="<<endl<<endl;system("pause");system("cls");}else break;}break;}}void tongji() //人事统计while(1){int z,i;int g=0;cout<<"请输入要统计的类型:1.在职人员 2.党员 3.女性人员 4.高学历高职称人员"<<endl;int r;cin>>r;if(r==1){z=i1+i2+i3;cout<<"在职人员数:"<<z<<endl;}else if(r==2){for(i=0;i<i1;i++){if(strcmp(xz[i].zzmm ,"党员")==0)g++;}for(i=0;i<i2;i++)if(strcmp(js[i].zzmm,"党员")==0) g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zzmm,"党员")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zzmm,"党员")==0) g++;}cout<<"党员数:"<<g<<endl; }else if(r==3){for(i=0;i<i1;i++){if(strcmp(xz[i].sex,"女")==0)g++;for(i=0;i<i2;i++){if(strcmp(js[i].sex,"女")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].sex,"女")==0)g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].sex,"女")==0)g++;}cout<<"女性人员数:"<<g<<endl; }else if(r==4){int g=0,h=0,c=0;for(i=0;i<i1;i++)if(strcmp(xz[i].zgxl,"大学")==0) g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"大学")==0) g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"大学")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"大学")==0) g++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"高中")==0)h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"高中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"高中")==0) h++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"高中")==0) h++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"初中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"初中")==0)h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"初中")==0)h++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"初中")==0)h++;}cout<<"大学人数:"<<g<<" 高中人数:"<<h<<" 初中人数:"<<c<<endl;}else{cout<<"统计的类型错误!"<<endl;system("PAUSE");. ... .}cout<<"是否继续人事统计:Y继续、其他退出"<<endl;char x;cin>>x;if(x!='y' && x!='Y')break;}}. word ..。

人力资源管理系统代码

人力资源管理系统代码
timAmOnDutyTime datetime,--上班时间
timAmRingOutTime dateTime,--下班时间
timsAmOnStatus varchar(10),--上班状态(迟到,早退,旷工,请假,出差, 正常(默认))
timsAmRingStatus varchar(10),--下班状态(迟到,早退,旷工,请假,出差, 正常(默认))
(
traId int identity(1,1) primary key not null,--标识列
traDeptNumId int,--我方部门编号(外键)
traDeptId int,--对方部门编号(外键)
traEmpId int,--申请人(外键)
traEmpNum int,--调用的对方员工(外键)
traContent varchar(800),--申请调用内容
tralyTime datetime,--申请时间
traStatus int,--审批状态(0:正在审批中,1:审批通过,2:审批未通过)
trsEmpName int,--审批人(外键)
traTime dateTime,--审批时间
(
useId int identity(1,1) primary key not null,--标识列
useName varchar(50),--状态名称(试用期,正式员工,离职员工,退休员工)
useState int ,--状态(0:表示正常使用中,1:表示已冻结)
useRemark text--备注
use master
if exists(select * from sysdatabases where name='HR_System')

人事管理系统数据库源代码

人事管理系统数据库源代码

using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace WebApplication1{public partial class WebForm1 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e) {Response.Redirect("~/登录.aspx");}protected void Button2_Click(object sender, EventArgs e) {Response.Redirect("~/人员信息查询.aspx");}protected void Button3_Click(object sender, EventArgs e){Response.Redirect("~/人员修改.aspx");}protected void Button4_Click(object sender, EventArgs e) {Response.Redirect("~/部门信息.aspx");}protected void Button5_Click(object sender, EventArgs e) {Response.Redirect("~/工资信息.aspx");}}}using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class部门信息 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){bool find =false;SqlConnection con=new SqlConnection("server=localhost;Integrated Security=SSPI;database=人事管理系统");con.Open();string cmdstr="select * from 部门表";SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;i<ds.Tables[0].Rows.Count;i++){for(int j=0;j<ds.Tables[0].Columns.Count;j++){String data=(ds.Tables[0].Rows[i][j].ToString()).Trim();if(data==TextBox1.Text.Trim()){TextBox2.Text=ds.Tables[0] .Rows[i]["部门代码"].ToString();TextBox3.Text=ds.Tables[0] .Rows[i]["部门名称"].ToString();find=true;}}}if (find == false){Response.Write("<script>window.alert('没有有关记录!')</script>"); con.Close();}}protected void Button2_Click(object sender, EventArgs e){Response.Redirect("~/Default.aspx");}}}using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;using System.Data.SqlTypes;namespace WebApplication1{public partial class_Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void TextBox1_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){SqlConnection con = new SqlConnection("server=localhost;IntegratedSecurity=SSPI;database=人事管理系统");string strCount;strCount = "select * from 人事表"; con.Open();SqlCommand com = new SqlCommand(strCount, con);SqlDataReader dr = com.ExecuteReader();string strUsername = "", strPassword = "";while (dr.Read()){if (TextBox1.Text == dr["编号"].ToString()||TextBox2.Text == dr["顾客密码"].ToString()){strUsername = dr["编号"].ToString();strPassword = dr["顾客密码"].ToString();break;}}dr.Close();con.Close();if (strUsername == ""){Response.Write("<script language=javascript>alert('登录成功!');</script>");return;}}protected void Button2_Click(object sender, EventArgs e){Response.Redirect("~/Default.aspx");}}}using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class工资信息 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void TextBox2_TextChanged(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){bool find = false;SqlConnection con = new SqlConnection("server=localhost;Integrated Security=SSPI;database=人事管理系统");con.Open();string cmdstr = "select * from 工资表";SqlDataAdapter da = new SqlDataAdapter(cmdstr, con);DataSet ds = new DataSet();da.Fill(ds);for (int i = 0; i < ds.Tables[0].Rows.Count; i++){for (int j = 0; j < ds.Tables[0].Columns.Count; j++){String data = (ds.Tables[0].Rows[i][j].ToString()).Trim();if (data == TextBox1.Text.Trim()){TextBox2.Text = ds.Tables[0].Rows[i]["应发工资"].ToString(); TextBox3.Text = ds.Tables[0].Rows[i]["岗位津贴"].ToString(); TextBox4.Text = ds.Tables[0].Rows[i]["奖励"].ToString();TextBox5.Text = ds.Tables[0].Rows[i]["保险"].ToString();find = true;}}}if (find == false){Response.Write("<script>window.alert('没有有关记录!')</script>");con.Close();}}protected void Button2_Click(object sender, EventArgs e){Response.Redirect("~/Default.aspx");}}}using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class人员信息 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){Response.Redirect("~/Default.aspx");}protected void Button2_Click(object sender, EventArgs e){bool find =false;SqlConnection con = new SqlConnection("server=localhost;Integrated Security=SSPI;database=人事管理系统");con.Open();string cmdstr="select * from 工资表";SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;i<ds.Tables[0].Rows.Count;i++){for(int j=0;j<ds.Tables[0].Columns.Count;j++){String data=(ds.Tables[0].Rows[i][j].ToString()).Trim();if(data==TextBox1.Text.Trim()){TextBox2.Text=ds.Tables[0] .Rows[i]["应发工资"].ToString();TextBox3.Text=ds.Tables[0] .Rows[i]["岗位津贴"].ToString();TextBox4.Text=ds.Tables[0] .Rows[i]["奖励"].ToString();TextBox5.Text = ds.Tables[0].Rows[i]["保险"].ToString();find=true;}}}if (find == false){Response.Write("<script>window.alert('没有有关记录!')</script>"); con.Close();}}}}using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class人员修改 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button2_Click(object sender, EventArgs e){SqlConnection con=new SqlConnection("server=localhost;IntegratedSecurity=SSPI;database=人事管理系统");con.Open();string insert="insert into 人事表(员工号,姓名,性别,职称,学历) values("+""+ TextBox1.Text.Trim() +""+","+"" + TextBox2.Text.Trim() +""+","+ TextBox3.Text.Trim() + "," +""+ TextBox4.Text.Trim() +""+","+"" +TextBox5.Text.Trim() + ""+")";Response.Write(insert);SqlCommand cmd1=new SqlCommand(insert,con);con.Close();}protected void Button1_Click(object sender, EventArgs e){Response.Redirect("~/Default.aspx");}protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) {}}}。

人力资源管理系统代码 ASP

人力资源管理系统代码 ASP

<!--#include file=DataBase/conn.asp--><%If request("action")="login" thenadmin_name=request("admin_name")'获取用户名admin_pass=request("admin_pass")'获取密码username=trim(request("admin_name"))password=trim(request("admin_pass"))for i=1 to len(username)user=mid(username,i,1)if user="'" or user="%" or user="<" or user=">" or user="&" or user="|" thenresponse.write "<script language=JavaScript>" & "alert('您的用户名含有非法字符,请重新输入!');" & "history.back()" & "</script>"response.endend ifnextfor i=1 to len(password)pass=mid(password,i,1)if pass="'" or pass="%" or pass="<" or pass=">" or upass="&" or pass="|" then response.write "<script language=JavaScript>" & "alert('您的密码含有非法字符,请重新输入!');" & "history.back()" & "</script>"response.endend ifnextset rs=server.CreateObject("adodb.recordset")sql="select * from tb_User where username='"&admin_name&"'and userpwd='"&admin_pass&"' "rs.open sql,conn,1,1if rs.eof then response.write "<br><br><br><br><font size=2><center>对不起,您输入的用户名或密码,请重新输入,谢谢!<a href=login.asp>返回</a></font>"else session("admin_name")=request("admin_name") response.Redirect("index.asp")'跳转到管理首页end ifrs.closeset rs=nothingconn.closeset conn=nothingend if%>6 首页设计网站首页主要由两部部分组成,一部分是管理导航区,另一部分是展示区。

人员信息管理系统源代码

人员信息管理系统源代码

#include<stdio.h>/*人员信息管理系统*/#include<string.h>#include<malloc.h>#include<stdlib.h>#define Max 10000typedef struct Node{int NO; // 编号char name[30]; // 姓名char sex[10]; // 性别int age; // 年龄char ZhiWu[30]; // 职务char Zhicheng[30]; //职称char ZZMM[30]; // 政治面貌char XueLi[30]; // 最高学历int OnTime; // 任职时间int CTime; // 来院时间char RenLB[30]; // 人员类别}Worker;Worker Q[Max];int top;int cnt = 0;int Insert() //输入人员信息{Worker *q;if( ( q = (Worker *)malloc( sizeof( Worker) ) ) == NULL )exit(0); printf( "请依次输入:编号,姓名,性别,年龄,职务,职称,政治面貌,最高学历,任职时间,来院时间,人员类别\n" );scanf( "%d %s %s %d %s %s %s %s %d %d %s", &(q->NO), q->name, q->sex, &(q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi, &(q->OnTime), &(q->CTime), q->RenLB );Q[top++] = (*q);printf( "已加入\n" );return top;}int Delete() //按编号删除人员信息{int NO;int i, j, ok = 0;printf( "请依次输入: 编号\n" );scanf( "%d", &NO );for( i = 0; i < top; i++ ){if( Q[i].NO ==NO ){for( j = i+1; j < top; j++ ){Q[j-1] = Q[j];}top--;ok = 1;break;}}if( ok == 0 )printf( "无此人\n" );else printf( "已删除\n" );return top;}void Search() //搜索人员信息{int NO;char name[30];int i, ok = 0;Worker *q;printf( "请依次输入: 编号和姓名\n" );scanf( "%d %s", &NO, name );for( i = 0; i < top; i++ ){if( Q[i].NO ==NO && strcmp( Q[i].name, name ) == 0 ) {ok = 1;break;}}q = &(Q[i]);if( ok == 0 )printf( "无此人\n" );else{printf( "该人信息为:\n" );printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (q->NO), q->name, q->sex, (q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi,(q->OnTime), (q->CTime), q->RenLB );}}void Sort(Worker *Q) //按要求进行排序分类{int way,i,j,flag=1;Worker temp;printf( "输入按什么排序:1 --- 年龄; 2 ---- 来院时间\n" );scanf( "%d", &way );if( way == 1 ){for(i=1;i<top&&flag==1;i++){flag=0;for(j=0;j<top-i;j++){if(Q[j].age>Q[j+1].age){flag=1;temp=Q[j];Q[j]=Q[j+1];Q[j+1]=temp;}}for(i=0;i<cnt;i++)printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (Q[i].NO),Q[i].name, Q[i].sex, (Q[i].age),Q[i].ZhiWu, Q[i].Zhicheng, Q[i].ZZMM, Q[i].XueLi, (Q[i].OnTime), (Q[i].CTime), Q[i].RenLB );}}else if( way == 2 ){for(i=1;i<top&&flag==1;i++){flag=0;for(j=0;j<top-i;j++){if(Q[j].CTime>Q[j+1].CTime){flag=1;temp=Q[j];Q[j]=Q[j+1];Q[j+1]=temp;}}for(i=0;i<cnt;i++)printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (Q[i].NO),Q[i].name, Q[i].sex, (Q[i].age),Q[i].ZhiWu, Q[i].Zhicheng, Q[i].ZZMM, Q[i].XueLi, (Q[i].OnTime), (Q[i].CTime), Q[i].RenLB );}for(i=0;i<cnt;i++)printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (Q[i].NO),Q[i].name, Q[i].sex, (Q[i].age),Q[i].ZhiWu, Q[i].Zhicheng, Q[i].ZZMM, Q[i].XueLi, (Q[i].OnTime), (Q[i].CTime), Q[i].RenLB );}}void COUNT_1() //统计在职人数{int i;for( i = 0; i < top; i++ ){if( strcmp( Q[i].RenLB, "退休人员" ) != 0 &&strcmp( Q[i].RenLB, "临时工" ) != 0 ){Worker *q;q = &(Q[i]);cnt++;printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (q->NO), q->name, q->sex, (q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi, (q->OnTime), (q->CTime), q->RenLB );}}printf( "共有%d 在职人数\n", cnt );}void COUNT_2() //统计党员人数{int i;for( i = 0; i < top; i++ ){if( strcmp( Q[i].ZZMM, "党员" ) == 0 ){Worker *q;q = &(Q[i]);cnt++;printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (q->NO), q->name, q->sex, (q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi, (q->OnTime), (q->CTime), q->RenLB );}}printf( "共有%d 党员\n", cnt );}void COUNT_3() // 统计女工人数{int i;for( i = 0; i < top; i++ ){if( strcmp( Q[i].sex, "女" ) == 0 ){Worker *q;q = &(Q[i]);cnt++;printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (q->NO), q->name, q->sex, (q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi, (q->OnTime), (q->CTime), q->RenLB );}}printf( "共有%d 女性员工\n", cnt );}void COUNT_4() //统计高学历人数{int i;for( i = 0; i < top; i++ ){if( strcmp( Q[i].XueLi, "研究生" ) == 0|| strcmp( Q[i].XueLi, "副教授" ) == 0|| strcmp( Q[i].XueLi, "教授" ) == 0|| strcmp( Q[i].XueLi, "院士" ) == 0|| strcmp( Q[i].XueLi, "博士" ) == 0|| strcmp( Q[i].XueLi, "博士后" ) == 0|| strcmp( Q[i].XueLi, "助理教授" ) == 0 ){Worker *q;q = &(Q[i]);cnt++;printf( "%d %s %s %d %s %s %s %s %d %d %s\n", (q->NO), q->name, q->sex, (q->age), q->ZhiWu, q->Zhicheng, q->ZZMM, q->XueLi, (q->OnTime), (q->CTime), q->RenLB );}printf( "共有%d 高学历员工\n", cnt );}void Count() //统计函数{int way;printf( "输入按什么统计:1 --- 在职人数; 2 --- 党员人数;3 --- 女工人数;4 --- 高学历高职称人数: \n" );printf( "输入统计关键字:" );scanf( "%d", &way );switch( way ){case 1: COUNT_1(); break;case 2: COUNT_2(); break;case 3: COUNT_3(); break;case 4: COUNT_4(); break;}}void Edit() // 编辑存储功能{}int main(){int way;top = 0;printf( "\n\n" );printf( "****************************************************************** **\n" );printf( " * 1:添加人员,输入人员相关信息*\n" );printf( " * 2: 删除人员,提供职工号*\n" );printf( " * 3: 查询提供编号和姓名*\n" );printf( " * 4: 统计提供相应方式对应输入*\n" );printf( " * 5: 排序,按程序要求提供相应的关键字*\n" );printf( " * 6: 编辑存储*\n" );printf( "****************************************************************** **\n" );while( 1 ){printf( "输入需要操作:way = " ); // 选择功能if( scanf( "%d", &way ) == EOF )break; // 以 ctrl + Z 结束输入switch(way){case 1: Insert(); break;case 2: Delete(); break;case 3: Search(); break;case 4: Count(); break;case 5: Sort(Q); break;case 6: Edit(); break;}}return 0;}。

python人员信息管理系统源代码

python人员信息管理系统源代码

Python人员信息管理系统源代码一、介绍人员信息管理系统是一种用于管理和存储人员信息的软件系统。

它可以帮助组织和企业更好地管理员工、学生或其他成员的个人信息。

本文将介绍一个使用Python 编写的人员信息管理系统的源代码。

二、系统功能人员信息管理系统通常具有以下功能:1.添加人员信息:可以输入人员的姓名、性别、年龄、联系方式等基本信息,并将其保存到系统中。

2.删除人员信息:可以根据人员的姓名或其他标识符删除系统中的人员信息。

3.修改人员信息:可以修改已有人员的信息,如联系方式、年龄等。

4.查询人员信息:可以根据人员的姓名或其他标识符查询系统中的人员信息。

5.显示所有人员信息:可以将系统中的所有人员信息以列表或表格的形式展示出来。

三、源代码实现以下是一个使用Python编写的人员信息管理系统的源代码示例:class Person:def __init__(self, name, gender, age, contact): = nameself.gender = genderself.age = ageself.contact = contactclass PersonManagementSystem:def __init__(self):self.persons = []def add_person(self, person):self.persons.append(person)def delete_person(self, name):for person in self.persons:if == name:self.persons.remove(person)breakdef modify_person(self, name, new_contact):for person in self.persons:if == name:person.contact = new_contactbreakdef search_person(self, name):for person in self.persons:if == name:return persondef display_all_persons(self):for person in self.persons:print("Name:", )print("Gender:", person.gender)print("Age:", person.age)print("Contact:", person.contact)print("")# 示例用法system = PersonManagementSystem()person1=Person("Alice","Female",25,"*****************") person2=Person("Bob","Male",30,"***************")system.add_person(person1)system.add_person(person2)system.display_all_persons()system.modify_person("Alice","********************")person = system.search_person("Bob")if person:print("Name:", )print("Gender:", person.gender)print("Age:", person.age)print("Contact:", person.contact)else:print("Person not found.")system.delete_person("Alice")system.display_all_persons()四、系统使用示例以下是一个使用该人员信息管理系统的示例:1.添加人员信息:Name: AliceGender: FemaleAge: 25Contact:*****************Name: BobGender: MaleAge: 30Contact:***************2.修改人员信息:Name: AliceGender: FemaleAge: 25Contact:********************3.查询人员信息:Name: BobGender: MaleAge: 30Contact:***************4.删除人员信息:Name: BobGender: MaleAge: 30Contact:***************五、总结通过编写这个人员信息管理系统的源代码,我们可以更好地理解和应用面向对象编程的概念和技巧。

人力资源管理系统源代码

人力资源管理系统源代码

1)登陆窗体代码设计窗体代码主要实现了连接数据库的功能,这里用于连接用户信息表。

其程序如下:Private Sub Form_Load()Dim i As IntegerIf App.PrevInstance ThenMsgBox ("程序已经运行,不能再次装载。

"), vbExclamationUnload MeEnd If'本段代码用于判定本程序是否已经装载于内存中,以避免程序的多重启动i = 0Open App.Path + "\user.ini" For Input As #1Do While Not EOF(1)Input #1, user(i), pws(i), state(i), Emplo(i)If state(i) = "A" ThenCombo1.AddItem user(i)End Ifi = i + 1Loop Close #1Combo1.ListIndex = 1'在窗口装载阶段读取用户设置文件获取用户信息并装载于用户列表框中End Sub(2)“取消”按钮是退出登录界面,退出系统的。

其代码如下:Private Sub CmdCancel_Click()Unload MeEndEnd Sub(3)“确定”按钮代码设计“确定”按钮代码主要实现了用户登陆时,用户名和密码的认证,当用户名或密码错误时,系统提示错误。

其程序如下:Private Sub cmdOK_Click()If txtPassword = pws(Combo1.ListIndex) ThenCurId = Combo1.ListIndexEmploID = Emplo(CurId)CurUser = user(CurId)CurPsw = pws(CurId)Me.Hide'Load FrmMainFrmMain.ShowElse MsgBox "Invalid Password, try again!", , "Login"txtPassword.SetFocusSendKeys "{Home}+{End}"End If End Sub(1)窗体选择的单击事件代码设计窗体选择的单击事件代码主要实现了进入本系统所有模块的功能,这里有以下几个模块,它们分别是员工信息模块,假条信息模块,工资管理模块,用户设置模块等/其程序如下:Private Sub Toolbar2_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.IndexCase 1Call showemployee ‘显示员工信息模块Case 2Call showleave ‘显示假条信息模块Case 3Call showsalary ‘显示工资信息模块Case 4If frmLogin.CurUser = "root" ThenFrmSys.ShowElseFrmPsw.ShowPwin = "Frmmain"FrmMain.Enabled = FalseEnd IfEnd SelectEnd Sub(2)命令按钮的单击事件代码设计命令按钮的代码主要实现了进入本系统部分主要模块的功能,这里有以下几个功能,它们分别是编辑,删除,查询,设置。

python人员信息管理系统源代码

python人员信息管理系统源代码

python人员信息管理系统源代码Python人员信息管理系统源代码简介本文介绍了一个基于Python的人员信息管理系统的源代码,该系统可以实现人员信息的添加、修改、删除和查询等功能。

技术栈- Python 3.8.5- SQLite3- tkinter功能模块1. 数据库连接模块该模块用于连接SQLite3数据库,并创建一个名为“person.db”的数据库。

2. 数据库表创建模块该模块用于创建一个名为“person_info”的表,该表包含以下字段:id、name、age、gender和address。

3. 添加人员信息模块该模块用于向数据库中添加一条人员信息记录,包括姓名、年龄、性别和地址。

4. 修改人员信息模块该模块用于修改数据库中已有的一条人员信息记录,可以修改姓名、年龄、性别和地址。

5. 删除人员信息模块该模块用于从数据库中删除一条已有的人员信息记录,根据id进行删除。

6. 查询人员信息模块该模块用于查询数据库中所有的人员信息记录,并将结果显示在窗口中。

源代码实现1. 数据库连接实现:import sqlite3def connect_db():conn = sqlite3.connect("person.db") cursor = conn.cursor()return conn, cursordef close_db(conn, cursor):cursor.close()conn.close()2. 数据库表创建实现:def create_table():conn, cursor = connect_db()sql = '''create table person_info(id integer primary key autoincrement,name text,age integer,gender text,address text)'''cursor.execute(sql)mit()close_db(conn, cursor)3. 添加人员信息实现:def add_person(name, age, gender, address):conn, cursor = connect_db()sql = "insert into person_info(name, age, gender, address) values(?, ?, ?, ?)"cursor.execute(sql, (name, age, gender, address))mit()close_db(conn, cursor)4. 修改人员信息实现:def update_person(id_, name=None, age=None, gender=None, address=None):conn,cursor=connect_db()sql="update person_info set"if name is not None:sql+=" name='{}',".format(name)if age is not None:sql+=" age='{}',".format(age)if gender is not None:sql+=" gender='{}',".format(gender)if address is not None:sql+=" address='{}',".format(address)# 去掉最后一个逗号sql=sql[:-1]# 根据id更新sql+="where id={}".format(id_)cursor.execute(sql)mit()close_db(conn,cursor)5. 删除人员信息实现:def delete_person(id_):conn,cursor=connect_db()sql="delete from person_info where id={}".format(id_)cursor.execute(sql)mit()close_db(conn,cursor)6. 查询人员信息实现:def query_all_person():conn,cursor=connect_db()sql="select * from person_info"cursor.execute(sql)# 获取所有查询结果result=cursor.fetchall()close_db(conn,cursor)return result7. 界面实现:import tkinter as tkimport tkinter.messagebox as messageboxclass Application(tk.Frame):def __init__(self, master=None):super().__init__(master)self.master = masterself.pack()self.create_widgets()def create_widgets(self):# 添加人员信息部分self.add_label = bel(self, text="添加人员信息") self.add_label.grid(row=0, column=0)_label = bel(self, text="姓名")_label.grid(row=1, column=0)_entry = tk.Entry(self)_entry.grid(row=1, column=1)self.age_label = bel(self, text="年龄")self.age_label.grid(row=2, column=0)self.age_entry = tk.Entry(self)self.age_entry.grid(row=2, column=1)self.gender_label = bel(self, text="性别")self.gender_label.grid(row=3, column=0)# 性别用单选框实现gender_var=tk.StringVar()gender_var.set("男")male_radiobutton=tk.Radiobutton(self,text="男",value="男",variable=gender_var)male_radiobutton.grid(row=3,column=1)female_radiobutton=tk.Radiobutton(self,text="女",value="女",variable=gender_var)female_radiobutton.grid(row=3,column=2)# 地址用文本框实现self.address_label=bel(self,text="地址")self.address_label.grid(row=4,column=0)self.address_text=tk.Text(self,width=20,height=5)self.address_text.grid(row=4,column=1)# 添加按钮self.add_button = tk.Button(self, text="添加",command=self.add_person)self.add_button.grid(row=5, column=1)# 修改人员信息部分self.update_label = bel(self, text="修改人员信息")self.update_label.grid(row=6, column=0)self.id_label = bel(self, text="ID")self.id_label.grid(row=7, column=0)self.id_entry = tk.Entry(self)self.id_entry.grid(row=7, column=1)# 修改的内容用文本框实现self.update_label = bel(self, text="修改的内容") self.update_label.grid(row=8, column=0)# 姓名_update_label = bel(self, text="姓名") _update_label.grid(row=9, column=0)# 用Entry实现_update_entry = tk.Entry(self)_update_entry.grid(row=9, column=1)# 年龄self.age_update_label = bel(self, text="年龄") self.age_update_label.grid(row=10, column=0)# 用Entry实现self.age_update_entry = tk.Entry(self)self.age_update_entry.grid(row=10, column=1)# 性别gender_var=tk.StringVar()gender_var.set("男")male_radiobutton=tk.Radiobutton(self,text="男",value="男",variable=gender_var)male_radiobutton.grid(row=11,column=1)female_radiobutton=tk.Radiobutton(self,text="女",value="女",variable=gender_var)female_radiobutton.grid(row=11,column=2)# 地址self.address_update_label = bel(self, text="地址")self.address_update_label.grid(row=12, column=0)# 用Text实现self.address_update_text = tk.Text(self, width=20, height=5)self.address_update_text.grid(row=12, column=1)# 修改按钮self.update_button = tk.Button(self, text="修改", command=self.update_person)self.update_button.grid(row=13, column=1)# 删除人员信息部分self.delete_label = bel(self, text="删除人员信息") self.delete_label.grid(row=14, column=0)self.id_delete_label = bel(self, text="ID")self.id_delete_label.grid(row=15, column=0)self.id_delete_entry = tk.Entry(self)self.id_delete_entry.grid(row=15, column=1)# 删除按钮self.delete_button = tk.Button(self, text="删除", command=self.delete_person)self.delete_button.grid(row=16, column=1)# 查询人员信息部分self.query_label = bel(self, text="查询人员信息")self.query_label.grid(row=17,columnspan-2,pady-10)# 用Treeview实现表格显示查询结果columns=("ID","姓名","年龄","性别","地址")# 设置列宽和对齐方式等属性treeview=tk.ttk.Treeview(self,columns=columns,show="heading s")treeview.column("ID",width=50,anchor="center")treeview.column("姓名",width=100,anchor="center")treeview.column("年龄",width=50,anchor="center")treeview.column("性别",width=50,anchor="center")treeview.column("地址",width=150)# 设置表头for col in columns:treeview.heading(col,text=col)# 查询按钮self.query_button = tk.Button(self, text="查询",command=self.query_person)self.query_button.grid(row=18,columnspan-2,pady-10)# 添加treeview组件treeview.grid(row-19,columnspan-2,pady-10)def add_person(self):name = _entry.get()age = self.age_entry.get()gender = gender_var.get()address = self.address_text.get(1.0, tk.END).strip()if not name or not age or not gender or not address:messagebox.showwarning(title="提示", message="请填写完整信息!")returntry:age = int(age)except ValueError:messagebox.showwarning(title="提示", message="年龄必须是数字!")returnadd_person(name, age, gender, address)messagebox.showinfo(title="提示", message="添加成功!")def update_person(self):id_ = self.id_entry.get()if not id_:messagebox.showwarning(title-"提示",message-"请填写ID!")returntry:id_=int(id_)except ValueError:messagebox.showwarning(title-"提示",message-"ID必须是数字!")returnname=_update_entry.get()age=self.age_update_entry.get()gender=gender_var.get()address=self.address_update_text.get(1.0,tk.END).strip()if not name and not age and not gender and not address: messagebox.showwarning(title-"提示",message-"请填写修改的内容!")returntry:if age:age=int(age)except ValueError:messagebox.showwarning(title-"提示",message-"年龄必须是数字!")returnupdate_person(id_,name,age,gender,address)messagebox.showinfo(title="提示",message="修改成功!")def delete_person(self):id_ = self.id_delete_entry.get()if not id_:messagebox.showwarning(title="提示", message="请填写ID!")returntry:id_ = int(id_)except ValueError:messagebox.showwarning(title="提示", message="ID必须是数字!")returndelete_person(id_)messagebox.showinfo(title="提示", message="删除成功!")def query_person(self):# 先清空treeviewfor item in treeview.get_children():treeview.delete(item)# 获取所有人员信息result=query_all_person()# 将查询结果插入到treeview中for row in result:treeview.insert("",tk.END,values=row)if __name__ == '__main__':root = ()root.title("人员信息管理系统")app = Application(master=root)app.mainloop()总结本文介绍了一个基于Python的人员信息管理系统的源代码,该系统可以实现人员信息的添加、修改、删除和查询等功能。

Java人事管理系统开源代码

Java人事管理系统开源代码

作者:郑彪 QQ:846315324目录摘要 (II)Abstract (II)第一章概述.............................................................. .................... (1)1.1 前言 (1)1.2 系统功能简介 (2)第二章设计简介及设计方案论述 (3)2.1 设计简介....................................................................................... . .3 2.2 设计方案论述 (3)第三章详细设计 (4)3.1 算法描述 (4)3.2 系统功能模块 (7)第四章设计结果及分析 (8)4.1 系统实现....................................................................................... . .8 4.2 结果分析 (8)总结 (9)致谢 (10)参考文献 (11)附录主要程序代码 (12)摘要随着计算机技术的发展,办公自动化进入社会的每一个角落已经势不可挡,而人事管理系统是办公自动化的一个小小体现,它为人事管理大量又繁杂的员工数据工作提供了方便,提高了人事管理工作的效率,为办公自动化的普及奠定了基础。

人事管理系统是任何一个现代化企事业单位不可或缺的部分,它的内容对于企事业的管理者来说至关重要。

人事管理系统应该能够为管理者提供充足的信息和快捷的查询手段。

随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。

作为计算机应用的一部分,使用计算机对人事信息进行管理,具有着传统管理所无法比拟的优点,例如,检索迅速、查找方便、可靠性高、存储量大、寿命长、成本低等,这些优点能够极大地提高人事管理的效率。

企业人事管理系统java源代码

企业人事管理系统java源代码

企业⼈事管理系统java源代码import java.awt.* ;import java.awt.event.*;import java.sql.*;import java.util.*;import javax.swing.*;import javax.swing.border.*;public class A extends JFrame{protected JPanel p = new JPanel();protected JPanel p1 = new JPanel();protected JPanel p2 = new JPanel();protected JPanel p3= new JPanel();JMenuBar M =new JMenuBar();JMenu m1 = new JMenu("基本信息模块");JMenu m2 = new JMenu("考勤考评信息模块");JMenu m3 = new JMenu("系统维护信息模块");JMenuItem mm1 = new JMenuItem("员⼯基本信息"); JMenuItem mm2 = new JMenuItem("员⼯家庭成员基本信息"); JMenuItem mm3 = new JMenuItem("员⼯培训信息"); JMenuItem mm4 = new JMenuItem("员⼯考勤信息"); JMenuItem mm5 = new JMenuItem("员⼯考评信息"); JMenuItem mm6 = new JMenuItem("普通管理员"); JMenuItem mm7 = new JMenuItem("⾼级管理员"); JMenuItem mm8 = new JMenuItem("退出");protected JLabel l1 = new JLabel("员⼯编号:");protected JLabel l2 = new JLabel("姓名:");protected JLabel l3 = new JLabel("性别:");protected JLabel l4 = new JLabel("年龄:");protected JLabel l5 = new JLabel("部门:");protected JTextField t1 = new JTextField(10);protected JTextField t2 = new JTextField(10);protected JTextField t3 = new JTextField(10);protected JTextField t4 = new JTextField(10);protected JTextField t5 = new JTextField(10);private JButton b1 = new JButton("查询");private JButton b2 = new JButton("插⼊");private JButton b3 = new JButton("修改");private JButton b4 = new JButton("删除");private JButton b5 = new JButton("清除");private JButton b6 = new JButton("下⼀条");private Connection c; // @jve:decl-index=0:private Statement s; // @jve:decl-index=0:private ResultSet r; // @jve:decl-index=0:{super("⼈事管理系统");getContentPane().add(p);setJMenuBar(M);M.add(m1);M.add(m2);M.add(m3);m1.add(mm1);m1.add(mm2);m1.add(mm3);m1.addSeparator();m1.add(mm8);m2.add(mm4);m2.add(mm5);m3.add(mm6);m3.add(mm7);p.add(p1,BorderLayout.NORTH);p.add(p2,BorderLayout.CENTER);p.add(p3,BorderLayout.SOUTH);p1.setLayout(new GridLayout(5,2,1,3));p1.add(l1);p1.add(t1);p1.add(l2);p1.add(t2);p1.add(l3);p1.add(t3);p1.add(l4);p1.add(t4);p1.add(l5);p1.add(t5);p2.add(b1);p1.add(b2);p2.add(b3);p1.add(b4);p2.add(b5);p3.add(b6);t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");setSize(350,300);setVisible(true);try{Class.forName("sun.jdbc.odbc.JdbcOdbcDrive");c=DriverManager.getConnection("jdbc:odbc:sd","sa",null);s=c.createStatement();r=s.executeQuery("select * from 员⼯基本信息表");}catch (SQLException e){JOptionPane.showMessageDialog(null ,e.getMessage(),"操作错误!",JOptionPane.ERROR_MESSAGE); System.exit(1);}catch(ClassNotFoundException e)JOptionPane.showMessageDialog(null ,e.getMessage(),"驱动程序找不到!",JOptionPane.ERROR_MESSAGE); System.exit(1);}addWindowListener( new WindowAdapter(){public void windowClosing(WindowEvent event){try {s.close();c.close();catch(SQLException e){JOptionPane.showMessageDialog(null,e.getMessage(),"不能关闭!",JOptionPane.ERROR_MESSAGE); System.exit(1);}}});b1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){try{r=s.executeQuery("select * from 员⼯基本信息表" + "where 员⼯编号='"+t1.getText()+"'");if(r.next()){t1.setText(r.getString(1));t2.setText(r.getString(2));t3.setText(r.getString(3));t4.setText(r.getString(4));t5.setText(r.getString(5));JOptionPane.showMessageDialog(null,"查询成功!","查询操作",JOptionPane.ERROR_MESSAGE);}else{t2.setText("");t3.setText("");t4.setText("");t5.setText("");JOptionPane.showMessageDialog(null,"查询失败!","查询操作",JOptionPane.ERROR_MESSAGE);}catch(NumberFormatException e){System.out.println(e);}catch(SQLException e){System.out.println(e);}});b2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){String v1,v2,v3,v4,v5;v1=t1.getText();v2=t2.getText();v3=t3.getText();v4=t4.getText();v5=t5.getText();if((!v1.equals( "" ))&&(!v2.equals(""))&&(!v3.equals(""))&&(!v4.equals(""))&&(!v5.equals (""))){try{int n1 = Integer.parseInt(v4);int r1 = s.executeUpdate("INSERT INTO 员⼯基本信息表"+ "values('"+v1+"','"+v2+"','"+v3+"',"+n1+",'"+v5+"')"); if(r1!=0){t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");JOptionPane.showMessageDialog(null,"插⼊成功!","插⼊操作",JOptionPane.ERROR_MESSAGE);}}catch (NumberFormatException e ){System.out.println(e);}catch (SQLException e){System.out.println(e);}}else{JOptionPane.showMessageDialog(null,"插⼊失败!","插⼊操作",JOptionPane.ERROR_MESSAGE);}}});b3.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event)try {int r1=s.executeUpdate("update 员⼯基本信息表set 姓名='"+t2.getText()+"'," +"性别='"+t3.getText()+"'," +"年龄="+Integer.parseInt(t4.getText())+"," +"部门='"+t5.getText()+"'"+"where 员⼯编号='"+t1.getText()+"'");if(r1!=0){JOptionPane.showMessageDialog(null,"修改成功!","修改操作",JOptionPane.ERROR_MESSAGE);}else{JOptionPane.showMessageDialog(null,"修改失败!","修改操作",JOptionPane.ERROR_MESSAGE);}} catch (NumberFormatException e ){System.out.println(e);}catch (SQLException e){System.out.println(e);}}});b4.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){try{int r1=s.executeUpdate("delete from 员⼯基本信息表"+"where 员⼯编号='"+t1.getText()+"'");if(r1!=0){t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");JOptionPane.showMessageDialog(null,"删除成功!","删除操作",JOptionPane.ERROR_MESSAGE);}else{JOptionPane.showMessageDialog(null,"删除失败!","删除操作",JOptionPane.ERROR_MESSAGE);}} catch (NumberFormatException e ){System.out.println(e);}catch (SQLException e){System.out.println(e);}}});b5.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");}});b6.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){try{if(r.next())t1.setText(r.getString(1));t2.setText(r.getString(2));t3.setText(r.getString(3));t4.setText(""+r.getInt(4));t5.setText(r.getString(5));}catch (NumberFormatException e ){System.out.println(e);} catch (SQLException e){System.out.println(e);}}});mm8.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent event){System.exit(0);}});}public static void main(String args[]){new A();}}。

高校人事管理系统程序设计源代码

高校人事管理系统程序设计源代码

目录新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。

错误!未定义书签。

? 头文件:错误!未定义书签。

? 源文件:错误!未定义书签。

新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。

头文件:#include <iostream>#include <fstream>using namespace std;dd(n1);i1++;}else if(b==2) dd(n2);i2++;}else if(b==3) dd(n3);i3++;}else if(b==4) dd(n4);i4++;}else if(b==5){break;}else{cout<<"输入有误!请重试!"<<endl;cout<<endl;system ("pause");system ("cls");continue;}}}ave(file);file<<endl;file<<i2<<endl; ave(file); file<<endl;file<<i3<<endl; ave(file); file<<endl;file<<i4<<endl; ave(file);();}Oxz; ead(file);}file>>i2; Ojs;ead(file);}file>>i3; Oyb;ead(file);}file>>i4; Otx;ead(file);}();}Oxz==g){h=g-1;xz[h].show();z=1;editPer(g,z); Ojs==g){h=g-1;js[h].show();z=2;editPer(g,z); Oyb==g){h=g-1;yb[h].show();z=3;editPer(g,z); Otx==g){h=g-1;tx[h].show();z=4;editPer(g,z); ame,nam)==0) {xz[t].show();x=1;editPer(xz[t].NOxz,x); Oxz,x);ame,nam)==0){js[t].show();x=2;editPer(js[t].NOjs,x); Ojs,x);ame,nam)==0){yb[t].show();x=3;editPer(yb[t].NOyb,x); Oyb,x);ame,nam)==0){tx[t].show();x=4;editPer(tx[t].NOtx,x); Otx,x);dd(n1);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==2)js[n2].add(n2);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==3){yb[n3].add(n3);cout<<endl<<"是否保存(y/n)"<<endl; cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==4)tx[n4].add(n4);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}}else break;break;}}Oxz--; Ojs--; Oyb--; Otx--;职人员 2.党员 3.女性人员 4.高学历高职称人员"<<endl;int r;cin>>r;if(r==1){z=i1+i2+i3;cout<<"在职人员数:"<<z<<endl; }else if(r==2){for(i=0;i<i1;i++){if(strcmp(xz[i].zzmm ,"党员")==0) g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zzmm,"党员")==0) g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zzmm,"党员")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zzmm,"党员")==0) g++;}cout<<"党员数:"<<g<<endl; }else if(r==3){for(i=0;i<i1;i++){if(strcmp(xz[i].sex,"女")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].sex,"女")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].sex,"女")==0)g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].sex,"女")==0)g++;}cout<<"女性人员数:"<<g<<endl; }else if(r==4){int g=0,h=0,c=0;for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"大学")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"大学")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"大学")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"大学")==0) g++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"高中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"高中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"高中")==0) h++;for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"高中")==0) h++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"初中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"初中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"初中")==0) h++;}for(i=0;i<i4;i++)if(strcmp(tx[i].zgxl,"初中")==0)h++;}cout<<"大学人数:"<<g<<" 高中人数:"<<h<<" 初中人数:"<<c<<endl; }else{cout<<"统计的类型错误!"<<endl;system("PAUSE");}cout<<"是否继续人事统计:Y继续、其他退出"<<endl;char x;cin>>x;if(x!='y' && x!='Y')break;}}。

高校人事管理系统C 程序设计源代码

高校人事管理系统C 程序设计源代码

目录新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。

头文件:#include <iostream>#include <fstream>using namespace std;dd(n1);i1++;}else if(b==2)dd(n2);i2++;}else if(b==3)dd(n3);i3++;}else if(b==4)dd(n4);i4++;}else if(b==5){FileSave();break;}else{cout<<"输入有误!请重试!"<<endl;cout<<endl;system ("pause");system ("cls");continue;}}}ave(file);file<<endl;file<<i2<<endl;ave(file);file<<endl;file<<i3<<endl;ave(file);file<<endl;file<<i4<<endl;ave(file);file<<endl;();}Oxz;ead(file);}file>>i2;Ojs;ead(file);}file>>i3;Oyb;ead(file);}file>>i4;Otx;ead(file);}();}Oxz==g){h=g-1;xz[h].show();z=1;editPer(g,z);Ojs==g){h=g-1;js[h].show();z=2;editPer(g,z);Oyb==g){h=g-1;yb[h].show();z=3;editPer(g,z);Otx==g){h=g-1;tx[h].show();z=4;editPer(g,z);ame,nam)==0){xz[t].show();x=1;editPer(xz[t].NOxz,x);Oxz,x);ame,nam)==0){js[t].show();x=2;editPer(js[t].NOjs,x);Ojs,x);ame,nam)==0){yb[t].show();x=3;editPer(yb[t].NOyb,x);Oyb,x);ame,nam)==0){tx[t].show();x=4;editPer(tx[t].NOtx,x);Otx,x);dd(n1);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==2){js[n2].add(n2);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==3){yb[n3].add(n3);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}if(z==4){tx[n4].add(n4);cout<<endl<<"是否保存(y/n)"<<endl;cin>>su2;if(su2=='y'||su2=='Y'){FileSave();}else break;}}else break;break;}}Oxz--;Ojs--;Oyb--;Otx--;职人员 2.党员 3.女性人员 4.高学历高职称人员"<<endl;int r;cin>>r;if(r==1){z=i1+i2+i3;cout<<"在职人员数:"<<z<<endl;}else if(r==2){for(i=0;i<i1;i++){if(strcmp(xz[i].zzmm ,"党员")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].zzmm,"党员")==0)g++;}for(i=0;i<i3;i++){g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zzmm,"党员")==0) g++;}cout<<"党员数:"<<g<<endl;}else if(r==3){for(i=0;i<i1;i++){if(strcmp(xz[i].sex,"女")==0)g++;}for(i=0;i<i2;i++){if(strcmp(js[i].sex,"女")==0)g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].sex,"女")==0)g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].sex,"女")==0)g++;}cout<<"女性人员数:"<<g<<endl; }else if(r==4){int g=0,h=0,c=0;for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"大学")==0)g++;}for(i=0;i<i2;i++){g++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"大学")==0) g++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"大学")==0) g++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"高中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"高中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"高中")==0) h++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"高中")==0) h++;}for(i=0;i<i1;i++){if(strcmp(xz[i].zgxl,"初中")==0) h++;}for(i=0;i<i2;i++){if(strcmp(js[i].zgxl,"初中")==0) h++;}for(i=0;i<i3;i++){if(strcmp(yb[i].zgxl,"初中")==0)h++;}for(i=0;i<i4;i++){if(strcmp(tx[i].zgxl,"初中")==0)h++;}cout<<"大学人数:"<<g<<" 高中人数:"<<h<<" 初中人数:"<<c<<endl; }else{cout<<"统计的类型错误!"<<endl;system("PAUSE");}cout<<"是否继续人事统计:Y继续、其他退出"<<endl;char x;cin>>x;if(x!='y' && x!='Y')break;}}。

人事工资管理系统源代码java

人事工资管理系统源代码java

bm.javaimport java.awt.*;import ;import java.sql.*;import javax.swing.*;class bm extends Frame implements ActionListener,ItemListener { private condb conx=null;private ResultSet rs=null;private String sql=null;private Label num=new Label("职工号");private Label jb=new Label("税收");private Label fj=new Label("医疗保险");private Label in=new Label("退休保险");private TextField numtx=new TextField();private TextField jbtx=new TextField();private TextField fjtx=new TextField();private TextField intx=new TextField();private Choice numcho=new Choice();private Button add=new Button("增加");private Button exit=new Button("退出");public bm(){ setTitle("扣除工资");setSize(400,300);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);num.setBounds(80,50,50,20);jb.setBounds(80,80,50,20);fj.setBounds(80,110,50,20);in.setBounds(80,140,50,20);numtx.setBounds(160,50,100,20);jbtx.setBounds(160,80,100,20);fjtx.setBounds(160,110,100,20);intx.setBounds(160,140,100,20);numcho.setBounds(160,170,100,20);add.setBounds(60,220,50,20);exit.setBounds(300,220,50,20);add(add);add(exit);add(num);add(jb);add(fj);add(in);add(numtx);add(jbtx);add(fjtx);add(intx);add(numcho);//lbadd.addActionListener(this);exit.addActionListener(this);numcho.addItemListener(this);initnumcho();setVisible(true);addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){dispose();}});}public void itemStateChanged(ItemEvent i){ numtx.setText(numcho.getSelectedItem());}public void initnumcho(){ conx=new condb();sql="select * from 扣除工资";numcho.removeAll();try { rs=conx.getrs(conx.con,sql);while(rs.next()){numcho.add(rs.getString("职工号"));}conx.dbclose(conx.con,rs);conx=null;rs=null;}catch(Exception eo){}}public void actionPerformed(ActionEvent e){ conx=new condb();if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("增加")){sql="select * from 扣除工资where 职工号='"+numtx.getText()+"'";try{ rs=conx.getrs(conx.con,sql);if(rs.next()){sql="insert into 扣除工资(职工号,税收,医疗保险,养老保险)"+"values('"+numtx.getText().trim()+"',"+jbtx.getText()+","+fjtx.getText()+",'"+intx.getText()+"')";try { ;conx.dbclose(conx.con,null);}catch(Exception ue){""+ue);}JOptionPane jop=new JOptionPane();jop.showMessageDialog(null," 扣除工资添加成功!","添加成功",-1);conx.dbclose(conx.con,rs);numtx.setText("");jbtx.setText("");fjtx.setText("");conx=null;rs=null;}else { JOptionPane jop=new JOptionPane();jop.showConfirmDialog(null,"添加失败!","警告!",-1);conx.dbclose(conx.con,rs);conx=null;rs=null;}} catch(SQLException et){""+et);}}}}/*else*/bmcx.javaimport java.awt.*;import ;import java.sql.*;import javax.swing.*;import ;class bmcx extends Frame implements ActionListener{ private condb conc=null;private ResultSet rs=null;private String sql=null;private Label chao=new Label("职工号:");private Label cname=new Label("姓名:");private Label csex=new Label("税收:");private Label cage=new Label("医疗保险:");private Label cdep=new Label("退休保险: ");private TextField chaotx=new TextField();private Label cnametx=new Label("");private Label csextx=new Label("");private Label cagetx=new Label("");private Label cdeptx=new Label("");private Button cx=new Button("查询");private Button tc=new Button("退出");public bmcx(){ setTitle("扣除工资查询");setSize(400,250);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);chao.setBounds(80,50,50,20);cname.setBounds(80,80,50,20);csex.setBounds(80,110,50,20);cage.setBounds(80,140,50,20);cdep.setBounds(80,170,50,20);chaotx.setBounds(160,50,150,20);cnametx.setBounds(160,80,150,20);csextx.setBounds( 160,110,150,20);cagetx.setBounds(160,140,150,20);cdeptx.setBounds(140,170,150,20);cx.setBounds(60,205,50,20);tc.setBounds(300,205,50,20);add(chao);add(cname);add(cagetx);add(cage);add(csex);add(cdep);add(chaotx);add(cnametx);add(csextx);add(cdeptx);add(cx);add(tc);setVisible(true);cx.addActionListener(this);tc.addActionListener(this);addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){dispose();}});}public void actionPerformed(ActionEvent e){ if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("查询")){ conc=new condb();sql="select 姓名,税收,医疗保险,退休保险from 扣除工资,职工where 扣除工资.职工号=职工.职工号and 扣除工资.职工号='"+chaotx.getText()+"'";try { rs=conc.getrs(conc.con,sql);if(rs.next()){cnametx.setText(rs.getString("姓名"));csextx.setText(rs.getString("税收"));cagetx.setText(rs.getString("医疗保险"));cdeptx.setText(rs.getString("退休保险"));conc.dbclose(conc.con,rs);conc=null;rs=null;}else {JOptionPane jop=new JOptionPane();jop.showConfirmDialog(null,"该用户不存在!","警告",-1);}}catch(Exception ee){}}}}condb.javaimport java.sql.*;public class condb{ public Connection con;//在类头定义连接对象public condb()//在此构造方法中实现有关程序的加载,同时捕捉异常。

人事管理系统源代码

人事管理系统源代码

人事管理系统源代码第一篇:人事管理系统源代码#include #include #include #define N 100 struct member_info {char xm[7];char xb[3];char sr[15];char whcd[13];char zc[17];char sfzh[19];char lxdh[12];int gl;int nl;};struct member_info member[N+1];int CurrentCount=0;void input(){ char sfjx=1;while(sfjx!=0){if(CurrentCount==N){printf(“n人数已达上限,不能添加!!n”);sfjx=0;}else{CurrentCount++;printf(“n请输入员工信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):n”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}} printf(“人员已排序”);int i,j;for(i=1;ifor(j=CurrentCount;j>i;j--)if(strcmp(member[j].sfzh,member[j-1].sfzh)<0){member[0]=member[j];member[j]=member[j-1];member[j-1]=member[0];}printf(“n人事基本信息表n”);printf(“ 序号姓名性别生日年龄文化程度联系电话身份证号码工龄职称n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %6s%3s%11s%3d%8s%12s%20s%3d%5sn”,i, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i ].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );system(“pause”);} voi d save(){FILE *fp;fp=fopen(“ygjbxx.txt”,“w”);if(fp==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fp,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fp,“n%8s%4s%16s%4d%14s%13s%20s%4d%18s”, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );fclose(fp);printf(“n信息已成功保存!!n”);}system(“pause”);} void read(){FILE *fp;fp=fop en(“ygjbxx.txt”,“r”);if(fp==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fp,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fp,“%s%s%s%d%s%s%s%d%s”,member[i].xm,mem ber[i].xb,member[i].sr,&member[i].nl,member[i].whcd,member[i]. lxdh,member[i].sfzh,&member[i].gl,member[i].zc);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}fclose(fp);p rintf(“n信息已成功读取!!n”);}system(“pause”);} void search(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待查员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}prin tf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void del(){char dcsfzh[19];int sfjx=1,i,j;while(sfjx!=0){printf(“n请输入一个待删员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n按任意键开始删除......n”);system(“pause”);for(j=i+1;j<=CurrentCount;j++)member[j-1]=member[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modify(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待修改员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,memb er[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n请输入新内容......n”);printf(“n请输入人员相关信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scan f(“%d”,&sfjx);}system(“pause”);} int check(){int count=0,name,pass;while(count<=2){printf(“n请输入用户名及密码:”);scanf(“%d%d”,&name,&pass);count++;if((name==1)&&(pass==1))count=10;elseif(count>2)count=5;}if(count==10)return 0;elsereturn 1;} struct mem_gz {float jbgz;float cql;float jj;float kk;float grsd;float sf;};struct mem_gz mem[N+1];void inputgz(){ char sfjx=1;CurrentCount=0;while(sfjx!=0){if(CurrentCount==N){printf(“n工资已添加完毕,无法添加!!n”);sfjx=0;}else{CurrentCount++;printf(“请输入身份证号码为:%s的员工工资资料n”,member[CurrentCount].sfzh);printf(“n请输入员工工资信息(基本工资考勤奖金扣款个人所得税):n”);scanf(“%f%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[C urrentCount].cql,&mem[CurrentCount].jj,&mem[CurrentCount]. kk,&mem[CurrentCount].grsd);mem[CurrentCount].sf=mem[CurrentCount].jbgz*mem[Curr entCount].cql+mem[CurrentCount].jj-mem[CurrentCount].kk-mem[CurrentCount].grsd;}printf(“n是否继续(0--结束,其它--继续):n”);scanf(“%d”,&sfjx);}system(“pause”);} void savegz(){FILE *fq;fq=fopen(“yggzxx.txt”,“w”);if(fq==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fq,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fq,“n%f %f %f %f %f %f”,mem[i].jbgz,mem[i].cql,m em[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);fclose(fq);printf(“n信息已成功保存!!n”);}system(“pause”);} void readg z(){FILE *fq;fq=fopen(“yggzxx.txt”,“r”);if(fq==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fq,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fq,“%f%f%f%f%f%f”,&mem[i].jbgz,&mem[i].cql,&m em[i].jj,&mem[i].kk,&mem[i].grsd,&mem[i].sf);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd ,mem[i].sf);}fclose(fq);printf(“n信息已成功读取!!n”);}system(“pause”);} void searchgz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待查员工编号(身份证号从小到大的顺序):”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void delgz(){int dcbh;int sfjx=1,j;while(sfjx!=0){printf(“n请输入一个待删工资的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n按任意键开始删除......n”);system(“pause”);for(j=dcbh+1;j<=CurrentCount;j++)mem[j-1]=mem[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modifygz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待修改工资员工的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n请输入新内容......n”);printf(“n请输入人员工资信息(基本工资考勤奖金扣款个人所得税实发工资):”);scanf(“%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[dcb h].cql,&mem[dcbh].jj,&mem[dcbh].kk,&mem[dcbh].grsd,&mem [dcbh].sf);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void lis tgz(){ int i;printf(“n员工工资信息表n”);printf(“ 序号基本工资考勤奖金扣款个人所得税实发工资n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %8f%8f%8f%8f”,i,mem[i].jbgz,mem[i].cql,me m[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);system(“pause”);}void main(){int xz=1;printf(“*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*n”);printf(“*欢迎使用人事工资管理系统*n”);printf(“***************************************nnn”);if(check()!=0){printf(“n你无权使用本系统......nn”);system(“pause”);}else{while(xz!=0){printf(“n请选择相应功能:n”);printf(“1-录入n2-查询n3-修改n4-删除n5-保存n6-读取n7-输入员工工资n8-保存工资信息n9-读取工资信息n10-修改工资信息n11-删除工资信息n12-工资列表n0-结束n请输入选择:”);scanf(“%d”,&xz);switch(xz){case 1:input();break;case 2:search();break;case 3:modify();break;case 4:del();break;case 5:save();break;case 6:read();break;case 7:inputgz();break;case 8:savegz();break;case 9:readgz();break;case 10:modifygz();break;case 11:delgz();break;case 12:listgz();break;case 0:printf(“nn谢谢使用本系统!nn”);system(“pause”);break;default:printf(“n无此功能,请重新选择......n”);system(“pause”);}}} }第二篇:人事管理系统数据库源代码using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Res ponse.Redirect(“~/登录.aspx”);}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/人员信息查询.aspx”);}protected void Button3_Click(object sender, EventArgs e){ Response.Redirect(“~/人员修改.aspx”);}protected void Button4_Click(object sender, EventArgs e){ Response.Redirect(“~/部门信息.aspx”);}protected void Button5_Click(object sender, EventArgs e){ Response.Redirect(“~/工资信息.aspx”);} } }using System;using System.Collections;usingSystem.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 部门信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find =false;SqlConnection con=new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);con.Open();string cmdstr=“select * from 部门表”;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][“部门代码”].ToString();TextBox3.T ext=ds.Tables[0].Rows[i][“部门名称”].T oString();find=true;}} } if(find == false){ Response.Write(“”);con.Close();} }protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/Default.aspx”);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;using System.Data.SqlTypes;namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox1_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){SqlConnection con = new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);string strCount;strCount = “select * from 人事表”;con.Open();SqlCommand com = new SqlCommand(strCount, con);SqlDataReader dr = com.ExecuteReader();string strUsername = “", strPassword = ”“;while(dr.Read()){ if(TextBox1.Text == dr[”编号“].ToString()||TextBox2.Text == dr[”用户密码“].ToString()){ strUsername = dr[”编号“].T oString();strPassword = dr[”用户密码“].ToString();break;} } dr.Close();con.Close();if(strUsername== ”“){ Response.Write(”“);return;}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;usingSystem.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 工资信息 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox2_TextChanged(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find = false;SqlConnection con = new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr = ”select * from 工资表“;SqlDataAdapter da = new SqlDataAdapter(cmdstr, con);DataSet ds = new DataSet();da.Fill(ds);for(int i = 0;i < ds.Tables[0].Rows.Count;i++){ for(int j = 0;j < ds.Tables[0].Columns.Count;j++){ String data =(ds.Tables[0].Rows[i][j].ToString()).Trim();if(data == TextBox1.Text.Trim()){TextBox2.Text = ds.Table s[0].Rows[i][”应发工资“].ToString();TextBox3.Text = ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text = ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);}protected void Button2_Click(object sender, EventArgs e){ bool find =false;SqlConnection con = new S qlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr=”select * from 工资表“;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][”应发工资“].ToString();TextBox3.Text=ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text=ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();} } } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员修改: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button2_Click(object sender, EventArgs e){ SqlConnection con=new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string insert=”insert into 人事表(员工号,姓名,性别,职称,学历)values(“+”“+ TextBox1.Text.Trim()+”“+”,“+”“ + TextBox2.Text.Trim()+”“+”,“+TextBox3.Text.Trim()+ ”,“ +”“+ TextBox4.Text.Trim()+”“+”,“+”“ +TextBox5.Text.Trim()+ ”“+”)“;Response.Write(insert);SqlCommand cmd1=new SqlCommand(insert,con);con.Close();}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx");}protected void GridView1_SelectedIndexChanged(object sender, EventArgs e){ } } }第三篇:人事管理系统企业人事财务管理系统的开发与设计内容摘要随着Internet的不断发展,传统的管理方式,消耗大量的人力物力,传统的方式已经赶不上时代的脚步,所以开发一个高效的企业人事财务管理系统,是非常必要的。

《数据库应用》课程设计——人事管理系统(java源代码)

《数据库应用》课程设计——人事管理系统(java源代码)

《数据库应用》课程设计——人事管理系统(java源代码)//用户登陆类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class Land extends JFrame{JFrame jf ;JTextField textName=new JTextField(); JPasswordField textage=new JPasswordField(); JLabel label = new JLabel("员工管理系统");JLabel labelName=new JLabel("用户名:");JLabel labelage=new JLabel("密码:");JButton buttonEnter=new JButton("登录");JButton buttoncancel=new JButton("清空");public Land(){jf=this;setTitle("登录");Font f = new Font("新宋体",Font.PLAIN,12); Container con = getContentPane();con.setLayout(null);label.setBounds(95,10,110,20);label.setFont(new Font("新宋体",Font.PLAIN,14));con.add(label);labelName.setBounds(45,40,55,20);labelName.setFont(f);con.add(labelName);textName.setBounds(95,40,120,20);con.add(textName);labelage.setBounds(45,70,45,20);con.add(labelage);labelage.setFont(f);textage.setBounds(95,70,120,20);con.add(textage);buttonEnter.setBounds(90,110,60,20);buttonEnter.setFont(f);con.add(buttonEnter);//登陆的鼠标监听buttonEnter.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent me){if(textName.getText().equals("")){new JOptionPane().showMessageDialog(null,"用户名不能为空!"); }else if(textage.getText().equals("")){new JOptionPane().showMessageDialog(null,"密码不能为空!"); }else{String sql="select * from UserInformation where User_Name = '" + textName.getText() + "' and Password = '" + textage.getText()+ "'";System.out.println(sql);Judge(sql);}}});buttoncancel.setBounds(155,110,60,20);buttoncancel.setFont(f);con.add(buttoncancel);//清空按钮的鼠标监听方法buttoncancel.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent me){textName.setText("");textage.setText("");}});setResizable(false);Image img=Toolkit.getDefaultToolkit().getImage("image\\main.gif");setIconImage(img);Toolkit t = Toolkit.getDefaultToolkit();int w = t.getScreenSize().width;int h = t.getScreenSize().height;setBounds(w/2-150,h/2-90,300,180);setVisible(true);}private void Judge(String sqlString) {if (Database.joinDB()) {if (Database.query(sqlString))try{if(Database.rs.isBeforeFirst()) {System.out.println("密码正确");jf.setVisible(false);.close();new Main();}else {System.out.println("错误");new JOptionPane().showMessageDialog(null,"用户名或密码错误!","",JOptionPane.ERROR_MESSAGE);}}catch(Exception ex) {System.out.println(ex.getMessage());}}else{System.out.println("连接数据库不成功");}}public static void main(String args[]){new Land();}}//主函数类,可以独立运行package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class Main extends JFrame implements Runnable{ Thread t=new Thread(this);JDesktopPane deskpane = new JDesktopPane();JPanel p = new JPanel();Label lp1=new Label("欢迎使用员工管理系统 !"); ImageIcon icon1=new ImageIcon("imagetjsc.gif"); ImageIcon icon2=new ImageIcon("imagecxdl.gif"); ImageIcon icon3=new ImageIcon("imagexgmm.gif"); ImageIcon icon4=new ImageIcon("imagetcxt.gif"); ImageIcon icon5=new ImageIcon("imagejj.gif"); ImageIcon icon6=new ImageIcon("imagehelp.gif"); ImageIcon icon7=new ImageIcon("imagecx.gif"); ImageIcon icon8=new ImageIcon("imagegl.gif");ImageIcon icon9=new ImageIcon("imagext.gif");ImageIcon icon10=new ImageIcon("imagexxgl.gif");ImageIcon icon11=new ImageIcon("imagexxcx.gif");ImageIcon icon12=new ImageIcon("imagebz.gif");ImageIcon icon13=new ImageIcon("imagegy.gif");ImageIcon icon14=new ImageIcon("imageglxx.gif");ImageIcon icon15=new ImageIcon("imagecxxx.gif");//完--------------------------------------------------------------------------------public Main(){setTitle("员工管理系统");Container con = getContentPane();con.setLayout(new BorderLayout());con.add(deskpane,BorderLayout.CENTER);Font f =new Font("新宋体",Font.PLAIN,12);JMenuBar mb = new JMenuBar();JMenu systemM = new JMenu("系统管理");systemM.setFont(f);JMenu manageM = new JMenu("信息管理");manageM.setFont(f);JMenu employeeMM = new JMenu("员工信息管理");employeeMM.setFont(f);JMenu selectM = new JMenu("信息查询");selectM.setFont(f);JMenu employeeSM =new JMenu("员工信息查询"); employeeSM.setFont(f);JMenu helpM = new JMenu("帮助");helpM.setFont(f);JMenu aboutM=new JMenu("关于");aboutM.setFont(f);JMenuItem password = new JMenuItem("密码修改"); password.setFont(f);JMenuItem land = new JMenuItem("重新登陆");land.setFont(f);JMenuItem addDelete = new JMenuItem("添加/删除用户"); addDelete.setFont(f);JMenuItem exit = new JMenuItem("退出系统");exit.setFont(f);systemM.add(password);systemM.add(land);systemM.add(addDelete);systemM.add(exit);//为系统管理菜单加事件password.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("AmendPassword");deskpane.add(new AmendPassword());}});land.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Land");setVisible(false);new Land();}});addDelete.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deskpane.add(new AddDeleteUser());}});exit.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){//new JOptionPane().showMessageDialog(setVisible(false);}});JMenuItem departmentM = new JMenuItem("部门信息管理"); departmentM.setFont(f);JMenuItem employeeM = new JMenuItem("基本信息管理"); employeeM.setFont(f);JMenuItem trainM = new JMenuItem("培训信息管理");trainM.setFont(f);JMenuItem encouragementPunishM = new JMenuItem("奖罚信息管理"); encouragementPunishM.setFont(f);JMenuItem wageM =new JMenuItem("薪资信息管理");wageM.setFont(f);employeeMM.add(trainM);employeeMM.add(employeeM);employeeMM.add(encouragementPunishM);employeeMM.add(wageM);manageM.add(employeeMM);manageM.add(departmentM);//为管理菜单加事件departmentM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Departmentmanage");deskpane.add(new Departmentmanage());}});employeeM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Employeemanage");deskpane.add(new Employeemanage());}});trainM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Trainmanage");deskpane.add(new Trainmanage());}});encouragementPunishM.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("EncouragementPunish");deskpane.add(new EncouragementPunish());}});wageM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("WageManage");deskpane.add(new WageManage());}});JMenuItem departmentS = new JMenuItem("部门信息查询"); departmentS.setFont(f);JMenuItem employeeS = new JMenuItem("基本信息查询"); employeeS.setFont(f);JMenuItem trainS = new JMenuItem("培训信息查询");trainS.setFont(f);JMenuItem encouragementPunishS = new JMenuItem("奖罚信息查询"); encouragementPunishS.setFont(f);JMenuItem wageS =new JMenuItem("薪资信息查询");wageS.setFont(f);employeeSM.add(trainS);employeeSM.add(employeeS);employeeSM.add(encouragementPunishS);employeeSM.add(wageS);selectM.add(employeeSM);selectM.add(departmentS);//为查询菜单加事件departmentS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("DIQ");deskpane.add(new DIQ());}});employeeS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("BIQ");deskpane.add(new BIQ());}});trainS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("TIQ");deskpane.add(new TIQ());}});encouragementPunishS.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("EPIQ");deskpane.add(new EPIQ());}});wageS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("SIQ");deskpane.add(new SIQ());}});JMenuItem help = new JMenuItem("帮助");help.setFont(f);JMenuItem about =new JMenuItem("关于");about.setFont(f);helpM.add(help);aboutM.add(about);//为帮助菜单加事件about.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new About());}});mb.add(systemM);mb.add(manageM);mb.add(selectM);mb.add(helpM);mb.add(aboutM);setJMenuBar(mb);Image img=Toolkit.getDefaultToolkit().getImage("imagemain.gif"); setIconImage(img);systemM.setIcon(icon9);manageM.setIcon(icon8);selectM.setIcon(icon7);helpM.setIcon(icon6);addDelete.setIcon(icon1);land.setIcon(icon2);password.setIcon(icon3);exit.setIcon(icon4);employeeMM.setIcon(icon5);employeeSM.setIcon(icon5);departmentM.setIcon(icon10);departmentS.setIcon(icon11);help.setIcon(icon6);aboutM.setIcon(icon13);about.setIcon(icon13);employeeM.setIcon(icon14);trainM.setIcon(icon14); encouragementPunishM.setIcon(icon14); wageM.setIcon(icon14);employeeS.setIcon(icon15);trainS.setIcon(icon15); encouragementPunishS.setIcon(icon15); wageS.setIcon(icon15);JToolBar jToolBar1 = new JToolBar(); jToolBar1.setLayout(new GridLayout(9,1)); JButton jButton1 = new JButton();jButton1.setToolTipText("员工基本信息管理"); JButton jButton2 = new JButton();jButton2.setToolTipText("员工基本信息查询"); JButton jButton3 = new JButton();jButton3.setToolTipText("修改密码");JButton jButton5 = new JButton();jButton5.setToolTipText("计算器");JButton jButton6 = new JButton();jButton6.setToolTipText("退出系统");jToolBar1.setMaximumSize(new java.awt.Dimension(600, 50)); jToolBar1.setMinimumSize(new java.awt.Dimension(600, 50)); //添加工具栏中按钮的方法jButton1.setIcon(new ImageIcon("image1.png"));jButton1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Employeemanage");deskpane.add(new Employeemanage());}});jToolBar1.add(jButton1);jButton2.setIcon(new ImageIcon("image2.png"));jButton2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new BIQ());}});jToolBar1.add(jButton2);jButton3.setIcon(new ImageIcon("image3.png"));jButton3.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new AmendPassword());}});jToolBar1.add(jButton3);jButton5.setIcon(new ImageIcon("image5.png"));jButton5.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Calculator");deskpane.add(new Calculator());}});jToolBar1.add(jButton5);jButton6.setIcon(new javax.swing.ImageIcon("image6.png")); jButton6.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.exit(0);}});jToolBar1.add(jButton6);jToolBar1.setBounds(0, 0, 30, 600);jToolBar1.setEnabled(false);con.add(jToolBar1,BorderLayout.WEST);p.setLayout(new BorderLayout());p.add(lp1,BorderLayout.EAST);t.start();con.add(p,BorderLayout.SOUTH);Toolkit t = Toolkit.getDefaultToolkit();int width = t.getScreenSize().width - 200; int height = t.getScreenSize().height - 100; setSize(width,height);setLocation(150,100);setVisible(true);setResizable(false);}//线程的方法public void run(){System.out.println("线程启动了!");Toolkit t = Toolkit.getDefaultToolkit();int x=t.getScreenSize().width;System.out.println("x=" + x);lp1.setForeground(Color.red);while(true){if(x<-600){x=t.getScreenSize().width;}lp1.setBounds(x,0,700,20);x-=10;try{Thread.sleep(100);}catch(Exception e){} }}public static void main(String[] args){new Main();}}//数据库联接类package classsource;import java.sql.*;public class Database {public static Connection cn;public static Statement st;public static ResultSet rs;public static boolean joinDB() {boolean joinFlag;try {joinFlag = true;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");cn =DriverManager.getConnection("jdbc:odbc:EmployeeInformationMS","sa"," ");cn.setCatalog("EmployeeInformationMS");System.out.println("数据库连接成功");st = cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);return joinFlag;} catch (SQLException sqlEx) {System.out.println(sqlEx.getMessage());joinFlag = false;return joinFlag;} catch (ClassNotFoundException notfoundEX) { System.out.println(notfoundEX.getMessage());joinFlag = false;return joinFlag;}}public static boolean executeSQL(String sqlString) { boolean executeFlag;try {st.execute(sqlString);executeFlag = true;} catch (Exception e) {executeFlag = false;System.out.println("sql exception:" + e.getMessage()); }return executeFlag;}public static boolean query(String sqlString) {try {rs = null;//System.out.println(sqlString);rs = st.executeQuery(sqlString);} catch (Exception Ex) {System.out.println("sql exception:" + Ex);return false;}return true;}}//添加删除用户类package classsource;import java.awt.event.*;import java.awt.*;import javax.swing.*;import java.sql.*;public class AddDeleteUser extends javax.swing.JInternalFrame { private JButton butACancel,butDCancel,butDelete,butOk;private JComboBox cbUserName;private JLabel jLabel1,jLabel2,jLabel3,jLabel4,jLabel5;private JPasswordField pas1,pas2,pas3;private JTextField txtname;public AddDeleteUser() {initComponents();this.setVisible(true);this.setClosable(true);this.setSize(268,350);}private void initComponents() { jLabel1 = new JLabel();jLabel2 = new JLabel();jLabel3 = new JLabel();txtname = new JTextField();pas1 = new JPasswordField();pas2 = new JPasswordField(); butOk = new JButton();butACancel = new JButton();jLabel4 = new JLabel(); cbUserName = new JComboBox(); jLabel5 = new JLabel();pas3 = new JPasswordField(); butDelete = new JButton(); butDCancel = new JButton(); getContentPane().setLayout(null); jLabel1.setText("新用户名:"); getContentPane().add(jLabel1); jLabel1.setBounds(30, 30, 70, 20); jLabel2.setText("输入密码:");getContentPane().add(jLabel2);jLabel2.setBounds(30, 60, 70, 18); jLabel3.setText("确认密码:"); getContentPane().add(jLabel3);jLabel3.setBounds(30, 90, 60, 18); getContentPane().add(txtname); txtname.setBounds(100, 30, 130, 24); getContentPane().add(pas1);pas1.setBounds(100, 60, 130, 24); getContentPane().add(pas2);pas2.setBounds(100, 90, 130, 24); butOk.setText("添加");getContentPane().add(butOk);butOk.setBounds(80, 130, 70, 27); butACancel.setText("清空"); getContentPane().add(butACancel); butACancel.setBounds(160, 130, 70, 27); jLabel4.setText("已有用户名:"); getContentPane().add(jLabel4);jLabel4.setBounds(30, 180, 80, 18); getContentPane().add(cbUserName); cbUserName.setBounds(100, 180, 130, 24); jLabel5.setText("密码:"); getContentPane().add(jLabel5);jLabel5.setBounds(30, 210, 60, 18);getContentPane().add(pas3);pas3.setBounds(100, 216, 130, 24);butDelete.setText("删除");getContentPane().add(butDelete);butDelete.setBounds(79, 260, 70, 27);butDCancel.setText("清空");getContentPane().add(butDCancel);butDCancel.setBounds(160, 260, 70, 27);//将所有用用户名读出来Database.joinDB();String sql="select * from UserInformation";try{if(Database.query(sql)){while(Database.rs.next()){String name=Database.rs.getString("User_Name");cbUserName.addItem(name);}}}catch(Exception e){}//为添加和取消按钮加事件----------------------------------------- butOk.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if(txtname.getText().equals("")){new JOptionPane().showMessageDialog(null,"用户名不能为空!");}else if(pas1.getText().equals("")){new JOptionPane().showMessageDialog(null,"密码不能为空!");}else if(pas1.getText().equals(pas2.getText())){String sql="insert UserInformation values('"+ txtname.getText() +"','"+ pas1.getText() +"','B')";try{if(Database.executeSQL(sql)){new JOptionPane().showMessageDialog(null,"添加成功!");cbUserName.addItem(txtname.getText());}}catch(Exception ea){}}}});butACancel.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){txtname.setText("");pas1.setText("");pas2.setText("");}});//为删除和取消按钮加事件--------------------------------------- butDelete.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){String name="" + cbUserName.getSelectedItem();String sql="select * from UserInformation where User_Name='"+ name +"'";try{if(Database.query(sql)){Database.rs.next();String pas=pas3.getText();String password=Database.rs.getString("Password");System.out.println(password);if(pas.equals(password)){String sdelete="delete from UserInformation where User_Name='"+ name +"'";if(Database.executeSQL(sdelete)){new JOptionPane().showMessageDialog(null,"删除成功!");pas3.setText("");cbUserName.removeAllItems();String sql1="select * from UserInformation";if(Database.query(sql1)){while(Database.rs.next()){Stringname1=Database.rs.getString("User_Name"); cbUserName.addItem(name1);}}}}else{new JOptionPane().showMessageDialog(null,"密码不正确!");}}}catch(Exception el){System.out.println(el);}}});butDCancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){pas3.setText("");}});}}//修改密码类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class AmendPassword extends JInternalFrame { JLabel lbe1=new JLabel("修改密码");JPanel p=new JPanel();public AmendPassword(){setTitle("修改密码");p.add(lbe1);AmendPanel panel=new AmendPanel();Container contentPane=getContentPane(); contentPane.add(p,"North");contentPane.add(panel,"Center");setBounds(100, 100, 280, 260);this.setClosable(true);setVisible(true);}}class AmendPanel extends JPanel {JButton b1,b2;JLabel lbe2,lbe3,lbe4,lbe5; JPasswordField pas1,pas2,pas3; JComboBox tf;public AmendPanel(){lbe2=new JLabel("用户名:");lbe3=new JLabel("输入旧密码:"); lbe4=new JLabel("输入新密码:"); lbe5=new JLabel("确定新密码:"); tf=new JComboBox();pas1=new JPasswordField();pas2=new JPasswordField();pas3=new JPasswordField();b1=new JButton("确定");b2=new JButton("清空");add(lbe2);lbe2.setBounds(16,10,90,25); this.add(tf);tf.setBounds(100,10,120,25); add(lbe3);lbe3.setBounds(16,45,90,25);add(pas1);pas1.setBounds(100,45,120,25);add(lbe4);lbe4.setBounds(16,80,80,25);add(pas2);pas2.setBounds(100,80,120,25);add(lbe5);lbe5.setBounds(16,115,80,25);add(pas3);pas3.setBounds(100,115,120,25);add(b1);b1.setBounds(100,160,60,30);add(b2);b2.setBounds(160,160,60,30);setLayout(null);//将所有用用户名读出来Database.joinDB();String sql="select * from UserInformation";try{if(Database.query(sql)){while(Database.rs.next()){String name=Database.rs.getString("User_Name"); tf.addItem(name);}}}catch(Exception e){}//为确定取消按钮加事件b1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){String name="" + tf.getSelectedItem();System.out.println(name);String sql="select * from UserInformation where User_Name='"+ name +"'";System.out.println(sql);try{if(Database.query(sql)){Database.rs.next();String ps1=pas1.getText();String password=Database.rs.getString("Password");if(ps1.equals(password)){if(pas2.getText().equals(pas3.getText())){String supdate="update UserInformation set Password='"+pas3.getText()+"' where User_Name='"+ name +"'";Database.executeSQL(supdate);new JOptionPane().showMessageDialog(null,"密码更改成功!");}else{new JOptionPane().showMessageDialog(null,"两次密码不同!");}}else{new JOptionPane().showMessageDialog(null,"旧密码不正确!");}}}catch(Exception el){System.out.println(el);}}});b2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){pas1.setText("");pas2.setText("");pas3.setText("");}});}}//关于类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class About extends JInternalFrame {JLabel label = new JLabel("运行环境:Windows");JLabel labe2 = new JLabel("开发语言:JAVA");JLabel labe3 = new JLabel("数据库类型:SqlServer2000"); public About(){setTitle("关于");Container con=getContentPane();con.setLayout(new GridLayout(4,1));con.add(label);con.add(labe2);con.add(labe3);con.setBackground(Color.white);setResizable(false);setSize(380,220);setVisible(true);setClosable(true);}}//员工信息查询类package classsource;import java.awt.*;import javax.swing.*;import javax.swing.table.*;import java.awt.event.*;import java.util.*;import javax.swing.JScrollPane.*;import java.sql.*;public class BIQ extends JInternalFrame{JLabel lbl1=new JLabel("基本信息查询");JLabel lbl2=new JLabel("员工编号:");JLabel lbl3=new JLabel("员工姓名:");JTextField btxtid=new JTextField(10);JTextField btxtname=new JTextField(10);JButton btn1=new JButton("查询");JTable table;DefaultTableModel dtm;String columns[] = {"员工编号","员工姓名"," 性别 ","出生日期","婚姻状况","政治面貌"," 学历 ","进入公司时间","转正时间"," 部门 "," 职务 ","员工状态"," 备注"};public BIQ(){setTitle("基本信息查询");dtm = new DefaultTableModel();table = new JTable(dtm);JScrollPane sl = new JScrollPane();sl.getViewport().add(table);dtm.setColumnCount(5);dtm.setColumnIdentifiers(columns); getContentPane().setLayout(null);lbl1.setBounds(240,10,300,30);lbl1.setFont(new Font("宋体",Font.BOLD,24)); getContentPane().add(lbl1);Font f=new Font("宋体",Font.PLAIN,12);lbl2.setBounds(10,60,80,25);lbl2.setFont(f);getContentPane().add(lbl2);btxtid.setBounds(80,60,80,23);btxtid.setFont(f);getContentPane().add(btxtid);lbl3.setBounds(10,90,80,25);lbl3.setFont(f);getContentPane().add(lbl3);btxtname.setBounds(80,90,80,23);btxtname.setFont(f);getContentPane().add(btxtname);btn1.setBounds(90,130,60,25);btn1.setFont(f);getContentPane().add(btn1);sl.setBounds(180,60,500,370);getContentPane().add(sl);//设置边框btxtid.setBorder(BorderFactory.createLineBorder(Color.black));btxtname.setBorder(BorderFactory.createLineBorder(Color.black));btn1.setBorder(BorderFactory.createRaisedBevelBorder());sl.setBorder(BorderFactory.createLineBorder(Color.black));//----连接数据库--------------------------------------------------------------------------Database.joinDB();String sql="select * from EmployeeInformation";if(Database.query(sql)){System.out.println(sql);try{while(Database.rs.next()){String eNumber=(""+Database.rs.getInt("E_Number"));System.out.println(eNumber);String eName=Database.rs.getString("E_Name");System.out.println(eName);String eSex=Database.rs.getString("E_Sex");System.out.println(eSex);String eBornDate=Database.rs.getString("E_BornDate");System.out.println(eBornDate);String eMarriage=Database.rs.getString("E_Marriage");System.out.println(eMarriage);StringePoliticsVisage=Database.rs.getString("E_PoliticsVisage"); System.out.println(ePoliticsVisage);String eSchoolAge=Database.rs.getString("E_SchoolAge"); System.out.println(eSchoolAge);String eEnterDate=Database.rs.getString("E_EnterDate"); System.out.println(eEnterDate);String eInDueFormDate=Database.rs.getString("E_InDueFormDate"); System.out.println(eInDueFormDate);String eDepartment=Database.rs.getString("E_Department"); System.out.println(eDepartment);String eHeadship=Database.rs.getString("E_Headship");System.out.println(eHeadship);String eEstate=Database.rs.getString("E_Estate");System.out.println(eEstate);String eRemark=Database.rs.getString("E_Remark");System.out.println(eRemark);Vector v=new Vector();v.add(eNumber);v.add(eName);v.add(eSex);v.add(eBornDate);v.add(eMarriage);v.add(ePoliticsVisage);v.add(eSchoolAge);v.add(eEnterDate);v.add(eInDueFormDate);v.add(eDepartment);v.add(eHeadship);v.add(eEstate);v.add(eRemark);dtm.addRow(v);}}catch(Exception eBIQ){System.out.println("初始化数据失败!");}}//为查询按钮加事件btn1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent eBIQ){ System.out.println("按钮事件");String esql;int rc=dtm.getRowCount();for(int i=0;i<rc;i++){dtm.removeRow(0);}if(btxtid.getText().equals("")&&btxtname.getText().equals("")){ esql="select * from EmployeeInformation";}else if(btxtname.getText().equals("")){esql="select * from EmployeeInformation where E_Number = '" + btxtid.getText() +"'";}else{esql="select * from EmployeeInformation where E_Number = '" + btxtid.getText() +"' or E_Name like '%"+ btxtname.getText() +"%'";}System.out.println(esql);if(Database.query(esql)){try{while(Database.rs.next()){String eNumber=(""+Database.rs.getInt("E_Number"));System.out.println(eNumber);String eName=Database.rs.getString("E_Name");System.out.println(eName);。

人事管理系统(源代码

人事管理系统(源代码

附录:毕业设计程序清单设计题目人事管理系统教学班:学生姓名:学号:指导教师:完成日期:Option ExplicitDim Bupdata As BooleanDim i As IntegerPrivate Sub Cmbdegree_Click()If Cmbdegree.Text = "定制" ThenFrmTable.ShowCmbdegree.ListIndex = 0End IfEnd SubPrivate Sub Cmbdepart_Click()If Cmbdepart.Text = "定制" ThenFrmTable.ShowCmbdepart.ListIndex = 0End IfEnd SubPrivate Sub CmdAddNew_Click()If CmdAddNew.Caption = "添加" ThenCmdAddNew.Caption = "确认"CmdDel.Enabled = FalseCmdOK.Enabled = FalseDataA.ReadOnly = FalseFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0Next iDataA.Recordset.AddNewTxt(0).Locked = FalseIf FrmMain.cutable = "employee" ThenDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowIf Opsex(0) ThenDataA.Recordset.Fields(4) = "男"ElseDataA.Recordset.Fields(4) = "女"End IfDataA.Recordset.Fields(7) = Cmbdegree.TextDataA.Recordset.Fields(8) = Cmbdepart.TextElseIf FrmMain.cutable = "leave" ThenDataA.Recordset.Fields(8) = frmLogin.EmploIDDataA.Recordset.Fields(9) = NowElseDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowEnd IfTxt(0).SetFocusElse 'OKIf Txt(0).Text = "" ThenMsgBox "不可以为空"Txt(0).SetFocusExit SubEnd IfFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next iIf FrmMain.cutable = "employee" ThenDataB.Recordset.FindFirst "职工编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "职员编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfElseIf FrmMain.cutable = "leave" ThenDataB.Recordset.FindFirst "假条编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "假条编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfElseFor i = 4 To 10If Not IsNumeric(Txt(i).Text) ThenMsgBox "not a number"Txt(i).SetFocusExit SubEnd IfNext iDataB.Recordset.FindFirst "工资编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "工资编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfEnd IfDataA.Recordset.UpdateDataA.Recordset.MoveLastFrmMain.DataA.RefreshFrmMain.DataB.RefreshDataB.RefreshCmdAddNew.Caption = "添加"CmdDel.Enabled = TrueCmdOK.Enabled = TrueEnd IfEnd SubPrivate Sub CmdCacel_Click()If CmdAddNew.Caption = "确认" ThenDataA.Recordset.CancelUpdateEnd IfFrmMain.Enabled = TrueFrmMain.SetFocusUnload MeFrmMain.DataA.RefreshIf FrmMain.cutable = "employee" ThenFrmMain.DBGA.Columns("性别").Button = TrueFrmMain.DBGA.Columns("学历").Button = TrueFrmMain.DBGA.Columns("部门").Button = True End IfEnd SubPrivate Sub CmdDel_Click()DataA.ReadOnly = FalseDataA.Recordset.DeleteDataA.Recordset.MoveNextIf DataA.Recordset.EOF ThenDataA.Recordset.MoveLastEnd IfFrmMain.DataA.RefreshEnd SubPrivate Sub cmdOK_Click()If Txt(0).Text = "" ThenMsgBox "不可以为空"Txt(0).SetFocusExit SubEnd IfBupdata = FalseDataA.Recordset.EditIf FrmMain.cutable = "leave" ThenDataA.Recordset.Fields(8) = frmLogin.EmploIDDataA.Recordset.Fields(9) = NowElseIf FrmMain.cutable = "employee" ThenDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowIf Opsex(0) ThenDataA.Recordset.Fields(4) = "男"ElseDataA.Recordset.Fields(4) = "女"End IfDataA.Recordset.Fields(7) = Cmbdegree.TextDataA.Recordset.Fields(8) = Cmbdepart.TextDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowElseFor i = 4 To 10If Not IsNumeric(Txt(i).Text) ThenMsgBox "not a number"Txt(i).SetFocusExit SubEnd IfNext iDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowEnd IfFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next iDataA.Recordset.UpdateFrmMain.DataA.RefreshDataB.RefreshEnd SubPrivate Sub DataA_V alidate(Action As Integer, Save As Integer)If Action = 11 And Bupdata ThenSave = 0End IfEnd SubPrivate Sub Lab_Click(Index As Integer)End SubPrivate Sub Txt_KeyPress(Index As Integer, KeyAscii As Integer)If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And Index = 0 Then KeyAscii = 0Exit SubEnd IfIf FrmMain.cutable = "leave" And Index = 1 ThenIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack ThenKeyAscii = 0Exit SubEnd IfEnd IfIf FrmMain.cutable = "salary" ThenIf Index <= 3 ThenIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack ThenKeyAscii = 0Exit SubEnd IfEnd IfIf Index = 13 Then Exit SubIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And KeyAscii <> 46 ThenKeyAscii = 0Exit SubEnd IfEnd IfEnd SubPrivate Sub Txt_change(Index As Integer)If Bupdata = False Then Bupdata = TrueIf FrmMain.cutable = "salary" ThenIf Txt(Index).Text = "" Then Exit SubIf Index >= 4 And Index <= 6 ThenTxt(7).Text = V al(Txt(4).Text) + V al(Txt(5).Text) + V al(Txt(6).Text)Txt(12).Text = V al(Txt(7).Text) - V al(Txt(11).Text)End IfIf Index >= 8 And Index <= 10 ThenTxt(11).Text = V al(Txt(8).Text) + V al(Txt(9).Text) + V al(Txt(10).Text)Txt(12).Text = V al(Txt(7).Text) - V al(Txt(11).Text)End IfEnd IfEnd SubPrivate Sub Form_Load()DataA.DatabaseName = App.Path + "\sm.mdb"DataB.DatabaseName = App.Path + "\sm.mdb"DataA.Caption = FrmMain.cutableDataA.RecordSource = "select * from " + FrmMain.cutableDataB.RecordSource = "select * from " + FrmMain.cutableDataA.RefreshTxt(0).Locked = True'If FrmMain.DBGA.Row = 0 Then Exit SubIf FrmMain.cutable = "employee" Then 'employeeFor i = 0 To 12Lab(i).Caption = DataA.Recordset.Fields(i).NameNext iTxt(0).DataField = DataA.Recordset.Fields(0).NameTxt(1).DataField = DataA.Recordset.Fields(1).NameTxt(2).DataField = DataA.Recordset.Fields(2).NameTxt(3).DataField = DataA.Recordset.Fields(3).NameTxt(4).V isible = FalseTxt(5).DataField = DataA.Recordset.Fields(5).NameTxt(6).DataField = DataA.Recordset.Fields(6).NameTxt(7).V isible = FalseTxt(8).V isible = FalseTxt(9).DataField = DataA.Recordset.Fields(9).NameTxt(10).DataField = DataA.Recordset.Fields(10).NameTxt(11).DataField = DataA.Recordset.Fields(11).NameTxt(12).DataField = DataA.Recordset.Fields(12).NameTxt(13).DataField = DataA.Recordset.Fields(15).NameIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfIf DataA.Recordset.Fields(4) = "男" ThenOpsex(0).V alue = TrueElseOpsex(1).V alue = TrueEnd If'设置lsdegree的显示项For i = 0 To FrmMain.LsDegree.ListCount - 2Cmbdegree.AddItem FrmMain.LsDegree.List(i)If FrmMain.LsDegree.List(i) = DataA.Recordset.Fields(7) ThenCmbdegree.ListIndex = iEnd IfNext iIf Cmbdegree.ListIndex = -1 ThenCmbdegree.AddItem DataA.Recordset.Fields(7)Cmbdegree.ListIndex = Cmbdegree.ListCount - 1End IfCmbdegree.AddItem "定制"'设置lsdepart的显示项For i = 0 To FrmMain.LsDepart.ListCount - 2Cmbdepart.AddItem FrmMain.LsDepart.List(i)If FrmMain.LsDepart.List(i) = DataA.Recordset.Fields(8) ThenCmbdepart.ListIndex = iEnd IfNext iIf Cmbdepart.ListIndex = -1 ThenCmbdepart.AddItem DataA.Recordset.Fields(8)Cmbdepart.ListIndex = Cmbdepart.ListCount - 1End IfCmbdepart.AddItem "定制"'设置完毕ElseIf FrmMain.cutable = "leave" Then 'leaveTxt(7).V isible = TrueCmbdegree.V isible = FalseCmbdepart.V isible = FalseFrame1.V isible = FalseFor i = 8 To 12Lab(i).Visible = FalseTxt(i).V isible = FalseNext iFor i = 0 To 7Lab(i).Caption = DataA.Recordset.Fields(i).NameTxt(i).DataField = DataA.Recordset.Fields(i).NameNext iTxt(13).DataField = DataA.Recordset.Fields(10).NameIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfElse 'salaryFrame1.V isible = FalseCmbdegree.V isible = FalseCmbdepart.V isible = FalseFor i = 0 To 12Lab(i).Caption = DataA.Recordset.Fields(i).NameTxt(i).DataField = DataA.Recordset.Fields(i).NameNext iTxt(13).DataField = DataA.Recordset.Fields(15).NameTxt(7).Locked = TrueTxt(11).Locked = TrueTxt(12).Locked = TrueIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfEnd IfEnd SubPrivate Sub Form_Unload(Cancel As Integer)FrmMain.Enabled = TrueFrmMain.SetFocusUnload MeFrmMain.DataB.RefreshEnd SubOption ExplicitConst MxUser = 100Public EmploID As IntegerPublic CurUser As StringPublic CurId As StringPublic CurPsw As StringDim user(MxUser), pws(MxUser), state(MxUser), Emplo(MxUser) As StringPrivate Sub Form_Load()Dim i As IntegerIf App.PrevInstance ThenMsgBox ("程序已经运行,不能再次装载。

人事管理系统C 源代码

人事管理系统C 源代码

#include "stdio.h" /*标准输入输出函数库*/#include "stdlib.h" /*标准函数库*/#include "string.h" /*字符串函数库*/#include "conio.h" /*屏幕操作函数库*/#define HEADER1 " -------------------------------RSDA---------------------------------------- \n"#define HEADER2 "| number| name | jbgz | jj | kk | yfgz | sk | sfgz | \n"#define HEADER3 "|--------|-----------|--------|--------|--------|--------|--------|--------| \n"#define FORMAT "|%-8s|%-10s |%8.2f|%8.2f|%8.2f|%8.2f|%8.2f|%8.2f| \n" #define DATA p->num,p->name,p->jbgz,p->jj,p->kk,p->yfgz,p->sk,p->sfgz#define END "---------------------------------------------------------------------------- \n"#define N 60int saveflag=0; /*是否需要存盘的标志变量*//*定义与职工有关的数据结构*/typedef struct employee /*标记为employee*/{char num[10]; /*职工编号*/char name[15]; /*职工姓名*/float jbgz; /*基本工资*/float jj; /*奖金*/float kk; /*扣款*/float yfgz; /*应发工资*/float sk; /*税款*/float sfgz; /*实发工资*/}RSDA;void menu() /*主菜单*/{system("cls"); /*调用DOS命令,清屏.与clrscr()功能相同*/printf(" The Employee Management System \n");printf("*************************Menu********************************\n");printf(" * 1 input record 2 delete record *\n");printf(" * 3 search record 4 modify record *\n");printf(" * 5 insert record 6 count record *\n");printf(" * 7 sort record 8 save record *\n");printf(" * 9 display record 0 quit system *\n");printf("*************************************************************\n");/*printf()送格式化输出至屏幕中*/}void printheader() /*格式化输出表头*/{printf(HEADER1);printf(HEADER2);printf(HEADER3);}void printdata(RSDA pp) /*格式化输出表中数据*/{RSDA* p;p=&pp;printf(FORMAT,DATA);}void Disp(RSDA tp[],int n) /*显示数组tp[]中存储的记录,内容为employee 结构中定义的内容*/{int i;if(n==0) /*表示没有职工工资记录*/{printf("\n=====>Not employee record!\n");while(getchar()!='\n')continue;getchar();}printf("\n\n");printheader(); /*输出表格头部*/i=0;while(i<n) /*逐条输出数组中存储的职工信息*/{printdata(tp[i]);i ;printf(HEADER3);}while(getchar()!='\n')continue;getchar();}void Wrong() /*输出按键错误信息*/{printf("\n\n\n\n\n***********Error:input has wrong! press any key to continue**********\n");while(getchar()!='\n')continue;getchar();}void Nofind() /*输出未查找到此职工的信息*/{printf("\n=====>Not find this employee record!\n");}/*************************************************************作用:用于定位数组中符合要求的记录,并返回保存该记录的数组元素下标值参数:findmess[]保存要查找的具体内容; nameornum[]保存按什么在数组中查找**************************************************************/int Locate(RSDA tp[],int n,char findmess[],char nameornum[]){int i=0;if(strcmp(nameornum,"num")==0) /*按职工编号查询*/{while(i<n)if(strcmp(tp[i].num,findmess)==0) /*若找到findmess值的职工编号*/return i;i ;}}else if(strcmp(nameornum,"name")==0) /*按职工姓名查询*/{while(i<n){if(strcmp(tp[i].name,findmess)==0) /*若找到findmess值的姓名*/ return i;i ;}}return -1; /*若未找到,返回一个整数-1*/}/*输入字符串,并进行长度验证(长度<lens)*/void stringinput(char *t,int lens,char *notice){char n[255];do{printf(notice); /*显示提示信息*/scanf("%s",n); /*输入字符串*/if(strlen(n)>lens) printf("\n exceed the required length! \n"); /*进行长度校验,超过lens值重新输入*/}while(strlen(n)>lens);strcpy(t,n); /*将输入的字符串复制到字符串t中*/}/*输入数值,0<=数值)*/float numberinput(char *notice){float t=0.00;do{printf(notice); /*显示提示信息*/scanf("%f",&t); /*输入如工资等数值型的值*/if(t<0) printf("\n score must >=0! \n"); /*进行数值校验*/}while(t<0);return t;}/*增加职工工资记录*/int Add(RSDA tp[],int n){char ch,num[10];int i,flag=0;system("cls");Disp(tp,n); /*先打印出已有的职工工资信息*/while(1) /*一次可输入多条记录,直至输入职工编号为0的记录结束添加操作*/ {while(1) /*输入职工编号,保证该编号没有被使用,若输入编号为0,则退出添加记录操作*/{stringinput(num,10,"input number(press '0'return menu):"); /*格式化输入编号并检验*/flag=0;if(strcmp(num,"0")==0) /*输入为0,则退出添加操作,返回主界面*/{return n;}i=0;while(i<n) /*查询该编号是否已经存在,若存在则要求重新输入一个未被占用的编号*/{if(strcmp(tp[i].num,num)==0){flag=1;break;}i ;}if(flag==1) /*提示用户是否重新输入*/{ getchar();printf("==>The number %s is existing,try again?(y/n):",num);scanf("%c",&ch);if(ch=='y'||ch=='Y')continue;elsereturn n;}else{break;}}strcpy(tp[n].num,num); /*将字符串num复制到tp[n].num中*/stringinput(tp[n].name,15,"Name:");tp[n].jbgz=numberinput("jbgz:"); /*输入并检验基本工资*/tp[n].jj=numberinput("jiangjin:"); /*输入并检验奖金*/tp[n].kk=numberinput("koukuan:"); /*输入并检验扣款*/tp[n].yfgz=tp[n].jbgz tp[n].jj-tp[n].kk; /*计算应发工资*/tp[n].sk=tp[n].yfgz*0.12; /*计算税金,这里取应发工资的12%*/tp[n].sfgz=tp[n].yfgz-tp[n].sk; /*计算实发工资*/saveflag=1;n ;}return n;}/*按职工编号或姓名,查询记录*/void Qur(RSDA tp[],int n){int select; /*1:按编号查,2:按姓名查,其他:返回主界面(菜单)*/char searchinput[20]; /*保存用户输入的查询内容*/int p=0;if(n<=0) /*若数组为空*/{system("cls");printf("\n=====>No employee record!\n");getchar();return;}system("cls");printf("\n =====>1 Search by number =====>2 Search by name\n"); printf(" please choice[1,2]:");scanf("%d",&select);if(select==1) /*按编号查询*/{stringinput(searchinput,10,"input the existing employee number:");p=Locate(tp,n,searchinput,"num");/*在数组tp中查找编号为searchinput 值的元素,并返回该数组元素的下标值*/if(p!=-1) /*若找到该记录*/{printheader();printdata(tp[p]);printf(END);printf("press any key to return");getchar();}elseNofind();getchar();}else if(select==2) /*按姓名查询*/{stringinput(searchinput,15,"input the existing employee name:");p=Locate(tp,n,searchinput,"name");if(p!=-1){printheader();printdata(tp[p]);printf(END);printf("press any key to return");getchar();}elseNofind();getchar();}elseWrong();getchar();}/*删除记录:先找到保存该记录的数组元素的下标值,然后在数组中删除该数组元素*/int Del(RSDA tp[],int n){int sel;char findmess[20];int p=0,i=0;if(n<=0){ system("cls");printf("\n=====>No employee record!\n");getchar();return n;}system("cls");Disp(tp,n);printf("\n =====>1 Delete by number =====>2 Delete by name\n"); printf(" please choice[1,2]:");scanf("%d",&sel);if(sel==1){stringinput(findmess,10,"input the existing employee number:");p=Locate(tp,n,findmess,"num");getchar();if(p!=-1){for(i=p 1;i<n;i ) /*删除此记录,后面记录向前移*/{strcpy(tp[i-1].num,tp[i].num);strcpy(tp[i-1].name,tp[i].name);tp[i-1].jbgz=tp[i].jbgz;tp[i-1].jj=tp[i].jj;tp[i-1].kk=tp[i].kk;tp[i-1].yfgz=tp[i].yfgz;tp[i-1].jbgz=tp[i].sk;tp[i-1].sfgz=tp[i].sfgz;}printf("\n==>delete success!\n");n--;getchar();saveflag=1;}elseNofind();getchar();}else if(sel==2) /*先按姓名查询到该记录所在的数组元素的下标值*/{stringinput(findmess,15,"input the existing employee name:");p=Locate(tp,n,findmess,"name");getchar();if(p!=-1){for(i=p 1;i<n;i ) /*删除此记录,后面记录向前移*/{strcpy(tp[i-1].num,tp[i].num);strcpy(tp[i-1].name,tp[i].name);tp[i-1].jbgz=tp[i].jbgz;tp[i-1].jj=tp[i].jj;tp[i-1].kk=tp[i].kk;tp[i-1].yfgz=tp[i].yfgz;tp[i-1].jbgz=tp[i].sk;tp[i-1].sfgz=tp[i].sfgz;}printf("\n=====>delete success!\n");n--;getchar();saveflag=1;}elseNofind();getchar();}return n;}/*修改记录:先按输入的职工编号查询到该记录,然后提示用户修改编号之外的值,编号不能修改*/void Modify(RSDA tp[],int n){char findmess[20];int p=0;if(n<=0){ system("cls");printf("\n=====>No employee record!\n");getchar();return ;}system("cls");printf("modify employee recorder");Disp(tp,n);stringinput(findmess,10,"input the existing employee number:"); /*输入并检验该编号*/p=Locate(tp,n,findmess,"num"); /*查询到该数组元素,并返回下标值*/if(p!=-1) /*若p!=-1,表明已经找到该数组元素*/{printf("Number:%s,\n",tp[p].num);printf("Name:%s,",tp[p].name);stringinput(tp[p].name,15,"input new name:");printf("jbgz:%8.2f,",tp[p].jbgz);tp[p].jbgz=numberinput("jbgz:");printf("jiangjin:%8.2f,",tp[p].jj);tp[p].jj=numberinput("jiangjin:");printf("koukuan:%8.2f,",tp[p].kk);tp[p].kk=numberinput("koukuan:");tp[n].yfgz=tp[n].jbgz tp[n].jj-tp[n].kk;tp[n].sk=tp[n].yfgz*0.12;tp[n].sfgz=tp[n].yfgz-tp[n].sk;printf("\n=====>modify success!\n");getchar();Disp(tp,n);getchar();saveflag=1;}else{Nofind();getchar();}return ;}/*插入记录:按职工编号查询到要插入的数组元素的位置,然后在该编号之后插入一个新数组元素。

C#企业人事管理系统源代码截图

C#企业人事管理系统源代码截图

1.登陆界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace qiye{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void button1_Click(object sender, EventArgs e) {string mysql;string strsql;int i=0;string uname = "";if (textBox3.Text.Trim() != label5.Text.Trim())MessageBox.Show("验证码错误!");else{if (radioButton1.Checked){strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from employee whereyno='"+textBox1.Text.Trim()+"' and pwd='"+textBox2.Text.Trim()+"'";SqlConnection mycon = new SqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql,mycon);SqlDataReader myreader = mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){Form fr = new用户界面();fr.Show();}else{MessageBox.Show("账号密码错误!");}}else if (radioButton2.Checked){strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager where mno='" +textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = new SqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader = mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){Form fr = new管理员界面();fr.Show();}else{MessageBox.Show("账号密码错误!");}}elseMessageBox.Show("请选择用户类型!");}}public string RandomNum(int n){string strchar = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H," +"I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z," +"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";string[] arry = strchar.Split(',');string num = "";int temp = -1;Random rand = new Random();for (int i = 1; i < n + 1; i++){if (temp != -1){rand = new Random(i * temp * unchecked((int)DateTime.Now.Ticks)); }int t = rand.Next(61);if (temp != -1 && temp == t)return RandomNum(n);temp = t;num += arry[t];}return num;}private void Page_Load(object sender, EventArgs e){label5.Text= RandomNum(4);}private void button3_Click(object sender, EventArgs e) {label5.Text = RandomNum(4);}private void button2_Click(object sender, EventArgs e) {Form fr = new注册();fr.Show();}}}2.注册界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace qiye{public partial class注册 : Form{public注册(){InitializeComponent();}int m = 0;private void textBox6_TextChanged(object sender, EventArgs e) {}private void button3_Click(object sender, EventArgs e){if (m == 0){this.textBox2.PasswordChar = (char)0;this.textBox3.PasswordChar = (char)0;m = 1;}else{this.textBox2.PasswordChar = (char)42;this.textBox3.PasswordChar = (char)42;m = 0;}}private void button1_Click(object sender, EventArgs e){string mysql;string strsql;string mysql1,mysql2;int i = 0;int j = 0,k=0;string uname = "";strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true"; mysql = "select mno from invitation whereinvite='"+textBox7.Text.Trim()+"'";SqlConnection mycon = new SqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader = mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();j++;}mycon.Close();mysql1 = "select name from employee where yno='" + textBox1.Text.Trim() + "'";SqlConnection mycon1 = new SqlConnection(strsql);mycon1.Open();SqlCommand mycom1 = new SqlCommand(mysql1, mycon1);SqlDataReader myreader1 = mycom1.ExecuteReader();while (myreader1.Read()) //循环读取信息{uname = myreader1[0].ToString();k++;}mycon1.Close();if (j < 1)MessageBox.Show("邀请码错误!");else if (k > 0)MessageBox.Show("账号重复,请输入其他账号!");else if (textBox1.Text == "" || textBox2.Text.Trim() == "")MessageBox.Show("账号密码不能为空!");else if (textBox2.Text.Trim() != textBox3.Text.Trim())MessageBox.Show("两次密码输入不一致,请重新输入!");else{strsql = "server=DESKTOP-RADS474;database=qiye;integratedsecurity=true";mysql2 = "insert into employeevalues('"+textBox1.Text.Trim()+"','"+textBox2.Text.Trim()+ "','"+textBox4.Text.Trim()+ "','"+textBox5.Text+ "','"+textBox6.Text+"')";SqlConnection mycon2 = new SqlConnection(strsql);mycon2.Open();SqlCommand mycom2 = new SqlCommand(mysql2, mycon2);try{mycom2.ExecuteNonQuery();mycon2.Close();}catch{mycon2.Close();}MessageBox.Show("账号申请成功!");Form fr = new Form1();fr.Show();this.Close();}}private void button2_Click(object sender, EventArgs e){Form fr = new Form1();fr.Show();this.Close();}}}3.用户界面using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace qiye{public partial class用户界面 : Form{public用户界面(){InitializeComponent();}private void button3_Click(object sender, EventArgs e) {Form fr = new Form1();fr.Show();this.Close();}private void button1_Click(object sender, EventArgs e) {Form fr = new界面();fr.Show();}private void button2_Click(object sender, EventArgs e) {Form fr = new yuangong.请假();fr.Show();this.Close();}private void button4_Click(object sender, EventArgs e) {Form fr = new留言板();fr.Show();}}4.基本信息using System;using System.Collections.Generic; using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace qiye{public partial class 界面 : Form {public 界面(){InitializeComponent();private void button3_Click(object sender, EventArgs e){string mysql;string strsql;int i = 0;string uname = "";if (checkBox1.Checked){if (radioButton1.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from employee whereyno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = newSqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader =mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from employee where employee.yno='" + textBox1.Text.Trim() + "' and employee.pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon2 = new SqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = newSqlCommand(mysql2, mycon2);SqlDataReader dr =mycom2.ExecuteReader();while (dr.Read()){textBox3.Text =dr["yno"].ToString().Trim();textBox4.Text =dr["name"].ToString().Trim();textBox5.Text =dr["age"].ToString().Trim();textBox6.Text =dr["sex"].ToString().Trim();}}else{MessageBox.Show("账号密码错误!");}}}else if (radioButton2.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager wheremno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = newSqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader =mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from manager where mno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon2 = new SqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = newSqlCommand(mysql2, mycon2);SqlDataReader dr =mycom2.ExecuteReader();while (dr.Read()){textBox3.Text =dr["mno"].ToString().Trim();textBox4.Text =dr["name"].ToString().Trim();textBox5.Text =dr["age"].ToString().Trim();textBox6.Text =dr["sex"].ToString().Trim();}}else{MessageBox.Show("账号密码错误!");}}}else{MessageBox.Show("请选择用户类型!");}}else{if (radioButton1.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from employee whereyno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = newSqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader =mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from employee,infor where employee.yno=infor.sno and employee.yno='" +textBox1.Text.Trim() + "' and employee.pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon2 = new SqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = newSqlCommand(mysql2, mycon2);SqlDataReader dr =mycom2.ExecuteReader();while (dr.Read()){textBox3.Text =dr["yno"].ToString().Trim();textBox4.Text =dr["name"].ToString().Trim();textBox5.Text =dr["age"].ToString().Trim();textBox6.Text =dr["sex"].ToString().Trim();textBox7.Text =dr["minzu"].ToString().Trim();textBox8.Text =dr["zhengzhi"].ToString().Trim();textBox9.Text =dr["chusheng"].ToString().Trim();textBox10.Text =dr["hunyin"].ToString().Trim();textBox11.Text =dr["wenhua"].ToString().Trim();textBox12.Text =dr["biye"].ToString().Trim();textBox13.Text =dr["shengdenz"].ToString().Trim();textBox14.Text =dr["shouji"].ToString().Trim();textBox15.Text =dr["dizhi"].ToString().Trim();textBox16.Text =dr["gongzi"].ToString().Trim();textBox17.Text =dr["baoxian"].ToString().Trim();textBox18.Text =dr["zhufang"].ToString().Trim();textBox19.Text =dr["jiangjin"].ToString().Trim();textBox20.Text =dr["bumen"].ToString().Trim();textBox21.Text =dr["zhiwu"].ToString().Trim();}}else{MessageBox.Show("账号密码错误!");}}}else if (radioButton2.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager wheremno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = newSqlConnection(strsql);mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon);SqlDataReader myreader =mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from manager,infor where manager.mno=infor.sno and manager.mno='" + textBox1.Text.Trim() + "' and manager.pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon2 = newSqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = newSqlCommand(mysql2, mycon2);SqlDataReader dr =mycom2.ExecuteReader();while (dr.Read()){textBox3.Text =dr["mno"].ToString().Trim();textBox4.Text =dr["name"].ToString().Trim();textBox5.Text =dr["age"].ToString().Trim();textBox6.Text =dr["sex"].ToString().Trim();textBox7.Text =dr["minzu"].ToString().Trim();textBox8.Text =dr["zhengzhi"].ToString().Trim();textBox9.Text =dr["chusheng"].ToString().Trim();textBox10.Text =dr["hunyin"].ToString().Trim();textBox11.Text =dr["wenhua"].ToString().Trim();textBox12.Text =dr["biye"].ToString().Trim();textBox13.Text =dr["shengdenz"].ToString().Trim();textBox14.Text =dr["shouji"].ToString().Trim();textBox15.Text =dr["dizhi"].ToString().Trim();textBox16.Text =dr["gongzi"].ToString().Trim();textBox17.Text =dr["baoxian"].ToString().Trim();textBox18.Text =dr["zhufang"].ToString().Trim();textBox19.Text =dr["jiangjin"].ToString().Trim();textBox20.Text =dr["bumen"].ToString().Trim();textBox21.Text =dr["zhiwu"].ToString().Trim();}}else{MessageBox.Show("账号密码错误!"); }}}else{MessageBox.Show("请选择用户类型!");}}}private void Page_Load(object sender, EventArgs e){this.textBox3.ReadOnly = true;this.textBox16.ReadOnly = true;this.textBox17.ReadOnly = true;this.textBox18.ReadOnly = true;this.textBox19.ReadOnly = true;this.textBox20.ReadOnly = true;this.textBox21.ReadOnly = true;}private void button5_Click(object sender, EventArgs e) {string mysql;int i = 0;string uname = "";if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager where mno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'"; SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader();while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){this.textBox3.ReadOnly = false;this.textBox16.ReadOnly = false;this.textBox17.ReadOnly = false;this.textBox18.ReadOnly = false;this.textBox19.ReadOnly = false;this.textBox20.ReadOnly = false;this.textBox21.ReadOnly = false;}else{MessageBox.Show("账号密码错误!");}}}private void button1_Click(object sender, EventArgs e){string strsql;int i = 0;string uname = "";if (radioButton1.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from employee where yno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader(); while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){int m = 0;string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from record where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon2 = newSqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = new SqlCommand(mysql2, mycon2);SqlDataReader dr = mycom2.ExecuteReader();while (dr.Read()){m++;}mycon2.Close();if (m > 0){string mysql3;string strsql3;strsql3 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql3 = "update record set re='上班' where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon3 = new SqlConnection(strsql3);mycon3.Open();SqlCommand mycom3 = newSqlCommand(mysql3,mycon3);try{mycom3.ExecuteNonQuery();mycon3.Close();}catch{mycon3.Close();}MessageBox.Show("打卡成功");}else{string mysql3;string strsql3;strsql3 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql3 = "insert into recordvalues('"+textBox1.Text+"','上班')";SqlConnection mycon3 = new SqlConnection(strsql3);mycon3.Open();SqlCommand mycom3 = newSqlCommand(mysql3, mycon3);try{mycom3.ExecuteNonQuery();mycon3.Close();}catch{mycon3.Close();}MessageBox.Show("打卡成功");}}else{MessageBox.Show("账号密码错误!");}}}else if (radioButton2.Checked){if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager where mno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'"; SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader(); while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){int m = 0;string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from record where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon2 = newSqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = new SqlCommand(mysql2, mycon2);SqlDataReader dr = mycom2.ExecuteReader();while (dr.Read()){m++;}mycon2.Close();if (m > 0){string mysql3;string strsql3;strsql3 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql3 = "update record set re='上班' where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon3 = newSqlConnection(strsql3);mycon3.Open();SqlCommand mycom3 = newSqlCommand(mysql3, mycon3);try{mycom3.ExecuteNonQuery();mycon3.Close();}catch{mycon3.Close();}MessageBox.Show("打卡成功");}else{string mysql3;string strsql3;strsql3 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql3 = "insert into record values('" + textBox1.Text + "','上班')";SqlConnection mycon3 = new SqlConnection(strsql3);mycon3.Open();SqlCommand mycom3 = newSqlCommand(mysql3, mycon3);try{mycom3.ExecuteNonQuery();mycon3.Close();}catch{mycon3.Close();}MessageBox.Show("打卡成功");}}else{MessageBox.Show("账号密码错误!");}}}else{MessageBox.Show("请选择用户类型!");}}private void button2_Click(object sender, EventArgs e){string mysql;string strsql;int i = 0;if (textBox1.Text != ""){strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select re from record where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader(); while (myreader.Read()){i++;}mycon.Close();if (i > 0){string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "update record set re='下班' where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon2 = newSqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = new SqlCommand(mysql2, mycon2);try{mycom2.ExecuteNonQuery();mycon2.Close();}catch{mycon2.Close();}MessageBox.Show("下班了,谢谢!");}else{MessageBox.Show("您还没有打卡!");}}else {MessageBox.Show("账号不能为空!");}}private void button4_Click(object sender, EventArgs e){string mysql;string strsql;int i = 0;string uname = "";if (textBox1.Text == "" || textBox2.Text == ""){MessageBox.Show("账号密码不能为空!");}else{if (radioButton1.Checked){strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from employee where yno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'";SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader(); while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){int m = 0;string mysql2;string strsql2;strsql2 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql2 = "select * from infor where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon2 = newSqlConnection(strsql2);mycon2.Open();SqlCommand mycom2 = new SqlCommand(mysql2, mycon2);SqlDataReader dr = mycom2.ExecuteReader();while (dr.Read()){m++;}mycon2.Close();if (m > 0){string mysql3;string strsql3;strsql3 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql3 = "update infor setminzu='"+textBox7.Text+ "',zhengzhi='" + textBox8.Text + "', " +"chusheng='" + textBox9.Text +"',hunyin='" + textBox10.Text + "',wenhua='" + textBox11.Text + "', " +"biye='" + textBox12.Text +"',shengdenz='" + textBox13.Text + "',shouji='" + textBox14.Text + "'," +"dizhi='" + textBox15.Text +"',gongzi='" + textBox16.Text + "',baoxian='" + textBox17.Text + "'," +"zhufang='" + textBox18.Text +"',jiangjin='" + textBox19.Text + "',bumen='" + textBox20.Text + "'," +"zhiwu='" + textBox21.Text + "' where sno='" + textBox1.Text.Trim() + "'";SqlConnection mycon3 = newSqlConnection(strsql3);mycon3.Open();SqlCommand mycom3 = newSqlCommand(mysql3, mycon3);try{mycom3.ExecuteNonQuery();mycon3.Close();}catch{mycon3.Close();}}else{string mysql4;string strsql4;strsql4 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql4 = "insert into inforvalues('"+textBox1.Text+ "','" + textBox7.Text + "','" +textBox8.Text + "','" + textBox9.Text + "'," +"'" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox14.Text + "'," +"'" + textBox15.Text + "','" + textBox16.Text + "','" + textBox17.Text + "','" + textBox18.Text + "','" + textBox19.Text + "'," +"'" + textBox20.Text + "','" + textBox21.Text + "')";SqlConnection mycon4 = new SqlConnection(strsql4);mycon4.Open();SqlCommand mycom4 = newSqlCommand(mysql4, mycon4);try{mycom4.ExecuteNonQuery();mycon4.Close();}catch{mycon4.Close();}}string mysql5;string strsql5;strsql5 = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql5 = "update employee set yno='" + textBox3.Text +"',name='"+textBox4.Text+"',age='"+textBox5.Text+"',sex='"+textBox6.T ext+"'";SqlConnection mycon5 = newSqlConnection(strsql5);mycon5.Open();SqlCommand mycom5 = new SqlCommand(mysql5, mycon5);try{mycom5.ExecuteNonQuery();mycon5.Close();}catch{mycon5.Close();}MessageBox.Show("信息修改成功!");}elseMessageBox.Show("该账户不存在!");}else if (radioButton2.Checked){strsql = "server=DESKTOP-RADS474;database=qiye;integrated security=true";mysql = "select name from manager where mno='" + textBox1.Text.Trim() + "' and pwd='" + textBox2.Text.Trim() + "'"; SqlConnection mycon = new SqlConnection(strsql); mycon.Open();SqlCommand mycom = new SqlCommand(mysql, mycon); SqlDataReader myreader = mycom.ExecuteReader(); while (myreader.Read()) //循环读取信息{uname = myreader[0].ToString();i++;}mycon.Close();if (i > 0){int m = 0;string mysql2;string strsql2;。

公司人员管理系统源代码

公司人员管理系统源代码

公司人员管理系统源代码#include#include#include#include//全局数据,对象double ManagerSalary; //经理固定月薪double SalesManagerSalary; //销售经理固定月薪double SalesManagerPercent; //销售经理提成%double SalesPercent; //销售人员提成%double WagePerHour; //技术人员小时工资int ID; //员工标识(要保证唯一)class Person //员工类{protected:int No; //编号char Name[20]; //姓名int Duty; //岗位double Earning; //收入Person *next;public:Person(char ID,char *Name,int Duty){this->Duty=Duty;strcpy(this->Name,Name);this->No=ID;}virtual void CalcSalary()=0;virtual void Output()=0;friend class Company;};class Manager:public Person //经理类{public:Manager(char ID,char *Name,int Duty):Person(ID,Name,Duty){}void CalcSalary(){Earning=ManagerSalary;}void Output(){CalcSalary();cout<<no<<"\t"<<name<<"\t经理\t"<<earning<<endl;}};class SalesManager:public Person //销售经理类{private:double Amount;public:SalesManager(char ID,char *Name,int Duty):Person(ID,Name,Duty){}void SetAmount(double s){Amount=s;}void CalcSalary(){Earning=SalesManagerSalary+Amount*SalesManagerPerce nt/100;}void Output(){CalcSalary();cout<<no<<"\t"<<name<<"\t销售经理\t"<<earning<<endl;}};class Technician:public Person //技术员类{private:double t;public:Technician(char ID,char *Name,int Duty,double T):Person(ID,Name,Duty){this->t=T;}double GetT(){return t;}void SetT(double T){this->t=T;}{Earning=WagePerHour*t;}void Output(){CalcSalary();cout<<no<<"\t"<<name<<"\t技术员\t"<<t<<"\t"<<earning<<endl;}};class Sales:public Person //销售员类{private:double Amount;public:Sales(char ID,char *Name,int Duty,double Amount):Person(ID,Name,Duty){this->Amount=Amount;}double GetAmount(){return Amount;}void SetAmount(double Amount){this->Amount=Amount;}{Earning=SalesPercent/100*Amount;}void Output(){CalcSalary();cout<<no<<"\t"<<name<<"\t销售员\t"<<amount<<"\t"<<earning<<endl;}};class Company //公司类{private:Person *Worker; //员工表void Clear(); //清除内存中数据public:Company(){Worker=0;Load();}~Company(){Person *p;p=Worker;while(p){p=p->next;delete Worker;Worker=p;}Worker=0;}void Add(); //增加人员void Delete(); //删除人员void Modify(); //修改人员void Query(); //查询人员void Set(); //基础数据设置void Save(); //数据存盘(包括基础数据,人员数据)void Load(); //数据装入(包括基础数据,人员数据)};void Company::Clear() //清除内存中人员数据(内部使用) {Person* p=Worker;while(p){Worker=p->next;delete p;p=Worker;}}void Company::Add(){Person *p; //新结点指针int Duty;char Name[20</no<<"\t"<<name<<"\t销售员\t"<<amount<<"\t"<<earning<<endl;</no<<"\t"<<name<<"\t技术员\t"<<t<<"\t"<<earning<<endl;</no<<"\t"<<name<<"\t销售经理\t"<<earning<<endl;</no<<"\t"<<name<<"\t经理\t"<<earning<<endl;];double Amount,T;cout<<"\n** 新增员工 **\n";//输入员工信息ID++;cout<<"输入岗位(1-经理2-销售经理3-销售员4-技术员):"; cin>>Duty;cout<<"输入姓名:"; cin>>Name;if(Duty==3){cout<<"本月销售额:"; cin>>Amount;}else if(Duty==4){cout<<"本月工作小时数(0-168):";cin>>T;}//创建新员工结点switch(Duty){case 1:p=new Manager(ID,Name,Duty); break; case 2:p=new SalesManager(ID,Name,Duty); break; case 3:p=new Sales(ID,Name,Duty,Amount); break; case 4:p=new Technician(ID,Name,Duty,T); break; }p->next=0;//员工结点加入链表if(Worker) //若已经存在结点{Person *p2;p2=Worker;while(p2->next) //查找尾结点{p2=p2->next;}p2->next=p; //连接}else //若不存在结点(表空){Worker=p; //连接}}void Company::Delete() //删除人员{int No;cout<<"\n** 删除员工 **\n";cout<<"ID:"; cin>>No;//查找要删除的结点Person *p1,*p2; p1=Worker;while(p1){if(p1->No==No)break;else{p2=p1;p1=p1->next;}}//删除结点if(p1!=NULL)//若找到结点,则删除{if(p1==Worker) //若要删除的结点是第一个结点{Worker=p1->next;delete p1;}else //若要删除的结点是后续结点{p2->next=p1->next;delete p1;}cout<<"找到并删除\n";}else //未找到结点cout<<"未找到!\n";}void Company::Modify(){int No,Duty;char Name[20];double Amount,T;cout<<"\n** 修改员工 **\n";cout<<"ID:"; cin>>No;//查找要修改的结点Person *p1,*p2; p1=Worker;while(p1){if(p1->No==No)break;else{p2=p1;p1=p1->next;}}//修改结点if(p1!=NULL)//若找到结点{p1->Output();cout<<"调整岗位(1-经理2-销售经理3-销售员4-技术员):";cin>>Duty;if(p1->Duty!=Duty) //若岗位发生变动{//修改其它数据cout<<"输入姓名:"; cin>>Name;if(Duty==3){cout<<"本月销售额:"; cin>>Amount;}else if(Duty==4){cout<<"本月工作小时数(0-168):";cin>>T;}//创建新员工结点Person *p3;switch(Duty){case 1:p3=new Manager(p1->No,Name,Duty); break;case 2:p3=new SalesManager(p1->No,Name,Duty); break;case 3:p3=new Sales(p1->No,Name,Duty,Amount); break;case 4:p3=new Technician(p1->No,Name,Duty,T); break;}//员工结点替换到链表p3->next=p1->next;if(p1==Worker) //若要替换的结点是第一个结点Worker=p3;else //若要删除的结点是后续结点p2->next=p3;//删除原来的员工结点delete p1;}else //若岗位没有变动{cout<<"输入姓名:"; cin>>p1->Name;if(Duty==3){cout<<"本月销售额:";cin>>Amount; ((Sales *)p1)->SetAmount(Amount);}else if(Duty==4){cout<<"本月工作小时数(0-168):";cin>>T; ((T echnician *)p1)->SetT(T);}}cout<<"修改成功!\n";}else //未找到结点cout<<"未找到!\n";}void Company::Query(){cout<<"\n** 查询人员本月销售信息 **\n";double sum=0; //销售额总和Person *p=Worker;while(p){if(p->Duty==3)sum+=((Sales *)p)->GetAmount();p=p->next;}p=Worker;double sum2=0; //工资总和while(p){if(p->Duty==2)((SalesManager *)p)->SetAmount(sum);p->Output();sum2+=p->Earning;p=p->next;}cout<<"本月盈利:"<<sum*0.20-sum2<<endl;cout<<"(按照20%利润计算)\n";}void Company::Set(){cout<<"\n** 设置基础数据 **\n";cout<<"经理固定月薪["<<managersalary<<"元]:"; cin>>ManagerSalary;cout<<"销售经理固定月薪["<<salesmanagersalary<<"元]:"; cin>>SalesManagerSalary;cout<<"销售经理提成["<<salesmanagerpercent<<"%]:";cin>>SalesManagerPercent;cout<<"销售人员提成["<<salespercent<<"%]:";cin>>SalesPercent;cout<<"技术人员小时工资["<<wageperhour<<"(元cin>>WagePerHour;cout<<"员工标识[>="<<id<<"]:";cin>>ID;}void Company::Save() //数据存盘(包括基础数据,人员数据),均采用文本文件{ofstream fPerson,fBase;char c;cout<<"\n保存人员和基础数据,是否继续?[Y/N]:"; cin>>c;if(toupper(c)!='Y')return;//保存人员编号、姓名、岗位fPerson.open("person.txt",ios::out);Person *p=Worker;while(p){fPerson<No<<"\t"<Name<<"\t"<Duty<<"\t";if(p->Duty==3)fPerson<<((Sales*)p)->GetAmount()<<"\t";else if(p->Duty==4)fPerson<<((Technician *)p)->GetT()<<"\t";fPerson<<endl;p=p->next;}fPerson.close();//保存基础数据fBase.open("base.txt",ios::out);fBase<<"经理固定月薪\t"<<managersalary<fBase<<"销售经理固定月薪\t"<<salesmanagersalary< fBase<<"销售经理提成%\t"<<salesmanagerpercent< fBase<<"销售人员提成%\t"<<salespercent<fBase<<"技术人员小时工资\t"<<wageperhour<fBase<<"ID\t"<<id<<endl;fPerson.close();cout<<"\n保存人员和基础数据已经完成...\n";}void Company::Load() //数据装入(包括基础数据,人员数据) {//基础数据装入ifstream fBase;char buf[80]; //buf用于保存数据文件中的注释字符串fBase.open("base.txt",ios::in);fBase>>buf>>ManagerSalary; //经理固定月薪fBase>>buf>>SalesManagerSalary; //销售经理固定月薪fBase>>buf>>SalesManagerPercent; //销售经理提成%fBase>>buf>>SalesPercent; //销售人员提成%fBase>>buf>>WagePerHour; //技术人员小时工资fBase>>buf>>ID; //员工标识fBase.close();//清除内存人员数据Clear();//人员数据数据装入ifstream fPerson;Person *p=Worker;int No; char Name[20]; int Duty;double Amount,T;fPerson.open("person.txt",ios::in);//读一条记录fPerson>>No>>Name>>Duty;if(Duty==3)fPerson>>Amount;else if(Duty==4)fPerson>>T;while(fPerson.good()){//创建员工结点switch(Duty){case 1:p=new Manager(No,Name,Duty); break;case 2:p=new SalesManager(No,Name,Duty); break;case 3:p=new Sales(No,Name,Duty,Amount); break;case 4:p=new Technician(No,Name,Duty,T); brea</id<<endl;</wageperhour<</salespercent<</salesmanagerpercent< </salesmanagersalary<</managersalary<</endl;</id<<"]:";</wageperhour<<"(元></salespercent<<"%]:";</salesmanagerpercent<<"%]:";</salesmanagersalary<<"元]:";></managersalary<<"元]:"; </sum*0.20-sum2<<endl;k;}p->next=0;//员工结点加入链表if(Worker) //若已经存在结点{Person *p2;p2=Worker;while(p2->next) //查找尾结点{p2=p2->next;}p2->next=p; //连接}else //若不存在结点(表空){Worker=p; //连接}//读下一条记录fPerson>>No>>Name>>Duty;if(Duty==3)fPerson>>Amount;else if(Duty==4)fPerson>>T;}fPerson.close();cout<<"\n人员和基础数据已经装入...\n";void main(){char c;Company a;do{cout<<"\n*** 公司人员管理系统 ***\n"; cout<<"1-增加人员\n";cout<<"2-删除人员\n";cout<<"3-修改人员\n";cout<<"4-查询本月经营信息\n"; cout<<"5-基础数据设置\n";cout<<"6-数据存盘\n";cout<<"7-数据装入\n";cout<<"8-退出\t请选择(1-8):";cin>>c;switch(c){case '1': a.Add(); break;case '2': a.Delete();break;case '3': a.Modify();break;case '4': a.Query(); break;case '5': a.Set(); break;case '6': a.Save(); break;case '7': a.Load(); break;}}while(c!='8');。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 100struct member_info{char xm[7];char xb[3];char sr[15];char whcd[13];char zc[17];char sfzh[19];char lxdh[12];int gl;int nl;};struct member_info member[N+1];int CurrentCount=0;void input(){char sfjx=1;while(sfjx!=0){if(CurrentCount==N){printf("\n人数已达上限,不能添加!!!\n");sfjx=0;}else{CurrentCount++;printf("\n请输入员工信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):\n");scanf("%s%s%s%d%s%s%s%d%s",member[CurrentCount].xm,member[CurrentCount].xb,memb er[CurrentCount].sr,&member[CurrentCount].nl,member[CurrentCount].whcd,member[CurrentC ount].lxdh,member[CurrentCount].sfzh,&member[CurrentCount].gl,member[CurrentCount].zc);printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}}printf("人员已排序");int i,j;for(i=1;i<CurrentCount;i++)for(j=CurrentCount;j>i;j--)if(strcmp(member[j].sfzh,member[j-1].sfzh)<0){member[0]=member[j];member[j]=member[j-1];member[j-1]=member[0];}printf("\n 人事基本信息表\n");printf(" 序号姓名性别生日年龄文化程度联系电话身份证号码工龄职称\n");for(i=1;i<=CurrentCount;i++)printf("%4d %6s%3s%11s%3d%8s%12s%20s%3d%5s\n",i,member[i].xm,member[i].xb,member[ i].sr,member[i].nl,member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc);system("pause");}void save(){FILE *fp;fp=fopen("ygjbxx.txt","w");if(fp==NULL)printf("\n文件打开不成功,信息无法保存!!!\n");else{fprintf(fp,"%d",CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fp,"\n%8s%4s%16s%4d%14s%13s%20s%4d%18s",member[i].xm,member[i].xb,member[ i].sr,member[i].nl,member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc);fclose(fp);printf("\n信息已成功保存!!!\n");}system("pause");}void read(){FILE *fp;fp=fopen("ygjbxx.txt","r");if(fp==NULL)printf("\n文件打开不成功,信息无法读取!!!\n");else{fscanf(fp,"%d",&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fp,"%s%s%s%d%s%s%s%d%s",member[i].xm,member[i].xb,member[i].sr,&member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,&member[i].gl,member[i].zc);printf("姓名:%s性别:%s生日:%s年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %s\n",member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxd h,member[i].sfzh,member[i].gl,member[i].zc);}fclose(fp);printf("\n信息已成功读取!!!\n");}system("pause");}void search(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf("\n请输入一个待查员工的身份证号码:");scanf("%s",dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf("查无此人!!!\n");else{printf("\n此人详细信息如下:\n");printf("姓名:%s性别:%s生日:%s年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %s\n",member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxd h,member[i].sfzh,member[i].gl,member[i].zc);}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}void del(){char dcsfzh[19];int sfjx=1,i,j;while(sfjx!=0){printf("\n请输入一个待删员工的身份证号码:");scanf("%s",dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf("查无此人!!!\n");else{printf("\n此人详细信息如下:\n");printf("姓名:%s性别:%s生日:%s年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %s\n",member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxd h,member[i].sfzh,member[i].gl,member[i].zc);printf("\n按任意键开始删除......\n");system("pause");for(j=i+1;j<=CurrentCount;j++)member[j-1]=member[j];CurrentCount--;printf("\n已成功删除......\n");system("pause");}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}void modify(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf("\n请输入一个待修改员工的身份证号码:");scanf("%s",dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf("查无此人!!!\n");else{printf("\n此人详细信息如下:\n");printf("姓名:%s性别:%s生日:%s年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %s\n",member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxd h,member[i].sfzh,member[i].gl,member[i].zc);printf("\n请输入新内容......\n");printf("\n请输入人员相关信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):");scanf("%s%s%s%d%s%s%s%d%s",member[CurrentCount].xm,member[CurrentCount].xb,memb er[CurrentCount].sr,&member[CurrentCount].nl,member[CurrentCount].whcd,member[CurrentC ount].lxdh,member[CurrentCount].sfzh,&member[CurrentCount].gl,member[CurrentCount].zc);printf("\n已成功修改......\n");system("pause");}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}int check(){int count=0,name,pass;while(count<=2){printf("\n请输入用户名及密码:");scanf("%d%d",&name,&pass);count++;if((name==1)&&(pass==1))count=10;elseif(count>2)count=5;}if(count==10)return 0;elsereturn 1;}struct mem_gz{float jbgz;float cql;float jj;float kk;float grsd;float sf;};struct mem_gz mem[N+1];void inputgz(){char sfjx=1;CurrentCount=0;while(sfjx!=0){if(CurrentCount==N){printf("\n工资已添加完毕,无法添加!!!\n");sfjx=0;}else{CurrentCount++;printf("请输入身份证号码为:%s的员工工资资料\n",member[CurrentCount].sfzh);printf("\n请输入员工工资信息(基本工资考勤奖金扣款个人所得税):\n");scanf("%f%f%f%f%f",&mem[CurrentCount].jbgz,&mem[CurrentCount].cql,&mem[CurrentCoun t].jj,&mem[CurrentCount].kk,&mem[CurrentCount].grsd);mem[CurrentCount].sf=mem[CurrentCount].jbgz*mem[CurrentCount].cql+mem[CurrentCount].jj -mem[CurrentCount].kk-mem[CurrentCount].grsd;}printf("\n是否继续(0--结束,其它--继续):\n");scanf("%d",&sfjx);}system("pause");}void savegz(){FILE *fq;fq=fopen("yggzxx.txt","w");if(fq==NULL)printf("\n文件打开不成功,信息无法保存!!!\n");else{fprintf(fq,"%d",CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fq,"\n%f %f %f %f %f %f",mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd,mem [i].sf);fclose(fq);printf("\n信息已成功保存!!!\n");}system("pause");}void readgz(){FILE *fq;fq=fopen("yggzxx.txt","r");if(fq==NULL)printf("\n文件打开不成功,信息无法读取!!!\n");else{fscanf(fq,"%d",&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fq,"%f%f%f%f%f%f",&mem[i].jbgz,&mem[i].cql,&mem[i].jj,&mem[i].kk,&mem[i].grsd, &mem[i].sf);printf("基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%f\n",mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);}fclose(fq);printf("\n信息已成功读取!!!\n");}system("pause");}void searchgz(){int dcbh;int sfjx=1;while(sfjx!=0){printf("\n请输入一个待查员工编号(身份证号从小到大的顺序):");scanf("%d",&dcbh);if(dcbh<1||dcbh>CurrentCount)printf("查无此人!!!\n");else{printf("\n此人工资信息如下:\n");printf("基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%f\n",mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dcbh].kk,mem[dcbh].grsd,mem[dcb h].sf);}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}void delgz(){int dcbh;int sfjx=1,j;while(sfjx!=0){printf("\n请输入一个待删工资的编号:");scanf("%d",&dcbh);if(dcbh<1||dcbh>CurrentCount)printf("查无此人!!!\n");else{printf("\n此人工资信息如下:\n");printf("基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%f\n",mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dcbh].kk,mem[dcbh].grsd,mem[dcb h].sf);printf("\n按任意键开始删除......\n");system("pause");for(j=dcbh+1;j<=CurrentCount;j++)mem[j-1]=mem[j];CurrentCount--;printf("\n已成功删除......\n");system("pause");}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}void modifygz(){int dcbh;int sfjx=1;while(sfjx!=0)printf("\n请输入一个待修改工资员工的编号:");scanf("%d",&dcbh);if(dcbh<1||dcbh>CurrentCount)printf("查无此人!!!\n");else{printf("\n此人工资信息如下:\n");printf("基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%f\n",mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dcbh].kk,mem[dcbh].grsd,mem[dcb h].sf);printf("\n请输入新内容......\n");printf("\n请输入人员工资信息(基本工资考勤奖金扣款个人所得税实发工资):");scanf("%f%f%f%f",&mem[CurrentCount].jbgz,&mem[dcbh].cql,&mem[dcbh].jj,&mem[dcbh].kk ,&mem[dcbh].grsd,&mem[dcbh].sf);printf("\n已成功修改......\n");system("pause");}printf("\n是否继续(0--结束,其它--继续):");scanf("%d",&sfjx);}system("pause");}void listgz(){int i;printf("\n 员工工资信息表\n");printf(" 序号基本工资考勤奖金扣款个人所得税实发工资\n");for(i=1;i<=CurrentCount;i++)printf("%4d %8f%8f%8f%8f",i,mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd,mem[i]. sf);system("pause");}void main(){int xz=1;printf(" *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*\n");printf(" * 欢迎使用人事工资管理系统*\n");printf(" ***************************************\n\n\n");if(check()!=0)printf("\n你无权使用本系统......\n\n");system("pause");}else{while(xz!=0){printf("\n请选择相应功能:\n");printf("1-录入\n2-查询\n3-修改\n4-删除\n5-保存\n6-读取\n7-输入员工工资\n8-保存工资信息\n9-读取工资信息\n10-修改工资信息\n11-删除工资信息\n12-工资列表\n0-结束\n请输入选择:");scanf("%d",&xz);switch(xz){case 1:input();break;case 2:search();break;case 3:modify();break;case 4:del();break;case 5:save();break;case 6:read();break;case 7:inputgz();break;case 8:savegz();break;case 9:readgz();break;case 10:modifygz();break;case 11:delgz();break;case 12:listgz();break;case 0:printf("\n\n谢谢使用本系统!\n\n");system("pause");break;default:printf("\n无此功能,请重新选择......\n");system("pause");}}}}。

相关文档
最新文档