课程设计考勤管理系统源代码.docx
《课程设计考勤管理系统源代码.docx》由会员分享,可在线阅读,更多相关《课程设计考勤管理系统源代码.docx(81页珍藏版)》请在冰豆网上搜索。
![课程设计考勤管理系统源代码.docx](https://file1.bdocx.com/fileroot1/2023-2/8/97b93926-65b7-499d-b1df-21a108bc995d/97b93926-65b7-499d-b1df-21a108bc995d1.gif)
课程设计考勤管理系统源代码
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()//
{
@Override
publicvoidactionPerformed(ActionEvente)
{
//TODO自动生成的方法存根
UBoundFrameframe=newUBoundFrame();
dispose();
}
});
b2.addActionListener(newActionListener()//
{
@Override
publicvoidactionPerformed(ActionEvente)
{
//TODO自动生成的方法存根
BoundFrameframe=newBoundFrame();
dispose();
}
});
b3.addActionListener(newActionListener()//
{
@Override
publicvoidactionPerformed(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()//确定
{
@Override
publicvoidactionPerformed(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;i<4;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;
importjava.sql.ResultSet;
importjava.sql.SQLException;
importjava.sql.Statement;
importjava.sql.*;
classEqu_FrameextendsJFrame//配置信息
{
publicEqu_Frame()
{
this.setTitle("配置信息");
this.setSize(400,400);
this.setContentPane(newJPanel());
this.setVisible(true);
this.create();
}
JLabelk1,k2,k3,k4,k5,k6,k7,k8,k9,k10;
JLabelf1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
Boxbox1,box2,box3,box4,box5,box6,box7,box;
JButtonb1,b2;
privatevoidcreate()
{
k1=newJLabel("上班时间:
");
k2=newJLabel(":
");
k3=newJLabel("下班时间:
");
k4=newJLabel(":
");
k5=newJLabel("每月工作总时间:
");
k6=newJLabel("每月工作天数:
");
k7=newJLabel("每月工作日期:
");
k8=newJLabel("~");
k9=newJLabel("每月放假日期:
");
k10=newJLabel("~");
b1=newJButton("修改");
b2=newJButton("返回");
f1=newJLabel("08");
f2=newJLabel("30");
f3=newJLabel("17");
f4=newJLabel("30");
f5=newJLabel("200");
f6=newJLabel("22");
f7=newJLabel("星期一");
f8=newJLabel("星期五");
f9=newJLabel("星期六");
f10=newJLabel("星期日");
box1=Box.createHorizontalBox();
box2=Box.createHorizontalBox();
box3=Box.createHorizontalBox();
box4=Box.createHorizontalBox();
box5=Box.createHorizontalBox();
box6=Box.createHorizontalBox();
box7=Box.createHorizontalBox();
box=Box.createVerticalBox();
box1.add(k1);
box1.add(f1);
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(k7);
box5.add(f7);
box5.add(k8);
box5.add(f8);
box6.add(k9);
box6.add(f9);
box6.add(k10);
box6.add(f10);
box7.add(b1);
box7.add(Box.createHorizontalStrut(20));
box7.add(b2);
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);
box.add(Box.createVerticalStrut(20));
box.add(box6);
box.add(Box.createVerticalStrut(20));
box.add(box7);
this.add(box);
b1.addActionListener(newActionListener()//确定
{
@Override
publicvoidactionPerformed(ActionEvente)
{
//TODO自动生成的方法存根
EquAltFrameframe=newEquAltFrame();
dispose();
}
});
b2.addActionListener(newActionListener()//确定
{
@Override
publicvoidactionPerformed(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.*;
classEquAltFrameextendsJFrame//修改配置信息
{
publicEquAltFrame()
{
this.setTitle("修改配置信息");
this.setSize(400,400);
this.setContentPane(newJPanel());
this.setVisible(true);
this.create();
}
JLabelk1,k2,k3,k4,k5,k6,k7,k8,k9,k10;
JTextFieldf1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
Boxbox1,box2,box3,box4,box5,box6,box7,box;
JButtonb1,b2;
privatevoidcreate()
{
k1=newJLabel("上班时间:
");
k2=newJLabel(":
");
k3=newJLabel("下班时间:
");
k4=newJLabel(":
");
k5=newJLabel("每月工作总时间:
");
k6=newJLabel("每月工作天数:
");
k7=newJLabel("每月工作日期:
");
k8=newJLabel("~");
k9=newJLabel("每月放假日期:
");
k10=newJLabel("~");
b1=newJButton("保存");
b2=newJButton("取消");
f1=newJTextField(5);
f2=newJTextField(5);
f3=newJTextField(5);
f4=newJTextField(5);
f5=newJTextField(5);
f6=newJTextField(5);
f7=new