-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmpFactory.java
More file actions
35 lines (35 loc) · 1.02 KB
/
EmpFactory.java
File metadata and controls
35 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package hexa;
import java.util.List;
import org.skife.jdbi.v2.DBI;
public class EmpFactory {
public static EmployeeDAO getDAO() {
DBI dbi = DbConnection.getConnect();
EmployeeDAO eDAO=dbi.onDemand(EmployeeDAO.class);
return eDAO;
}
public static List<Employee> getEmployees() {
EmployeeDAO eDAO=getDAO();
List<Employee> eList=eDAO.getAllEmployees();
return eList;
}
public static Employee ValidateEmpLogin(String eN, String eP) {
EmployeeDAO eDAO=getDAO();
Employee emp=eDAO.validateLogin(eN, eP);
return emp;
}
public static int insertEmp(String eN, String eP, String eH) {
EmployeeDAO eDAO=getDAO();
int val=eDAO.insertOneEmployee(eN, eP, eH);
return val;
}
public static int updateEmp(int id, String name) {
EmployeeDAO eDAO=getDAO();
int val=eDAO.updateNameGivenId(id, name);
return val;
}
public static int deleteEmp(int id) {
EmployeeDAO eDAO=getDAO();
int val=eDAO.deleteGivenId(id);
return val;
}
}