人事管理系统大数据库源代码
【人事】人事工资管理系统源代码java
![【人事】人事工资管理系统源代码java](https://img.taocdn.com/s3/m/d39e7f851ed9ad51f11df289.png)
【关键字】人事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()//在此构造方法中实现有关程序的加载,同时捕捉异常。
人力资源管理系统源代码
![人力资源管理系统源代码](https://img.taocdn.com/s3/m/20ddb50c77c66137ee06eff9aef8941ea76e4b60.png)
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。
人事管理系统数据库设计--sql代码
![人事管理系统数据库设计--sql代码](https://img.taocdn.com/s3/m/c878ca2d360cba1aa911da07.png)
建立数据库:create database 数据库建表:create table 部门信息表(部门编号char(2)primary key ,部门名称nchar(14),部门职能nchar(14),部门人数char (4))gocreate table 管理员信息表(用户名nchar(4)primary key ,密码char(10) ,)gocreate table 用户信息表(用户名char(10) primary key ,用户类型char(10),密码char(10))gocreate table 员工工作岗位表(姓名nchar(4)primary key ,员工编号char(4)工作岗位nchar(3) ,部门名称nchar(10),参加工作时间char (4))gocreate table 员工学历信息表(姓名nchar(4) primary key ,员工编号char(4)学历nchar(2),毕业时间char(10),毕业院校nchar (10),外语情况nchar(10),专业nchar(10))gocreate table 员工婚姻情况表(姓名nchar(4) primary key ,员工编号char(4)婚姻情况nchar(2) ,配偶姓名nchar(4),配偶年龄char (3),工作单位nchar(10),)gocreate table 员工基本信息表(员工编号char(4)primary key ,姓名nchar(4),性别nchar(1),民族nchar (3),出生年月char(14),学历nchar(10),政治面貌nchar(3),婚姻状况nchar(2),部门名称nchar(10),工作岗位nchar(10),)建立视图:CREATE VIEW 按员工工作岗位查询asSELECT 员工工作岗位表。
工作岗位, 员工基本信息表。
员工编号,员工基本信息表。
姓名, 员工基本信息表.性别, 员工基本信息表。
数据库人事管理系统代码
![数据库人事管理系统代码](https://img.taocdn.com/s3/m/52de7c0fcc1755270722082e.png)
on update cascade,
);
create table degree_info (
Degree_no varchar(15) primary key,
);
--创建插入员工存储过程
create procedure insertworker
@Worker_no varchar(15) ,--工号
@Worker_name varchar(8) ,--姓名
@Sex varchar(2) ,--性别
--插入学历信息
insert into degree_info(Degree_no,Worker_no,Degree,Major,School,Gradute_date)
values (@Degree_no,@Worker_no,@Degree,@Major,@School,@Gradute_date)
Worker_no varchar(15) ,
Degree varchar(4) ,
Major varchar(25) ,
School varchar(25) ,
Gradute_date date ,
foreign key (Worker_no) references worker_info(Worker_no) on update cascade on delete cascade
--插入部门存储过程
create procedure add_department
@Department_no varchar(15) ,
公司人事管理系统代码和文档
![公司人事管理系统代码和文档](https://img.taocdn.com/s3/m/e4c9070caef8941ea66e05c1.png)
公司人事管理系统代码和文档公司人事管理系统专业软件工程移动应用开发学生姓名郭迁迁班级学号指导教师完成日期2014/6/20 1、功能图1、创建系统2、显示所有员工信息3、添加员工信息4、删除员工信息5、查找员工信息6、修改员工信息7、对员工月薪进行排序8、数据存盘0、退出系统输入账号密码进入系统公司人事管理系统2、类图技术经理类业务经理类文秘类技术人员类财务人员类经理类Person 类(基类) 3、界面不同用户进入的选择界面老板进入的界面员工进入的界面 4、数据存储结构写入文件退出系统进行相应的操作读取文件信息保存方式采用二进制进行数据的保存结构在每对员工的数据信息进行操作时,首先读取文件,然后进行下面增删查改等相应的操作,在对相应操作后自动进行数据的存盘读取方式读取链表,写入文件。
5、总结和体会通过这一次 C 课程设计,让我学到了很多,让我学到对一个大型系统的设计不止是对代码的实现,要有一个洞察全局的心,就是先想好,有一个大致的规划,然后再去用代码实现非常容易,如果不想好就会写代码,那么会遇到很多问题,有时会使所做的功夫白费,所以提前想好是非常重要的。
在写公司人事管理系统时我遇到了很多问题,例如对文件的添加,使自己没有一点办法,在老师的耐心讲解下,终于完成了文件的添加,使自己对于文件有了新的认识,老师为我们讲解了类的实现,使自己有了新的理解,还让我体会到了交流的重要性,我虽然是社团的人员,但是很少和别人交流。
我要学会去和别人交流想法。
代码如下include include using namespace std; void Link; class Person { protected char name[10];// 姓名 char level[20];// 级别 int NO;// 编号 int Flag;// 标记 public Person *next; Personchar na[10],char le[20],int no,int F; Person{} Person{} virtual void Show{} virtual double Wage{} int Get_NO; char *Get_Name; char *Get_Level; int Get_Flag; int *Get_Flag1; };PersonPersonchar na[10],char le[20],int no,int F { strcpyname,na; strcpylevel,le; NOno; FlagF; } intPersonGet_NO { return NO; } char *PersonGet_Name { return name; } char *PersonGet_Level { return level; } intPersonGet_Flag { return Flag; } int *PersonGet_Flag1 { return } class Managerpublic Person// 经理 manager. { public Managerchar na[10],char le[20],int no,int FPersonna,le,no,F{} Manager{} double Wage; void Show; }; double ManagerWage { return 5000; } void ManagerShow { cout n ; noi;// 编号ifn1 { strcpyle, 经理““ ;cout na; F1; p1new Managerna,le,no,F; }else ifn2 { strcpyle,技术“人员“ ;cout na;cout dm ;F2;p1new Technical na,le,dm,no,F; }else ifn3{strcpyle,业务“人员“; cout na;cout y;cout x;F3;p1new Businessna,le,y,x,no,F; }else ifn4{ strcpyle,业“务经理“ ;cout na;cout y;cout x;F4;p1new Business_Managerna,le,y,x,no,F; }else ifn5{strcpyle,文秘““; cout na; F5; p1new Secretaryna,le,no,F; } p2-nextp1; p2p1; i;cout ch; }whilech y ||ch Y ; p2-nextNULL; } void BossShow//显示本月员工的信息{Person *phead-next;ifpNULL{cout Show; pp-next; } } void BossAdd_Information//增添员工信息{ char na[10];char le[20]; int dm;double y;double x;int no;char ch; int F;do{ Person*phead,*p1;whilep-nextNULL{ pp-next; } int n; cout n; switchn {case 1strcpyle , “经理“ ;cout na; cout no; F1; p1new Managerna,le,no,F;break;case2strcpyle, 技术“人员“ ; cout na;cout dm;cout no;F2;p1new Technical na,le,dm,no,F;break; case 3strcpyle,业务人员““; cout na; cout y; cout x; cout no; F3; p1new Businessna,le,y,x,no,F;break; case 4strcpyle, 业“务经理“ ; coutna;cout y;cout x; cout no; F4;p1new Business_Managerna,le,y,x,no,F;break; case 5strcpyle,文秘““;cout na;cout no;F5; p1new Secretaryna,le,no,F;break; defaultcout nextp1;p1-nextNULL;cout ch ; }whilech y ||chY; }void BossDelete_Information//删除指定员工信息{ Person *p1,*p2; int num; char na[10]; int n; char ch; do { intflag0; cout n; ifn1 { cout num; p1head; whilep1-nextNULL { p2p1; p1p1-next; ifp1-Get_NOnum{ p2-nextp1-next; flag1; p1 NULL; delete p1; break; } } } else ifn2 { cout na; p1head; whilep1-nextNULL{p2p1;p1p1-next; ifstrcmpp1-Get_Name,na0 { p2-nextp1-next; p1NULL; delete p1; flag1; break; } } } else { cout删除成功删除失败 ,可能未存入此员工信息or 指令错误,请你核实后继续ch ; }whilech y||ch Y ;BossShow;// 调用函数显示结果}void BossSearch_Information// 查找信息{char ch;do{Person *p1head-next;int S_num;cout S_num;whilep1NULL { ifp1-Get_NOS_num { cout Show; break; } p1p1-next; } coutch; }whilech Y ||ch y ; } void BossStaff//员工功能 { cout next;ifp1NULL{cout name;whilep1NULL {ifstrcmpp1-Get_Name,name0{cout S_num; ifp1-Get_NOS_num { cout Show; cout n; ifn0 { exit-1;}} else {cout next; }} void BossModify_Information//修改指定员工的信息{Person *p1head-next,*p2head,*p3NULL;char na[10]; char le[20]; int dm; double y; double x; int no; int num;int F;cout num;int i0;whilep1NULL { ifp1-Get_NOnum { int n; cout Show;cout n; switchn{case 1strcpyle,经理““ ;cout na; cout no; F1; p3new Managerna,le,no,F;break; case2strcpyle, 技术“人员“ ; cout n a; cout dm ; cout no; F2;p3new Technical na,le,dm,no,F;break; case 3strcpyle, 业务人员““; cout na; cout y; cout x; cout no; F3; p3new Businessna,le,y,x,no,F;break; case 4strcpyle, 业务“经理“ ;coutna;cout y;cout x;cout no; F4;p3new Business_Managerna,le,y,x,no,F;break;case 5strcpyle,文秘““;cout na;cout no;F5; p3new Secretaryna,le,no,F;break; defaultcout nextp1-next; p2-nextp3; delete p1; i1; } p1p1-next;p2p2-next; } ifi0 { cout nextNULL { min1phead; minqhead-next; whileqNULL { ifq-Wage min-Wage { min1p; minq; } qq-next;pp-next; } min1-nextmin-next;min-nextNULL; h-nextmin; hmin;}headnewhead; cout next;ofstream myfile“员工管理 .txt“; ofstream my“郭迁迁 .txt“; ifmyfile||my{ coutGet_Flag; switchn { case 1sizesizeofManager;break; case2sizesizeofTechnical ;break; case 3sizesizeofBusiness;break;case4sizesizeofBusiness_Manager;break;case5sizesizeofSecretary;break;}my.writechar*p-Get_Flag1,sizeofint;myfile.writechar*p,size;pp-next;}whilepNULL;myfile.close; my.close; }void BossRead_File { Person *p1,*p2; char na[10];char jb[20];intdm; double y; double x; int no; int num; int F; ifstream infile员工管理 .txt“ifstream;in “郭迁迁 .txt“ifinfile||in;{ cout 0 { p1-nextp2; p1p2; } int n; in.readchar * switchn { case1sizesizeofManagerna,jb,no,F; p2new Managerna,jb,no,F;break;case 2sizesizeofTechnical na,jb,dm,no,F; p2new Technicalna,jb,dm,no,F;break; case 3sizesizeofBusinessna,jb,y,x,no,F;p2newBusinessna,jb,y,x,no,F;break;case4sizesizeofBusiness_Managerna,jb,y,x,no,F;p2newBusiness_Managerna,jb,y,x,no,F;break;case5sizesizeofSecretaryna,jb,no,F; p2new Secretaryna,jb,no,F;break; } i; }whileinfile.readchar *p2,size;p2-nextNULL;in.close;infile.close;}bool Account// 帐号{ char z[7];ifstream ifile“ Account.txt“ ifi,iosout;le.getlinez,7;ifile.close;int flag1;whileflag {char zh[7];cout m;ifstrcmpmm,m0{ return true; break;}else{flag;ifflag2 { return false; } } } } void Instructions { char arry[1000];ifstream ifile使“ 用说明.txt“ ,iosout;ifile.getlinearry,1000;ifile. close; cout endl; cout“\t\t\t欢迎大家阅读使用说明“ endl endl; cout arry endl; } void Link { Boss b; int n;int m0; while1 { cout“ t****************“endl; cout。
人事管理系统数据库源代码
![人事管理系统数据库源代码](https://img.taocdn.com/s3/m/0c54c229854769eae009581b6bd97f192279bffc.png)
人事管理系统数据库源代码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;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++)< p="">{for(int j=0;j<ds.tables[0].columns.count;j++)< p="">{String data=(ds.Tables[0].Rows[i][j].T oString()).Trim();if(data==TextBox1.Text.Trim()){TextBox2.Text=ds.T ables[0] .Rows[i]["部门代码"].T oString();TextBox3.Text=ds.T ables[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;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= new SqlCommand(strCount, con);SqlDataReader dr = .ExecuteReader();string strUsername = "", strPassword = "";while (dr.Read()){if (TextBox1.Text == dr["编号"].ToString()||TextBox2.Text == dr["用户密码"].ToString()){strUsername = dr["编号"].T oString();strPassword = dr["用户密码"].T oString();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;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;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.T ables[0].Rows[i][j].ToString()).Trim();if (data == TextBox1.Text.Trim()){TextBox2.Text = ds.Tables[0].Rows[i]["应发工资"].T oString();TextBox3.Text = ds.Tables[0].Rows[i]["岗位津贴"].T oString();TextBox4.Text = ds.Tables[0].Rows[i]["奖励"].T oString();TextBox5.Text = 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;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class人员信息: System.Web.UI.Pageprotected 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;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++)< p="">{for(int j=0;j<ds.tables[0].columns.count;j++)< p="">{String data=(ds.Tables[0].Rows[i][j].T oString()).Trim();if(data==TextBox1.Text.Trim()){TextBox2.Text=ds.T ables[0] .Rows[i]["应发工资"].T oString();TextBox3.Text=ds.T ables[0] .Rows[i]["岗位津贴"].T oString();TextBox4.Text=ds.T ables[0] .Rows[i]["奖励"].T oString();TextBox5.Text = ds.Tables[0].Rows[i]["保险"].T oString();find=true;}}}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;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.T ext.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){}}}</ds.tables[0].columns.count;j++)<> </ds.tables[0].rows.count;i++)<></ds.tables[0].columns.count;j++)<> </ds.tables[0].rows.count;i++)<>。
人事管理系统毕业设计(设计与代码实现)
![人事管理系统毕业设计(设计与代码实现)](https://img.taocdn.com/s3/m/99cd904fe518964bcf847c37.png)
摘要随着计算机技术的飞速发展,计算机在企业管理中应用的普及,利用计算机实现企业人事管理势在必行。
本系统结合公司实际的人事管理制度,经过实际的需求分析,采用功能强大的Visual Basic6.0作为开发工具而开发出来的单机版人事管理系统。
整个系统从符合操作简便、界面友好、灵活、实用、安全的要求出发,完成人事管理的全过程,包括新进员工加入时人事档案的建立、老员工的转出、职位等的变动引起职工信息的修改、员工信息查询、统计等人事管理工作以及新进员的新增、老员工修改等管理工作。
经过实际使用证明,本文所设计的人事管理系统可以满足公司人事管理方面的需要。
关键词:VB、数据库、窗体、测试、目录第一章概述 (4)1.1、本课题的来源 (4)1.2、本论文的目的、内容及作者主要贡献 (4)第二章开好发工具的选择 (4)第三章系统调研及可行性分析 (7)3.1、系统调研 (7)3.2、可靠性分析概述 (8)3.3、技术可行性分析 (8)第四章系统分析 (9)4.1、系统需求分析 (9)4.2、数据流程图 (10)第五章系统总体设计 (10)5.1、功能描述 (10)5.2、系统操作流程图 (11)第六章系统详细设计 (12)6.1、数据库设计 (12)6.2、系统主要界面 (13)第七章系统测试 (16)7.1、测试举例 (16)7.2、测试项目 (17)7.3、测试方法 (18)致谢 (19)参考文献 (20)附件:源程序…………………………………………………………………………21第一章概述1、本课题的来源随着计算机技术的飞速发展,计算机在企业管理中应用的普及,利用计算机实现企业人事管理势在必行。
对于大中型企业来说,利用计算机支持企业高效率完成劳动人事管理的日常事务,是适应现代企业制度要求、推动企业劳动人事管理走向科学化、规范化的必要条件;计算机管理所无法比拟的优点检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。
oracle课程设计人事管理系统(附源代码)
![oracle课程设计人事管理系统(附源代码)](https://img.taocdn.com/s3/m/eb204fc158f5f61fb73666d4.png)
item44=new JMenuItem("查询岗位信息");
item45=new JMenuItem("删除岗位信息");
item42.addActionListener(this);
item43.addActionListener(this);
}
}
class WindowMenu extends JFrame implements ActionListener{
JMenuBar menubar;
JMenu menu1,menu2,menu3,menu4,menu5,menu6,menu7;
JMenuItem item11,item12,item13,item14;
JMenuItem item46,item47,item48,item49;
JMenuItem item41;
inputdata input;
selectdata select;
alterdata alter;
deletedata delete;
inputshortdata inputs;
selectshortdata selects;
altershortdata alters;
deleteshortdata deletes;
inputdepart inputp;
alterdepart alterp;
selectdepart selectp;
deletepart deletep;
inputworker inputw;
alterworker alterw;
item49.addActionListener(this);
企业人事管理系统java源代码
![企业人事管理系统java源代码](https://img.taocdn.com/s3/m/8736fd015e0e7cd184254b35eefdc8d376ee146c.png)
企业⼈事管理系统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();}}。
高校人事管理系统程序设计源代码
![高校人事管理系统程序设计源代码](https://img.taocdn.com/s3/m/30241aaa3169a4517723a3f9.png)
目录新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。
错误!未定义书签。
? 头文件:错误!未定义书签。
? 源文件:错误!未定义书签。
新建一个头文件类,名字为:,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。
头文件:#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#企业人事管理系统源代码截图](https://img.taocdn.com/s3/m/a694e054aa00b52acfc7caea.png)
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;。
人事管理系统源代码
![人事管理系统源代码](https://img.taocdn.com/s3/m/65f6556168eae009581b6bd97f1922791788be70.png)
人事管理系统源代码第一篇:人事管理系统源代码#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的不断发展,传统的管理方式,消耗大量的人力物力,传统的方式已经赶不上时代的脚步,所以开发一个高效的企业人事财务管理系统,是非常必要的。
人事信息管理系统(含源代码)
![人事信息管理系统(含源代码)](https://img.taocdn.com/s3/m/27b21e6a27d3240c8447efd2.png)
*******************实践教学*******************兰州理工大学计算机与通信学院2013年春季学期C程序设计课程设计题目:人事信息管理系统专业班级:计算机二班*名:***学号:********指导教师:***成绩:前言人事信息管理系统是一种典型的管理信息系统。
管理信息系统(MIS)是一门跨越若干领域的新学科。
在强调管理,强调信息的现代社会中越来越普及。
管理系统能够实现管理信息系统化是一个企事业单位不可缺少的部分,它的内容对于企业的决策者和管理者来说都至关重要,所以人事信息管理系统应该能够为用户提供充足的信息和快捷的查询手段。
一直以来人们使用传统人工的方式管理档案,这种管理方式存在着许多缺点。
如:效率低、保密性差。
时间一长,将产生大量的文件和数据,这对于查找、更新和维护都带来了不少的困难。
因此,随着企业的壮大和发展,传统的管理方式已不在适应企业的需要。
而使用计算机对人事信息进行管理,具有手工管理所无法比拟的优点.例如:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。
这些优点能够极大地提高企事业单位人事信息管理工作的效率,是企事业单位人事管理部门的科学化、正规化管理的重要途径,也是企事业单位与世界接轨的重要途径。
人事信息资源管理系统是企业员工管理的一个重要内容。
当今社会人员流动越来越频繁,人事管理工作也变得越来越复杂。
如果能够实现人事管理的自动化,无疑将给企业管理部门带来很大的方便。
人事信息管理就是把分散在企业单位的职工信息实行统一、集中、规范的收集管理,建立分类编号管理、电脑存储查询等现代化、专业化的管理系统。
企业人事管理的对象是企业、企业化管理的事业单位及职工本人。
人事信息管理为企业单位和个人提供信息输入、信息修改、信息查询、工资调整、依据信息出具个人的基本档案等服务;为企业单位和个人提供信息的收集、整理、保管服务。
目录前言 (I)摘要 (I)1需求分析 (1)1.1问题描述 (1)1.2系统功能 (2)1.3编程环境与工具 (2)2总体设计 .................................................................................................................................... 错误!未定义书签。
人事管理系统数据库设计
![人事管理系统数据库设计](https://img.taocdn.com/s3/m/fa830cb3af1ffc4fff47ac96.png)
《数据库原理与应用》课程设计报告设计题目:人事管理系统小组成员:2011 年12 月目录前言 (2)第一部分:基本情况与小组介绍 (3)1基本情况 (3)2小组介绍 (3)第二部分:课程设计内容 (4)第一章绪论 (4)1课题简介 (4)2设计目的 (4)3设计内容 (5)第二章需求分析 (6)1功能需求 (6)2数据流图 (7)3数据字典 (9)第三章概念结构设计 (18)1局部E-R图 (18)2全局E-R图 (19)第四章逻辑结构设计 (20)1关系模式 (20)2数据库结构的详细设计 (20)第五章物理结构设计 (24)1建立索引 (24)2存储结构 (24)3数据库的建立 (24)第三部分:分析与总结 (28)1数据库分析 (28)2课题总结 (28)参考文献 (30)前言数据库技术是计算机科学技术发展最快,应用最为广泛的技术之一。
其在计算机设计,人工智能,电子商务,企业管理,科学计算等诸多领域均得到了广泛的应用,已经成为计算机信息系统和应用的核心技术和重要基础。
随着信息技术的飞速发展,信息化的大环境给各成人高校提出了实现校际互联,国际互联,实现静态资源共享,动态信息发布的要求;信息化对学生个人提出了驾驭和掌握最新信息技术的素质要求;信息技术提供了对教学进行重大革新的新手段;信息化也为提高教学质量,提高管理水平,工作效率创造了有效途径。
利用计算机支持教学高效率,完成人事管理的日常事务,是适应现代教学制度要求、推动人事管理走向科学化、规范化的必要条件;而人事管理是一项琐碎、复杂而又十分细致的工作,工资计算、发放、核算的工作量很大,不允许出错,如果实行手工操作,每月须手工填制大量的表格,这就会耗费工作人员大量的时间和精力,计算机进行人事管理工作,不仅能够保证各项准确无误、快速输出,而且还可以利用计算机对有关教学的各种信息进行统计,同时计算机具有手工管理所无法比拟的优点。
例如:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。
《数据库应用》课程设计——人事管理系统(java源代码)
![《数据库应用》课程设计——人事管理系统(java源代码)](https://img.taocdn.com/s3/m/ef282a82964bcf84b8d57b05.png)
《数据库应用》课程设计——人事管理系统(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);。
人事管理系统(源代码
![人事管理系统(源代码](https://img.taocdn.com/s3/m/f1d22ed159f5f61fb7360b4c2e3f5727a5e9241e.png)
附录:毕业设计程序清单设计题目人事管理系统教学班:学生姓名:学号:指导教师:完成日期: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++程序设计源代码](https://img.taocdn.com/s3/m/bb545d82360cba1aa811da79.png)
目录新建一个头文件类,名字为:Person.h,再建一个源文件,名字随意,代码按顺序粘贴进去即可运行。
(2)头文件: (2)源文件: (12)新建一个头文件类,名字为: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;}}a。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
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){} }}。