您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 绩效管理 > 课程设计考勤管理系统源代码(DOC51页)
packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classAttendFrameextendsJFrame//工作制类型{publicAttendFrame(){this.setTitle(工作制类型);this.setVisible(true);this.setContentPane(newJPanel());this.setSize(300,200);create();}privatevoidcreate(){JButtonb1,b2,b3;Boxbox1,box2,box;b1=newJButton(非弹性工作制);b2=newJButton(弹性工作制);b3=newJButton(返回);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(b1);box1.add(Box.createHorizontalStrut(20));box1.add(b2);box2.add(b3);box.add(box1);box.add(Box.createVerticalStrut(30));box.add(box2);this.add(box);b1.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根UBoundFrameframe=newUBoundFrame();dispose();}});b2.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根BoundFrameframe=newBoundFrame();dispose();}});b3.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MFrameframe=newMFrame();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classBoundFrameextendsJFrame{publicBoundFrame(){this.setTitle(弹性工作制);this.setVisible(true);this.setContentPane(newJPanel());this.setSize(400,400);create();}JLabelk1,k2,k3,k4,k5,k6;JTextFieldf1,f2,f3,f4,f5,f6;Boxbox1,box2,box3,box4,box5,box;JButtonb1;privatevoidcreate(){k1=newJLabel(工号:);k2=newJLabel(姓名:);k3=newJLabel(当月工时:);k4=newJLabel(:);k5=newJLabel(当月工作天数);k6=newJLabel(当月富余:);b1=newJButton(返回);f1=newJTextField(5);f2=newJTextField(5);f3=newJTextField(5);f4=newJTextField(5);f5=newJTextField(5);f6=newJTextField(5);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box4=Box.createHorizontalBox();box5=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(k1);box1.add(f1);box1.add(Box.createHorizontalStrut(20));box1.add(k2);box1.add(f2);box2.add(k3);box2.add(f3);box2.add(k4);box2.add(f4);box3.add(k5);box3.add(f5);box4.add(k6);box4.add(f6);box5.add(b1);box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);this.add(box);b1.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根AttendFrameframe=newAttendFrame();dispose();}});}}packagekaoqin;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;publicclassConnectionDB{privateStringJDriver=sun.jdbc.odbc.JdbcOdbcDriver;privateStringsqlURL=jdbc:odbc:bobo;//privateStringJDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver;//privateStringsqlURL=jdbc:sqlserver://localhost:1433;DatabaseName=MyTest;integratedSecurity=TRUE;;privateConnectionconnection;privateStatementstatement;privatestaticConnectionconn=null;privateString[]tableSQL=newString[4];publicConnectionDB(){try{Class.forName(JDriver);connection=DriverManager.getConnection(sqlURL);statement=connection.createStatement();}catch(ClassNotFoundExceptione){e.printStackTrace();}catch(SQLExceptione){e.printStackTrace();}}publicConnectiongetConnection(){returnconnection;}publicStatementgetStatement(){returnstatement;}publicvoidbreakDB(){try{statement.close();connection.close();}catch(SQLExceptione){e.printStackTrace();}}publicvoidcreateTable(){tableSQL[0]=createtablestaff_info(+Snochar(9)primarykey,+Snamechar(10)notnull,+Sagesmallint,+enter_timechar(10)notnull,+positionchar(10)notnull,+sexchar(1),+passwordchar(6));;tableSQL[1]=createtablepz_info(+arrive_hourchar(2),+arrive_minutechar(2),+leave_hourchar(2),+leave_minutechar(2),+everyday_timechar(2));;tableSQL[2]=createtableeverymonth_statistics(+Snochar(9)notnull,+Snamechar(10)notnull,+remain_timechar(4),+late_timessmallint,+early_leavesmallint,+work_daysmallint,+primarykey(Sno),+foreignkey(Sno)+referencesstaff_info(Sno)ondeletecascade);;tableSQL[3]=createtableeveryday_statistics(+Snochar(9)notnull,+Snamechar(10)notnull,+hourchar(2),+minutechar(2),+actionchar(6),+timechar(4),+primarykey(Sno),+foreignkey(Sno)+referencesstaff_info(Sno)ondeletecascade);;try{for(inti=0;i4;i++)statement.executeUpdate(tableSQL[i]);}catch(SQLExceptione){e.printStackTrace();}}privatestaticResultSetexecuteQuery(Stringsql){try{if(conn==null)newConnectionDB();returnconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql);}catch(SQLExceptione){e.printStackTrace();returnnull;}finally{}}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importj
本文标题:课程设计考勤管理系统源代码(DOC51页)
链接地址:https://www.777doc.com/doc-940702 .html