Employee Management System Report
Employee Management System Report
MINI PROJECT
ON
EMPLOYEE
MANAGEMENT
SYSTEM
i
ACKNOWLEDGEMENT
It gives me a great pleasure to present the report file of the project work undertaken
during BCA final year. I owe special dept of gratitude to MR. SANJAY KANT TYAGI
Department of Computer Application, Shri Ram College, Muzaffarnagar for his constant
support and guidance throughout the course of our work.His sincerity thoroughness and
preservence have been a constant source of inspiration for us.
I acknowledge the contribution of all faculty members of the department for their kind
assistance and coorperation during the development of our project.
i
CERTIFICATE
The matter emboided in thus Project Work has not beensubmitted earlier for award of any
degree or diploma in any University/Institution to the best of our knowledge and belief.
i
ABSTRACT
It is simple to understand and can be used by anyone who is not even familier with
simple employees system. It is user friendly and just asks the user to follow step by step
operations by giving him few options. It is fast and can perform many operations of a
company.
i
DECLARATION
We Beenu Singh, Ekta Pundir hereby declare that the project report title “ Employee
Management System” is an original work carried out by our under the supervision of
“Mr. Sanjay Kant Tyagi ” We further declare that this work has not been submitted to
any other Institute/University for the award of the degree of Bachelor of Computer
Applications.
Beenu Singh
Ekta Pundir
i
INTRODUCTION
Employee Management System is an application that enables users to create and store
Employee Records. The application also provides facilities of a payroll system which
enables user to generate pay slip too. This application is helpful to department of the
organization which maintains data of employees related to an organization.
i
OBJECTIVE OF THE PROJECT
In this world of growing technologies everything has been computerized. With large
number of work oppurtunities the Human workforce has increased. Thus there is a need
of a system which can handle the data of such a large number of Employees in an
organization. This project simplifies the task of maintain records because of its user
friendly nature.
i
LIMITATIONS OF EXISTING SYSTEM
When the existing system of the Employee Management System, we found that some
add on were required there so that problems could be solved. Some of the problems or
limitations in the present system are: -
To update each employee with their company name
While preparing the Reports statements the employee have to manually go through the
Records Mannually.
There is no security of the database register i.e. any other person can make changes in the
database.It is a time consuming task to maintain the data of previous employee.
i
HARDWARE REQUIREMENTS
In order to implement a new system the choice of processor with maximum possible
speed is made. There should be sufficient memory to store data and software tools for
efficient processing.
System : IBM-Compatible PC
Processor : Pentium IV
Platform : Window 10
Language used : J2EE
i
FRONT END & BACK END USED
Java uses front end programming because JAVA use back end as like
ACCESS DATABASE.
In JAVA we can use easy database connectivity and design the Form, Report
and other MDI application with the help of Database.
i
DATA FLOW DIAGRAM
Searche
Username d data
USER1
User Detail
Password
CHECK
THE
VALID
USER2 USER
Invalid
message
i
DFD OF EMPLOYEE MANAGEMENT SYSTEM
SALARY
.
EMPLOYEE
Paid Salary
Employee data
Salary data
Employee
Management
System
i
E-R DIAGRAM
Dno.
Dname
Login
HOD
Password
User Id
Login
Employee Department
&
Salary
Sno Phone
Employee
Addres
Name
s
i
OPERATIONS OF PRESENT SYSTEM
A. Employee management
Add new employee
Delete employee
Modify employee
Search employee
B. Salary management
Pay salary
Display salary
C. Department
Add new employee
Delete employee
Modify employee
Search employee
i
TABLES
DATABASE DESIGN
All the tables, sequences, triggers are stored in database for storing the information about
entrance test made by the users.
1. LOGIN TABLE
2. EMPLOYEE TABLE
i
3 .DEPARTMENT TABLE
4. SALARY TABLE
i
MODULE
In this module, registered user enters a password and the software checks its validity. If
the password is valid then he is allowed to enter, otherwise “Invalid User/Password”
message is displayed.
Module 2: Department
Module 3: Salary
Module4: Employee
i
FORMS
LOGIN FORM::
WELCOME FORM ::
i
CHANGE PASSWORD FORM ::
i
MAIN FORM ::
i
ADD EMPLOYEE FORM ::
i
EDIT EMPLOYEE FORM ::
i
ADD DEPARTMENT FORM ::
i
EDIT DEPARTMENT FORM ::
i
SEARCH DEPARTMENT FORM ::
i
LIST OF EMPLOYEE ::
i
LIST OF DEPARTMENT ::
LIST OF SALARY ::
i
CODING
Login form
class Login implements ActionListener
{
JFrame frm;
JLabel l1,l2;
JTextField txtid;
JPasswordField txtpwd;
JButton login,quit;
Login()
{
frm=new JFrame("Login Form");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);
/*ImageIcon img=new ImageIcon("image.jpg");
JLabel lpic=new JLabel(img);
lpic.setBounds(300,200,400,300);
frm.add(lpic);*/
i
txtid.setBounds(190,50,170,30);
frm.add(txtid);
l2.setBounds(30,110,150,30);
frm.add(l2);
txtpwd.setBounds(190,110,170,30);
frm.add(txtpwd);
login.setBounds(40,170,110,30);
frm.add(login);
quit.setBounds(230,170,110,30);
frm.add(quit);
login.addActionListener(this);
quit.addActionListener(this);
frm.setBounds(300,200,400,300);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==login)
{
String login,pass;
try
{
login=txtid.getText();
pass=txtpwd.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from logintable where
loginid='"+login+"' and password='"+pass+"'";
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
//JOptionPane.showMessageDialog(null,"Correct");
SplashForm obj=new SplashForm();
}
else
JOptionPane.showMessageDialog(null,"Incorrect");
}
catch(Exception e1)
{}
}
else
frm.dispose();
}
Welcome form
i
class SplashForm implements ActionListener
{
JFrame frm;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JButton btn;
SplashForm()
{
frm=new JFrame(" Welcome Form");
frm.setSize(600,700);
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.show();
frm.getContentPane().setBackground(Color.black);
frm.setLayout(null);
l1=new JLabel("EMPLOYEE");
l2=new JLabel("MANAGEMENT");
l3=new JLabel("SYSTEM");
l4=new JLabel("Developed By:");
l5=new JLabel("HEMA");
l6=new JLabel("NEELU PANDEY");
l7=new JLabel("Submitted To:");
l8=new JLabel("ANUJ SIR");
btn=new JButton("C O N T I N U E ");
l1.setFont(f1);
l2.setFont(f1);
l3.setFont(f1);
l4.setFont(f2);
l7.setFont(f2);
l5.setFont(f3);
l6.setFont(f3);
l8.setFont(f3);
l1.setForeground(Color.red);
l2.setForeground(Color.red);
l3.setForeground(Color.red);
l4.setForeground(Color.magenta);
l7.setForeground(Color.magenta);
l5.setForeground(Color.blue);
l6.setForeground(Color.blue);
l8.setForeground(Color.blue);
l1.setBounds(130,10,300,50);
i
frm.add(l1);
l2.setBounds(110,70,600,50);
frm.add(l2);
l3.setBounds(160,130,300,50);
frm.add(l3);
l4.setBounds(50,300,200,50);
frm.add(l4);
l7.setBounds(300,300,200,50);
frm.add(l7);
l5.setBounds(50,350,100,40);
frm.add(l5);
l6.setBounds(50,370,150,40);
frm.add(l6);
l8.setBounds(300,340,100,40);
frm.add(l8);
btn.setBounds(180,450,300,40);
frm.add(btn);
btn.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn)
{
MainMenu obj=new MainMenu();
}
}
}
Main Form
class MainMenu implements ActionListener
{
JFrame frm;
JMenuBar mb;
JMenu emp,dept,salary,report,security,exit;
JMenuItem
addemp,editemp,searchemp,adddept,editdept,searchdept,salaryslip,listofemp,listofsalary,l
istofdept,changepwd,yes,no;
MainMenu()
{
frm=new JFrame("MAIN FORM");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.gray);
frm.setSize(500,400);
frm.show();
mb=new JMenuBar();
frm.setJMenuBar(mb);
i
emp=new JMenu("EMPLOYEE");
dept=new JMenu("DEPARTMENT");
salary=new JMenu("SALARY");
report=new JMenu("REPORT");
security=new JMenu("SECURITY");
exit=new JMenu("EXIT");
mb.add(emp);
mb.add(dept);
mb.add(salary);
mb.add(report);
mb.add(security);
mb.add(exit);
emp.add(addemp);
emp.add(editemp);
emp.add(searchemp);
dept.add(adddept);
dept.add(editdept);
dept.add(searchdept);
salary.add(salaryslip);
report.add(listofemp);
report.add(listofdept);
report.add(listofsalary);
security.add(changepwd);
exit.add(yes);
exit.add(no);
addemp.addActionListener(this);
editemp.addActionListener(this);
searchemp.addActionListener(this);
adddept.addActionListener(this);
editdept.addActionListener(this);
searchdept.addActionListener(this);
i
salaryslip.addActionListener(this);
listofemp.addActionListener(this);
listofdept.addActionListener(this);
listofsalary.addActionListener(this);
changepwd.addActionListener(this);
yes.addActionListener(this);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource()==addemp)
{
AddEmployee obj1=new AddEmployee();
}
else if(evt.getSource()==editemp)
{
EditEmployee obj2=new EditEmployee();
}
else if(evt.getSource()==searchemp)
{
SearchEmp obj3=new SearchEmp();
}
else if(evt.getSource()==adddept)
{
DeptDetails obj4=new DeptDetails();
}
else if(evt.getSource()==editdept)
{
EditDept obj5=new EditDept();
}
else if(evt.getSource()==searchdept)
{
SearchDept obj5=new SearchDept();
}
else if(evt.getSource()==salaryslip)
{
PaySalary obj5=new PaySalary();
}
else if(evt.getSource()==listofemp)
{
ListEmployee obj5=new ListEmployee();
}
else if(evt.getSource()==listofdept)
{
ListDepartment obj5=new ListDepartment();
}
else if(evt.getSource()==listofsalary)
i
{
ListSalary obj5=new ListSalary();
}
else if(evt.getSource()==changepwd)
{
Changepswrd obj5=new Changepswrd();
}
else if(evt.getSource()==yes)
{
System.exit(0);
}
}
}
Add Employee Form
txtempcode=new JTextField(20);
txtname=new JTextField(20);
i
txtcontact=new JTextField(20);
txtgender=new JTextField(20);
txtdept=new JTextField(20);
txtpost=new JTextField(20);
cb.addItem("Male");
cb.addItem("Female");
txtage=new JTextField(20);
txtdoj=new JTextField(20);
txtsalary=new JTextField(20);
txtaddress=new JTextField(20);
frm.setLayout(new GridLayout(11,2));
frm.add(l1);
frm.add(txtempcode);
frm.add(l2);
frm.add(txtname);
frm.add(l3);
frm.add(txtcontact);
frm.add(l4);
frm.add(cb);
frm.add(l5);
frm.add(txtage);
frm.add(l6);
frm.add(txtdoj);
frm.add(l7);
frm.add(txtsalary);
frm.add(l8);
frm.add(txtaddress);
frm.add(l9);
frm.add(txtdept);
frm.add(l10);
frm.add(txtpost);
frm.add(save);
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.add(exit);
save.addActionListener(this);
exit.addActionListener(this);
frm.setBounds(300,200,400,400);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==save)
{
try
{
i
int empcode,age,salary;
String name,contact,gender,doj,address,post,dept;
empcode=Integer.parseInt(txtempcode.getText());
age=Integer.parseInt(txtage.getText());
salary=Integer.parseInt(txtsalary.getText());
post=txtpost.getText();
dept=txtdept.getText();
name=txtname.getText();
contact=txtcontact.getText();
doj=txtdoj.getText();
address=txtaddress.getText();
gender=cb.getSelectedItem().toString();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="insert into employeetable
values("+empcode+",'"+name+"','"+contact+"','"+gender+"',"+age+",'"+doj+"',"+salary+"
,'"+address+"','"+dept+"','"+post+"')";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Data Stored");
txtempcode.setText(null);
txtage.setText("");
txtsalary.setText("");
txtname.setText("");
txtdoj.setText("");
txtcontact.setText("");
txtaddress.setText("");
txtpost.setText("");
txtdept.setText("");
txtempcode.requestFocus();
}
catch(Exception e1)
{JOptionPane.showMessageDialog(null,e1.getMessage());}
}
else
frm.dispose();
}
}
Edit Employee
class EditEmployee implements ActionListener
{
JFrame frm;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10;
JTextField
txtempcode,txtname,txtage,txtgender,txtcontact,txtdoj,txtdept,txtpost,txtsalary,txtaddress;
i
JButton ok,exit,delete,update;
EditEmployee()
{
frm=new JFrame("Edit Employee Record");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);
ok=new JButton("OK");
exit=new JButton("Exit");
delete=new JButton("Delete");
update=new JButton("Update");
ok.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
delete.setBackground(Color.LIGHT_GRAY);
update.setBackground(Color.LIGHT_GRAY);
ok.addActionListener(this);
exit.addActionListener(this);
delete.addActionListener(this);
update.addActionListener(this);
frm.setLayout(new GridLayout(12,2));
frm.add(l1);
frm.add(txtempcode);
frm.add(ok);
i
frm.add(exit);
frm.add(l2);
frm.add(txtname);
frm.add(l3);
frm.add(txtage);
frm.add(l4);
frm.add(txtgender);
frm.add(l5);
frm.add(txtcontact);
frm.add(l6);
frm.add(txtdoj);
frm.add(l7);
frm.add(txtdept);
frm.add(l8);
frm.add(txtpost);
frm.add(l9);
frm.add(txtsalary);
frm.add(l10);
frm.add(txtaddress);
frm.add(delete);
frm.add(update);
frm.setBounds(300,200,400,400);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
int ecode;
try
{
ecode=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from employeetable where
empcode="+ecode;
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
txtage.setText(res.getString("age"));
txtaddress.setText(res.getString("address"));
txtname.setText(res.getString("name"));
txtsalary.setText(res.getString("salary"));
txtdoj.setText(res.getString("doj"));
txtcontact.setText(res.getString("contact"));
i
txtdept.setText(res.getString("department"));
txtpost.setText(res.getString("post"));
txtgender.setText(res.getString("gender"));
}
else
{
JOptionPane.showMessageDialog(null," Not
Found");
}
}
catch(Exception e1)
{}
}
else if(e.getSource()==delete)
{
try
{
int eno=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="delete from employeetable where
empcode="+eno;
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Successfully
deleteed");
txtempcode.setText("");
txtname.setText("");
txtgender.setText("");
txtsalary.setText("");
txtaddress.setText("");
txtdept.setText("");
txtdoj.setText("");
txtpost.setText("");
txtage.setText("");
txtcontact.setText("");
}
catch(Exception e3)
{}
}
else if(e.getSource()==update)
{
try
{
int eno=Integer.parseInt(txtempcode.getText());
i
int age,salary;
String name, address,dept,post,contact,doj,gender;
name=txtname.getText();
age=Integer.parseInt(txtage.getText());
salary=Integer.parseInt(txtsalary.getText());
contact=txtcontact.getText();
post=txtpost.getText();
dept=txtdept.getText();
doj=txtdoj.getText();
address=txtaddress.getText();
gender=txtgender.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="update employeetable set
name='"+name+"',age="+age+",salary="+salary+",contact='"+contact+"',gender='"+gend
er+"',department='"+dept+"',post='"+post+"',address='"+address+"' where
empcode="+eno;
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Successfully
updated");
txtempcode.setText("");
txtname.setText("");
txtgender.setText("");
txtsalary.setText("");
txtaddress.setText("");
txtdept.setText("");
txtdoj.setText("");
txtpost.setText("");
txtage.setText("");
txtcontact.setText("");
}
catch(Exception e3)
{JOptionPane.showMessageDialog(null,e3.getMessage());}
}
else
frm.dispose();
}
}
Search Employee Form
i
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10;
JTextField
txtempcode,txtname,txtage,txtgender,txtcontact,txtdoj,txtdept,txtpost,txtsalary,txtaddress;
JButton ok,exit;
SearchEmp()
{
frm=new JFrame("Search Employee");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);.
txtempcode=new JTextField(20);
txtname=new JTextField(20);
txtage=new JTextField(20);
txtgender=new JTextField(20);
txtcontact=new JTextField(20);
txtdoj=new JTextField(20);
txtdept=new JTextField(20);
txtpost=new JTextField(20);
txtsalary=new JTextField(20);
txtaddress=new JTextField(20);
ok=new JButton("OK");
exit=new JButton("Exit");
ok.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
frm.setLayout(new GridLayout(11,2));
frm.add(l1);
frm.add(txtempcode);
frm.add(ok);
frm.add(exit);
ok.addActionListener(this);
exit.addActionListener(this);
frm.add(l2);
frm.add(txtname);
frm.add(l3);
i
frm.add(txtage);
frm.add(l4);
frm.add(txtgender);
frm.add(l5);
frm.add(txtcontact);
frm.add(l6);
frm.add(txtdoj);
frm.add(l7);
frm.add(txtdept);
frm.add(l8);
frm.add(txtpost);
frm.add(l9);
frm.add(txtsalary);
frm.add(l10);
frm.add(txtaddress);
frm.setBounds(300,200,400,400);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
try
{
int ecode=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from employeetable where
empcode="+ecode;
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
txtage.setText(res.getString("age"));
txtaddress.setText(res.getString("address"));
txtname.setText(res.getString("name"));
txtsalary.setText(res.getString("salary"));
txtdoj.setText(res.getString("doj"));
txtcontact.setText(res.getString("contact"));
txtdept.setText(res.getString("department"));
txtpost.setText(res.getString("post"));
txtgender.setText(res.getString("gender"));
}
else
{
i
JOptionPane.showMessageDialog(null," Not
Found");
}
}
catch(Exception e1)
{}
}
else
frm.dispose();
}
}
Add Department Form
txtno=new JTextField(20);
txtname=new JTextField(20);
txthod=new JTextField(20);
save=new JButton("Save");
exit=new JButton("Exit");
save.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
frm.setLayout(null);
l1.setBounds(30,30,150,30);
frm.add(l1);
txtno.setBounds(180,30,170,30);
frm.add(txtno);
l2.setBounds(30,90,150,30);
frm.add(l2);
txtname.setBounds(180,90,170,30);
i
frm.add(txtname);
l3.setBounds(30,150,150,30);
frm.add(l3);
txthod.setBounds(180,150,170,30);
frm.add(txthod);
save.setBounds(40,210,100,30);
frm.add(save);
exit.setBounds(240,210,100,30);
frm.add(exit);
frm.setBounds(300,200,400,350);
frm.show();
save.addActionListener(this);
exit.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==save)
{
try
{
int deptno;
String deptname,hod;
deptno=Integer.parseInt(txtno.getText());
deptname=txtname.getText();
hod=txthod.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="insert into depttable
values("+deptno+",'"+deptname+"','"+hod+"')";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Data Stored");
txtno.setText(null);
txtname.setText("");
txthod.setText("");
txtno.requestFocus();
}
catch(Exception e1)
{JOptionPane.showMessageDialog(null,e1.getMessage());}
}
else
{
frm.dispose();
}
}
}
i
Edit Department Form
class EditDept implements ActionListener
{
JFrame frm;
JLabel l1,l2,l3;
JTextField txtno,txtname,txthod;
JButton ok,exit,delete,update;
EditDept()
{
frm=new JFrame("Edit Department Record");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);
ok=new JButton("OK");
exit=new JButton("Exit");
delete=new JButton("Delete");
update=new JButton("Update");
ok.addActionListener(this);
exit.addActionListener(this);
delete.addActionListener(this);
update.addActionListener(this);
ok.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
delete.setBackground(Color.LIGHT_GRAY);
update.setBackground(Color.LIGHT_GRAY);
frm.setLayout(null);
l1.setBounds(30,30,150,30);
frm.add(l1);
txtno.setBounds(200,30,170,30);
frm.add(txtno);
ok.setBounds(40,80,100,30);
frm.add(ok);
exit.setBounds(260,80,100,30);
frm.add(exit);
l2.setBounds(30,130,150,30);
i
frm.add(l2);
txtname.setBounds(200,130,170,30);
frm.add(txtname);
l3.setBounds(30,190,150,30);
frm.add(l3);
txthod.setBounds(200,190,170,30);
frm.add(txthod);
delete.setBounds(40,250,100,30);
frm.add(delete);
update.setBounds(260,250,100,30);
frm.add(update);
frm.setBounds(300,200,400,400);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
int dcode;
try
{
dcode=Integer.parseInt(txtno.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from depttable where
deptno="+dcode;
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
txtname.setText(res.getString("deptname"));
txthod.setText(res.getString("hod"));
}
else
{
JOptionPane.showMessageDialog(null," Not
Found");
}
}
catch(Exception e1)
{}
}
else if(e.getSource()==delete)
{
try
i
{
int dno=Integer.parseInt(txtno.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="delete from depttable where deptno="+dno;
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Successfully
deleteed");
txtno.setText("");
txtname.setText("");
txthod.setText("");
}
catch(Exception e3)
{}
}
else if(e.getSource()==update)
{
try
{
int dno=Integer.parseInt(txtno.getText());
String name,hod;
name=txtname.getText();
hod=txthod.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="update depttable set
deptno="+dno+",deptname='"+name+"',hod='"+hod+"'";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Successfully
updated");
txtno.setText("");
txtname.setText("");
txthod.setText("");
}
catch(Exception e3)
{JOptionPane.showMessageDialog(null,e3.getMessage());}
}
else
{
frm.dispose();
}
i
}
}
Search Department Form
class SearchDept implements ActionListener
{
JFrame frm;
JLabel l1,l2,l3;
JTextField txtno,txtname,txthod;
JButton ok,exit;
SearchDept()
{
frm=new JFrame("Search Department");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);
txtno=new JTextField(20);
txtname=new JTextField(20);
txthod=new JTextField(20);
ok=new JButton("OK");
exit=new JButton("Exit");
ok.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
frm.setLayout(null);
l1.setBounds(30,30,150,30);
frm.add(l1);
txtno.setBounds(190,30,170,30);
frm.add(txtno);
ok.setBounds(40,80,100,30);
frm.add(ok);
exit.setBounds(250,80,100,30);
frm.add(exit);
ok.addActionListener(this);
exit.addActionListener(this);
l2.setBounds(30,140,150,30);
frm.add(l2);
txtname.setBounds(190,140,170,30);
frm.add(txtname);
l3.setBounds(30,220,150,30);
frm.add(l3);
txthod.setBounds(190,220,170,30);
frm.add(txthod);
i
frm.setBounds(300,200,400,350);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
try
{
int dno=Integer.parseInt(txtno.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from depttable where
deptno="+dno;
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
txtname.setText(res.getString("deptname"));
txthod.setText(res.getString("hod"));
}
else
{
JOptionPane.showMessageDialog(null," Not
Found");
}
}
catch(Exception e1)
{}
}
else
frm.dispose();
}
}
i
PaySalary()
{
frm=new JFrame("Pay Salary Form");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.getContentPane().setBackground(Color.pink);
txtslipno=new JTextField(20);
txtdos=new JTextField(20);
txtempcode=new JTextField(20);
txtname=new JTextField(20);
txtpost=new JTextField(20);
txtdept=new JTextField(20);
txtcontact=new JTextField(20);
txtsalary=new JTextField(20);
txtmonth=new JTextField(20);
ok=new JButton("OK");
exit=new JButton("Exit");
pay=new JButton("Pay");
clear=new JButton("Clear");
ok.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
pay.setBackground(Color.LIGHT_GRAY);
clear.setBackground(Color.LIGHT_GRAY);
frm.setLayout(new GridLayout(11,2));
frm.add(l1);
frm.add(txtslipno);
frm.add(l2);
frm.add(txtdos);
frm.add(l3);
frm.add(txtempcode);
frm.add(l9);
frm.add(txtmonth);
frm.add(ok);
frm.add(exit);
frm.add(l4);
i
frm.add(txtname);
frm.add(l5);
frm.add(txtpost);
frm.add(l6);
frm.add(txtdept);
frm.add(l7);
frm.add(txtcontact);
frm.add(l8);
frm.add(txtsalary);
frm.add(pay);
frm.add(clear);
ok.addActionListener(this);
exit.addActionListener(this);
pay.addActionListener(this);
clear.addActionListener(this);
frm.setBounds(300,200,400,400);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==ok)
{
int ecode;
try
{
ecode=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select * from employeetable where
empcode="+ecode;
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
txtname.setText(res.getString("name"));
txtcontact.setText(res.getString("contact"));
txtdept.setText(res.getString("department"));
txtpost.setText(res.getString("post"));
}
else
{
JOptionPane.showMessageDialog(null,"Not
Found");
}
}
catch(Exception e1)
i
{}
}
else if(e.getSource()==pay)
{
int ecode;
try
{
int slipno,salary;
String dos,month;
slipno=Integer.parseInt(txtslipno.getText());
salary=Integer.parseInt(txtsalary.getText());
dos=txtdos.getText();
month=txtmonth.getText();
ecode=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="insert into paytable values
("+slipno+",'"+dos+"',"+ecode+","+salary+",'"+month+"')";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Data Stored");
}
catch(Exception e2)
{JOptionPane.showMessageDialog(null,e2.getMessage());}
}
else if(e.getSource()==clear)
{
try
{
int eno=Integer.parseInt(txtempcode.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="delete from paytable where empcode="+eno;
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Successfully
clear");
txtempcode.setText("");
txtname.setText("");
txtsalary.setText("");
txtpost.setText("");
txtdept.setText("");
txtcontact.setText("");
txtmonth.setText("");
}
i
catch(Exception e3)
{}
}
else
frm.dispose();
}
}
LIST OF EMPLOYEE
class ListEmployee
{
JFrame frm;
ListEmployee()
{
frm=new JFrame("List Of Employee");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.setSize(800,800);
frm.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
frm.getContentPane().setBackground(Color.pink);
i
catch(Exception e)
{JOptionPane.showMessageDialog(null,e.getMessage());}
}
}
LIST OF DEPARTMENT
class ListDepartment
{
JFrame frm;
ListDepartment()
{
frm=new JFrame("List Of Department");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.setSize(300,300);
frm.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
frm.getContentPane().setBackground(Color.pink);
}
}
i
LIST OF SALARY
class ListSalary
{
JFrame frm;
ListSalary()
{
frm=new JFrame("List Of Salary");
frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE);
frm.setSize(750,400);
frm.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
frm.getContentPane().setBackground(Color.pink);
}
}
CHANGE PASSWORD
class Changepswrd implements ActionListener
{
i
JFrame frm;
JPasswordField txtcurrent,txtnew,txtconfirm;
JLabel l1,l2,l3;
JButton verify,change,exit;
Changepswrd()
{
verify=new JButton("Verify");
exit=new JButton("Exit");
change=new JButton("Change");
verify.setBackground(Color.LIGHT_GRAY);
change.setBackground(Color.LIGHT_GRAY);
exit.setBackground(Color.LIGHT_GRAY);
txtcurrent=new JPasswordField(20);
txtnew=new JPasswordField(20);
txtconfirm=new JPasswordField(20);
frm.setLayout(null);
l1.setBounds(50,50,150,30);
txtcurrent.setBounds(180,50,150,30);
verify.setBounds(120,100,100,30);
l2.setBounds(50,150,150,30);
txtnew.setBounds(180,150,150,30);
l3.setBounds(50,200,150,30);
txtconfirm.setBounds(180,200,150,30);
change.setBounds(50,250,100,30);
exit.setBounds(230,250,100,30);
frm.add(l1);
frm.add(txtcurrent);
frm.add(verify);
frm.add(l2);
frm.add(txtnew);
frm.add(l3);
frm.add(txtconfirm);
frm.add(change);
frm.add(exit);
i
verify.addActionListener(this);
exit.addActionListener(this);
change.addActionListener(this);
frm.setBounds(300,200,400,350);
frm.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==verify)
{
String password;
try
{
password=txtcurrent.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="select password from logintable where
password='"+password+"'";
ResultSet res=stmt.executeQuery(query);
if(res.next())
{
password.equals(query);
JOptionPane.showMessageDialog(null,"correct
password");
}
else
{
JOptionPane.showMessageDialog(null,"Not
Found");
}
}
catch(Exception e1)
{JOptionPane.showMessageDialog(null,e1.getMessage());}
}
else if(e.getSource()==change)
{
try
{
String changepswrd=txtnew.getText();
String confirmpswrd=txtconfirm.getText();
if(changepswrd.equals(confirmpswrd))
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
i
Connection
con=DriverManager.getConnection("jdbc:odbc:emp");
Statement stmt=con.createStatement();
String query="update logintable set
password='"+changepswrd+"'";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Password
Changed");
}
else
JOptionPane.showMessageDialog(null,"Password
mismatch");
}
catch(Exception e1)
{JOptionPane.showMessageDialog(null,e1.getMessage());}
}
else
frm.dispose();
}
}
i
CONCLUSION
After having completed this project, We felt that it was an excellent learning experience
as I deal with a real life project that give a opportunity to working for the students to
make their test more easy, while working on this project I got a good exposure to the
sharp programming skills and the various programming techniques while coding for this
system I was exposed to the vast knowledge about the strength and weakness of JAVA
language .
A part from this I have been able to appreciate the hard work of programmers spent in
developing such a system the most important realization was the amount of cooperation,
dedication, hardwork and team spirit that goes into making of a successful project.
i
BIBLOGRAPHY
The following are the books references that have been studied in the duration of making
of this project.
WEB REFRENCES
www.google.com
www.wikipedia.com
www.studymafia.org