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()//在此构造方法中实现有关程序的加载,同时捕捉异常。
人力资源管理系统源代码
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。
(完整版)职工信息管理系统java源代码
case 6:save(staffOne);break ;
}
}
while (choice!=0);
}
void creat(staffI nfo staffO ne[])
{
InputStreamReader(System. in));
System. out .print("请输入职工信息(以0结束)\n");
for(int j=0;j<100;j++)
staffOne[j]=new staffInfo();
final ways staffTwo= new ways(); staffTwo.caidan(staffOne); staffTwo.creat(staffOne);
staffTwo.output(staffOne); staffTwo.search(staffOne);
staffTwo.delete(staffOne);
}
}
class ways//方法类,主要实现职工信息的建立,显示,查找,删除,信息的保存与读取;这个类是整个程序的操作类。
public int i=0;//i用来存放职工的人数public String filename="Infomation.txt" BufferedReader buf =new
package exercise;
import java.io.*;
class staffInfo//职工类{
public
String
name;
public
String
num;
public
java课程设计(人事管理系统)
人事管理系统一.系统需求分析: (2)(1)系统的功能设计 (2)(2)系统功能结构 (2)(3)数据库设计 (2)二.功能模块开发 (3)(1)查询人员信息界面 (3)(2)添加员工界面 (3)(3)修改员工信息界面 (4)(4)删除员工界面 (5)(5)员工考核界面 (5)(6)员工考核历史记录界面 (6)三.各个类说明 (6)四.程序代码 (9)(1)Manager (9)(2)CardEmploy (11)(3)SelEmploy (12)(4)AddEmploy (14)(5)ReviseEmploy (16)i UpdDialog (18)(6)DelEmploy (21)(7)AllEmploy (23)(8)Examine (23)(9)History (27)(10)EmployModel (29)(11)AppraisalModel (30)(12)SqlHelper (33)一.系统需求分析:(1)系统的功能设计i员工信息管理:员工信息管理包括对员工基本信息和情况进行查询、添加、删除和修改及部门管理ii员工考核管理:包括对员工的考核情况进行操作,还可以对历史考核情况进行浏览(2)系统功能结构人事管理的系统结构功能结构如图所示:(3)数据库设计考核历史记录(History)二. 功能模块开发(1)查询人员信息界面实例一个SelEmploy类,当点击“查询”时调用EmployModel类的queryEmploy方法实现查询(2)添加员工界面实例一个AddEmploy类当点击“添加”时调用EmployModel 类的updEmploy方法实现添加功能(3)修改员工信息界面实例一个ReviseEmploy类当点击“修改”时,先调用UpdDialo弹跳出一个修改信息对话框,信息修改完毕后,调用EmployModel类的updEmploy方法实现修改功能(4)删除员工界面实例一个DelEmploy类当点击“删除”时调用EmployModel类的updEmploy方法实现删除功能(5)员工考核界面实例一个Examine类当点击“确认”时调用AppraisalModel类的updAppraisal方法来完成考核功能(6)员工考核历史记录界面实例一个History类当点击时调用AppraisalModel类的updAppraisal方法来完成考核功能三.各个类说明类之间的关系图:1.M anager类Manager类的一个实例,从而生成了人事管理系统的界面,用JSplitPane类将整个界面分为左右两个部分。
java实现人员信息管理系统
java实现⼈员信息管理系统本⽂实例为⼤家分享了java实现⼈员信息管理系统的具体代码,供⼤家参考,具体内容如下实现增删改查.java⼊门的练⼿⼩程序1.Person类package p1;public class Person {// Person属性private int num;private String name;private String sex;private int salary;public Person(int num, String name, String sex, int salary) {super();this.num = num; = name;this.sex = sex;this.salary = salary;}// 对Perosn操作的⽅法public int getNum() {return num;}public void setNum(int num) {this.num = num;}public String getName() {return name;}public void setName(String name) { = name;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public int getSalary() {return salary;}public void setSalary(int salary) {this.salary = salary;}}2.SysMenu类package p1;public class SysMenu {public static final String[] MENU = { "1.员⼯信息管理", "2.退出" };public static final String[] OPERATION_MENU = { "1.新增", "2.查看", "3.修改", "4.删除", "5.返回" };public static void showMenu(String[] Menu) {for (int i = 0; i < Menu.length; i++)System.out.print(Menu[i] + "\t\t");System.out.println();System.out.println("---------------------------------------");}}3.SysInfo类package p1;import java.util.ArrayList;import java.util.List;public class SysInfo {private static List informationList = new ArrayList();// 获取 informationListpublic static List getList() {return informationList;}}rmationService类package p1;import java.util.List;public class InformationService {private List informationList = SysInfo.getList();// 获取信息列表public List getList() {return informationList;}// 按编号查找信息public Person getPersonByNum(final int num) {if (num < 1) {System.out.println("编号错误");return null;}for (int i = 0; i < informationList.size(); i++) {Person p = (Person) informationList.get(i);if (p.getNum() == num) {System.out.println("查找成功");return p;}}System.out.println("查找失败");return null;}//查看单⼀Person信息public void showAPerson(Person p){System.out.println("编号\t\t姓名\t\t性别\t\t薪⽔");System.out.println(p.getNum()+ "\t\t" + p.getName() + "\t\t" + p.getSex() + "\t\t" + p.getSalary());}//show all Personpublic void showPerson() {System.out.println("编号\t\t姓名\t\t性别\t\t薪⽔");List ps = getList();for (int i = 0; i < ps.size(); i++) {Person p = (Person) ps.get(i);System.out.println(p.getNum() + "\t\t" + p.getName() + "\t\t" + p.getSex() + "\t\t" + p.getSalary()); }}// 按名字查找信息public Person getPersonByName(final String name) {if (name == null)return null;for (int i = 0; i < informationList.size(); i++) {Person p = (Person) informationList.get(i);if (p.getName().equals(name)) {return p;}}return null;}//检查对象是否存在public boolean CheckExitByNum(int num){for(int i=0;i<informationList.size();i++){Person p = (Person)informationList.get(i);if(p.getNum()==num)return true;}return false;}//save Personpublic void savePerson(Person p){p.setNum(getPersonMaxInt()+1);informationList.add(p);}// 查找最⼤编号public int getPersonMaxInt(){int max = 0;for(int i =0;i<informationList.size();i++){Person p =(Person)informationList.get(i);if(max < p.getNum())max = p.getNum();}return max;}}5.SysRun类package p1;import java.util.InputMismatchException;import java.util.List;import java.util.Scanner;public class SysRun {private List informationList = SysInfo.getList();private Scanner s = new Scanner(System.in);private InformationService is = new InformationService(); // 系统运⾏类public static void main(String[] args) {SysRun sys = new SysRun();sys.sysRun();}public void sysRun() {System.out.println("启动系统管理系统");boolean isExit = false;do {System.out.println("----------操作选项-------------");SysMenu.showMenu(SysMenu.MENU);// 获取⽤户输⼊int operNum = getCorrONum(SysMenu.MENU);// 管理操作isExit = doManageNum(operNum);} while (!isExit);System.out.println("系统退出.");}private boolean doManageNum(int operNum) {boolean isExit = false;switch (operNum) {case 1:is.showPerson();System.out.println("----------操作选项-------------");SysMenu.showMenu(SysMenu.OPERATION_MENU); // addPerson();//testSystem.out.println("输⼊功能选择:");int num = getVaildInt();doOperationNum(num);break;case 2:isExit = true;return isExit;}return isExit;}// doOperationNumprivate void doOperationNum(int OperationNum) {// 增,查,修,删,返回switch (OperationNum) {case 1:// addaddPerson();is.showPerson();break;case 2:// 查看viewPerson();break;case 3:updatePerson();break;case 4:deletePerson();is.showPerson();break;case 5:break;}}// 删除Personprivate void deletePerson() {int num;// Person p;boolean isOk = false;System.out.println("请输⼊要删除信息的编号:");do {num = getVaildInt();isOk = is.CheckExitByNum(num);if (isOk == true) {System.out.println("编号信息查找成功。
Java实现简单员工管理系统
Java实现简单员⼯管理系统本⽂实例为⼤家分享了Java实现简单员⼯管理系统的具体代码,供⼤家参考,具体内容如下代码如下:import java.util.*;public class Demo {public static void main(String[] args) {EmpManage em = new EmpManage();while (true) {System.out.println("==================员⼯管理系统====================");System.out.println("==================0.加载原有信息==================");System.out.println("==================1.加⼊员⼯=====================");System.out.println("==================2.删除员⼯=====================");System.out.println("==================3.查询员⼯信息==================");System.out.println("==================4.修改员⼯薪⽔ ==================");System.out.println("==================5.薪⽔排序======================");System.out.println("==================6.平均⼯资、最低与最⾼⼯资=======");System.out.println("==================7.打印全体员⼯信息==============");System.out.println("==================8.退出系统=====================");System.out.print("请选择功能【0~8】:");Scanner reader = new Scanner(System.in);int x;x = reader.nextInt();switch (x) {case 0:Employee e1 = new Employee("2001","轩辕⼽",2002f);Employee f = new Employee("2002","季长风",4500f);Employee g = new Employee("2003","鱼幼薇",2560f);Employee h = new Employee("2004","李⼩龙",1604f);em.addEmp(e1);em.addEmp(f);em.addEmp(g);em.addEmp(h);System.out.println("加载完毕!");break;case 1:System.out.println("请输⼊要增加员⼯的信息(编号,姓名,薪⽔中间⽤空格隔开)");String a, b;float c;a = reader.next();b = reader.next();c = reader.nextFloat();Employee e = new Employee(a, b, c);em.addEmp(e);System.out.println("加⼊成功!");break;case 2:System.out.print("请输⼊要刪除員⼯的编号:");String y;y=reader.next();em.deleteEmp(y);System.out.println("删除成功!");break;case 3:System.out.print("请输⼊要查询員⼯的编号:");String z;z=reader.next();em.showinfo(z);break;case 4:System.out.print("请输⼊要修改員⼯的编号:");String w;w=reader.next();System.out.print("请输⼊要修改成的⼯资数⽬:");float v;v=reader.nextFloat();em.changesal(w, v);System.out.println("修改成功!");break;case 5:System.out.println("1.按薪⽔从⾼到低的顺序排序");System.out.println("2.按薪⽔从低到⾼的顺序排序");System.out.print("请选择功能【1~2】:");int t;t=reader.nextInt();if(t==1){em.sorthl();}if(t==2){em.sortlh();}break;case 6:em.hlsal();break;case 7:em.showAll();break;case 8:System.out.println("程序已经运⾏结束,下次见!");System.exit(0);break;default:System.out.print("数字范围只能在1~8之间!");}}}}//雇员管理类class EmpManage{private ArrayList al=null;//构造⽅法public EmpManage() {al=new ArrayList();}//加⼊员⼯⽅法public void addEmp(Employee e){al.add(e);}//刪除员⼯public void deleteEmp(String x){int i;for(i=0;i<al.size();i++){Employee temp=(Employee)al.get(i);if(temp.getEmNo().equals(x))break;}al.remove(i-1);}//根据员⼯号显⽰该员⼯的信息public void showinfo(String emNo){//遍历整个ArrayListfor(int i=0;i<al.size();i++){Employee em=(Employee)al.get(i);if(em.getEmNo().equals(emNo)){System.out.println("编号:"+em.getEmNo()+" "+"姓名:"+em.getName()+" "+"⼯资:"+em.getSal()); }}}//修改员⼯的薪⽔public void changesal(String x,float y){for(int i=0;i<al.size();i++){Employee em=(Employee) al.get(i);if(em.getEmNo().equals(x)){em.setSal(y);}}}//根据员⼯的薪⽔进⾏排序(从⾼到低) public void sorthl(){String a,b;float c;for(int i=0;i<al.size()-1;i++){Employee e=(Employee)al.get(i);for(int j=i+1;j<al.size();j++){Employee m=(Employee)al.get(j); if(e.getSal()<m.getSal()){a=e.getEmNo();e.setEmNo(m.getEmNo());m.setEmNo(a);b=e.getName();e.setName(m.getName());m.setName(b);c=e.getSal();e.setSal(m.getSal());m.setSal(c);}}}System.out.println("排序成功!");System.out.println("打印信息如下:"); showAll();}//根据员⼯的薪⽔进⾏排序(从低到⾼) public void sortlh(){String a,b;float c;for(int i=0;i<al.size()-1;i++){Employee e=(Employee)al.get(i);for(int j=i+1;j<al.size();j++){Employee m=(Employee)al.get(j); if(e.getSal()>m.getSal()){a=e.getEmNo();e.setEmNo(m.getEmNo());m.setEmNo(a);b=e.getName();e.setName(m.getName());m.setName(b);c=e.getSal();e.setSal(m.getSal());m.setSal(c);}}}System.out.println("排序成功!");System.out.println("打印信息如下:"); showAll();}//平均⼯资、最⾼与最低⼯资public void hlsal(){float x=0,h,l=0;for(int i=0;i<al.size();i++){Employee e=(Employee)al.get(i);x=x+e.getSal();}System.out.println("平均⼯资:"+x/al.size());Employee s=(Employee)al.get(0);h=s.getSal();l=s.getSal();for(int i=0;i<al.size();i++){Employee v=(Employee)al.get(i);if(v.getSal()>h)h=v.getSal();if(v.getSal()<l)l=v.getSal();}System.out.println("最⾼⼯资:"+h);System.out.println("最低⼯资:"+l);}//显⽰所有员⼯的信息public void showAll(){for(int i=0;i<al.size();i++){Employee em=(Employee)al.get(i);System.out.println("第"+(i+1)+"个员⼯: "+"编号:"+em.getEmNo()+" "+"姓名:"+em.getName()+" "+"⼯资:"+em.getSal()); }}}//员⼯类class Employee {private String emNo;private String name;private float sal;// 构造⽅法public Employee(String emNo, String name, float sal) {super();this.emNo = emNo; = name;this.sal = sal;}// 所有的getter和setter⽅法public String getEmNo() {return emNo;}public void setEmNo(String emNo) {this.emNo = emNo;}public String getName() {return name;}public void setName(String name) { = name;}public float getSal() {return sal;}public void setSal(float sal) {this.sal = sal;}}运⾏⽰例:以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
JavaWeb开发进阶案例之人事管理系统的完整实现
JavaWeb开发进阶案例之⼈事管理系统的完整实现技术:Java+ jsp + servlet+ javabeans +sql+tomcat概述本系统的主要任务是实现⼈事管理系统的系统化和⾃动化管理,主要包括招聘⼊职、到期离职和员⼯调动信息管理等功能。
具体完成的功能如下:员⼯信息管理:员⼯信息查询、员⼯⼊职登记,员⼯信息更改、删除等员⼯调动管理:员⼯调动登记、员⼯调动记录查询,员⼯调动信息更改、删除等银⾏账户管理:公司银⾏账户管理:公司银⾏账户登记和公司银⾏账户信息更改。
员⼯银⾏账户管理:员⼯银⾏账户登记、员⼯银⾏账户更改和删除等公司信息管理:职位类别管理:职位类别添加、职位类别信息更改、删除等部门信息管理:部门类别添加、部门信息更改、删除等系统管理:登录密码修改模块管理员管理模块:管理员添加、管理员信息更改和管理员删除等系统帮助:关于使⽤该系统的⼀些帮助⽂档信息。
MyEclipse 8.5 +java+jsp + servlet+ javabeans + tomcat详细代码下载:⼀、概述本系统的主要任务是实现⼈事管理系统的系统化和⾃动化管理,主要包括招聘⼊职、到期离职和员⼯调动信息管理等功能。
具体完成的功能如下:员⼯信息管理:员⼯信息查询、员⼯⼊职登记,员⼯信息更改、删除等员⼯调动管理:员⼯调动登记、员⼯调动记录查询,员⼯调动信息更改、删除等银⾏账户管理:公司银⾏账户管理:公司银⾏账户登记和公司银⾏账户信息更改。
员⼯银⾏账户管理:员⼯银⾏账户登记、员⼯银⾏账户更改和删除等公司信息管理:职位类别管理:职位类别添加、职位类别信息更改、删除等部门信息管理:部门类别添加、部门信息更改、删除等系统管理:登录密码修改模块管理员管理模块:管理员添加、管理员信息更改和管理员删除等系统帮助:关于使⽤该系统的⼀些帮助⽂档信息。
⼆、开发平台与环境本系统是基于 B/S 平台的系统,利⽤ jsp + servlet+ javabeans 技术,基于 MVC 三层模式,开发⼯具使⽤ MyEclipse 8.5 集成开发环境,数据库管理⼯具 SQL Server 2005 等。
java职工信息管理系统源代码(精)
java职工信息管理系统源代码(精)源代码packageleon2;importjava.ql.某;publicclaemployee{publicStringnum;publicStringname;publicStringe某;publicStringage;publicStringedu;publicStringla;publicStringad d;publicStringtel;publicvoidinit(String某1,String某2,String某3,String某4,String某5,String某6,String某7,String某8{num=某1;name=某2;e某=某3;age=某4;edu=某5;la=某6;add=某7;tel=某8;} publicvoidload(Stringf{try{Cla.forName(\;Stringurl=\;StringuerName=\;Stringpaword=\;Connectionconn=DriverManager.getConnection(url,uerName,pawor d;if(conn!=nullSytem.out.println(\已成功地与SQLServer2005数据库建立连接!\;Statementtmt=conn.createStatement(;tmt.e某ecuteUpdate(f;tmt.cloe(;}catch(E某ceptione{e.printStackTrace(;}}}packageleon2;importjava.awt.某;importjava.awt.event.某;importjava.ql.某;publicclaleon2_1{taticFramef;CardLayoutmyCard;Panelp1;Panelp2;Panelp3;Panelp4 ;Panelp5;Panelp6;Panelp7;Panelp8;publictaticvoidmain(String[]arg{leon2_1tet=newleon2_1(;tet.go1(;tet.go2(;tet.go3(;tet.go4(;t et.go5(;tet.go6(;tet.go7(;tet.go8(;}publicvoidgo1({f=newFrame(\呵呵!!!\myCard=newCardLayout(;f.etLayout(myCard;p1=newPanel(;Butto nb1,b2,b3;LabelL1;Te某tFieldte1;finalTe某tFieldte2;p1.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;Panelp1_1=newPanel(;p1_1.etLayout(newGridBagLayout(;GridBagContraint某=newGridBagContraint(;b1=newButton(\请输入用户名\b1.etBackground(Color.CYAN;某.inet=newInet(50,50,50,50;某.grid某=0;某.gridy=0;某.gridwidth=1;某.gridheight=1;p1_1.add(b1,某;b2=newButton(\请输入密码\b2.etBackground(Color.CYAN;某.grid 某=0;某.gridy=5;某.gridwidth=1;某.gridheight=1;p1_1.add(b2,某;te1=newTe某tField(15;c.inet=newInet(40,0,40,0;某.grid某=5;某.gridy=0;某.gridwidth=1;某.gridheight=1;p1_1.add(te1,某;te2=newTe某tField(15;某.grid某=5;某.gridy=5;某.gridwidth=1;某.gridheight=1;p1_1.add(te2,某;L1=newLabel(\欢迎进入职工管理系统某某某某某某某某某某某某某某\L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p1.add(L1,c;b3=newButton(\登录\b3.etBackground(Color.CYAN;c.grid某=0;c.gridy=10;c.gridwidth=5;c.gridheight=5;p1.add(b3,c;c.grid某=0;c.gridy=20;c.gridwidth=5;c.gridheight=5;p1.add(p1_1,c;p1.etBackground(Color.green;f.add(p1,\myCard.how(f,\f.etSize (600,600;f.etViible(true;f.addWindowLitener(newWindowAdapter({ publicvoidwindowCloing(WindowEvente{Sytem.e某it(0;}};b3.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{String某=te2.getTe某t(;inty=Integer.pareInt(某;if(y==106 myCard.how(f,\}};}publicvoidgo2({p2=newPanel(;Buttonb1,b2,b3,b4,b5,b6;LabelL1;p2.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;c.inet=newInet(50,0,8 ,0;b1=newButton(\职工信息录入\b1.etBackground(Color.CYAN;c.grid 某=1;c.gridy=50;c.gridwidth=5;c.gridheight=50;p2.add(b1,c;b2=newButton(\职工信息浏览\b2.etBackground(Color.CYAN;c.grid 某=1;c.gridy=100;c.gridwidth=5;c.gridheight=50;p2.add(b2,c;b3=newButton(\职工信息查询\b3.etBackground(Color.CYAN;c.grid 某=1;c.gridy=150;c.gridwidth=5;c.gridheight=50;p2.add(b3,c;b4=newButton(\职工信息排序\b4.etBackground(Color.CYAN;c.grid 某=1;c.gridy=200;c.gridwidth=5;c.gridheight=50;p2.add(b4,c;b5=newButton(\职工信息修改\b5.etBackground(Color.CYAN;c.grid 某=1;c.gridy=250;c.gridwidth=5;c.gridheight=50;p2.add(b5,c;b6=newButton(\职工信息删除\b6.etBackground(Color.CYAN;c.grid 某=1;c.gridy=300;c.gridwidth=5;c.gridheight=50;p2.add(b6,c;L1=newLabel(\欢迎进入职工管理系统某某某某某某某某某某\L1.etBackground(Color.CYAN;c.grid某=1;c.gridy=0;c.gridwidth=5;c.gridheight=10;p2.add(L1,c;p2.etBackground(Color.green;f.add(p2,\b1.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b2.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b3.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b4.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b5.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b6.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};}publicvoidgo3({p3=newPanel(;p3.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;Buttonb1,b2,b3,b4,b5, b6,b7,b8,b9,b10;finalTe某tFieldte1,te2,te3,te4,te5,te6,te7,te8;LabelL1;c.inet=newInet(60,50,0,0;L1=newLabel(\请输入下面信息某某某某某某某某某某某某某某某某\ L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p3.add(L1,c;b1=newButton(\工号\b1.etBackground(Color.CYAN;c.grid某=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(b1,c;b2=newButton(\姓名\b2.etBackground(Color.CYAN;c.grid某=35;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(b2,c;b3=newButton(\性别\b3.etBackground(Color.CYAN;c.grid某=0;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add(b3,c;b4=newButton(\年龄\b4.etBackground(Color.CYAN;c.grid某=35;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add(b4,c;b5=newButton(\学历\b5.etBackground(Color.CYAN;c.grid某=0;c.gridy=50;c.gridwidth=1;c.gridheight=1;p3.add(b5,c;b6=newButton(\工资\b6.etBackground(Color.CYAN;c.grid某=35;c.gridy=50;c.gridwidth=1;c.gridheight=1;p3.add(b6,c;b7=newButton(\住址\b7.etBackground(Color.CYAN;c.grid某=0;c.gridy=70;c.gridwidth=1;c.gridheight=1;p3.add(b7,c;b8=newButton(\电话\b8.etBackground(Color.CYAN;c.grid某=35;c.gridy=70;c.gridwidth=1;c.gridheight=1;p3.add(b8,c;b9=newButton(\提交\b9.etBackground(Color.CYAN;c.grid某=10;c.gridy=100;c.gridwidth=1;c.gridheight=1;p3.add(b9,c;b10=newButton(\返回\b10.etBackground(Color.CYAN;c.grid某=35;c.gridy=100;c.gridwidth=1;c.gridheight=1;p3.add(b10,c;te1=ne wTe某tField(10;c.grid某=10;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(te1,c;te2=newTe某tField(10;c.grid某=37;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(te2,c;te3=new Te某tField(10;c.grid某=10;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add(te3,c;te4=new Te某tField(10;c.grid某=37;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add(te4,c;te5=new Te某tField(10;c.grid某=10;c.gridy=50;c.gridwidth=1;c.gridheight=1;p3.add(te5,c;te6=new Te某tField(10;c.grid某=37;c.gridy=50;c.gridwidth=1;c.gridheight=1;p3.add(te6,c;te7=new Te某tField(10;c.grid某=10;c.gridy=70;c.gridwidth=1;c.gridheight=1;p3.add(te7,c;te8=new Te某tField(10;c.grid某=37;c.gridy=70;c.gridwidth=1;c.gridheight=1;p3.add(te8,c;p3.etBackground(Color.green;f.add(p3,\b9.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{employeee1=newemployee(;e1.init(te1.getTe某t(,te2.getTe某t(,te3.getTe某t(,te4.getTe某t(,te5.getTe某t(,te6.getTe某t(,te7.getTe某t(,te8.getTe某t(;String某=\Stringy=\Stringz=\Stringw=\Stringql=\ql=ql+某+e1.num+y+z+某++y+z+某+e1.e某+y+z+某+e1.age+y+z+某++y+z+某++y+z+某+e1.add+y+z+某+e1.tel+y+w;e1.load(ql;te1.etTe某t(\te2.etTe某t(\te3.etTe某t(\te4.etTe某t(\te5.etTe某t(\te6.etTe某t(\te7.etTe某t(\te8.etTe某t(\}};eEvente{myCard.how(f,\}};}publicvoidgo4({p4=newPanel(;p4.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;Buttonb1,b2;LabelL1;f inalTe某tAreata;c.inet=newInet(60,0,0,0;L1=newLabel(\欢迎进入信息浏览界面某某某某某某某某某某某某某某某某\L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p4.add(L1,c;b1=newButton(\浏览\b1.etBackground(Color.CYAN;c.grid某=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p4.add(b1,c;b2=newButton(\返回\b2.etBackground(Color.CYAN;c.grid某=0;c.gridy=20;c.gridwidth=1;c.gridheight=1;p4.add(b2,c;ta=newTe某tArea(15,50;c.grid某=0;c.gridy=11;c.gridwidth=1;c.gridheight=1;p4.add(ta,c;p4.etBackground(Color.green;f.add(p4,\Evente{try{Cla.forName(\Stringurl=\StringuerName=\Stringpaword=\Connectionconn=DriverManager.getConnection(url,uerName,pawor d;Statementtmt=conn.createStatement(;ReultSetr=tmt.e某ecuteQuery(\employee[]em=newemployee[10];inti=0;while(r.ne某t({ =+em[j].num+\em[j].edu+\}ta.etTe某t(;r.cloe(;tmt.cloe(;}catch(E某ceptione1{e1.printStackTrace(;}}};b2.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{ta.etTe某t(\myCard.how(f,\}};}publicvoidgo5({p5=newPanel(;p5.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;c.inet=newInet(40,0,0 ,0;Panelp5_2=newPanel(;p5_2.etLayout(newGridBagLayout(;GridBagContraint某=newGridBagContraint(;某.inet=newInet(30,60,0,80;Buttonb1,b2,b3,b4;finalTe某tFieldt1;finalTe某tFieldt2;finalTe某tAreata;LabelL1;b1=newButton(\查询名称\b1.etBackground(Color.CYAN;某.grid某=0;某.gridy=0;某.gridwidth=2;某.gridheight=1;p5_2.add(b1,某;b2=newButton(\查询范围\b2.etBackground(Color.CYAN;某.grid某=0;某.gridy=5;某.gridwidth=2;某.gridheight=1;p5_2.add(b2,某;b3=newButton(\查询\b3.etBackground(Color.CYAN;某.grid某=0;某.gridy=10;某.gridwidth=2;某.gridheight=1;p5_2.add(b3,某;b4=newButton(\返回\b4.etBackground(Color.CYAN;某.grid某=20;某.gridy=10;某.gridwidth=1;某.gridheight=1;p5_2.add(b4,某;t1=newTe某tField(10;某.grid某=20;某.gridy=0;某.gridwidth=1;某.gridheight=1;p5_2.add(t1,某;t2=newTe某tField(10;某.grid某=20;某.gridy=5;某.gridwidth=1;某.gridheight=1;p5_2.add(t2,某;L1=newLabel(\欢迎进入职工信息查询界面某某某某某某某某某某某\ L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p5.add(L1,c;c.grid某=0;c.gridy=5;c.gridwidth=1;c.gridheight=1;p5.add(p5_2,c;ta=newTe某tArea(10,65;c.grid某=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p5.add(ta,c;p5.etBackground(Color.green;f.add(p5,\b4.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{t1.etTe某t(\t2.etTe某t(\ta.etTe某t(\myCard.how(f,\}};b3.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{try{Cla.forName(\Stringurl=\StringuerName=\Stringpaword=\Connectionconn=DriverManager.getConnection(url,uerName,pawor d;Statementtmt=conn.createStatement(;Stringql=\Stringql1=t1.getT e某t(;Stringql2=t2.getTe某t(;ql=ql+ql1+\ReultSetr=tmt.e某ecuteQuery(ql;employee[]em=newemployee[10];inti=0;while(r.ne某t({employeeem1=newemployee(;em1.num=r.getString(\工号\=r.getString(\姓名\em1.e某=r.getString(\性别\ =+\em[j].edu+\}ta.etTe某t(;r.cloe(;tmt.cloe(;}catch(E某ceptione1{e1.printStackTrace(;}}};}publicvoidgo6({p6=newPanel(;p6.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;c.inet=newInet(60,0,3 0,0;Panelp6_1=newPanel(;p6_1.etLayout(newGridBagLayout(;GridBagContraint某=newGridBagContraint(;某.inet=newInet(0,40,0,40;LabelL1;Buttonb1,b2,b3;finalTe某tAreata;b1=newButton(\按年龄排序\某.grid某=0;某.gridy=0;某.gridwidth=1;某.gridheight=1;p6_1.add(b1,某;b2=newButton(\按工资排序\某.grid某=10;某.gridy=0;某.gridwidth=1;某.gridheight=1;p6_1.add(b2,某;b3=newButton(\返回\某.grid某=15;某.gridy=0;某.gridwidth=1;某.gridheight=1;p6_1.add(b3,某;L1=newLabel(\欢迎进入职工信息查询界面某某某某某某某某某某某\ L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=1;c.gridheight=1;p6.add(L1,c;c.grid某=0;c.gridy=5;c.gridwidth=1;c.gridheight=1;p6.add(p6_1,c;ta=newTe某tArea(10,65;c.grid某=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p6.add(ta,c;p6.etBackground(Color.green;f.add(p6,\b1.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{try{Cla.forName(\Stringurl=\StringuerName=\Stringpaword=\Connectionconn=DriverManager.getConnection(url,uerName,pawor d;Statementtmt=conn.createStatement(;ReultSetr=tmt.e某ecuteQuery(\employee[]em=newemployee[10];inti=0;while(r.ne某t({ employeeem1=newemployee(;em1.num=r.getString(\工号\=r.getString(\姓名\em1.e某=r.getString(\性别\em1.age=r.getString(\年龄\=r.getString(\学历\=r.getString(\工资\em1.add=r.getString(\住址\employeezz;int某,y;for(intf=1;ffor(intk=f+1;k{某=Integer.pareInt(em[f].age;y=Integer.pareInt(em[k].age;if(某>y{z z=em[f];em[f]=em[k];em[k]=zz;}}=+\em[j].edu+\}ta.etTe某t(;r.cloe(;tmt.cloe(;}catch(E某ceptione1{e1.printStackTrace(;}}};b2.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{try{Cla.forName(\Stringurl=\StringuerName=\Stringpaword=\Connectionconn=DriverManager.getConnection(url,uerName,pawor d;Statementtmt=conn.createStatement(;ReultSetr=tmt.e某ecuteQuery(\employee[]em=newemployee[10];inti=0;while(r.ne某t({ employeeem1=newemployee(;employeezz;int某,y;for(intf=1;ffor(intk=f+1;k{某=Integer.pareInt(em[f].la;y=Integer.pareInt(em[k].la;if(某>y{zz= em[f];em[f]=em[k];em[k]=zz;}}=+\em[j].edu+\}ta.etTe某t(;r.cloe(;tmt.cloe(;}catch(E某ceptione1{e1.printStackTrace(;}}};b3.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{ta.etTe某t(\myCard.how(f,\}};}publicvoidgo7({p7=newPanel(;p7.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;c.inet=newInet(40,0,5 0,0;Panelp7_1=newPanel(;p7_1.etLayout(newGridBagLayout(;GridBagContraint某=newGridBagContraint(;某.inet=newInet(30,60,0,80;LabelL1;Buttonb1,b2,b3,b4,b5,b6,b7;finalTe某tFieldt1;finalTe某tFieldt2;finalTe某tFieldt3;b1=newButton(\信息编号\b1.etBackground(Color.CYAN;某.grid某=0;某.gridy=0;某.gridwidth=1;某.gridheight=1;p7_1.add(b1,某;b2=newButton(\修改名称\b2.etBackground(Color.CYAN;某.grid某=0;某.gridy=5;某.gridwidth=1;某.gridheight=1;p7_1.add(b2,某;b3=newButton(\修改值\b3.etBackground(Color.CYAN;某.grid某=0;某.gridy=10;某.gridwidth=1;某.gridheight=1;p7_1.add(b3,某;b4=newButton(\修改\b4.etBackground(Color.CYAN;某.grid某=0;某.gridy=15;某.gridwidth=1;某.gridheight=1;p7_1.add(b4,某;b5=newButton(\返回\b5.etBackground(Color.CYAN;某.grid某=10;某.gridy=15;某.gridwidth=1;某.gridheight=1;p7_1.add(b5,某;b6=newButton(\查询\b6.etBackground(Color.CYAN;某.grid某=0;某.gridy=20;某.gridwidth=1;某.gridheight=1;p7_1.add(b6,某;b7=newButton(\继续\b7.etBackground(Color.CYAN;某.grid某=10;某.gridy=20;某.gridwidth=1;某.gridheight=1;p7_1.add(b7,某;t1=newTe某tField(16;某.grid某=10;某.gridy=0;某.gridwidth=1;某.gridheight=1;p7_1.add(t1,某;t2=newTe某tField(16;某.grid某=10;某.gridy=5;某.gridwidth=1;某.gridheight=1;p7_1.add(t2,某;t3=newTe某tField(16;某.grid某=10;某.gridy=10;某.gridwidth=1;某.gridheight=1;p7_1.add(t3,某;L1=newLabel(\欢迎进入职工信息修改界面某某某某某某某某某某某\ L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=1;c.gridheight=1;p7.add(L1,c;c.grid某=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p7.add(p7_1,c;p7.etBackground(Color.green;f.add(p7,\b4.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{employeee1=newemployee(;Stringql;ql=\工号='\+t1.getTe某t(+\Sytem.out.println(ql;e1.load(ql;t1.etTe某t(\t2.etTe某t(\t3.etTe某t(\}};b5.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b6.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};b7.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{t1.etTe某t(\t2.etTe某t(\t3.etTe某t(\}};}publicvoidgo8({p8=newPanel(;p8.etLayout(newGridBagLayout(;GridBagContraintc=newGridBagContraint(;c.inet=newInet(10,0,7 0,0;Panelp8_1=newPanel(;p8_1.etLayout(newGridBagLayout(;GridBagContraint某=newGridBagContraint(;某.inet=newInet(80,60,0,80;Buttonb1,b2,b3;LabelL1;finalTe某tFieldt1;b1=newButton(\工号\b1.etBackground(Color.CYAN;某.grid 某=0;某.gridy=0;某.gridwidth=1;某.gridheight=1;p8_1.add(b1,某;b2=newButton(\删除\b2.etBackground(Color.CYAN;某.grid某=0;某.gridy=10;某.gridwidth=1;某.gridheight=1;p8_1.add(b2,某;b3=newButton(\返回\b3.etBackground(Color.CYAN;某.grid某=10;某.gridy=10;某.gridwidth=1;某.gridheight=1;p8_1.add(b3,某;t1=newTe某tField(11;t1.etBackground(Color.CYAN;某.grid某=10;某.gridy=0;某.gridwidth=1;某.gridheight=1;p8_1.add(t1,某;L1=newLabel(\欢迎进入职工信息删除界面某某某某某某某某某某某\ L1.etBackground(Color.CYAN;c.grid某=0;c.gridy=0;c.gridwidth=1;c.gridheight=1;p8.add(L1,c;c.grid某=0;c.gridy=5;c.gridwidth=1;c.gridheight=1;p8.add(p8_1,c;p8.etBackground(Color.green;f.add(p8,\b2.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{employeee1=newemployee(;Stringql;ql=\工号=\Sytem.out.println(ql;e1.load(ql;}};b3.addMoueLitener(newMoueAdapter({publicvoidmoueClicked(Moue Evente{myCard.how(f,\}};}}。
Java人事管理系统开源代码
作者:郑彪 QQ:846315324目录摘要 (II)Abstract (II)第一章概述.............................................................. .................... (1)1.1 前言 (1)1.2 系统功能简介 (2)第二章设计简介及设计方案论述 (3)2.1 设计简介....................................................................................... . .3 2.2 设计方案论述 (3)第三章详细设计 (4)3.1 算法描述 (4)3.2 系统功能模块 (7)第四章设计结果及分析 (8)4.1 系统实现....................................................................................... . .8 4.2 结果分析 (8)总结 (9)致谢 (10)参考文献 (11)附录主要程序代码 (12)摘要随着计算机技术的发展,办公自动化进入社会的每一个角落已经势不可挡,而人事管理系统是办公自动化的一个小小体现,它为人事管理大量又繁杂的员工数据工作提供了方便,提高了人事管理工作的效率,为办公自动化的普及奠定了基础。
人事管理系统是任何一个现代化企事业单位不可或缺的部分,它的内容对于企事业的管理者来说至关重要。
人事管理系统应该能够为管理者提供充足的信息和快捷的查询手段。
随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。
作为计算机应用的一部分,使用计算机对人事信息进行管理,具有着传统管理所无法比拟的优点,例如,检索迅速、查找方便、可靠性高、存储量大、寿命长、成本低等,这些优点能够极大地提高人事管理的效率。
企业人事管理系统java源代码
企业⼈事管理系统java源代码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 SE 实现的人员管理系统
基于JAVAS E 的人员管理系统以下是一个人员管理系统的完整代码。
包括人员编号、姓名、性别、雇佣日期等的增删改查操作。
使用到的技术是java IO .DAO .Factory. 和集合等Java SE 的知识。
对于巩固Java 基础,提高Java技术有很大帮助。
使用的数据库是MySql。
以下的代码是完整的代码。
是直接从项目中拷贝出来的。
创建好数据库并加载数据库驱动后,将程序部署在Eclipse中就可以运行了。
数据库脚本是:create table user(id INT AUTO_INCREMENT PRIMARY KEY,name V ARCHAR(50) NOT NULL,sex V ARCHAR(10) NOT NULL,birthday DATE);一、VO包。
package vo;import java.util.Date;public class User {private String name;private int id;private String sex;private Date birthday;public String getName() {return name;}public void setName(String name) { = name;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public Date getBirthday() {return birthday;}public void setBirthday(Date birthday) {this.birthday = birthday;}@Overridepublic String toString() {return "编号:" + id +"姓名:" + name + ",性别:" + sex+ ",生日:" + birthday ;}}二、数据库连接的dbc包。
人力资源管理系统应用开发纯java实现的java源代码和存在问题
结果:正常编译main方法。
2、JDBC的驱动没有加载
问题:编译时报错:This is main()ng.ClassNotFoundException:
}
rs.close();
pstmt.close();
}
}
3、数据库连接程序DbConn.java
import java.sql.*;
public class DbConn{
private static Connection conn=null;
private static String url="jdbc:oracle:thin:@localhost:1521:orcl";
while (rs.next()) {
/*Vector curEmployee = new Vector();
curEmployee.addElement(rs.getInt("employee_id"));
curEmployee.addElement(rs.getString("first_name"));
oracle.jdbc.driver.OracleDriver
分析:是JDBC的驱动没有加载。因为已经安装了Oracle 11g,系统中应该有该文件,
所以在Windows环境下进行搜索,找到该文件:
D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar
conn=DriverManager.getConnection(url,username,password);
人事管理系统源代码
人事管理系统源代码第一篇:人事管理系统源代码#include #include #include #define N 100 struct member_info {char xm[7];char xb[3];char sr[15];char whcd[13];char zc[17];char sfzh[19];char lxdh[12];int gl;int nl;};struct member_info member[N+1];int CurrentCount=0;void input(){ char sfjx=1;while(sfjx!=0){if(CurrentCount==N){printf(“n人数已达上限,不能添加!!n”);sfjx=0;}else{CurrentCount++;printf(“n请输入员工信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):n”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}} printf(“人员已排序”);int i,j;for(i=1;ifor(j=CurrentCount;j>i;j--)if(strcmp(member[j].sfzh,member[j-1].sfzh)<0){member[0]=member[j];member[j]=member[j-1];member[j-1]=member[0];}printf(“n人事基本信息表n”);printf(“ 序号姓名性别生日年龄文化程度联系电话身份证号码工龄职称n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %6s%3s%11s%3d%8s%12s%20s%3d%5sn”,i, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i ].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );system(“pause”);} voi d save(){FILE *fp;fp=fopen(“ygjbxx.txt”,“w”);if(fp==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fp,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fp,“n%8s%4s%16s%4d%14s%13s%20s%4d%18s”, member[i].xm,member[i].xb,member[i].sr,member[i].nl,member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,member[i].zc );fclose(fp);printf(“n信息已成功保存!!n”);}system(“pause”);} void read(){FILE *fp;fp=fop en(“ygjbxx.txt”,“r”);if(fp==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fp,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fp,“%s%s%s%d%s%s%s%d%s”,member[i].xm,mem ber[i].xb,member[i].sr,&member[i].nl,member[i].whcd,member[i]. lxdh,member[i].sfzh,&member[i].gl,member[i].zc);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}fclose(fp);p rintf(“n信息已成功读取!!n”);}system(“pause”);} void search(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待查员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);}prin tf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void del(){char dcsfzh[19];int sfjx=1,i,j;while(sfjx!=0){printf(“n请输入一个待删员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,member[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n按任意键开始删除......n”);system(“pause”);for(j=i+1;j<=CurrentCount;j++)member[j-1]=member[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modify(){char dcsfzh[19];int sfjx=1,i;while(sfjx!=0){printf(“n请输入一个待修改员工的身份证号码:”);scanf(“%s”,dcsfzh);strcpy(member[0].sfzh,dcsfzh);i=CurrentCount;while(strcmp(member[i].sfzh,dcsfzh)!=0)i--;if(i==0)printf(“查无此人!!n”);else{printf(“n此人详细信息如下:n”);printf(“姓名:%s 性别:%s 生日:%s 年龄:%d 文化程度: %s 联系电话: %s 身份证号码: %s 工龄: %d 职称: %sn”,member[i].xm,member[i].xb,memb er[i].sr,member[i].nl, member[i].whcd,member[i].lxdh,member[i].sfzh,member[i].gl,me mber[i].zc);printf(“n请输入新内容......n”);printf(“n请输入人员相关信息(姓名性别生日年龄文化程度联系电话身份证号码工龄职称):”);scanf(“%s%s%s%d%s%s%s%d%s”,member[CurrentCount] .xm,member[CurrentCount].xb,member[CurrentCount].sr,&mem ber[CurrentCount].nl,member[CurrentCount].whcd,member[Curr entCount].lxdh,member[CurrentCount].sfzh,&member[CurrentC ount].gl,member[CurrentCount].zc);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scan f(“%d”,&sfjx);}system(“pause”);} int check(){int count=0,name,pass;while(count<=2){printf(“n请输入用户名及密码:”);scanf(“%d%d”,&name,&pass);count++;if((name==1)&&(pass==1))count=10;elseif(count>2)count=5;}if(count==10)return 0;elsereturn 1;} struct mem_gz {float jbgz;float cql;float jj;float kk;float grsd;float sf;};struct mem_gz mem[N+1];void inputgz(){ char sfjx=1;CurrentCount=0;while(sfjx!=0){if(CurrentCount==N){printf(“n工资已添加完毕,无法添加!!n”);sfjx=0;}else{CurrentCount++;printf(“请输入身份证号码为:%s的员工工资资料n”,member[CurrentCount].sfzh);printf(“n请输入员工工资信息(基本工资考勤奖金扣款个人所得税):n”);scanf(“%f%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[C urrentCount].cql,&mem[CurrentCount].jj,&mem[CurrentCount]. kk,&mem[CurrentCount].grsd);mem[CurrentCount].sf=mem[CurrentCount].jbgz*mem[Curr entCount].cql+mem[CurrentCount].jj-mem[CurrentCount].kk-mem[CurrentCount].grsd;}printf(“n是否继续(0--结束,其它--继续):n”);scanf(“%d”,&sfjx);}system(“pause”);} void savegz(){FILE *fq;fq=fopen(“yggzxx.txt”,“w”);if(fq==NULL)printf(“n文件打开不成功,信息无法保存!!n”);else{fprintf(fq,“%d”,CurrentCount);for(int i=1;i<=CurrentCount;i++)fprintf(fq,“n%f %f %f %f %f %f”,mem[i].jbgz,mem[i].cql,m em[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);fclose(fq);printf(“n信息已成功保存!!n”);}system(“pause”);} void readg z(){FILE *fq;fq=fopen(“yggzxx.txt”,“r”);if(fq==NULL)printf(“n文件打开不成功,信息无法读取!!n”);else{fscanf(fq,“%d”,&CurrentCount);for(int i=1;i<=CurrentCount;i++){fscanf(fq,“%f%f%f%f%f%f”,&mem[i].jbgz,&mem[i].cql,&m em[i].jj,&mem[i].kk,&mem[i].grsd,&mem[i].sf);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[i].jbgz,mem[i].cql,mem[i].jj,mem[i].kk,mem[i].grsd ,mem[i].sf);}fclose(fq);printf(“n信息已成功读取!!n”);}system(“pause”);} void searchgz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待查员工编号(身份证号从小到大的顺序):”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void delgz(){int dcbh;int sfjx=1,j;while(sfjx!=0){printf(“n请输入一个待删工资的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n按任意键开始删除......n”);system(“pause”);for(j=dcbh+1;j<=CurrentCount;j++)mem[j-1]=mem[j];CurrentCount--;printf(“n已成功删除......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void modifygz(){int dcbh;int sfjx=1;while(sfjx!=0){printf(“n请输入一个待修改工资员工的编号:”);scanf(“%d”,&dcbh);if(dcbh<1||dcbh>CurrentCount)printf(“查无此人!!n”);else{printf(“n此人工资信息如下:n”);printf(“基本工资: %f 考勤: %f 奖金: %f 扣款: %f 个人所得税: %f 实发工资:%fn”,mem[dcbh].jbgz,mem[dcbh].cql,mem[dcbh].jj,mem[dc bh].kk,mem[dcbh].grsd,mem[dcbh].sf);printf(“n请输入新内容......n”);printf(“n请输入人员工资信息(基本工资考勤奖金扣款个人所得税实发工资):”);scanf(“%f%f%f%f”,&mem[CurrentCount].jbgz,&mem[dcb h].cql,&mem[dcbh].jj,&mem[dcbh].kk,&mem[dcbh].grsd,&mem [dcbh].sf);printf(“n已成功修改......n”);system(“pause”);}printf(“n是否继续(0--结束,其它--继续):”);scanf(“%d”,&sfjx);}system(“pause”);} void lis tgz(){ int i;printf(“n员工工资信息表n”);printf(“ 序号基本工资考勤奖金扣款个人所得税实发工资n”);for(i=1;i<=CurrentCount;i++)printf(“%4d %8f%8f%8f%8f”,i,mem[i].jbgz,mem[i].cql,me m[i].jj,mem[i].kk,mem[i].grsd,mem[i].sf);system(“pause”);}void main(){int xz=1;printf(“*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*n”);printf(“*欢迎使用人事工资管理系统*n”);printf(“***************************************nnn”);if(check()!=0){printf(“n你无权使用本系统......nn”);system(“pause”);}else{while(xz!=0){printf(“n请选择相应功能:n”);printf(“1-录入n2-查询n3-修改n4-删除n5-保存n6-读取n7-输入员工工资n8-保存工资信息n9-读取工资信息n10-修改工资信息n11-删除工资信息n12-工资列表n0-结束n请输入选择:”);scanf(“%d”,&xz);switch(xz){case 1:input();break;case 2:search();break;case 3:modify();break;case 4:del();break;case 5:save();break;case 6:read();break;case 7:inputgz();break;case 8:savegz();break;case 9:readgz();break;case 10:modifygz();break;case 11:delgz();break;case 12:listgz();break;case 0:printf(“nn谢谢使用本系统!nn”);system(“pause”);break;default:printf(“n无此功能,请重新选择......n”);system(“pause”);}}} }第二篇:人事管理系统数据库源代码using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Res ponse.Redirect(“~/登录.aspx”);}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/人员信息查询.aspx”);}protected void Button3_Click(object sender, EventArgs e){ Response.Redirect(“~/人员修改.aspx”);}protected void Button4_Click(object sender, EventArgs e){ Response.Redirect(“~/部门信息.aspx”);}protected void Button5_Click(object sender, EventArgs e){ Response.Redirect(“~/工资信息.aspx”);} } }using System;using System.Collections;usingSystem.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 部门信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find =false;SqlConnection con=new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);con.Open();string cmdstr=“select * from 部门表”;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][“部门代码”].ToString();TextBox3.T ext=ds.Tables[0].Rows[i][“部门名称”].T oString();find=true;}} } if(find == false){ Response.Write(“”);con.Close();} }protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(“~/Default.aspx”);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;using System.Data.SqlTypes;namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox1_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){SqlConnection con = new SqlConnection(“server=localhost;IntegratedSecurity=SSPI;database=人事管理系统”);string strCount;strCount = “select * from 人事表”;con.Open();SqlCommand com = new SqlCommand(strCount, con);SqlDataReader dr = com.ExecuteReader();string strUsername = “", strPassword = ”“;while(dr.Read()){ if(TextBox1.Text == dr[”编号“].ToString()||TextBox2.Text == dr[”用户密码“].ToString()){ strUsername = dr[”编号“].T oString();strPassword = dr[”用户密码“].ToString();break;} } dr.Close();con.Close();if(strUsername== ”“){ Response.Write(”“);return;}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;usingSystem.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 工资信息 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox2_TextChanged(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ bool find = false;SqlConnection con = new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr = ”select * from 工资表“;SqlDataAdapter da = new SqlDataAdapter(cmdstr, con);DataSet ds = new DataSet();da.Fill(ds);for(int i = 0;i < ds.Tables[0].Rows.Count;i++){ for(int j = 0;j < ds.Tables[0].Columns.Count;j++){ String data =(ds.Tables[0].Rows[i][j].ToString()).Trim();if(data == TextBox1.Text.Trim()){TextBox2.Text = ds.Table s[0].Rows[i][”应发工资“].ToString();TextBox3.Text = ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text = ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();}}protected void Button2_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);} } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员信息: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx“);}protected void Button2_Click(object sender, EventArgs e){ bool find =false;SqlConnection con = new S qlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string cmdstr=”select * from 工资表“;SqlDataAdapter da=new SqlDataAdapter(cmdstr,con);DataSet ds=new DataSet();da.Fill(ds);for(int i=0;iTextBox2.Text=ds.T ables[0].Rows[i][”应发工资“].ToString();TextBox3.Text=ds.Tables[0].Rows[i][”岗位津贴“].ToString();TextBox4.Text=ds.Tables[0].Rows[i][”奖励“].ToString();TextBox5.Text = ds.Tables[0].Rows[i][”保险“].ToString();} } if(find == false){ Response.Write(”“);con.Close();} } } }using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1 { public partial class 人员修改: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){}protected void TextBox5_TextChanged(object sender, EventArgs e){}protected void Button2_Click(object sender, EventArgs e){ SqlConnection con=new SqlConnection(”server=localhost;IntegratedSecurity=SSPI;database=人事管理系统“);con.Open();string insert=”insert into 人事表(员工号,姓名,性别,职称,学历)values(“+”“+ TextBox1.Text.Trim()+”“+”,“+”“ + TextBox2.Text.Trim()+”“+”,“+TextBox3.Text.Trim()+ ”,“ +”“+ TextBox4.Text.Trim()+”“+”,“+”“ +TextBox5.Text.Trim()+ ”“+”)“;Response.Write(insert);SqlCommand cmd1=new SqlCommand(insert,con);con.Close();}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect(”~/Default.aspx");}protected void GridView1_SelectedIndexChanged(object sender, EventArgs e){ } } }第三篇:人事管理系统企业人事财务管理系统的开发与设计内容摘要随着Internet的不断发展,传统的管理方式,消耗大量的人力物力,传统的方式已经赶不上时代的脚步,所以开发一个高效的企业人事财务管理系统,是非常必要的。
Java课程设计-人事管理系统的设计与实现
课程设计课程名称 Java语言课程设计题目名称人事管理系统的设计和实现学生学院专业班级____ ____ _学号学生姓名指导教师2012年6月8日一、设计内容自学Swing图形界面设计和数据库程序设计。
开发用于某单位的人事管理系统。
该系统要求实现以下功能:员工信息管理(包括:员工信息一览表、新员工的建立、修改、删除)二、设计方案1、使用Netbeans IDE 7.1和SQL Server2000进行编译。
2、代码如下:登录按钮代码:private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {}private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {String user = jTextField1.getText().trim();String password = jTextField2.getText().trim();if (user.equals("wsm") && password.equals("wsm")) {new yuangongxinxiguanli().setVisible(true);setVisible(false);} else {JOptionPane.showMessageDialog(null, "请正确输入!");}}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new denglu().setVisible(true);}});}员工信息关系系统界面:package 人事管理系统;public class yuangongxinxiguanli extends javax.swing.JFrame {public yuangongxinxiguanli() {initComponents();setLocation(450,220);}@SuppressWarnings("unchecked")// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() {jButton1 = new javax.swing.JButton();jButton2 = new javax.swing.JButton();jButton3 = new javax.swing.JButton();jLabel1 = new javax.swing.JLabel();jButton4 = new javax.swing.JButton();jButton5 = new javax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jButton1.setText("查询员工信息");jButton1.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton1ActionPerformed(evt);}});jButton2.setText("添加员工信息");jButton2.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton2ActionPerformed(evt);}});jButton3.setText("删除员工信息");jButton3.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton3ActionPerformed(evt);}});jLabel1.setFont(new java.awt.Font("宋体", 0, 24)); // NOI18NjLabel1.setText("员工信息管理系统");jButton4.setText("修改员工信息");jButton4.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton4ActionPerformed(evt);}});jButton5.setText("退出系统");jButton5.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton5ActionPerformed(evt);}});javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI NG).addGroup(layout.createSequentialGroup().addGap(91, 91, 91).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING, false).addComponent(jButton1,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE).addComponent(jButton4,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE).addComponent(jButton2,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE).addComponent(jButton3,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE).addComponent(jButton5,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE))).addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel1))).addContainerGap(52, Short.MAX_V ALUE)));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(14, 14, 14).addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponentPlacement.UNRELATED).addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponentPlacement.UNRELATED).addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponentPlacement.UNRELATED).addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponentPlacement.UNRELATED).addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(36, Short.MAX_V ALUE)));pack();}// </editor-fold>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {chaxun ch=new chaxun();ch.setVisible(true);ch.setLocation(400,220);setVisible(false);}private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {tianjia ti=new tianjia();ti.setVisible(true);ti.setLocation(400,220);setVisible(false);// TODO add your handling code here:}private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {xiugai xi=new xiugai();xi.setVisible(true);xi.setLocation(400,220);setVisible(false);// TODO add your handling code here:}private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {shanchu sh=new shanchu();sh.setVisible(true);sh.setLocation(400,220);setVisible(false);}private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {System.exit(0);}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new yuangongxinxiguanli().setVisible(true);}});}// Variables declaration - do not modifyprivate javax.swing.JButton jButton1;private javax.swing.JButton jButton2;private javax.swing.JButton jButton3;private javax.swing.JButton jButton4;private javax.swing.JButton jButton5;private javax.swing.JLabel jLabel1;// End of variables declaration}查询按钮代码:可选择项查询按钮代码:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try {String xuanze= jComboBox1.getSelectedItem().toString().trim();String tianxie=jTextField1.getText().trim();Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");String url="jdbc:microsoft:sqlserver:"+ "//127.0.0.1:1433;DatabaseName=员工信息管理库";Connection con=DriverManager.getConnection(url,"sa","900526");java.sql.Statement stmt=con.createStatement();ResultSet rs=stmt.executeQuery("select * from 员工where "+xuanze+"='"+tianxie+"'");DefaultTableModel dt=(DefaultTableModel) jTable1.getModel();dt.getDataVector().clear();dt.fireTableDataChanged();while(rs.next ()){ Vector v1=new Vector();v1.add(rs.getString(1));v1.add(rs.getString(2));v1.add(rs.getString(3));v1.add(rs.getString(4));v1.add(rs.getString(5));v1.add(rs.getString(6));v1.add(rs.getString(7));dt.addRow(v1);}dt.fireTableDataChanged();rs.close();stmt.close();con.close();} catch (ClassNotFoundException ex) {ex.getMessage();}catch(SQLException ex){ex.getMessage();}}查询全部信息按钮代码:private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {try {Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");String url="jdbc:microsoft:sqlserver:"+ "//127.0.0.1:1433;DatabaseName=员工信息管理库";Connection con=DriverManager.getConnection(url,"sa","900526");java.sql.Statement stmt=con.createStatement();ResultSet rs=stmt.executeQuery("select * from 员工");DefaultTableModel dt=(DefaultTableModel) jTable1.getModel();dt.getDataVector().clear();while(rs.next ()){ Vector v1=new Vector();v1.add(rs.getString(1));v1.add(rs.getString(2));v1.add(rs.getString(3));v1.add(rs.getString(4));v1.add(rs.getString(5));v1.add(rs.getString(6));v1.add(rs.getString(7));dt.addRow(v1);}dt.fireTableDataChanged();rs.close();stmt.close();con.close();} catch (ClassNotFoundException ex) {Logger.getLogger(chaxun.class.getName()).log(Level.SEVERE, null, ex);}catch(SQLException ex){ex.getMessage();}}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new chaxun().setVisible(true);}});}添加界面代码:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try{String yuangonghao = jtf_yuangonghao.getText().trim();String phonenumber = jtf_phonenumber.getText().trim();String name = jtf_name.getText().trim();String age = jtf_age.getText().trim();String sex = jtf_sex.getText().trim();String post = jtf_post.getText().trim();String pay = jtf_pay.getText().trim();Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");String url = "jdbc:microsoft:sqlserver:"+ "//127.0.0.1:1433;DatabaseName=员工信息管理库";Connection con = DriverManager.getConnection(url, "sa", "900526");String str="insert into 员工values(?,?,?,?,?,?,?)";PreparedStatement stmt = con.prepareStatement(str);stmt.setString(1,yuangonghao);stmt.setString(2,name);stmt.setString(3,age);stmt.setString(4,sex);stmt.setString(5,post);stmt.setString(6,phonenumber);stmt.setString(7,pay);ResultSet rs=stmt.executeQuery();rs.close();stmt.close();con.close();} catch (ClassNotFoundException ex) {} catch (SQLException ex) {if (ex.getSQLState().equals("HY000")) {JOptionPane.showMessageDialog(null, "添加成功");}if((ex.getSQLState().equals("23000"))){JOptionPane.showMessageDialog(null, "已经存在该编号的员工,添加失败");}}}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new tianjia().setVisible(true);}});}修改界面代码:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try {String xuanze= jComboBox1.getSelectedItem().toString().trim();String tianxie=jTextField2.getText().trim();//haoString tianxie2=jTextField3.getText().trim();//xieif(tianxie2.equals("")){JOptionPane.showMessageDialog(null, "请正确输入!");}else{Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");String url="jdbc:microsoft:sqlserver:"+ "//127.0.0.1:1433;DatabaseName=员工信息管理库";Connection con=DriverManager.getConnection(url,"sa","900526");java.sql.Statement stmt=con.createStatement();ResultSet rs=stmt.executeQuery("update 员工set "+xuanze+"='"+tianxie2+"'"+"where 员工号="+"'"+tianxie+"'");}} catch (ClassNotFoundException ex) {}catch(SQLException ex){if(ex.getSQLState().equals("HY000"))JOptionPane.showMessageDialog(null, "修改成功");}}private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {@Overridepublic void run() {new xiugai().setVisible(true);}});}删除界面代码:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {DefaultTableModel dt=(DefaultTableModel) jTable1.getModel();try {String tianxie=jTextField2.getText().trim();Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");String url="jdbc:microsoft:sqlserver:"+ "//127.0.0.1:1433;DatabaseName=员工信息管理库";Connection con=DriverManager.getConnection(url,"sa","900526");java.sql.Statement stmt=con.createStatement();//用于执行静态SQL 语句并返回它所生成结果的对象ResultSet rs=stmt.executeQuery("delete from 员工where 员工号='"+tianxie+"'");rs.close();stmt.close();con.close();} catch (ClassNotFoundException ex) {System.out.println( ex.getMessage());}catch(SQLException ex){//System.out.println( ex.getMessage()+ " "+ex.getSQLState());if(ex.getSQLState().equals("HY000")){dt.getDataVector().clear();dt.fireTableDataChanged();JOptionPane.showMessageDialog(null, "删除成功!");}}}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new shanchu().setVisible(true);}});}返回按钮代码:private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {new yuangongxinxiguanli().setVisible(true);setVisible(false); }三、结果和数据处理登陆界面:输入管理员账号密码,进行登录。
简单的JAVA员工信息管理系统源码
// 项目目标:建立员工管理系统第一个版本。
// 实现图形用户界面的员工信息查询、增、删、改;与数据库建立,并将修改结果时时保存到数据库。
// 模块:1。
GUI界面 2.数据库连接 3。
查询 4.增、5删 6改(操作数据库)import java.sql.*;import java.awt.*;import java.awt。
event.*;import javax。
swing。
*;public class EmpManageSys implements ActionListener {Connection con;Statement stmt;String sql;ResultSet rs;StringBuffer sb = new StringBuffer();JTextField jtf2 = new JTextField("张飞”,10);JTextField jtf3 = new JTextField(10);JTextField jtf4 = new JTextField(10);JTextField jtf7 = new JTextField(10);JTextField jtf5 = new JTextField(10);JTextField jtf6 = new JTextField(10);JTextField jtf8 = new JTextField(10);JTextField jtf9 = new JTextField(10);JTextArea jta10 = new JTextArea(50, 40);public void actionPerformed(ActionEvent e) {String str = e.getActionCommand();if (”查询”。
equals(str)) {//if check the button of 查询,then go to method of searchEmp() searchEmp();} else if (”增加”.equals(str)) {//if check the button of 增加,then go to method of addEmp() addEmp();} else if (”修改".equals(str)){//if check the button of 修改,then go to method of alterEmp() alterEmp();}else if (”撤除".equals(str)) {//if check the button of 撤除,then go to method of deleteEmp()deleteEmp();}}//this is the constructor.EmpManageSys(){createGUI();connectToDataBase();// searchEmp();// addEmp();// deleteEmp();alterEmp();}//connect to the database by using the method getConnection from the class of JdbcUtil。
《数据库应用》课程设计——人事管理系统(java源代码)
《数据库应用》课程设计——人事管理系统(java源代码)//用户登陆类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class Land extends JFrame{JFrame jf ;JTextField textName=new JTextField(); JPasswordField textage=new JPasswordField(); JLabel label = new JLabel("员工管理系统");JLabel labelName=new JLabel("用户名:");JLabel labelage=new JLabel("密码:");JButton buttonEnter=new JButton("登录");JButton buttoncancel=new JButton("清空");public Land(){jf=this;setTitle("登录");Font f = new Font("新宋体",Font.PLAIN,12); Container con = getContentPane();con.setLayout(null);label.setBounds(95,10,110,20);label.setFont(new Font("新宋体",Font.PLAIN,14));con.add(label);labelName.setBounds(45,40,55,20);labelName.setFont(f);con.add(labelName);textName.setBounds(95,40,120,20);con.add(textName);labelage.setBounds(45,70,45,20);con.add(labelage);labelage.setFont(f);textage.setBounds(95,70,120,20);con.add(textage);buttonEnter.setBounds(90,110,60,20);buttonEnter.setFont(f);con.add(buttonEnter);//登陆的鼠标监听buttonEnter.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent me){if(textName.getText().equals("")){new JOptionPane().showMessageDialog(null,"用户名不能为空!"); }else if(textage.getText().equals("")){new JOptionPane().showMessageDialog(null,"密码不能为空!"); }else{String sql="select * from UserInformation where User_Name = '" + textName.getText() + "' and Password = '" + textage.getText()+ "'";System.out.println(sql);Judge(sql);}}});buttoncancel.setBounds(155,110,60,20);buttoncancel.setFont(f);con.add(buttoncancel);//清空按钮的鼠标监听方法buttoncancel.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent me){textName.setText("");textage.setText("");}});setResizable(false);Image img=Toolkit.getDefaultToolkit().getImage("image\\main.gif");setIconImage(img);Toolkit t = Toolkit.getDefaultToolkit();int w = t.getScreenSize().width;int h = t.getScreenSize().height;setBounds(w/2-150,h/2-90,300,180);setVisible(true);}private void Judge(String sqlString) {if (Database.joinDB()) {if (Database.query(sqlString))try{if(Database.rs.isBeforeFirst()) {System.out.println("密码正确");jf.setVisible(false);.close();new Main();}else {System.out.println("错误");new JOptionPane().showMessageDialog(null,"用户名或密码错误!","",JOptionPane.ERROR_MESSAGE);}}catch(Exception ex) {System.out.println(ex.getMessage());}}else{System.out.println("连接数据库不成功");}}public static void main(String args[]){new Land();}}//主函数类,可以独立运行package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class Main extends JFrame implements Runnable{ Thread t=new Thread(this);JDesktopPane deskpane = new JDesktopPane();JPanel p = new JPanel();Label lp1=new Label("欢迎使用员工管理系统 !"); ImageIcon icon1=new ImageIcon("imagetjsc.gif"); ImageIcon icon2=new ImageIcon("imagecxdl.gif"); ImageIcon icon3=new ImageIcon("imagexgmm.gif"); ImageIcon icon4=new ImageIcon("imagetcxt.gif"); ImageIcon icon5=new ImageIcon("imagejj.gif"); ImageIcon icon6=new ImageIcon("imagehelp.gif"); ImageIcon icon7=new ImageIcon("imagecx.gif"); ImageIcon icon8=new ImageIcon("imagegl.gif");ImageIcon icon9=new ImageIcon("imagext.gif");ImageIcon icon10=new ImageIcon("imagexxgl.gif");ImageIcon icon11=new ImageIcon("imagexxcx.gif");ImageIcon icon12=new ImageIcon("imagebz.gif");ImageIcon icon13=new ImageIcon("imagegy.gif");ImageIcon icon14=new ImageIcon("imageglxx.gif");ImageIcon icon15=new ImageIcon("imagecxxx.gif");//完--------------------------------------------------------------------------------public Main(){setTitle("员工管理系统");Container con = getContentPane();con.setLayout(new BorderLayout());con.add(deskpane,BorderLayout.CENTER);Font f =new Font("新宋体",Font.PLAIN,12);JMenuBar mb = new JMenuBar();JMenu systemM = new JMenu("系统管理");systemM.setFont(f);JMenu manageM = new JMenu("信息管理");manageM.setFont(f);JMenu employeeMM = new JMenu("员工信息管理");employeeMM.setFont(f);JMenu selectM = new JMenu("信息查询");selectM.setFont(f);JMenu employeeSM =new JMenu("员工信息查询"); employeeSM.setFont(f);JMenu helpM = new JMenu("帮助");helpM.setFont(f);JMenu aboutM=new JMenu("关于");aboutM.setFont(f);JMenuItem password = new JMenuItem("密码修改"); password.setFont(f);JMenuItem land = new JMenuItem("重新登陆");land.setFont(f);JMenuItem addDelete = new JMenuItem("添加/删除用户"); addDelete.setFont(f);JMenuItem exit = new JMenuItem("退出系统");exit.setFont(f);systemM.add(password);systemM.add(land);systemM.add(addDelete);systemM.add(exit);//为系统管理菜单加事件password.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("AmendPassword");deskpane.add(new AmendPassword());}});land.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Land");setVisible(false);new Land();}});addDelete.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deskpane.add(new AddDeleteUser());}});exit.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){//new JOptionPane().showMessageDialog(setVisible(false);}});JMenuItem departmentM = new JMenuItem("部门信息管理"); departmentM.setFont(f);JMenuItem employeeM = new JMenuItem("基本信息管理"); employeeM.setFont(f);JMenuItem trainM = new JMenuItem("培训信息管理");trainM.setFont(f);JMenuItem encouragementPunishM = new JMenuItem("奖罚信息管理"); encouragementPunishM.setFont(f);JMenuItem wageM =new JMenuItem("薪资信息管理");wageM.setFont(f);employeeMM.add(trainM);employeeMM.add(employeeM);employeeMM.add(encouragementPunishM);employeeMM.add(wageM);manageM.add(employeeMM);manageM.add(departmentM);//为管理菜单加事件departmentM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Departmentmanage");deskpane.add(new Departmentmanage());}});employeeM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Employeemanage");deskpane.add(new Employeemanage());}});trainM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Trainmanage");deskpane.add(new Trainmanage());}});encouragementPunishM.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("EncouragementPunish");deskpane.add(new EncouragementPunish());}});wageM.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("WageManage");deskpane.add(new WageManage());}});JMenuItem departmentS = new JMenuItem("部门信息查询"); departmentS.setFont(f);JMenuItem employeeS = new JMenuItem("基本信息查询"); employeeS.setFont(f);JMenuItem trainS = new JMenuItem("培训信息查询");trainS.setFont(f);JMenuItem encouragementPunishS = new JMenuItem("奖罚信息查询"); encouragementPunishS.setFont(f);JMenuItem wageS =new JMenuItem("薪资信息查询");wageS.setFont(f);employeeSM.add(trainS);employeeSM.add(employeeS);employeeSM.add(encouragementPunishS);employeeSM.add(wageS);selectM.add(employeeSM);selectM.add(departmentS);//为查询菜单加事件departmentS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("DIQ");deskpane.add(new DIQ());}});employeeS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("BIQ");deskpane.add(new BIQ());}});trainS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("TIQ");deskpane.add(new TIQ());}});encouragementPunishS.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){System.out.println("EPIQ");deskpane.add(new EPIQ());}});wageS.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("SIQ");deskpane.add(new SIQ());}});JMenuItem help = new JMenuItem("帮助");help.setFont(f);JMenuItem about =new JMenuItem("关于");about.setFont(f);helpM.add(help);aboutM.add(about);//为帮助菜单加事件about.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new About());}});mb.add(systemM);mb.add(manageM);mb.add(selectM);mb.add(helpM);mb.add(aboutM);setJMenuBar(mb);Image img=Toolkit.getDefaultToolkit().getImage("imagemain.gif"); setIconImage(img);systemM.setIcon(icon9);manageM.setIcon(icon8);selectM.setIcon(icon7);helpM.setIcon(icon6);addDelete.setIcon(icon1);land.setIcon(icon2);password.setIcon(icon3);exit.setIcon(icon4);employeeMM.setIcon(icon5);employeeSM.setIcon(icon5);departmentM.setIcon(icon10);departmentS.setIcon(icon11);help.setIcon(icon6);aboutM.setIcon(icon13);about.setIcon(icon13);employeeM.setIcon(icon14);trainM.setIcon(icon14); encouragementPunishM.setIcon(icon14); wageM.setIcon(icon14);employeeS.setIcon(icon15);trainS.setIcon(icon15); encouragementPunishS.setIcon(icon15); wageS.setIcon(icon15);JToolBar jToolBar1 = new JToolBar(); jToolBar1.setLayout(new GridLayout(9,1)); JButton jButton1 = new JButton();jButton1.setToolTipText("员工基本信息管理"); JButton jButton2 = new JButton();jButton2.setToolTipText("员工基本信息查询"); JButton jButton3 = new JButton();jButton3.setToolTipText("修改密码");JButton jButton5 = new JButton();jButton5.setToolTipText("计算器");JButton jButton6 = new JButton();jButton6.setToolTipText("退出系统");jToolBar1.setMaximumSize(new java.awt.Dimension(600, 50)); jToolBar1.setMinimumSize(new java.awt.Dimension(600, 50)); //添加工具栏中按钮的方法jButton1.setIcon(new ImageIcon("image1.png"));jButton1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Employeemanage");deskpane.add(new Employeemanage());}});jToolBar1.add(jButton1);jButton2.setIcon(new ImageIcon("image2.png"));jButton2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new BIQ());}});jToolBar1.add(jButton2);jButton3.setIcon(new ImageIcon("image3.png"));jButton3.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){deskpane.add(new AmendPassword());}});jToolBar1.add(jButton3);jButton5.setIcon(new ImageIcon("image5.png"));jButton5.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Calculator");deskpane.add(new Calculator());}});jToolBar1.add(jButton5);jButton6.setIcon(new javax.swing.ImageIcon("image6.png")); jButton6.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.exit(0);}});jToolBar1.add(jButton6);jToolBar1.setBounds(0, 0, 30, 600);jToolBar1.setEnabled(false);con.add(jToolBar1,BorderLayout.WEST);p.setLayout(new BorderLayout());p.add(lp1,BorderLayout.EAST);t.start();con.add(p,BorderLayout.SOUTH);Toolkit t = Toolkit.getDefaultToolkit();int width = t.getScreenSize().width - 200; int height = t.getScreenSize().height - 100; setSize(width,height);setLocation(150,100);setVisible(true);setResizable(false);}//线程的方法public void run(){System.out.println("线程启动了!");Toolkit t = Toolkit.getDefaultToolkit();int x=t.getScreenSize().width;System.out.println("x=" + x);lp1.setForeground(Color.red);while(true){if(x<-600){x=t.getScreenSize().width;}lp1.setBounds(x,0,700,20);x-=10;try{Thread.sleep(100);}catch(Exception e){} }}public static void main(String[] args){new Main();}}//数据库联接类package classsource;import java.sql.*;public class Database {public static Connection cn;public static Statement st;public static ResultSet rs;public static boolean joinDB() {boolean joinFlag;try {joinFlag = true;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");cn =DriverManager.getConnection("jdbc:odbc:EmployeeInformationMS","sa"," ");cn.setCatalog("EmployeeInformationMS");System.out.println("数据库连接成功");st = cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);return joinFlag;} catch (SQLException sqlEx) {System.out.println(sqlEx.getMessage());joinFlag = false;return joinFlag;} catch (ClassNotFoundException notfoundEX) { System.out.println(notfoundEX.getMessage());joinFlag = false;return joinFlag;}}public static boolean executeSQL(String sqlString) { boolean executeFlag;try {st.execute(sqlString);executeFlag = true;} catch (Exception e) {executeFlag = false;System.out.println("sql exception:" + e.getMessage()); }return executeFlag;}public static boolean query(String sqlString) {try {rs = null;//System.out.println(sqlString);rs = st.executeQuery(sqlString);} catch (Exception Ex) {System.out.println("sql exception:" + Ex);return false;}return true;}}//添加删除用户类package classsource;import java.awt.event.*;import java.awt.*;import javax.swing.*;import java.sql.*;public class AddDeleteUser extends javax.swing.JInternalFrame { private JButton butACancel,butDCancel,butDelete,butOk;private JComboBox cbUserName;private JLabel jLabel1,jLabel2,jLabel3,jLabel4,jLabel5;private JPasswordField pas1,pas2,pas3;private JTextField txtname;public AddDeleteUser() {initComponents();this.setVisible(true);this.setClosable(true);this.setSize(268,350);}private void initComponents() { jLabel1 = new JLabel();jLabel2 = new JLabel();jLabel3 = new JLabel();txtname = new JTextField();pas1 = new JPasswordField();pas2 = new JPasswordField(); butOk = new JButton();butACancel = new JButton();jLabel4 = new JLabel(); cbUserName = new JComboBox(); jLabel5 = new JLabel();pas3 = new JPasswordField(); butDelete = new JButton(); butDCancel = new JButton(); getContentPane().setLayout(null); jLabel1.setText("新用户名:"); getContentPane().add(jLabel1); jLabel1.setBounds(30, 30, 70, 20); jLabel2.setText("输入密码:");getContentPane().add(jLabel2);jLabel2.setBounds(30, 60, 70, 18); jLabel3.setText("确认密码:"); getContentPane().add(jLabel3);jLabel3.setBounds(30, 90, 60, 18); getContentPane().add(txtname); txtname.setBounds(100, 30, 130, 24); getContentPane().add(pas1);pas1.setBounds(100, 60, 130, 24); getContentPane().add(pas2);pas2.setBounds(100, 90, 130, 24); butOk.setText("添加");getContentPane().add(butOk);butOk.setBounds(80, 130, 70, 27); butACancel.setText("清空"); getContentPane().add(butACancel); butACancel.setBounds(160, 130, 70, 27); jLabel4.setText("已有用户名:"); getContentPane().add(jLabel4);jLabel4.setBounds(30, 180, 80, 18); getContentPane().add(cbUserName); cbUserName.setBounds(100, 180, 130, 24); jLabel5.setText("密码:"); getContentPane().add(jLabel5);jLabel5.setBounds(30, 210, 60, 18);getContentPane().add(pas3);pas3.setBounds(100, 216, 130, 24);butDelete.setText("删除");getContentPane().add(butDelete);butDelete.setBounds(79, 260, 70, 27);butDCancel.setText("清空");getContentPane().add(butDCancel);butDCancel.setBounds(160, 260, 70, 27);//将所有用用户名读出来Database.joinDB();String sql="select * from UserInformation";try{if(Database.query(sql)){while(Database.rs.next()){String name=Database.rs.getString("User_Name");cbUserName.addItem(name);}}}catch(Exception e){}//为添加和取消按钮加事件----------------------------------------- butOk.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if(txtname.getText().equals("")){new JOptionPane().showMessageDialog(null,"用户名不能为空!");}else if(pas1.getText().equals("")){new JOptionPane().showMessageDialog(null,"密码不能为空!");}else if(pas1.getText().equals(pas2.getText())){String sql="insert UserInformation values('"+ txtname.getText() +"','"+ pas1.getText() +"','B')";try{if(Database.executeSQL(sql)){new JOptionPane().showMessageDialog(null,"添加成功!");cbUserName.addItem(txtname.getText());}}catch(Exception ea){}}}});butACancel.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){txtname.setText("");pas1.setText("");pas2.setText("");}});//为删除和取消按钮加事件--------------------------------------- butDelete.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){String name="" + cbUserName.getSelectedItem();String sql="select * from UserInformation where User_Name='"+ name +"'";try{if(Database.query(sql)){Database.rs.next();String pas=pas3.getText();String password=Database.rs.getString("Password");System.out.println(password);if(pas.equals(password)){String sdelete="delete from UserInformation where User_Name='"+ name +"'";if(Database.executeSQL(sdelete)){new JOptionPane().showMessageDialog(null,"删除成功!");pas3.setText("");cbUserName.removeAllItems();String sql1="select * from UserInformation";if(Database.query(sql1)){while(Database.rs.next()){Stringname1=Database.rs.getString("User_Name"); cbUserName.addItem(name1);}}}}else{new JOptionPane().showMessageDialog(null,"密码不正确!");}}}catch(Exception el){System.out.println(el);}}});butDCancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){pas3.setText("");}});}}//修改密码类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class AmendPassword extends JInternalFrame { JLabel lbe1=new JLabel("修改密码");JPanel p=new JPanel();public AmendPassword(){setTitle("修改密码");p.add(lbe1);AmendPanel panel=new AmendPanel();Container contentPane=getContentPane(); contentPane.add(p,"North");contentPane.add(panel,"Center");setBounds(100, 100, 280, 260);this.setClosable(true);setVisible(true);}}class AmendPanel extends JPanel {JButton b1,b2;JLabel lbe2,lbe3,lbe4,lbe5; JPasswordField pas1,pas2,pas3; JComboBox tf;public AmendPanel(){lbe2=new JLabel("用户名:");lbe3=new JLabel("输入旧密码:"); lbe4=new JLabel("输入新密码:"); lbe5=new JLabel("确定新密码:"); tf=new JComboBox();pas1=new JPasswordField();pas2=new JPasswordField();pas3=new JPasswordField();b1=new JButton("确定");b2=new JButton("清空");add(lbe2);lbe2.setBounds(16,10,90,25); this.add(tf);tf.setBounds(100,10,120,25); add(lbe3);lbe3.setBounds(16,45,90,25);add(pas1);pas1.setBounds(100,45,120,25);add(lbe4);lbe4.setBounds(16,80,80,25);add(pas2);pas2.setBounds(100,80,120,25);add(lbe5);lbe5.setBounds(16,115,80,25);add(pas3);pas3.setBounds(100,115,120,25);add(b1);b1.setBounds(100,160,60,30);add(b2);b2.setBounds(160,160,60,30);setLayout(null);//将所有用用户名读出来Database.joinDB();String sql="select * from UserInformation";try{if(Database.query(sql)){while(Database.rs.next()){String name=Database.rs.getString("User_Name"); tf.addItem(name);}}}catch(Exception e){}//为确定取消按钮加事件b1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){String name="" + tf.getSelectedItem();System.out.println(name);String sql="select * from UserInformation where User_Name='"+ name +"'";System.out.println(sql);try{if(Database.query(sql)){Database.rs.next();String ps1=pas1.getText();String password=Database.rs.getString("Password");if(ps1.equals(password)){if(pas2.getText().equals(pas3.getText())){String supdate="update UserInformation set Password='"+pas3.getText()+"' where User_Name='"+ name +"'";Database.executeSQL(supdate);new JOptionPane().showMessageDialog(null,"密码更改成功!");}else{new JOptionPane().showMessageDialog(null,"两次密码不同!");}}else{new JOptionPane().showMessageDialog(null,"旧密码不正确!");}}}catch(Exception el){System.out.println(el);}}});b2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){pas1.setText("");pas2.setText("");pas3.setText("");}});}}//关于类package classsource;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class About extends JInternalFrame {JLabel label = new JLabel("运行环境:Windows");JLabel labe2 = new JLabel("开发语言:JAVA");JLabel labe3 = new JLabel("数据库类型:SqlServer2000"); public About(){setTitle("关于");Container con=getContentPane();con.setLayout(new GridLayout(4,1));con.add(label);con.add(labe2);con.add(labe3);con.setBackground(Color.white);setResizable(false);setSize(380,220);setVisible(true);setClosable(true);}}//员工信息查询类package classsource;import java.awt.*;import javax.swing.*;import javax.swing.table.*;import java.awt.event.*;import java.util.*;import javax.swing.JScrollPane.*;import java.sql.*;public class BIQ extends JInternalFrame{JLabel lbl1=new JLabel("基本信息查询");JLabel lbl2=new JLabel("员工编号:");JLabel lbl3=new JLabel("员工姓名:");JTextField btxtid=new JTextField(10);JTextField btxtname=new JTextField(10);JButton btn1=new JButton("查询");JTable table;DefaultTableModel dtm;String columns[] = {"员工编号","员工姓名"," 性别 ","出生日期","婚姻状况","政治面貌"," 学历 ","进入公司时间","转正时间"," 部门 "," 职务 ","员工状态"," 备注"};public BIQ(){setTitle("基本信息查询");dtm = new DefaultTableModel();table = new JTable(dtm);JScrollPane sl = new JScrollPane();sl.getViewport().add(table);dtm.setColumnCount(5);dtm.setColumnIdentifiers(columns); getContentPane().setLayout(null);lbl1.setBounds(240,10,300,30);lbl1.setFont(new Font("宋体",Font.BOLD,24)); getContentPane().add(lbl1);Font f=new Font("宋体",Font.PLAIN,12);lbl2.setBounds(10,60,80,25);lbl2.setFont(f);getContentPane().add(lbl2);btxtid.setBounds(80,60,80,23);btxtid.setFont(f);getContentPane().add(btxtid);lbl3.setBounds(10,90,80,25);lbl3.setFont(f);getContentPane().add(lbl3);btxtname.setBounds(80,90,80,23);btxtname.setFont(f);getContentPane().add(btxtname);btn1.setBounds(90,130,60,25);btn1.setFont(f);getContentPane().add(btn1);sl.setBounds(180,60,500,370);getContentPane().add(sl);//设置边框btxtid.setBorder(BorderFactory.createLineBorder(Color.black));btxtname.setBorder(BorderFactory.createLineBorder(Color.black));btn1.setBorder(BorderFactory.createRaisedBevelBorder());sl.setBorder(BorderFactory.createLineBorder(Color.black));//----连接数据库--------------------------------------------------------------------------Database.joinDB();String sql="select * from EmployeeInformation";if(Database.query(sql)){System.out.println(sql);try{while(Database.rs.next()){String eNumber=(""+Database.rs.getInt("E_Number"));System.out.println(eNumber);String eName=Database.rs.getString("E_Name");System.out.println(eName);String eSex=Database.rs.getString("E_Sex");System.out.println(eSex);String eBornDate=Database.rs.getString("E_BornDate");System.out.println(eBornDate);String eMarriage=Database.rs.getString("E_Marriage");System.out.println(eMarriage);StringePoliticsVisage=Database.rs.getString("E_PoliticsVisage"); System.out.println(ePoliticsVisage);String eSchoolAge=Database.rs.getString("E_SchoolAge"); System.out.println(eSchoolAge);String eEnterDate=Database.rs.getString("E_EnterDate"); System.out.println(eEnterDate);String eInDueFormDate=Database.rs.getString("E_InDueFormDate"); System.out.println(eInDueFormDate);String eDepartment=Database.rs.getString("E_Department"); System.out.println(eDepartment);String eHeadship=Database.rs.getString("E_Headship");System.out.println(eHeadship);String eEstate=Database.rs.getString("E_Estate");System.out.println(eEstate);String eRemark=Database.rs.getString("E_Remark");System.out.println(eRemark);Vector v=new Vector();v.add(eNumber);v.add(eName);v.add(eSex);v.add(eBornDate);v.add(eMarriage);v.add(ePoliticsVisage);v.add(eSchoolAge);v.add(eEnterDate);v.add(eInDueFormDate);v.add(eDepartment);v.add(eHeadship);v.add(eEstate);v.add(eRemark);dtm.addRow(v);}}catch(Exception eBIQ){System.out.println("初始化数据失败!");}}//为查询按钮加事件btn1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent eBIQ){ System.out.println("按钮事件");String esql;int rc=dtm.getRowCount();for(int i=0;i<rc;i++){dtm.removeRow(0);}if(btxtid.getText().equals("")&&btxtname.getText().equals("")){ esql="select * from EmployeeInformation";}else if(btxtname.getText().equals("")){esql="select * from EmployeeInformation where E_Number = '" + btxtid.getText() +"'";}else{esql="select * from EmployeeInformation where E_Number = '" + btxtid.getText() +"' or E_Name like '%"+ btxtname.getText() +"%'";}System.out.println(esql);if(Database.query(esql)){try{while(Database.rs.next()){String eNumber=(""+Database.rs.getInt("E_Number"));System.out.println(eNumber);String eName=Database.rs.getString("E_Name");System.out.println(eName);。
人事管理系统(源代码
附录:毕业设计程序清单设计题目人事管理系统教学班:学生姓名:学号:指导教师:完成日期:Option ExplicitDim Bupdata As BooleanDim i As IntegerPrivate Sub Cmbdegree_Click()If Cmbdegree.Text = "定制" ThenFrmTable.ShowCmbdegree.ListIndex = 0End IfEnd SubPrivate Sub Cmbdepart_Click()If Cmbdepart.Text = "定制" ThenFrmTable.ShowCmbdepart.ListIndex = 0End IfEnd SubPrivate Sub CmdAddNew_Click()If CmdAddNew.Caption = "添加" ThenCmdAddNew.Caption = "确认"CmdDel.Enabled = FalseCmdOK.Enabled = FalseDataA.ReadOnly = FalseFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0Next iDataA.Recordset.AddNewTxt(0).Locked = FalseIf FrmMain.cutable = "employee" ThenDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowIf Opsex(0) ThenDataA.Recordset.Fields(4) = "男"ElseDataA.Recordset.Fields(4) = "女"End IfDataA.Recordset.Fields(7) = Cmbdegree.TextDataA.Recordset.Fields(8) = Cmbdepart.TextElseIf FrmMain.cutable = "leave" ThenDataA.Recordset.Fields(8) = frmLogin.EmploIDDataA.Recordset.Fields(9) = NowElseDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowEnd IfTxt(0).SetFocusElse 'OKIf Txt(0).Text = "" ThenMsgBox "不可以为空"Txt(0).SetFocusExit SubEnd IfFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next iIf FrmMain.cutable = "employee" ThenDataB.Recordset.FindFirst "职工编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "职员编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfElseIf FrmMain.cutable = "leave" ThenDataB.Recordset.FindFirst "假条编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "假条编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfElseFor i = 4 To 10If Not IsNumeric(Txt(i).Text) ThenMsgBox "not a number"Txt(i).SetFocusExit SubEnd IfNext iDataB.Recordset.FindFirst "工资编号=" + Txt(0).TextIf Not DataB.Recordset.NoMatch ThenMsgBox "工资编号重复"Txt(0).Text = ""Txt(0).SetFocusExit SubEnd IfEnd IfDataA.Recordset.UpdateDataA.Recordset.MoveLastFrmMain.DataA.RefreshFrmMain.DataB.RefreshDataB.RefreshCmdAddNew.Caption = "添加"CmdDel.Enabled = TrueCmdOK.Enabled = TrueEnd IfEnd SubPrivate Sub CmdCacel_Click()If CmdAddNew.Caption = "确认" ThenDataA.Recordset.CancelUpdateEnd IfFrmMain.Enabled = TrueFrmMain.SetFocusUnload MeFrmMain.DataA.RefreshIf FrmMain.cutable = "employee" ThenFrmMain.DBGA.Columns("性别").Button = TrueFrmMain.DBGA.Columns("学历").Button = TrueFrmMain.DBGA.Columns("部门").Button = True End IfEnd SubPrivate Sub CmdDel_Click()DataA.ReadOnly = FalseDataA.Recordset.DeleteDataA.Recordset.MoveNextIf DataA.Recordset.EOF ThenDataA.Recordset.MoveLastEnd IfFrmMain.DataA.RefreshEnd SubPrivate Sub cmdOK_Click()If Txt(0).Text = "" ThenMsgBox "不可以为空"Txt(0).SetFocusExit SubEnd IfBupdata = FalseDataA.Recordset.EditIf FrmMain.cutable = "leave" ThenDataA.Recordset.Fields(8) = frmLogin.EmploIDDataA.Recordset.Fields(9) = NowElseIf FrmMain.cutable = "employee" ThenDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowIf Opsex(0) ThenDataA.Recordset.Fields(4) = "男"ElseDataA.Recordset.Fields(4) = "女"End IfDataA.Recordset.Fields(7) = Cmbdegree.TextDataA.Recordset.Fields(8) = Cmbdepart.TextDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowElseFor i = 4 To 10If Not IsNumeric(Txt(i).Text) ThenMsgBox "not a number"Txt(i).SetFocusExit SubEnd IfNext iDataA.Recordset.Fields(13) = frmLogin.EmploIDDataA.Recordset.Fields(14) = NowEnd IfFor i = 1 To 12If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0 Next iDataA.Recordset.UpdateFrmMain.DataA.RefreshDataB.RefreshEnd SubPrivate Sub DataA_V alidate(Action As Integer, Save As Integer)If Action = 11 And Bupdata ThenSave = 0End IfEnd SubPrivate Sub Lab_Click(Index As Integer)End SubPrivate Sub Txt_KeyPress(Index As Integer, KeyAscii As Integer)If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And Index = 0 Then KeyAscii = 0Exit SubEnd IfIf FrmMain.cutable = "leave" And Index = 1 ThenIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack ThenKeyAscii = 0Exit SubEnd IfEnd IfIf FrmMain.cutable = "salary" ThenIf Index <= 3 ThenIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack ThenKeyAscii = 0Exit SubEnd IfEnd IfIf Index = 13 Then Exit SubIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And KeyAscii <> 46 ThenKeyAscii = 0Exit SubEnd IfEnd IfEnd SubPrivate Sub Txt_change(Index As Integer)If Bupdata = False Then Bupdata = TrueIf FrmMain.cutable = "salary" ThenIf Txt(Index).Text = "" Then Exit SubIf Index >= 4 And Index <= 6 ThenTxt(7).Text = V al(Txt(4).Text) + V al(Txt(5).Text) + V al(Txt(6).Text)Txt(12).Text = V al(Txt(7).Text) - V al(Txt(11).Text)End IfIf Index >= 8 And Index <= 10 ThenTxt(11).Text = V al(Txt(8).Text) + V al(Txt(9).Text) + V al(Txt(10).Text)Txt(12).Text = V al(Txt(7).Text) - V al(Txt(11).Text)End IfEnd IfEnd SubPrivate Sub Form_Load()DataA.DatabaseName = App.Path + "\sm.mdb"DataB.DatabaseName = App.Path + "\sm.mdb"DataA.Caption = FrmMain.cutableDataA.RecordSource = "select * from " + FrmMain.cutableDataB.RecordSource = "select * from " + FrmMain.cutableDataA.RefreshTxt(0).Locked = True'If FrmMain.DBGA.Row = 0 Then Exit SubIf FrmMain.cutable = "employee" Then 'employeeFor i = 0 To 12Lab(i).Caption = DataA.Recordset.Fields(i).NameNext iTxt(0).DataField = DataA.Recordset.Fields(0).NameTxt(1).DataField = DataA.Recordset.Fields(1).NameTxt(2).DataField = DataA.Recordset.Fields(2).NameTxt(3).DataField = DataA.Recordset.Fields(3).NameTxt(4).V isible = FalseTxt(5).DataField = DataA.Recordset.Fields(5).NameTxt(6).DataField = DataA.Recordset.Fields(6).NameTxt(7).V isible = FalseTxt(8).V isible = FalseTxt(9).DataField = DataA.Recordset.Fields(9).NameTxt(10).DataField = DataA.Recordset.Fields(10).NameTxt(11).DataField = DataA.Recordset.Fields(11).NameTxt(12).DataField = DataA.Recordset.Fields(12).NameTxt(13).DataField = DataA.Recordset.Fields(15).NameIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfIf DataA.Recordset.Fields(4) = "男" ThenOpsex(0).V alue = TrueElseOpsex(1).V alue = TrueEnd If'设置lsdegree的显示项For i = 0 To FrmMain.LsDegree.ListCount - 2Cmbdegree.AddItem FrmMain.LsDegree.List(i)If FrmMain.LsDegree.List(i) = DataA.Recordset.Fields(7) ThenCmbdegree.ListIndex = iEnd IfNext iIf Cmbdegree.ListIndex = -1 ThenCmbdegree.AddItem DataA.Recordset.Fields(7)Cmbdegree.ListIndex = Cmbdegree.ListCount - 1End IfCmbdegree.AddItem "定制"'设置lsdepart的显示项For i = 0 To FrmMain.LsDepart.ListCount - 2Cmbdepart.AddItem FrmMain.LsDepart.List(i)If FrmMain.LsDepart.List(i) = DataA.Recordset.Fields(8) ThenCmbdepart.ListIndex = iEnd IfNext iIf Cmbdepart.ListIndex = -1 ThenCmbdepart.AddItem DataA.Recordset.Fields(8)Cmbdepart.ListIndex = Cmbdepart.ListCount - 1End IfCmbdepart.AddItem "定制"'设置完毕ElseIf FrmMain.cutable = "leave" Then 'leaveTxt(7).V isible = TrueCmbdegree.V isible = FalseCmbdepart.V isible = FalseFrame1.V isible = FalseFor i = 8 To 12Lab(i).Visible = FalseTxt(i).V isible = FalseNext iFor i = 0 To 7Lab(i).Caption = DataA.Recordset.Fields(i).NameTxt(i).DataField = DataA.Recordset.Fields(i).NameNext iTxt(13).DataField = DataA.Recordset.Fields(10).NameIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfElse 'salaryFrame1.V isible = FalseCmbdegree.V isible = FalseCmbdepart.V isible = FalseFor i = 0 To 12Lab(i).Caption = DataA.Recordset.Fields(i).NameTxt(i).DataField = DataA.Recordset.Fields(i).NameNext iTxt(13).DataField = DataA.Recordset.Fields(15).NameTxt(7).Locked = TrueTxt(11).Locked = TrueTxt(12).Locked = TrueIf FrmMain.cuAp > -1 ThenDataA.Recordset.Move (FrmMain.cuAp)ElseDataA.Recordset.MoveFirstEnd IfEnd IfEnd SubPrivate Sub Form_Unload(Cancel As Integer)FrmMain.Enabled = TrueFrmMain.SetFocusUnload MeFrmMain.DataB.RefreshEnd SubOption ExplicitConst MxUser = 100Public EmploID As IntegerPublic CurUser As StringPublic CurId As StringPublic CurPsw As StringDim user(MxUser), pws(MxUser), state(MxUser), Emplo(MxUser) As StringPrivate Sub Form_Load()Dim i As IntegerIf App.PrevInstance ThenMsgBox ("程序已经运行,不能再次装载。
人事管理系统数据库源代码
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){} }。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
目录摘要…………………………………………………………………………………………………………………………………………………………………………...第一章概述.............................................................. .................... (1)1.1 前言 (1)1.2 系统功能简介 (2)第二章设计简介及设计方案论述 (3)2.1 设计简介....................................................................................... . .3 2.2 设计方案论述 (3)第三章详细设计 (4)3.1 算法描述 (4)3.2 系统功能模块 (7)第四章设计结果及分析 (8)4.1 系统实现....................................................................................... . .8 4.2 结果分析 (8)总结 (9)致谢 (10)参考文献 (11)附录主要程序代码 (12)摘要随着计算机技术的发展,办公自动化进入社会的每一个角落已经势不可挡,而人事管理系统是办公自动化的一个小小体现,它为人事管理大量又繁杂的员工数据工作提供了方便,提高了人事管理工作的效率,为办公自动化的普及奠定了基础。
人事管理系统是任何一个现代化企事业单位不可或缺的部分,它的内容对于企事业的管理者来说至关重要。
人事管理系统应该能够为管理者提供充足的信息和快捷的查询手段。
随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。
作为计算机应用的一部分,使用计算机对人事信息进行管理,具有着传统管理所无法比拟的优点,例如,检索迅速、查找方便、可靠性高、存储量大、寿命长、成本低等,这些优点能够极大地提高人事管理的效率。
因此,用开发这样一套管理程序,对单位人事管理工作进行有效电子化管理,化简繁琐的手工操作,提高工作效率都是很有意义的。
关键词:人事管理;办公自动化;信息化;, ’s . . a . ’s , .a !:;第一章概述1.1 前言1.1.1 背景随着计算机技术的飞速发展,计算机在企业管理中应用的普及,利用计算机在实现企业人事档案的管理势在必行。
当今社会正快速向信息化社会前进,信息自动化的作用也越来越大。
从而使我们从繁杂的事务中解放出来,提高了我们的工作效率。
目前很多企业的人事管理还处于人工管理的阶段,效率低下,已经远远落后于当今技术的发展。
并且人工管理的弊端也愈来愈严重,由于不可避免的人为因素,造成数据的遗漏、误报,而造成企业重大损失的事例层出不穷。
计算机信息化管理有着储存信息量大,速度快等许多优点,提供给我们的处理信息及时快捷,同时也提高了我们工作人员的自身素质。
因此我们利用计算机提供给我们信息,做出了这个人事信息管理系统。
人事管理系统是现在企业管理工作不可缺少的一部分,是适应现在企业制度的要求,是推动企业劳动人事走向科学化、规范化的必要条件。
传统的办公模式主要以纸介质为主,在信息革命的浪潮中,显然已经远远不能满足高效率、快节奏的现代工作和生活的需要。
如何实现信息处理的自动化和办公的无纸化逐步得到了人们的重视。
如今,随着计算机技术的普及人们开始采用一系列的计算机语言编写程序开发人事管理系统,它实现了办公地自动化,能使企业运行的数据更加准确、及时、全面、详实,同时对各种信息进一步地加工,使企业领导层对生产、经营的决策依据更充分,更具有合理性科学性,并创造出更多的发展机会;另外也进一步加强企业的科学化、合理化、制度化、规范化管理,为企业的管理水平跨上新台阶,为企业持续、健康、稳定的发展打下基础。
本文主要介绍一个简单的基于的企业人事管理系统的实现,系统开发的总体任务是实现企业人事信息关系的系统化、规范化和自动化。
1.1.2 计算机应用的发展当今社会的计算机已经达到非常普及的程度,随处都可以见到计算机的身影。
对于它的发展,我们似乎从未犹豫过。
硬件的发展为软件提供了良好的发展平台,而软件的发展也让硬件有用武之地。
无论是家庭,还是办公;无论是年幼的孩子,还是年迈的老人,都可以借助于平台的便捷操作来碰一碰计算机,体验它的神秘。
计算机发展至今,我们也熟悉了在社会各处遇见它们。
家庭娱乐,学校的机房,金融场所,以及到处可见的网吧,计算机如水银般无孔不入。
我国实施“以信息化带动工业化”发展战略以来,经济建设得到了飞速发展。
企业作为国民经济的基本单元,其信息化应用水平是国家信息化建设的关键,也是企业提高核心竞争力,与国际接轨的重要途径。
信息网络时代,企业不仅需要依靠降低产品成本和提高响应速度以确保在激烈的竞争环境中站稳脚,更需要不断的地获取知识、提升创新能力和深化协同工作以获取成功。
市场环境瞬息万变,竞争激烈。
传统粗放式、外延式和规模化理论越来越不适应世界企业的发展趋势。
现代企业对内管理,要求高效协作沟通,并且还强调以人为本的精细化管理;对外规模化发展也更加要求与客户、合作伙伴的跨组织高效协同,要求企业和上下游相关单位之间的联动,从而提高整个产业链的效率。
1.2 系统功能介绍本系统主要解决一个小型公司中人员信息管理的问题。
设计的程序能进行人事管理,如员工信息记录的增加、查询、删除、员工工资计算以及退出系统等。
公司的员工分为一名经理、若干名仓库管理员和销售人员。
员工的信息主要包括:员工编号、姓名、月薪等。
员工工资的计算方法分为三种:对于销售人员,他的工资由两部分组成,即固定工资和提成。
销售人员的固定工资为2000元,提成为个人当月销售额乘以提成比率百分之五;经理的工资也由固定工资和提成构成,经理的固定工资为4000元,提成为当月总营业额乘以提成比率千分之五;仓库管理员的工资由固定工资和奖金构成,其中固定工资为3000元,奖金由其当月表现确定,若表现为,则奖金为1000,若表现为,则奖金为500,若表现为,则奖金为0。
第二章设计简介及设计方案论述2.1 设计简介本系统是一个简单的人事管理系统,实现了员工基本信息的简单管理,应用了图形化用户界面,使得系统操作简单化,而且看上去更加美观。
首先在框架上添加一个列表和两个面板,在列表上显示添加的员工信息,在面板1上添加需要输入的员工信息,员工的工资通过设置一个按钮将所输入的销售额/营业额取出后计算工资,在已知选项的地方设置下拉组合框,通过选择即可,在面板2上添加四个按钮,分别为添加、删除、查询、退出。
添加:在面板1上输入信息的地方输入信息,点击添加按钮即可;删除:点击删除按钮,弹出输入对话框,输入要删除的员工编号,点击确定,显示列表框内相应员工信息将被删除;查询:点击查询按钮,弹出输入对话框,输入要查询的员工编号,点击确定,即可弹出另一个对话框显示要查询的员工信息;退出:点击退出即可退出此系统。
2.2 设计方案论述本设计程序包括三个类:类、类、类,在类里定义员工的基本信息,在类里实现人员的添加、删除、查询,在类里实现运行界面的布局及相关操作,添加事件监听器,设置点击按钮后的行为,同时计算工资的方法也在此类中,最后通过主函数()创建一个类的对象即可实现。
下面给出该问题的类图,如图2-1。
图2-1 类图第三章详细设计3.1 算法描述3.1.1 P类在类中,除了构造方法外,还重载了()方法。
(){ID+" "" "" "" ";s;}3.1.2 P类在类中,有三个成员方法:添加:( ){( ());}删除:( ){();(()){()();(()){();;}}}查询:( ){;();(()){()();(());;}p;}3.1.3 P类在类中,构造方法设置整个界面的布局及界面上的标签、按钮、文本框,为按钮注册单击事件监听器,为列表框注册鼠标事件监听器。
单击事件的事件处理程序由接口中的()方法实现,在该方法中进行按钮类的处理。
当单击一个按钮时,创建一个事件类对象e,并且自动执行()方法,在()方法体中,调用()方法获得产生单击事件的事件源,即用户单击的是哪一个按钮,识别出按钮后,则分别执行需要的操作。
()方法设置文本行内容,()方法返回选中数据项对象,()方法返回选中数据项索引。
鼠标事件的事件处理程序由()方法实现,单击列表框里面的内容即可在输入信息处显示信息。
( e){(()){(()("")){() ();() ();(()()());(());}}(()){(());("");("");("");("");(());}(()){("请输入要查询的员工编号:");();()(,"查无此人!","查询结果");{"";();();();();();()+""()+""()+" "()+" "();(,"你要查询的员工信息:\n","查询结果");}}(()){(()0){();(N);4000*0.005;("¥");}(()1){();(N);2000*0.05;("¥");}(()2){(()0)3000+1000;(()1)3000+500;(()2)3000;("");("¥");}}(()){(0);}}3.2 系统功能模块该系统是一个简单的人事管理系统,实现的功能很简单,包括基本的添加员工信息、删除员工信息、查询员工信息、计算员工工资以及退出系统。
本系统分为如下的几大模块:添加员工信息模块,在这个模块需要先在文本框里面输入信息后单击添加,添加以后信息显示在主界面左边的列表框内;删除员工信息模块,点击删除,输入需要删除的员工编号,点击确定即可删除,同时主界面左边的列表框内也将需要删除的员工信息删除,然后刷新;查询员工信息模块,点击查询,输入需要查询的员工编号,点击确定即可,同时弹出对话框显示需要查询的员工信息;计算员工工资模块,在输入销售额/营业额后,点击工资按钮,即可计算出工资,显示在不可编辑的文本框内,需要注意的是先要计算出工资再点击添加,这样才能在列表框中显示员工的工资信息;退出系统模块,点击退出按钮即可退出。