企业人事管理系统java源代码
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
public A() {
super("人事管理系统"); getContentPane().add(p); setJMenuBar(M);M.add(m1);M.add(m2);M.add(m3);m1.add(mm1); m1.add(mm2);m1.add(mm3);m1.addSeparator();m1.add(mm8);m2.add(mm4); m2.add(mm5);m3.add(mm6);m3.add(mm7); p.add(p1,BorderLayout.NORTH); p.add(p2,BorderLayout.CENTER); p.add(p3,BorderLayout.SOUTH); p1.setLayout(new GridLayout(5,2,1,3)); p1.add(l1);p1.add(t1); p1.add(l2);p1.add(t2); p1.add(l3);p1.add(t3); p1.add(l4);p1.add(t4); p1.add(l5);p1.add(t5); p2.add(b1);p1.add(b2); p2.add(b3);p1.add(b4); p2.add(b5);p3.add(b6); t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText(""); setSize(350,300);setVisible(true); try{
入操作",JOptionPane.ERROR_MESSAGE);
}
}
}
);
b3.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
try {
int r1=s.executeUpdate("update 员 工 基 本 信 息 表
{
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("考勤考评信息模块");
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("姓 名:");
JOptionPane.showMessageDialog(null ,e.getMessage()," 操 作 错 误 ! ",JOptionPane.ERROR_MESSAGE);
System.exit(1); } catch(ClassNotFoundException e) {
JOptionPane.showMessageDialog(null ,e.getMessage()," 驱 动 程 序 找 不 到 ! ",JOptionPane.ERROR_MESSAGE);
t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");
JOptionPane.showMessageDialog(null,"插入成功!","插入操
Байду номын сангаас
作",JOptionPane.ERROR_MESSAGE);
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){
protected JLabel l3 = new JLabel("性 protected JLabel l4 = new JLabel("年
别:"); 龄:");
protected JLabel l5 = new JLabel("部 门:");
protected JTextField t1 = new JTextField(10);
private JButton b2 = new JButton("插入"); private JButton b3 = new JButton("修改");
private JButton b4 = new JButton("删除"); private JButton b5 = new JButton("清除");
JMenu m3 = new JMenu("系统维护信息模块"); JMenuItem mm1 = new JMenuItem("员工基本信息");
JMenuItem mm2 = new JMenuItem("员工家庭成员基本信息"); JMenuItem mm3 = new JMenuItem("员工培训信息");
catch
(NumberFormatException
e ){System.out.println(e);}
catch (SQLException e){System.out.println(e);}}});
b4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
}
}
catch (NumberFormatException e ){System.out.println(e);}
catch (SQLException e){System.out.println(e);}}
else{JOptionPane.showMessageDialog(null,"插入失败!","插
"where 员 工 编 号
JOptionPane.showMessageDialog(null,"修改成功! ","修改操作",JOptionPane.ERROR_MESSAGE);
}
else{JOptionPane.showMessageDialog(null," 修 改 失 败!","修改操作",JOptionPane.ERROR_MESSAGE);}}
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,"查询成功!","查询操
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("查询");
set 姓名='"+t2.getText()+"'," +
"性别='"+t3.getText()+"'," +
"
年
龄
="+Integer.parseInt(t4.getText())+"," +
"
部
门
='"+t5.getText()+"'"+
='"+t1.getText()+"'");
if(r1!=0){
作",JOptionPane.ERROR_MESSAGE); } else{ t2.setText("");t3.setText("");t4.setText("");t5.setText(""); JOptionPane.showMessageDialog(null,"查询失败!","查询操
作",JOptionPane.ERROR_MESSAGE); }
System.exit(1); } addWindowListener( new WindowAdapter(){
public void windowClosing(WindowEvent event) { try {
s.close();c.close();
}
catch(SQLException e) {
} 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();
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:
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){
package rsgl;
import java.awt.* ;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
public class A extends JFrame