人事管理系统代码

合集下载

人力资源管理系统源代码

人力资源管理系统源代码

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代码

建立数据库: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 员工工作岗位表。

工作岗位, 员工基本信息表。

员工编号,员工基本信息表。

姓名, 员工基本信息表.性别, 员工基本信息表。

c语言设计的人事管理系统源码

c语言设计的人事管理系统源码

#include<iostream.h>#include<string.h>#include<iomanip.h>#include<fstream.h>#include<stdio.h>#include<stdlib.h>#include<conio.h>int k=1,i; //定义一个标志变量class birthday{ //定义出生年月日类public:int year;int month;int day;};class people{ //声明人员基类,以后在这个基础上派生出其它类public:people(){}virtual void enter(); //虚基函数,搭成一个框架,以后在此基础上扩充virtual void display();virtual int get_no(){return number;}virtual char * get_name(){return name;}virtual void change_infor(){} //信息修改函数virtual void readfile(){} //从文件中读virtual void write(){} //将信息写入文件people operator = (people p1); //运算符重载int operator == (people p1);virtual ~people(){};protected:char name[12];int number;char sex;birthday bir;char id[15];};people people::operator =(people p1)//定义运算符重载{strcpy(name,); number=p1.number; sex=p1.sex; bir.day=p1.bir.day;bir.month=p1.bir.month; bir.year=p1.bir.year;strcpy(id,p1.id);return p1;}int people::operator ==(people p1){if(id==p1.id) return 1;else return 0;}void people::enter(){ //定义信息输入函数cout<<"输入姓名:"; cin>>name;cout<<"输入编号:"; cin>>number;cout<<"输入性别:"; cin>>sex;cout<<"生日是(年月日):"; cin>>bir.year>>bir.month>>bir.day;cout<<"身份证号:";cin>>id;}void people::display(){ //定义信息显示函数cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(8)<<"性别"<<setw(8)<<"出生日期"<<setw(8)<<"身份证号"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(8)<<sex<<setw(8)<<bir.year<<setw(8)<<bir.mo nth<<setw(8)<<bir.day<<setw(8)<<id<<endl;}class student:virtual public people{ //以公有方式派生出学生类protected:char classnumber[20];public:student(){}virtual void enter(){people::enter();cout<<"输入班级名称:";cin>>classnumber;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~student(){};};class teacher:virtual public people{ //以公有方式派生出老师类protected:char principalship[16];char department[16];public:teacher(){}virtual void enter(){people::enter();cout<<"输入老师的职务:";cin>>principalship;cout<<"\n 输入老师所在的部门:";cin>>department;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~teacher(){}};//class graduate:virtual public student{ //以公有方式派生出研究生类protected:char subject[16];teacher adviser;public:graduate(){};virtual void enter(){student::enter();cout<<"输入研究生的专业:";cin>>subject;cout<<"输入导师的情况:"<<endl;adviser.enter();}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~graduate(){};};class teacher_asistant:public teacher,public graduate{ //以公有方式派生出助教类public:teacher_asistant(){};virtual void enter(){graduate::enter();cout<<"请输入助教生所在职务:";cin>>principalship;cout<<"请输入所在部门:";cin>>department;}virtual void display();virtual void readfile();virtual void write();virtual void change_infor();virtual ~teacher_asistant(){}};void student::display(){ //定义派生类学生的信息显示函数cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(12)<<"班级名称"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(10)<<id<<setw(12)<<classnumber<<endl;}void student::write(){ //定义派生类学生的信息写入文件函数student stu;char ch;ofstream myfile("student.txt",ios::app);do{stu.enter();myfile.write((char *)&stu,sizeof(stu));cout<<"还需要输入下个学生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void student::readfile(){ //定义派生类学生的读文件函数ifstream myfile("student.txt",ios::nocreate);while(myfile){student stu;if(myfile.read((char*)&stu,sizeof(stu))){if(stu.number!=-1) //删除一个学生的信息,通过不显示来定义删除stu.display();}}myfile.close();}void student::change_infor(){ //定义派生类学生的信息修改函数student stu;int num,p;cout<<"请输入你要修改或者删除的学生的编号:";cin>>num;fstream myfile("student.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&stu,sizeof(stu));if(num==stu.number){myfile.seekg(-sizeof(stu),ios::cur);cout<<"你是要修改还是要删除该学生的记录(1:删除2:修改):";cin>>p;if(p==1){stu.number=-1;break;}else {cout<<"请输入新的信息"<<endl;stu.enter();break;}}}myfile.write((char *)&stu,sizeof(stu));myfile.close();}void teacher::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(10)<<"职务"<<setw(10)<<"部门"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(12)<<id<<setw(10)<<principalship<<setw(10)<<department<<endl ;}void teacher::readfile(){ifstream myfile("teacher.txt",ios::nocreate);while(myfile){people *p;teacher tec;p=&tec;if(myfile.read((char*)&tec,sizeof(tec))){if(tec.number!=-1)p->display();}}myfile.close();}//void teacher::write(){teacher tec;char ch;ofstream myfile("teacher.txt",ios::app);do{tec.enter();myfile.write((char *)&tec,sizeof(tec));cout<<"还需要输入下个学生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void teacher::change_infor(){teacher tec;int num,p;cout<<"请输入你要修改或者删除的老师的编号:";cin>>num;fstream myfile("teacher.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&tec,sizeof(tec));if(num==tec.number){myfile.seekg(-sizeof(tec),ios::cur);cout<<"你是要修改还是要删除该老师的记录(1:删除2:修改):";cin>>p;if(p==1){tec.number=-1;break;}else {cout<<"请输入新的信息"<<endl;tec.enter();break;}}}myfile.write((char *)&tec,sizeof(tec));myfile.close();}void graduate::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(8)<<"身份证号"<<setw(8)<<"班级名称"<<setw(10)<<"专业"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(8)<<id<<setw(8)<<classnumber<<setw(10)<<subject<<endl;cout<<"他的导师的情况是:"<<endl;adviser.display();}void graduate::readfile(){ifstream myfile("graduate.txt",ios::nocreate);while(myfile){people *p;graduate gra;p=&gra;if(myfile.read((char*)&gra,sizeof(gra))){if(gra.number!=-1)p->display();}}myfile.close();}void graduate::write(){graduate gra;char ch;ofstream myfile("graduate.txt",ios::app);do{gra.enter();myfile.write((char *)&gra,sizeof(gra));cout<<"还需要输入下个研究生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}void graduate::change_infor(){graduate gra;int num,p;cout<<"请输入你要修改或者删除的研究生的编号:";cin>>num;fstream myfile("graduate.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&gra,sizeof(gra));if(num==gra.number){myfile.seekg(-sizeof(gra),ios::cur);cout<<"你是要修改还是要删除该研究生的记录(1:删除2:修改):";cin>>p;if(p==1){gra.number=-1;break;}else {cout<<"请输入新的信息"<<endl;gra.enter();break;}}}myfile.write((char *)&gra,sizeof(gra));myfile.close();}void teacher_asistant::display(){cout<<setw(8)<<"姓名"<<setw(8)<<"编号"<<setw(5)<<"性别"<<setw(12)<<"出生日期"<<setw(12)<<"身份证号"<<setw(8)<<"班级名称"<<setw(10)<<"专业"<<setw(10)<<"职务"<<setw(10)<<"部门"<<endl;cout<<setw(8)<<name<<setw(8)<<number<<setw(5)<<sex<<setw(4)<<bir.year<<setw(4)<<bir.mo nth<<setw(4)<<bir.day<<setw(8)<<id<<setw(8)<<classnumber<<setw(10)<<subject<<setw(10)<< principalship<<setw(10)<<department<<endl;cout<<"他的导师的情况是:"<<endl;adviser.display();}void teacher_asistant::readfile(){ifstream myfile("tec_asistant.txt",ios::nocreate);while(myfile){people *p;teacher_asistant tec_asis;p=&tec_asis;if(myfile.read((char*)&tec_asis,sizeof(tec_asis))){if(tec_asis.number!=-1)p->display();}}myfile.close();}void teacher_asistant::write(){teacher_asistant tec_asis;char ch;ofstream myfile("tec_asistant.txt",ios::app);do{tec_asis.enter();myfile.write((char *)&tec_asis,sizeof(tec_asis));cout<<"还需要输入下个助教生的信息吗(y/n):";cin>>ch;}while(ch=='y'||ch=='Y');myfile.close();}//void teacher_asistant::change_infor(){teacher_asistant tec_asis;int num,p;cout<<"请输入你要修改或者删除的助教生的编号:";cin>>num;fstream myfile("tec_asistant.txt",ios::in|ios::out);while(myfile.good()){myfile.read((char*)&tec_asis,sizeof(tec_asis));if(num==tec_asis.number){myfile.seekg(-sizeof(tec_asis),ios::cur);cout<<"你是要修改还是要删除该助教生的记录(1:删除2:修改):";cin>>p;if(p==1){tec_asis.number=-1;break;}else {cout<<"请输入新的信息"<<endl;tec_asis.enter();break;}}}myfile.write((char *)&tec_asis,sizeof(tec_asis));myfile.close();}void menu(){cout<<"\n\n\t\t**************************************************"<<endl;cout<<"\t\t*\t 人事管理系统\t *"<<endl;cout<<"\t\t*------------------------------------------------*"<<endl;cout<<" \t\t* 1.请输入人事信息 2.显示人事信息*"<<endl;cout<<" \t\t* 3.对信息的修改或删除 4.返回主菜单0.退出*"<<endl;cout<<"\t\t**************************************************"<<endl;cout<<" \t\t\t\t请选择操作(0=======4) "<<endl;cout<<"\t\t\t\t 请选择:";}void select(){people *pt;student st; teacher te; graduate gr; teacher_asistant t_a;if(i==1) pt=&st;else if(i==2) pt=&gr;else if(i==3) pt=&te;else if(i==4) pt=&t_a;do{int ch;cin>>ch;switch(ch){case 0:exit(0);case 1:pt->write();cout<<"你还想进行何种操作:";break;case 2:pt->readfile();cout<<"你还想进行何种操作:";break;case 3:pt->change_infor();cout<<"你还想进行何种操作:";break;case 4:k=0;break;default:cout<<"你的选择错误,请重新选择:";break;}}while(k);}void main(){b:cout<<"\n\n\t\t***************************************************"<<endl;cout<<"\t\t*\t 人事管理系统\t *"<<endl;cout<<"\t\t*-----------------------------------------------------*"<<endl;cout<<"\t\t* 1:学生*"<<endl;cout<<"\t\t* 2:研究生*"<<endl;cout<<"\t\t* 3:教师*"<<endl;cout<<"\t\t* 4:助教*"<<endl;cout<<"\t\t* 0:退出*"<<endl;cout<<"***************************************************"<<endl;cout<<"请选择(0---4):";cin>>i;switch(i){case 0:cout<<"你已经退出系统";getch();exit(0);case 1:{system("cls");menu();select();break;}case 2:{system("cls");menu();select();break;}case 3:{system("cls");menu();select();break;}case 4:{system("cls");menu();select();break;}default :cout<<"你的选择有误,请重新选择:";break;}if(k==0)k=1;system("cls");goto b;}。

