Skip to content

Commit aa299c8

Browse files
1st Commit -Add all Files
0 parents  commit aa299c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+671
-0
lines changed

.classpath

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
5+
<classpathentry kind="lib" path="D:/MY SQL 8.0.22/mysql-connector-java-8.0.22.jar"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Employee_Management_Project</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8
261 KB
310 KB

Images of UI/Insert UI/Main Frame.png

284 KB
318 KB
285 KB
271 KB
273 KB

bin/DeleteMethod$1.class

1.92 KB
Binary file not shown.

bin/DeleteMethod.class

1.28 KB
Binary file not shown.

bin/Emp.class

692 Bytes
Binary file not shown.

bin/Employee$1.class

1.49 KB
Binary file not shown.

bin/Employee$2.class

1.03 KB
Binary file not shown.

bin/Employee$3.class

633 Bytes
Binary file not shown.

bin/Employee$4.class

633 Bytes
Binary file not shown.

bin/Employee$5.class

633 Bytes
Binary file not shown.

bin/Employee.class

2.87 KB
Binary file not shown.

bin/Employee_SQL.class

2.42 KB
Binary file not shown.

bin/SearchMethod$1.class

2.69 KB
Binary file not shown.

bin/SearchMethod.class

1.37 KB
Binary file not shown.

bin/Test.class

393 Bytes
Binary file not shown.

bin/Ui_table.class

3.19 KB
Binary file not shown.

bin/UpdateMethod$1$1.class

2.28 KB
Binary file not shown.

bin/UpdateMethod$1.class

2.73 KB
Binary file not shown.

bin/UpdateMethod.class

1.69 KB
Binary file not shown.

src/DeleteMethod.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import java.awt.event.ActionEvent;
2+
import java.awt.event.ActionListener;
3+
import java.sql.Connection;
4+
import java.sql.Statement;
5+
6+
import javax.swing.JButton;
7+
import javax.swing.JFrame;
8+
import javax.swing.JLabel;
9+
import javax.swing.JOptionPane;
10+
import javax.swing.JTextField;
11+
12+
public class DeleteMethod {
13+
JFrame deleteframe ;
14+
JLabel Dlb;
15+
JTextField Dtx;
16+
17+
public void deleteUI() {
18+
19+
deleteframe = new JFrame("Delete Employee Data");
20+
21+
Dlb = new JLabel("Enter ID:");
22+
Dtx = new JTextField();
23+
JButton Dbt = new JButton("Remove");
24+
Dlb.setBounds(20,40,100,40);
25+
Dtx.setBounds(80,40,200,35);
26+
Dbt.setBounds(120,90,120,40);
27+
28+
deleteframe.add(Dlb);
29+
deleteframe.add(Dtx);
30+
deleteframe.add(Dbt);
31+
32+
deleteframe.setSize(500,300);
33+
deleteframe.setLayout(null);
34+
deleteframe.setVisible(true);
35+
36+
37+
38+
Dbt.addActionListener(new ActionListener(){
39+
40+
41+
@Override
42+
public void actionPerformed(ActionEvent e) {
43+
// TODO Auto-generated method stub
44+
try {
45+
46+
int delID = Integer.parseInt( Dtx.getText());
47+
Connection con = Employee_SQL.getConnection();
48+
Statement st=con.createStatement();
49+
int delCheck = st.executeUpdate( "delete from employee_project.table where Id = "+delID);
50+
con.close();
51+
52+
if(delCheck > 0) {
53+
JOptionPane.showMessageDialog(deleteframe, "Employee Data Deleted..." );
54+
}
55+
else
56+
{
57+
JOptionPane.showMessageDialog(deleteframe,"Employee Data Not Deleted...", "alert", JOptionPane.ERROR_MESSAGE );
58+
}
59+
60+
}
61+
catch(Exception e1)
62+
{
63+
e1.printStackTrace();
64+
}
65+
66+
}
67+
});
68+
}
69+
}

src/Emp.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
public class Emp {
3+
private String name1;
4+
private String Salary1;
5+
6+
public void setname(String name2) {
7+
name1 = name2;
8+
}
9+
public void setsalary(String Salary2)
10+
{
11+
12+
Salary1 = Salary2;
13+
14+
}
15+
public String getname(){
16+
17+
return name1;
18+
}
19+
public String getsalary(){
20+
21+
return Salary1;
22+
}
23+
24+
}

