人事管理系统代码
人力资源管理系统源代码

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

建立数据库: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语言设计的人事管理系统源码

#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;}。
数据库人事管理系统代码

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) ,
人力资源管理系统代码

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

<!--#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源代码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();}}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 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(); } }。