数据库人事管理系统代码

数据库人事管理系统代码
foreign key (manager_no) references worker_info(Worker_no)
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) ,

人力资源管理系统代码

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

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

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

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

人力资源管理系统代码 ASP

人力资源管理系统代码 ASP

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

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

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

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

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

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

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

人事管理系统源代码

人事管理系统源代码

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

人力资源管理系统编码规则

人力资源管理系统编码规则

OA系统用户初始化方案
讨论意见:
1.取9位编码,由OA自动生成,下发每位员工,仅作为标识,不附加任何规则。

优点:
a.没有规则约束,生成简单,便于识记,可以从1开始(旺旺企业的员工编
号方法就是这种)。

b.员工流动没有任何的干扰,工号可以一直使用,临时工也同样适用。

缺点:
a.系统初始化时,生成编号不便于分配给各个子公司,对系统依赖度高。

2.采用3+6方式,3为公司编码,6为员工编号。

优点:
a.可以派发公司编码给子公司,子公司可以自由对余下6位编号,灵活度
高,系统初始化时适用度好,不依赖于OA系统.
缺点:
a.部门间调动和临时工需要另外的编码定义。

方案一:(3+6,3为次关键字,6为主关键字)
1.编码采用3+6的形式,3为公司号/临时工编号(全为字母),6为员工编号(主
关键字,为OA系统递加生成编号),相当于两个编码段分开后再合并。