src/Employee_SQL.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import java.sql.Connection;
2+
import java.sql.DriverManager;
3+
import java.sql.PreparedStatement;
4+
import java.sql.ResultSet;
5+
import java.sql.SQLException;
6+
import java.sql.Statement;
7+
8+
public class Employee_SQL {
9+
10+
static Connection getConnection() throws ClassNotFoundException, SQLException
11+
{
12+
Class.forName("com.mysql.cj.jdbc.Driver");
13+
System.out.println("Driver Registered");
14+
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ employee_project","root","abc123");
15+
System.out.println("Connection Successfully");
16+
return con;
17+
}
18+
19+
static int insertData(int Id,String Name,String Salary) throws ClassNotFoundException, SQLException
20+
{
21+
Connection con=Employee_SQL.getConnection();
22+
Statement st=con.createStatement();
23+
int a=st.executeUpdate("INSERT INTO employee_project.table VALUES("+Id+",'"+Name+"','"+Salary+"')");
24+
con.close();
25+
return a;
26+
}
27+
// SHOW DATA ................
28+
29+
static String show() throws ClassNotFoundException, SQLException
30+
{
31+
String record="";
32+
Connection con=Employee_SQL.getConnection();
33+
Statement st=con.createStatement();
34+
ResultSet rs=st.executeQuery("SELECT * FROM employee_project.table ");
35+
while (rs.next())
36+
{
37+
record+=rs.getInt(1)+"\n";
38+
record+=rs.getString(2)+"\n";
39+
record+=rs.getString(3)+"\n";
40+
}
41+
con.close();
42+
return record;
43+
}
44+
}

src/SearchMethod.java

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import java.awt.event.ActionEvent;
2+
import java.awt.event.ActionListener;
3+
import java.sql.Connection;
4+
import java.sql.ResultSet;
5+
import java.sql.Statement;
6+
7+
import javax.swing.JButton;
8+
import javax.swing.JFrame;
9+
import javax.swing.JLabel;
10+
import javax.swing.JOptionPane;
11+
import javax.swing.JTextField;
12+
13+
public class SearchMethod {
14+
15+
JLabel sName,sSalary,nametag,salarytag;
16+
String name;
17+
String salary;
18+
public void searchUI() {
19+
20+
JFrame js = new JFrame("Search Frame");
21+
JLabel slb = new JLabel("Enter Id: ");
22+
JTextField stx = new JTextField();
23+
JButton sbt = new JButton("search");
24+
25+
26+
slb.setBounds(70,40,100,40);
27+
stx.setBounds(130,40,200,40);
28+
sbt.setBounds(170,100,100,40);
29+
30+
js.add(sbt);
31+
js.add(slb);
32+
js.add(stx);
33+
34+
35+
js.setSize(500,400);
36+
js.setLayout(null);
37+
js.setVisible(true);
38+
39+
40+
sbt.addActionListener(new ActionListener() {
41+
42+
@Override
43+
public void actionPerformed(ActionEvent e) {
44+
// TODO Auto-generated method stub
45+
46+
try
47+
{
48+
int srcID = Integer.parseInt( stx.getText());
49+
Connection con = Employee_SQL.getConnection();
50+
Statement st=con.createStatement();
51+
ResultSet sout = st.executeQuery("select * from employee_project.table where Id = "+srcID);
52+
53+
if(sout.next()) {
54+
name = sout.getString("Name");
55+
salary = sout.getString("Salary");
56+
57+
sName = new JLabel(name);
58+
sSalary = new JLabel(salary);
59+
sName.setBounds(100,190,200,50);
60+
sSalary.setBounds(100,220,200,50);
61+
nametag = new JLabel("Emp Name: ");
62+
salarytag = new JLabel("Emp Salary: ");
63+
nametag.setBounds(20,190,200,50);
64+
salarytag.setBounds(20,220,200,50);
65+
66+
js.add(nametag);
67+
js.add(salarytag);
68+
js.add(sName);
69+
js.add(sSalary);
70+
71+
72+
}
73+
else
74+
{
75+
JOptionPane.showMessageDialog(js,"No Record Found", "alert", JOptionPane.ERROR_MESSAGE );
76+
}
77+
con.close();
78+
79+
80+
}
81+
catch(Exception e1)
82+
{
83+
e1.printStackTrace();
84+
}
85+
86+
}
87+
88+
});
89+
90+
}
91+
}

0 commit comments

Comments
 (0)