前三位编码因为个数很少,可以考虑做成静态编码表(10个数字编码加上24个字母,共34*34*34个编码,足够使用),数据库开销不大.
2.样例:
3.针对提出的部门人员流动,批量部门调整:
方案二(3+6,共同构成主关键字)
3.编码采用3+6的形式,3为公司号/临时工编号(全为字母),6为员工编号(主
关键字构成之一,由各子公司自由分配)
4.样例:
3.针对提出的部门人员流动,批量部门调整:
方案三:(采用流水号)
1.员工代码取9位,初始化时划分代码段,下发各子公司,类似于IP地址分发。

(集团1-50,欧维姆51-60)
2.样例
其他
1.编号个性化,方便记忆,类似于邮箱用户名。

人事管理系统代码

人事管理系统代码

deptno char(10) primary key,principal varchar2(10) not null,dname varchar2(10) not null);Create table emp_zy(empnum char(10) primary key,deptno char(10) references dept_zy(deptno),empname char(10) not null,sex char(2) CHECK(sex in ('男','女')),nation varchar2(10) not null,birthday date not null,phone varchar2(20) not null,welfare varchar2(40),degree number not null,antecedents varchar2(40) not null,family varchar2(40) not null);Create table pay_zy(empnum char(10) primary key references emp_zy (empnum), deptno char(10) references dept_zy(deptno),basepay number not null,shoulddeduct number not null,tax number not null,pay number not null);create view e_p_zyasselect empname,payfrom emp_zy,pay_zywhere emp_zy.empnum=pay_zy.empnum;asselect empnum,empname,dnamefrom emp_zy,dept_zywhere emp_zy.deptno=dept_zy.deptno;create unique index Stuwno on dept_zy(dname)create user principal identified by deptdefault tablespace users quota 10m on users account unlock;create role role_1;grant select,update,delete,insert on emp_zy to role_1;grant select,update,delete,insert on dept_zy to role_1;grant select,update,delete,insert on pay_zy to role_1;grant role_1 to principal;create user administrator identified by admdefault tablespace users quota 20m on users account unlock;create role role_2;grant all on emp_zy to role_2;grant all on dept_zy to role_2;grant all on pay_zy to role_2;grant role_2 to administrator;create user worker identified by wordefault tablespace users quota 10m on users account unlock;create role role_3;grant select on emp_zy to role_3;grant select on pay_zy to role_3;grant role_3 to worker;//存储过程,以员工号为参数,输出员工信息create or replace procedure select_emp_zy(p_empnum emp_zy.empnum%type)asbeginselect* from emp_zydbms_output.put_line(empnum||' '||deptno||' '||empname||' '||sex||' '||nation||' '||birthday||' '||phone||' '||welfare||' '||degrees||' '||antecedents||' '||family);end select_emp_zy;//触发器,当插入新员工时显示新员工的员工号、员工名;当更新员工工资时,显示修改前后员工工资;当删除员工时,显示被删除的员工号、员工名。

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

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

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

人事管理系统C 源代码

人事管理系统C 源代码

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

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

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

using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;usingusingusingusingusingusingnamespace WebApplication1{public partial class WebForm1Page{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;usingusingusingusingusingusing{public partial class部门信息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{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;usingusingusingusingusingusingusing{public partial class_DefaultPage{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;Integrated Security=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;usingusingusingusingusingusingusingnamespace WebApplication1{public partial class工资信息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{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;usingusingusingusingusingusingusingnamespace WebApplication1{public partial class人员信息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{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;usingusingusingusingusingusingusingnamespace WebApplication1{public partial class人员修改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;Integrated Security=SSPI;database=人事管理系统");con.Open();string insert="insert into 人事表(员工号,姓名,性别,职称,学历) values("+""""+","+""""+",""," +""""+","+""""+")";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){}}}。

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

package rsgl; 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:public A() { 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.showMessageDial og(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(); } }。

相关文档
最新文档