├── OH-&-SS-System ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── bin │ └── com │ │ └── masai │ │ ├── Driver │ │ └── Driver.class │ │ ├── model │ │ ├── Eng_Com.class │ │ ├── Complain.class │ │ ├── Employee.class │ │ └── Engineer.class │ │ ├── utility │ │ ├── Color.class │ │ └── DBUtil.class │ │ ├── dao │ │ ├── EmployeeDao.class │ │ ├── EngineerDao.class │ │ ├── HODRollsDao.class │ │ ├── EmployeeDaoImpl.class │ │ ├── EngineerDaoImpl.class │ │ └── HODRollsDaoImpl.class │ │ ├── usecases │ │ ├── HODDriver.class │ │ ├── EmployeeDriver.class │ │ ├── EngineerDriver.class │ │ ├── LoginEmployeeUseCase.class │ │ ├── LoginEngineerUseCase.class │ │ ├── deleteEngineerUsecase.class │ │ ├── getAllProblemsUsecase.class │ │ ├── EmployeeUpdatePassword.class │ │ ├── RegisterComplainUsecase.class │ │ ├── RegisterEmployeeUseCase2.class │ │ ├── RegisterEngineerUseCase_.class │ │ ├── UpdatePasswordUseCases.class │ │ ├── assignedComplainUsecase.class │ │ ├── getAllEngDetailsUsecase.class │ │ ├── loginIntoSystemUsecases.class │ │ ├── registerEmployeeUsecase1.class │ │ ├── ComplainStatusCheckUsecase.class │ │ ├── ComplainAssignedByHodUsecase.class │ │ ├── GetCompletedComplaintUseCases.class │ │ ├── updateComplainStatusUsecase.class │ │ └── CompletedComplaintHistoryUsecase.class │ │ └── exceptions │ │ ├── HodException.class │ │ ├── MyException.class │ │ ├── ComplainException.class │ │ ├── EmployeeException.class │ │ └── EngineerException.class ├── src │ └── com │ │ └── masai │ │ ├── exceptions │ │ ├── HodException.java │ │ ├── MyException.java │ │ ├── ComplainException.java │ │ ├── EmployeeException.java │ │ └── EngineerException.java │ │ ├── dao │ │ ├── EngineerDao.java │ │ ├── HODRollsDao.java │ │ ├── EmployeeDao.java │ │ ├── EngineerDaoImpl.java │ │ ├── HODRollsDaoImpl.java │ │ └── EmployeeDaoImpl.java │ │ ├── utility │ │ ├── DBUtil.java │ │ └── Color.java │ │ ├── usecases │ │ ├── RegisterEmployeeUseCase1.java │ │ ├── getAllProblemsUsecase.java │ │ ├── updateComplainStatusUsecase.java │ │ ├── deleteEngineerUsecase.java │ │ ├── ComplainAssignedByHodUsecase.java │ │ ├── RegisterComplainUsecase.java │ │ ├── ComplainStatusCheckUsecase.java │ │ ├── GetCompletedComplaintUseCases.java │ │ ├── getAllEngDetailsUsecase.java │ │ ├── CompletedComplaintHistoryUsecase.java │ │ ├── UpdatePasswordUseCases.java │ │ ├── LoginEmployeeUseCase.java │ │ ├── EmployeeUpdatePassword.java │ │ ├── LoginEngineerUseCase.java │ │ ├── loginIntoSystemUsecases.java │ │ ├── assignedComplainUsecase.java │ │ ├── RegisterEmployeeUseCase2.java │ │ ├── RegisterEngineerUseCase_.java │ │ ├── EmployeeDriver.java │ │ ├── EngineerDriver.java │ │ └── HODDriver.java │ │ ├── model │ │ ├── Complain.java │ │ ├── Employee.java │ │ ├── Engineer.java │ │ └── Eng_Com.java │ │ └── Driver │ │ └── Driver.java ├── .project └── .classpath └── README.md /OH-&-SS-System/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/Driver/Driver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/Driver/Driver.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/model/Eng_Com.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/model/Eng_Com.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/utility/Color.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/utility/Color.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/EmployeeDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/EmployeeDao.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/EngineerDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/EngineerDao.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/HODRollsDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/HODRollsDao.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/model/Complain.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/model/Complain.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/model/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/model/Employee.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/model/Engineer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/model/Engineer.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/utility/DBUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/utility/DBUtil.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/HODDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/HODDriver.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/EmployeeDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/EmployeeDaoImpl.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/EngineerDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/EngineerDaoImpl.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/dao/HODRollsDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/dao/HODRollsDaoImpl.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/exceptions/HodException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/exceptions/HodException.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/exceptions/MyException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/exceptions/MyException.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/EmployeeDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/EmployeeDriver.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/EngineerDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/EngineerDriver.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/exceptions/ComplainException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/exceptions/ComplainException.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/exceptions/EmployeeException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/exceptions/EmployeeException.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/exceptions/EngineerException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/exceptions/EngineerException.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/LoginEmployeeUseCase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/LoginEmployeeUseCase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/LoginEngineerUseCase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/LoginEngineerUseCase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/deleteEngineerUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/deleteEngineerUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/getAllProblemsUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/getAllProblemsUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/EmployeeUpdatePassword.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/EmployeeUpdatePassword.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/RegisterComplainUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/RegisterComplainUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/RegisterEmployeeUseCase2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/RegisterEmployeeUseCase2.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/RegisterEngineerUseCase_.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/RegisterEngineerUseCase_.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/UpdatePasswordUseCases.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/UpdatePasswordUseCases.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/assignedComplainUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/assignedComplainUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/getAllEngDetailsUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/getAllEngDetailsUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/loginIntoSystemUsecases.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/loginIntoSystemUsecases.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/registerEmployeeUsecase1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/registerEmployeeUsecase1.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/ComplainStatusCheckUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/ComplainStatusCheckUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/ComplainAssignedByHodUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/ComplainAssignedByHodUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/GetCompletedComplaintUseCases.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/GetCompletedComplaintUseCases.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/updateComplainStatusUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/updateComplainStatusUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/bin/com/masai/usecases/CompletedComplaintHistoryUsecase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurusharan-gs/-lawful-chin-3963/HEAD/OH-&-SS-System/bin/com/masai/usecases/CompletedComplaintHistoryUsecase.class -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/exceptions/HodException.java: -------------------------------------------------------------------------------- 1 | package com.masai.exceptions; 2 | 3 | public class HodException extends Exception{ 4 | 5 | public HodException() { 6 | 7 | } 8 | 9 | public HodException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/exceptions/MyException.java: -------------------------------------------------------------------------------- 1 | package com.masai.exceptions; 2 | 3 | public class MyException extends Exception { 4 | 5 | public MyException() { 6 | 7 | } 8 | 9 | public MyException(String message) { 10 | super(message); 11 | } 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/exceptions/ComplainException.java: -------------------------------------------------------------------------------- 1 | package com.masai.exceptions; 2 | 3 | public class ComplainException extends Exception { 4 | 5 | public ComplainException() { 6 | 7 | } 8 | 9 | public ComplainException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/exceptions/EmployeeException.java: -------------------------------------------------------------------------------- 1 | package com.masai.exceptions; 2 | 3 | public class EmployeeException extends Exception { 4 | 5 | public EmployeeException() { 6 | 7 | } 8 | 9 | public EmployeeException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/exceptions/EngineerException.java: -------------------------------------------------------------------------------- 1 | package com.masai.exceptions; 2 | 3 | public class EngineerException extends Exception { 4 | 5 | public EngineerException() { 6 | 7 | } 8 | 9 | public EngineerException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /OH-&-SS-System/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | OH-&-SS-System 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /OH-&-SS-System/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/EngineerDao.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.masai.exceptions.ComplainException; 6 | import com.masai.exceptions.EngineerException; 7 | import com.masai.model.Eng_Com; 8 | 9 | public interface EngineerDao { 10 | 11 | public String loginEngineer(String usersname, String password)throws EngineerException; 12 | 13 | public List ComplainAssignedByHod(int engid)throws ComplainException; 14 | 15 | public String updateStatus(int engId) throws ComplainException; 16 | 17 | public List AttendedComplain(int engid)throws ComplainException; 18 | 19 | public String changePassword(String password,int engid)throws EngineerException; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/utility/DBUtil.java: -------------------------------------------------------------------------------- 1 | package com.masai.utility; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | 7 | public class DBUtil { 8 | 9 | public static Connection provideConnection() { 10 | 11 | Connection conn = null; 12 | 13 | try { 14 | Class.forName("com.mysql.cj.jdbc.Driver"); 15 | } catch (ClassNotFoundException e) { 16 | // TODO Auto-generated catch block 17 | e.printStackTrace(); 18 | } 19 | 20 | String url = "jdbc:mysql://localhost:3306/projectsb101"; 21 | 22 | try { 23 | conn = DriverManager.getConnection(url, "root", "root"); 24 | } catch (SQLException e) { 25 | // TODO Auto-generated catch block 26 | e.printStackTrace(); 27 | } 28 | 29 | 30 | return conn; 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/RegisterEmployeeUseCase1.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EmployeeDao; 6 | import com.masai.dao.EmployeeDaoImpl; 7 | 8 | public class RegisterEmployeeUseCase1 { 9 | 10 | public static void main(String[] args) { 11 | 12 | Scanner sc = new Scanner(System.in); 13 | 14 | System.out.println("Enter Employee Name : "); 15 | String name = sc.next(); 16 | 17 | System.out.println("Enter Employee Username : "); 18 | String username = sc.next(); 19 | 20 | System.out.println("Enter Employee Password : "); 21 | String password = sc.next(); 22 | 23 | EmployeeDao ed = new EmployeeDaoImpl(); 24 | 25 | String res = ed.registerEmployee(name, username, password); 26 | System.out.println(res); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /OH-&-SS-System/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=17 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.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=17 15 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/HODRollsDao.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.masai.exceptions.ComplainException; 6 | import com.masai.exceptions.EngineerException; 7 | import com.masai.exceptions.HodException; 8 | import com.masai.model.Complain; 9 | import com.masai.model.Engineer; 10 | 11 | public interface HODRollsDao { 12 | 13 | public String loginIntoSystem(String username, String password)throws HodException ; 14 | 15 | public String registerEngineer(Engineer engineer)throws EngineerException; 16 | 17 | public List getAllEngineerDetails()throws EngineerException; 18 | 19 | public String deleteEngineer(int engId) throws EngineerException; 20 | 21 | public List getAllProblems()throws ComplainException; 22 | 23 | public String assignedComplain(int engid,String name,String category,int id,String status); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/getAllProblemsUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.List; 4 | 5 | import com.masai.dao.HODRollsDao; 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.MyException; 11 | import com.masai.model.Complain; 12 | 13 | public class getAllProblemsUsecase { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, ComplainException { 16 | 17 | HODRollsDao hd = new HODRollsDaoImpl(); 18 | 19 | try { 20 | List lc = hd.getAllProblems(); 21 | lc.forEach(s -> System.out.println(s)); 22 | } catch (ComplainException e) { 23 | // TODO Auto-generated catch block 24 | e.printStackTrace(); 25 | } 26 | HODDriver.main(args); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/EmployeeDao.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.masai.exceptions.ComplainException; 6 | import com.masai.exceptions.EmployeeException; 7 | import com.masai.model.Complain; 8 | import com.masai.model.Employee; 9 | import com.masai.model.Eng_Com; 10 | 11 | public interface EmployeeDao { 12 | 13 | public String registerEmployee(String name, String username, String password); 14 | 15 | public String registerEmployee2(Employee employee); 16 | 17 | public String loginEmployee(String username, String password)throws EmployeeException; 18 | 19 | public String registerComplain(String complainname,String category)throws ComplainException; 20 | 21 | 22 | public List ComplainStatus(int EcomplainId)throws ComplainException; 23 | 24 | public List getComplainHistory(int empid)throws EmployeeException; 25 | 26 | public String changePassword(String password,int empid)throws EmployeeException; 27 | } 28 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/updateComplainStatusUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EngineerDao; 6 | import com.masai.dao.EngineerDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.HodException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class updateComplainStatusUsecase { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException { 15 | 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter Engineer Id To Update Problem Status :"); 20 | int num = sc.nextInt(); 21 | 22 | EngineerDao ed = new EngineerDaoImpl(); 23 | 24 | String res = ed.updateStatus(num); 25 | 26 | System.out.println(res); 27 | 28 | EngineerDriver.main(args); 29 | 30 | 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/deleteEngineerUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.HODRollsDao; 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class deleteEngineerUsecase { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException, ComplainException { 15 | 16 | Scanner sc = new Scanner(System.in); 17 | 18 | System.out.println("Enter Engineer Id And Delete :"); 19 | int eid = sc.nextInt(); 20 | 21 | HODRollsDao hd = new HODRollsDaoImpl(); 22 | 23 | try { 24 | 25 | String d = hd.deleteEngineer(eid); 26 | System.out.println(d); 27 | HODDriver.main(args); 28 | } catch (EngineerException e) { 29 | // TODO: handle exception 30 | e.printStackTrace(); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/ComplainAssignedByHodUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.List; 4 | 5 | import java.util.Scanner; 6 | 7 | import com.masai.dao.EngineerDao; 8 | import com.masai.dao.EngineerDaoImpl; 9 | import com.masai.exceptions.ComplainException; 10 | import com.masai.exceptions.EmployeeException; 11 | import com.masai.exceptions.HodException; 12 | import com.masai.exceptions.MyException; 13 | import com.masai.model.Eng_Com; 14 | 15 | 16 | public class ComplainAssignedByHodUsecase { 17 | 18 | public static void main(String[] args) throws EmployeeException, MyException, HodException, ComplainException { 19 | 20 | Scanner sc = new Scanner(System.in); 21 | 22 | System.out.println("Enter Engineer Id : "); 23 | int n = sc.nextInt(); 24 | 25 | EngineerDao ed = new EngineerDaoImpl(); 26 | 27 | try { 28 | List list = ed.ComplainAssignedByHod(n); 29 | list.forEach(s -> System.out.println(s)); 30 | } catch (ComplainException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | EngineerDriver.main(args); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/RegisterComplainUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EmployeeDao; 6 | import com.masai.dao.EmployeeDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class RegisterComplainUsecase { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, ComplainException { 15 | 16 | Scanner sc = new Scanner(System.in); 17 | 18 | System.out.println("Enter Category (Hardware/Software) : "); 19 | String com = sc.next(); 20 | System.out.println("Enter Complain Name : "); 21 | String cname = sc.next(); 22 | 23 | EmployeeDao dao = new EmployeeDaoImpl(); 24 | 25 | 26 | try { 27 | 28 | String res = dao.registerComplain(cname, cname); 29 | System.out.println(res); 30 | HODDriver.main(args); 31 | } catch (ComplainException e) { 32 | // TODO: handle exception 33 | e.printStackTrace(); 34 | } 35 | 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/ComplainStatusCheckUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.List; 4 | 5 | import java.util.Scanner; 6 | 7 | import com.masai.dao.EmployeeDao; 8 | import com.masai.dao.EmployeeDaoImpl; 9 | import com.masai.exceptions.ComplainException; 10 | import com.masai.exceptions.EmployeeException; 11 | import com.masai.exceptions.EngineerException; 12 | import com.masai.exceptions.HodException; 13 | import com.masai.exceptions.MyException; 14 | import com.masai.model.Eng_Com; 15 | 16 | public class ComplainStatusCheckUsecase { 17 | 18 | public static void main(String[] args)throws EmployeeException,MyException,EngineerException,HodException { 19 | 20 | 21 | Scanner sc = new Scanner(System.in); 22 | System.out.println("Enter Complain Id :"); 23 | int name = sc.nextInt(); 24 | 25 | EmployeeDao dao = new EmployeeDaoImpl(); 26 | try { 27 | List ec = dao.ComplainStatus(name); 28 | ec.forEach(s -> System.out.println(s)); 29 | EmployeeDriver.main(null); 30 | } catch (ComplainException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/GetCompletedComplaintUseCases.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.List; 4 | import java.util.Scanner; 5 | 6 | import com.masai.dao.EngineerDao; 7 | import com.masai.dao.EngineerDaoImpl; 8 | import com.masai.exceptions.ComplainException; 9 | import com.masai.exceptions.EmployeeException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | import com.masai.model.Eng_Com; 13 | 14 | public class GetCompletedComplaintUseCases { 15 | 16 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException { 17 | 18 | Scanner sc = new Scanner(System.in); 19 | 20 | System.out.println("Enter Engineer Id to Get List of All Attended Problem : "); 21 | int engid = sc.nextInt(); 22 | 23 | EngineerDao ed = new EngineerDaoImpl(); 24 | 25 | try { 26 | List lec = ed.AttendedComplain(engid); 27 | lec.forEach(s -> System.out.println(s)); 28 | } catch (ComplainException e) { 29 | // TODO Auto-generated catch block 30 | e.printStackTrace(); 31 | } 32 | 33 | EngineerDriver.main(args); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/getAllEngDetailsUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.model.Engineer; 8 | 9 | public class getAllEngDetailsUsecase { 10 | 11 | public static void main(String[] args) { 12 | 13 | HODRollsDaoImpl hd = new HODRollsDaoImpl(); 14 | 15 | try { 16 | 17 | List eng = hd.getAllEngineerDetails(); 18 | eng.forEach(s -> { 19 | System.out.println("-----------------------------------------"); 20 | 21 | System.out.println("Engineer ID : "+s.getEngid()); 22 | System.out.println("Engineer Name : "+ s.getUsername()); 23 | System.out.println("Engineer Username : "+ s.getUsername()); 24 | System.out.println("Engineer Password : "+ s.getPassword()); 25 | System.out.println("Engineer Category : "+ s.getCategory()); 26 | 27 | System.out.println("-----------------------------------------"); 28 | 29 | 30 | }); 31 | 32 | 33 | } catch (Exception e) { 34 | // TODO: handle exception 35 | System.out.println(e.getMessage()); 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/CompletedComplaintHistoryUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.List; 4 | import java.util.Scanner; 5 | 6 | import com.masai.dao.EmployeeDao; 7 | import com.masai.dao.EmployeeDaoImpl; 8 | import com.masai.exceptions.ComplainException; 9 | import com.masai.exceptions.EmployeeException; 10 | import com.masai.exceptions.EngineerException; 11 | import com.masai.exceptions.HodException; 12 | import com.masai.exceptions.MyException; 13 | import com.masai.model.Complain; 14 | 15 | public class CompletedComplaintHistoryUsecase { 16 | 17 | public static void main(String[] args)throws MyException, EngineerException, HodException, ComplainException { 18 | 19 | Scanner sc = new Scanner(System.in); 20 | System.out.println("Enter Employee Id :-"); 21 | int id = sc.nextInt(); 22 | 23 | EmployeeDao ed = new EmployeeDaoImpl(); 24 | 25 | try { 26 | List lcom = ed.getComplainHistory(id); 27 | lcom.forEach(s -> System.out.println(s)); 28 | EmployeeDriver.main(null); 29 | } catch (EmployeeException e) { 30 | // TODO Auto-generated catch block 31 | e.printStackTrace(); 32 | } 33 | 34 | 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/UpdatePasswordUseCases.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EngineerDao; 6 | import com.masai.dao.EngineerDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | 13 | public class UpdatePasswordUseCases { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException { 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter Engineer Id :"); 20 | int engid = sc.nextInt(); 21 | System.out.println("Enter New Password :"); 22 | String password = sc.next(); 23 | 24 | 25 | EngineerDao ed = new EngineerDaoImpl(); 26 | 27 | try { 28 | String res = ed.changePassword(password, engid); 29 | System.out.println(res); 30 | 31 | } catch (EngineerException e) { 32 | // TODO Auto-generated catch block 33 | e.printStackTrace(); 34 | } 35 | EngineerDriver.main(args); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/LoginEmployeeUseCase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EmployeeDao; 6 | import com.masai.dao.EmployeeDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | 13 | public class LoginEmployeeUseCase { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException, EngineerException { 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter Your Username :"); 20 | String username = sc.next(); 21 | 22 | System.out.println("Enter Your Password :"); 23 | String password = sc.next(); 24 | 25 | EmployeeDao dao = new EmployeeDaoImpl(); 26 | 27 | try { 28 | String res = dao.loginEmployee(username, password); 29 | System.out.println(res); 30 | EmployeeDriver.main(args); 31 | } catch (EmployeeException e) { 32 | // TODO Auto-generated catch block 33 | e.printStackTrace(); 34 | } 35 | 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/EmployeeUpdatePassword.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EmployeeDao; 6 | import com.masai.dao.EmployeeDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | 13 | public class EmployeeUpdatePassword { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, HodException, ComplainException { 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter Employee Id :"); 20 | int empid = sc.nextInt(); 21 | System.out.println("Enter New Password :"); 22 | String password = sc.next(); 23 | 24 | EmployeeDao ed = new EmployeeDaoImpl(); 25 | 26 | String res; 27 | try { 28 | res = ed.changePassword(password, empid); 29 | System.out.println(res); 30 | EmployeeDriver.main(args); 31 | } catch (EmployeeException e) { 32 | // TODO Auto-generated catch block 33 | e.printStackTrace(); 34 | } 35 | 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/LoginEngineerUseCase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.EngineerDao; 6 | import com.masai.dao.EngineerDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | 13 | public class LoginEngineerUseCase { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException { 16 | 17 | 18 | Scanner sc = new Scanner(System.in); 19 | 20 | System.out.println("Enter Your Username : "); 21 | String username = sc.next(); 22 | 23 | System.out.println("Enter Your Password : "); 24 | String password = sc.next(); 25 | 26 | 27 | EngineerDao ed = new EngineerDaoImpl(); 28 | 29 | 30 | 31 | try { 32 | 33 | String res = ed.loginEngineer(username, password); 34 | System.out.println(res); 35 | EngineerDriver.main(args); 36 | } catch (EngineerException e) { 37 | // TODO: handle exception 38 | e.printStackTrace(); 39 | } 40 | 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/loginIntoSystemUsecases.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.HODRollsDao; 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.HodException; 11 | import com.masai.exceptions.MyException; 12 | 13 | public class loginIntoSystemUsecases { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, ComplainException, HodException { 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter the UserName"); 20 | String username = sc.next(); 21 | 22 | System.out.println("Enter the Password"); 23 | String password = sc.next(); 24 | 25 | 26 | HODRollsDao hd = new HODRollsDaoImpl(); 27 | 28 | 29 | try { 30 | 31 | String res = hd.loginIntoSystem(username, password); 32 | System.out.println(res); 33 | HODDriver.main(args); 34 | } catch (HodException e) { 35 | // TODO: handle exception 36 | e.printStackTrace(); 37 | } 38 | 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/model/Complain.java: -------------------------------------------------------------------------------- 1 | package com.masai.model; 2 | 3 | public class Complain { 4 | 5 | private int complainID; 6 | private String complainName; 7 | private String category; 8 | 9 | public Complain() { 10 | super(); 11 | } 12 | 13 | 14 | public Complain(int complainID, String complainName, String category) { 15 | super(); 16 | this.complainID = complainID; 17 | this.complainName = complainName; 18 | this.category = category; 19 | } 20 | 21 | 22 | public int getComplainID() { 23 | return complainID; 24 | } 25 | 26 | 27 | public void setComplainID(int complainID) { 28 | this.complainID = complainID; 29 | } 30 | 31 | 32 | public String getComplainName() { 33 | return complainName; 34 | } 35 | 36 | 37 | public void setComplainName(String complainName) { 38 | this.complainName = complainName; 39 | } 40 | 41 | 42 | public String getCategory() { 43 | return category; 44 | } 45 | 46 | 47 | public void setCategory(String category) { 48 | this.category = category; 49 | } 50 | 51 | 52 | @Override 53 | public String toString() { 54 | return "Complain [complainID=" + complainID + ", complainName=" + complainName + ", category=" + category + "]"; 55 | } 56 | 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/assignedComplainUsecase.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.HODRollsDao; 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class assignedComplainUsecase { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, ComplainException { 15 | 16 | Scanner sc = new Scanner(System.in); 17 | 18 | System.out.println("Enter Engineer Id : "); 19 | int engid = sc.nextInt(); 20 | System.out.println("Enter Engineer Name : "); 21 | String name = sc.next(); 22 | System.out.println("Enter Engineer Category (Software/Hardware) : "); 23 | String category = sc.next(); 24 | System.out.println("Enter Complain Id : "); 25 | int complainid = sc.nextInt(); 26 | System.out.println("Enter Complain Status : "); 27 | String status = sc.next(); 28 | 29 | 30 | HODRollsDao hd = new HODRollsDaoImpl(); 31 | 32 | String res = hd.assignedComplain(engid, name, category, complainid, status); 33 | System.out.println(res); 34 | 35 | 36 | 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/model/Employee.java: -------------------------------------------------------------------------------- 1 | package com.masai.model; 2 | 3 | public class Employee { 4 | 5 | 6 | private int empid; 7 | private String name; 8 | private String username; 9 | private String password; 10 | 11 | 12 | public Employee() { 13 | super(); 14 | } 15 | 16 | 17 | public Employee(int empid, String name, String username, String password) { 18 | super(); 19 | this.empid = empid; 20 | this.name = name; 21 | this.username = username; 22 | this.password = password; 23 | } 24 | 25 | 26 | public int getEmpid() { 27 | return empid; 28 | } 29 | 30 | 31 | public void setEmpid(int empid) { 32 | this.empid = empid; 33 | } 34 | 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | 46 | public String getUsername() { 47 | return username; 48 | } 49 | 50 | 51 | public void setUsername(String username) { 52 | this.username = username; 53 | } 54 | 55 | 56 | public String getPassword() { 57 | return password; 58 | } 59 | 60 | 61 | public void setPassword(String password) { 62 | this.password = password; 63 | } 64 | 65 | 66 | @Override 67 | public String toString() { 68 | return "Employee [empid=" + empid + ", name=" + name + ", username=" + username + ", password=" + password 69 | + "]"; 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/RegisterEmployeeUseCase2.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.Driver.Driver; 6 | import com.masai.dao.EmployeeDao; 7 | import com.masai.dao.EmployeeDaoImpl; 8 | import com.masai.exceptions.ComplainException; 9 | import com.masai.exceptions.EmployeeException; 10 | import com.masai.exceptions.EngineerException; 11 | import com.masai.exceptions.HodException; 12 | import com.masai.exceptions.MyException; 13 | import com.masai.model.Employee; 14 | 15 | 16 | public class RegisterEmployeeUseCase2 { 17 | 18 | public static void main(String[] args)throws EmployeeException, MyException, HodException, EngineerException, ComplainException { 19 | 20 | Scanner sc = new Scanner(System.in); 21 | 22 | System.out.println("Enter Employee Name : "); 23 | String name = sc.next(); 24 | 25 | System.out.println("Enter Employee Username : "); 26 | String username = sc.next(); 27 | 28 | System.out.println("Enter Employee Password : "); 29 | String password = sc.next(); 30 | 31 | 32 | EmployeeDao empdao = new EmployeeDaoImpl(); 33 | 34 | Employee emp = new Employee(); 35 | emp.setName(name); 36 | emp.setUsername(username); 37 | emp.setPassword(password); 38 | 39 | String res = empdao.registerEmployee2(emp); 40 | 41 | System.out.println(res); 42 | 43 | try { 44 | 45 | Driver.main(args); 46 | 47 | } catch (EmployeeException e) { 48 | e.printStackTrace(); 49 | } 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/RegisterEngineerUseCase_.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.dao.HODRollsDao; 6 | import com.masai.dao.HODRollsDaoImpl; 7 | import com.masai.exceptions.ComplainException; 8 | import com.masai.exceptions.EmployeeException; 9 | import com.masai.exceptions.EngineerException; 10 | import com.masai.exceptions.MyException; 11 | import com.masai.model.Engineer; 12 | 13 | public class RegisterEngineerUseCase_ { 14 | 15 | public static void main(String[] args)throws EngineerException, EmployeeException, MyException, ComplainException { 16 | 17 | Scanner sc = new Scanner(System.in); 18 | 19 | System.out.println("Enter the Engineer Name : "); 20 | String name = sc.next(); 21 | 22 | System.out.println("Enter the Engineer Username : "); 23 | String username = sc.next(); 24 | 25 | System.out.println("Enter the Engineer Password : "); 26 | String password = sc.next(); 27 | 28 | System.out.println("Enter the Engineer Category (Hardware/Software) : "); 29 | String category = sc.next(); 30 | 31 | 32 | HODRollsDao hd = new HODRollsDaoImpl(); 33 | 34 | Engineer eng = new Engineer(); 35 | eng.setName(name); 36 | eng.setUsername(username); 37 | eng.setPassword(password); 38 | eng.setCategory(category); 39 | 40 | try { 41 | 42 | String res = hd.registerEngineer(eng); 43 | System.out.println(res); 44 | HODDriver.main(args); 45 | } catch (EngineerException e) { 46 | // TODO: handle exception 47 | e.printStackTrace(); 48 | } 49 | 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/Driver/Driver.java: -------------------------------------------------------------------------------- 1 | package com.masai.Driver; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.exceptions.ComplainException; 6 | import com.masai.exceptions.EmployeeException; 7 | import com.masai.exceptions.EngineerException; 8 | import com.masai.exceptions.HodException; 9 | import com.masai.exceptions.MyException; 10 | import com.masai.usecases.LoginEmployeeUseCase; 11 | import com.masai.usecases.LoginEngineerUseCase; 12 | import com.masai.usecases.RegisterEmployeeUseCase1; 13 | import com.masai.usecases.RegisterEmployeeUseCase2; 14 | import com.masai.usecases.loginIntoSystemUsecases; 15 | import com.masai.utility.Color; 16 | 17 | public class Driver { 18 | 19 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, HodException, ComplainException { 20 | 21 | System.out.println("Welcome to Online Hardware and Software Support System"); 22 | System.out.println("1. Login as HOD"); 23 | System.out.println("2. Login as Engineer"); 24 | System.out.println("3. Register as Employee"); 25 | System.out.println("4. Login as Employee"); 26 | 27 | System.out.println(); 28 | 29 | 30 | Scanner sc = new Scanner(System.in); 31 | 32 | int res = sc.nextInt(); 33 | 34 | if(res == 1) { 35 | loginIntoSystemUsecases.main(args); 36 | }else if(res == 2) { 37 | LoginEngineerUseCase.main(args); 38 | }else if(res == 3) { 39 | RegisterEmployeeUseCase2.main(args); 40 | }else if(res == 4) { 41 | LoginEmployeeUseCase.main(args); 42 | }else { 43 | throw new MyException("Invalid Input Please Try Again..."); 44 | } 45 | 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/model/Engineer.java: -------------------------------------------------------------------------------- 1 | package com.masai.model; 2 | 3 | public class Engineer { 4 | 5 | private int engid; 6 | private String name; 7 | private String username; 8 | private String password; 9 | private String category; 10 | 11 | 12 | public Engineer() { 13 | super(); 14 | } 15 | 16 | 17 | public Engineer(int engid, String name, String username, String password, String category) { 18 | super(); 19 | this.engid = engid; 20 | this.name = name; 21 | this.username = username; 22 | this.password = password; 23 | this.category = category; 24 | } 25 | 26 | 27 | public int getEngid() { 28 | return engid; 29 | } 30 | 31 | 32 | public void setEngid(int engid) { 33 | this.engid = engid; 34 | } 35 | 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | 47 | public String getUsername() { 48 | return username; 49 | } 50 | 51 | 52 | public void setUsername(String username) { 53 | this.username = username; 54 | } 55 | 56 | 57 | public String getPassword() { 58 | return password; 59 | } 60 | 61 | 62 | public void setPassword(String password) { 63 | this.password = password; 64 | } 65 | 66 | 67 | public String getCategory() { 68 | return category; 69 | } 70 | 71 | 72 | public void setCategory(String category) { 73 | this.category = category; 74 | } 75 | 76 | 77 | @Override 78 | public String toString() { 79 | return "Engineer [engid=" + engid + ", name=" + name + ", username=" + username + ", password=" + password 80 | + ", category=" + category + "]"; 81 | } 82 | 83 | 84 | 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/EmployeeDriver.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.Driver.Driver; 6 | import com.masai.exceptions.ComplainException; 7 | import com.masai.exceptions.EmployeeException; 8 | import com.masai.exceptions.EngineerException; 9 | import com.masai.exceptions.HodException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class EmployeeDriver { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException,EngineerException, HodException, ComplainException { 15 | 16 | while (true) { 17 | 18 | System.out.println(); 19 | System.out.println("1. Register Complaint"); 20 | System.out.println("2. Check Status of Complaint"); 21 | System.out.println("3. See All Complaints"); 22 | System.out.println("4. Update Password"); 23 | System.out.println("5. Exit To Main Page"); 24 | System.out.println("Please select an option to continue"); 25 | 26 | 27 | Scanner sc = new Scanner(System.in); 28 | 29 | int choice = sc.nextInt(); 30 | 31 | switch(choice) { 32 | 33 | case 1 : 34 | RegisterComplainUsecase.main(args); 35 | break; 36 | case 2 : 37 | ComplainStatusCheckUsecase.main(args); 38 | break; 39 | case 3 : 40 | CompletedComplaintHistoryUsecase.main(args); 41 | break; 42 | case 4 : 43 | EmployeeUpdatePassword.main(args); 44 | break; 45 | case 5 : 46 | 47 | try { 48 | 49 | Driver.main(args); 50 | 51 | } catch (EmployeeException e) { 52 | // TODO: handle exception 53 | e.printStackTrace(); 54 | } 55 | 56 | } 57 | 58 | } 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/EngineerDriver.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.exceptions.ComplainException; 6 | import com.masai.exceptions.EmployeeException; 7 | import com.masai.exceptions.EngineerException; 8 | import com.masai.exceptions.HodException; 9 | import com.masai.exceptions.MyException; 10 | import com.masai.Driver.Driver; 11 | 12 | 13 | public class EngineerDriver { 14 | 15 | public static void main(String[] args)throws EmployeeException, MyException, HodException, ComplainException { 16 | 17 | while(true) { 18 | 19 | System.out.println(); 20 | System.out.println("1. Get Assigned Complaints"); 21 | System.out.println("2. Update the status of Complaints"); 22 | System.out.println("3. All Attended Problems"); 23 | System.out.println("4. Update Password"); 24 | System.out.println("5. Exit to Main Page"); 25 | 26 | System.out.println("Please select an option to continue"); 27 | 28 | Scanner sc = new Scanner(System.in); 29 | int choice = sc.nextInt(); 30 | 31 | switch(choice) { 32 | 33 | case 1 : ComplainAssignedByHodUsecase.main(args); 34 | break; 35 | case 2 : updateComplainStatusUsecase.main(args); 36 | break; 37 | case 3 : GetCompletedComplaintUseCases.main(args); 38 | break; 39 | case 4 : UpdatePasswordUseCases.main(args); 40 | break; 41 | case 5 : 42 | try { 43 | Driver.main(args); 44 | 45 | } catch (EngineerException e) { 46 | // TODO: handle exception 47 | e.printStackTrace(); 48 | } 49 | 50 | 51 | 52 | } 53 | 54 | 55 | } 56 | 57 | } 58 | 59 | 60 | 61 | } 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/model/Eng_Com.java: -------------------------------------------------------------------------------- 1 | package com.masai.model; 2 | 3 | public class Eng_Com { 4 | 5 | private int engId; 6 | private String name; 7 | private String category; 8 | private int EcomplainId; 9 | private String ComplainStatus; 10 | 11 | 12 | public Eng_Com() { 13 | super(); 14 | } 15 | 16 | 17 | public Eng_Com(int engId, String name, String category, int ecomplainId, String complainStatus) { 18 | super(); 19 | this.engId = engId; 20 | this.name = name; 21 | this.category = category; 22 | EcomplainId = ecomplainId; 23 | ComplainStatus = complainStatus; 24 | } 25 | 26 | 27 | public int getEngId() { 28 | return engId; 29 | } 30 | 31 | 32 | public void setEngId(int engId) { 33 | this.engId = engId; 34 | } 35 | 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | 47 | public String getCategory() { 48 | return category; 49 | } 50 | 51 | 52 | public void setCategory(String category) { 53 | this.category = category; 54 | } 55 | 56 | 57 | public int getEcomplainId() { 58 | return EcomplainId; 59 | } 60 | 61 | 62 | public void setEcomplainId(int ecomplainId) { 63 | EcomplainId = ecomplainId; 64 | } 65 | 66 | 67 | public String getComplainStatus() { 68 | return ComplainStatus; 69 | } 70 | 71 | 72 | public void setComplainStatus(String complainStatus) { 73 | ComplainStatus = complainStatus; 74 | } 75 | 76 | 77 | @Override 78 | public String toString() { 79 | return "Engineer_Complain [engId=" + engId + ", name=" + name + ", category=" + category + ", EcomplainId=" 80 | + EcomplainId + ", ComplainStatus=" + ComplainStatus + "]"; 81 | } 82 | 83 | 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/usecases/HODDriver.java: -------------------------------------------------------------------------------- 1 | package com.masai.usecases; 2 | 3 | import java.util.Scanner; 4 | 5 | import com.masai.Driver.Driver; 6 | import com.masai.exceptions.ComplainException; 7 | import com.masai.exceptions.EmployeeException; 8 | import com.masai.exceptions.EngineerException; 9 | import com.masai.exceptions.HodException; 10 | import com.masai.exceptions.MyException; 11 | 12 | public class HODDriver { 13 | 14 | public static void main(String[] args)throws EmployeeException, MyException, EngineerException, ComplainException { 15 | 16 | while(true) { 17 | 18 | 19 | System.out.println("---------------------------------------------------"); 20 | System.out.println("1. Register Engineer"); 21 | System.out.println("2. Get details of all Engineers"); 22 | System.out.println("3. Delete an Engineer"); 23 | System.out.println("4. Get all complaints registered"); 24 | System.out.println("5. Assign Engineer"); 25 | System.out.println("6. To Main Page \n"); 26 | System.out.println("Please select an option to continue \n"); 27 | System.out.println("---------------------------------------------------"); 28 | 29 | 30 | Scanner sc = new Scanner(System.in); 31 | 32 | int choice = sc.nextInt(); 33 | 34 | switch(choice) { 35 | 36 | case 1 : 37 | RegisterEngineerUseCase_.main(args); 38 | break; 39 | case 2 : 40 | getAllEngDetailsUsecase.main(args); 41 | break; 42 | case 3 : 43 | deleteEngineerUsecase.main(args); 44 | break; 45 | case 4 : 46 | getAllProblemsUsecase.main(args); 47 | break; 48 | case 5 : 49 | assignedComplainUsecase.main(args); 50 | break; 51 | case 6 : 52 | try { 53 | Driver.main(args); 54 | } catch (HodException e) { 55 | // TODO: handle exception 56 | e.printStackTrace(); 57 | } 58 | 59 | 60 | } 61 | 62 | } 63 | 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # -lawful-chin-3963 2 |

Online Hardware and Software Support System

3 | 4 |

The system will be available on an online platform for 24x7 access to the employees, the engineers, the Head of the Department and the administration. It Helps keeping your IT staff productive with fast, accurate, remote technical support for your System environment. It provides defect support for a broad # range of Products running on System hardware. Factors to consider include cost of downtime, skills, retention, overheads, customer satisfaction, and many others.

5 | 6 |

Users:

7 |

1. HOD

8 |

2. Engineer

9 |

3. Employee

10 | 11 |

Roles for the HOD:

12 | 13 |

1. Login into the system 14 |

15 |

2. Register a new Engineer with a username(email) and password and the category (Hardware/software)

16 |

3. Can see List of all the Registered Engineers.

17 |

4. Can Delete any Engineers from the system

18 |

5. Can able to see all the raised problem.

19 |

6. Can assign any problem to any Engineer.

20 | 21 |

Roles of Engineer:

22 |

1. Each engineer has their own account by which they can login.(credentials given by the HOD)

23 |

2. Engineer can view the problem assigned to him by HOD .

24 |

3. Engineer can update the status of the problem addressed by him . i. e. whether it solved or any thing .

25 |

4. They can see list of all the problems attended by him/her.

26 |

5. Engineer can change his password.

27 | 28 |

Roles of Employee:

29 |

1. Employee can register himself with his username and password.

30 |

2. Each employee has their account in the system with which they can login.

31 |

3. Employee can register any complain (hardware / software ) through the system. After registering the complain a complain id is generated by the system.

32 |

4. Employee can see the status of their problem by using complain id . Status means they can check who (engineer) is assigned to his problem.

33 |

5. They can see all complain history raised by him/her.

34 |

6. Employee can change his/her password.

35 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/EngineerDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import com.masai.exceptions.ComplainException; 11 | import com.masai.exceptions.EngineerException; 12 | import com.masai.model.Eng_Com; 13 | import com.masai.utility.DBUtil; 14 | 15 | public class EngineerDaoImpl implements EngineerDao{ 16 | 17 | @Override 18 | public String loginEngineer(String usersname, String password) throws EngineerException { 19 | 20 | String messege = "Invalid Credentials"; 21 | 22 | 23 | try (Connection conn = DBUtil.provideConnection()) { 24 | 25 | PreparedStatement ps = conn.prepareStatement("select * from Engineer where username = ? AND password = ?"); 26 | 27 | ps.setString(1, usersname); 28 | ps.setString(2, password); 29 | 30 | ResultSet rs = ps.executeQuery(); 31 | 32 | if(rs.next()) { 33 | 34 | String name = rs.getString("name"); 35 | messege = "Welcome "+ name; 36 | }else { 37 | messege = "Wrong Credentials"; 38 | } 39 | 40 | 41 | } catch (SQLException e) { 42 | // TODO: handle exception 43 | e.getStackTrace(); 44 | 45 | throw new EngineerException("Engineer Not Found !!!!"); 46 | } 47 | 48 | 49 | 50 | 51 | return messege; 52 | 53 | } 54 | 55 | @Override 56 | public List ComplainAssignedByHod(int engid) throws ComplainException { 57 | 58 | List ec = new ArrayList<>(); 59 | 60 | try (Connection conn = DBUtil.provideConnection()){ 61 | 62 | PreparedStatement ps = conn.prepareStatement("select * from EngineerComplain where engid = ?"); 63 | 64 | ps.setInt(1, engid); 65 | 66 | ResultSet rs = ps.executeQuery(); 67 | 68 | while(rs.next()) { 69 | 70 | int eid = rs.getInt("engid"); 71 | String name = rs.getString("name"); 72 | String category = rs.getString("category"); 73 | int EcomplainId = rs.getInt("EcomplainId"); 74 | String ComplainStatus = rs.getString("ComplainStatus"); 75 | 76 | ec.add(new Eng_Com(eid, name, category, EcomplainId, ComplainStatus)); 77 | } 78 | 79 | 80 | } catch (SQLException e) { 81 | 82 | throw new ComplainException("Complain Not Assigned...!"); 83 | } 84 | 85 | if(ec.size()==0) { 86 | throw new ComplainException("No Complain Assigned...!"); 87 | } 88 | 89 | 90 | return ec; 91 | 92 | 93 | } 94 | 95 | @Override 96 | public String updateStatus(int engId) throws ComplainException { 97 | 98 | String message = "Complain Status Not Updated..."; 99 | 100 | try (Connection conn = DBUtil.provideConnection()) { 101 | 102 | PreparedStatement ps = conn.prepareStatement("Update EngineerComplain set ComplainStatus = 'Resolved' where EcomplainId = ?"); 103 | 104 | ps.setInt(1, engId); 105 | 106 | int x = ps.executeUpdate(); 107 | 108 | if(x > 0) { 109 | message = "Complain Status Updated Sucessfull... !"; 110 | } 111 | 112 | 113 | } catch (SQLException e) { 114 | message = e.getMessage(); 115 | } 116 | 117 | 118 | return message; 119 | 120 | } 121 | 122 | @Override 123 | public List AttendedComplain(int engid) throws ComplainException { 124 | 125 | List list = new ArrayList<>(); 126 | 127 | try (Connection conn = DBUtil.provideConnection()) { 128 | 129 | PreparedStatement ps = conn.prepareStatement("select * from EngineerComplain where engid = ? AND ComplainStatus = 'Resolved'"); 130 | 131 | ps.setInt(1, engid); 132 | 133 | ResultSet rs = ps.executeQuery(); 134 | 135 | while(rs.next()) { 136 | 137 | int engId = rs.getInt("engid"); 138 | String name = rs.getString("name"); 139 | String category = rs.getString("category"); 140 | int EcomplainId = rs.getInt("EcomplainId"); 141 | String ComplainStatus = rs.getString("ComplainStatus"); 142 | 143 | list.add(new Eng_Com(engId, name, category, EcomplainId, ComplainStatus)); 144 | 145 | 146 | } 147 | 148 | 149 | } catch (SQLException e) { 150 | e.printStackTrace(); 151 | 152 | throw new ComplainException("No Complain Found...!"); 153 | } 154 | 155 | 156 | return list; 157 | 158 | } 159 | 160 | @Override 161 | public String changePassword(String password, int engid) throws EngineerException { 162 | 163 | 164 | String message = "Password Not Changed..."; 165 | 166 | try (Connection conn = DBUtil.provideConnection()) { 167 | 168 | PreparedStatement ps = conn.prepareStatement("Update Engineer set password = ? where engid = ?"); 169 | 170 | ps.setString(1, password); 171 | ps.setInt(2, engid); 172 | 173 | int x = ps.executeUpdate(); 174 | 175 | if(x > 0) { 176 | message = "Password Updated Sucessfull..."; 177 | } 178 | 179 | 180 | 181 | } catch (SQLException e) { 182 | 183 | message = e.getMessage(); 184 | 185 | } 186 | 187 | 188 | return message; 189 | } 190 | 191 | 192 | 193 | } 194 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/HODRollsDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import javax.naming.spi.DirStateFactory.Result; 11 | 12 | import com.masai.exceptions.ComplainException; 13 | import com.masai.exceptions.EngineerException; 14 | import com.masai.exceptions.HodException; 15 | import com.masai.model.Complain; 16 | import com.masai.model.Engineer; 17 | import com.masai.utility.DBUtil; 18 | 19 | public class HODRollsDaoImpl implements HODRollsDao{ 20 | 21 | @Override 22 | public String loginIntoSystem(String username, String password) throws HodException{ 23 | 24 | String messege = "Invalid User..."; 25 | 26 | try(Connection conn = DBUtil.provideConnection()) { 27 | 28 | PreparedStatement ps = conn.prepareStatement("select * from loginhod where username = ? AND password = ?"); 29 | 30 | ps.setString(1, username); 31 | ps.setString(2, password); 32 | 33 | ResultSet rs = ps.executeQuery(); 34 | 35 | if(rs.next()) { 36 | String name = rs.getString("name"); 37 | messege = " WelCome " + name; 38 | } 39 | 40 | 41 | 42 | } catch (Exception e) { 43 | e.getStackTrace(); 44 | } 45 | 46 | 47 | 48 | return messege; 49 | } 50 | 51 | 52 | 53 | @Override 54 | public String registerEngineer(Engineer engineer) { 55 | 56 | String messege = "Engineer Not Register"; 57 | 58 | try (Connection conn = DBUtil.provideConnection()) { 59 | 60 | PreparedStatement ps = conn.prepareStatement("insert into Engineer(name, username, password, Category) values(?,?,?,?)"); 61 | 62 | ps.setString(1, engineer.getName()); 63 | ps.setString(2, engineer.getUsername()); 64 | ps.setString(3, engineer.getPassword()); 65 | ps.setString(4, engineer.getCategory()); 66 | 67 | int x = ps.executeUpdate(); 68 | 69 | if(x > 0) { 70 | messege = "Engineer Registered Sucessfully...!"; 71 | } 72 | 73 | 74 | } catch (SQLException e) { 75 | messege = e.getMessage(); 76 | } 77 | 78 | 79 | 80 | return messege; 81 | } 82 | 83 | 84 | 85 | @Override 86 | public List getAllEngineerDetails() throws EngineerException { 87 | 88 | List eng = new ArrayList<>(); 89 | 90 | try(Connection conn = DBUtil.provideConnection()) { 91 | 92 | PreparedStatement ps = conn.prepareStatement("select * from Engineer"); 93 | 94 | ResultSet rs = ps.executeQuery(); 95 | 96 | while(rs.next()) { 97 | 98 | int engid = rs.getInt("engid"); 99 | String name = rs.getString("name"); 100 | String username = rs.getString("username"); 101 | String password = rs.getString("password"); 102 | String category = rs.getString("category"); 103 | eng.add(new Engineer(engid,name, username, password, category)); 104 | 105 | } 106 | 107 | } catch (SQLException e) { 108 | throw new EngineerException(e.getMessage()); 109 | } 110 | if (eng.size() == 0) { 111 | throw new EngineerException("No Engineer Found !!!!"); 112 | } 113 | 114 | 115 | return eng; 116 | } 117 | 118 | 119 | 120 | @Override 121 | public String deleteEngineer(int engId) throws EngineerException { 122 | 123 | String messege = "Engineer Not Found This System...!"; 124 | 125 | try(Connection conn = DBUtil.provideConnection()) { 126 | 127 | PreparedStatement ps = conn.prepareStatement("delete from Engineer where engId= ?"); 128 | 129 | ps.setInt(1, engId); 130 | 131 | int x = ps.executeUpdate(); 132 | 133 | if(x > 0) { 134 | messege = "Engineer Deleted Sucessfully...!"; 135 | 136 | } 137 | 138 | } catch (SQLException e) { 139 | messege = e.getMessage(); 140 | } 141 | 142 | 143 | return messege; 144 | } 145 | 146 | 147 | 148 | @Override 149 | public List getAllProblems() throws ComplainException { 150 | 151 | 152 | List com = new ArrayList<>(); 153 | 154 | try(Connection conn = DBUtil.provideConnection()) { 155 | 156 | PreparedStatement ps = conn.prepareStatement("select * from Complain"); 157 | 158 | ResultSet rs = ps.executeQuery(); 159 | 160 | while(rs.next()) { 161 | 162 | int id = rs.getInt("ComplainId"); 163 | String name = rs.getString("ComplainName"); 164 | String category = rs.getString("Category"); 165 | 166 | Complain cp = new Complain(id, name, category); 167 | com.add(cp); 168 | 169 | 170 | } 171 | 172 | 173 | 174 | } catch (SQLException e) { 175 | 176 | throw new ComplainException(e.getMessage()); 177 | } 178 | 179 | if(com.size() == 0) { 180 | throw new ComplainException("No Complains Found!"); 181 | } 182 | 183 | 184 | return com; 185 | 186 | } 187 | 188 | 189 | 190 | @Override 191 | public String assignedComplain(int engid, String name, String category, int id, String status) { 192 | 193 | String message = "Complain Not Assigned... ! "; 194 | 195 | try(Connection conn = DBUtil.provideConnection()) { 196 | 197 | PreparedStatement ps = conn.prepareStatement("insert into EngineerComplain(engid,name,category,EcomplainId,ComplainStatus) values(?,?,?,?,?)"); 198 | 199 | ps.setInt(1, engid); 200 | ps.setString(2, name); 201 | ps.setString(3, category); 202 | ps.setInt(4, id); 203 | ps.setString(5, status); 204 | 205 | int x = ps.executeUpdate(); 206 | 207 | if(x > 0) { 208 | message = "Complain Assigned To Engineer " +name+ " Sucessfully... !"; 209 | } 210 | 211 | 212 | 213 | } catch (SQLException e) { 214 | 215 | message = e.getMessage(); 216 | } 217 | 218 | 219 | 220 | return message; 221 | } 222 | 223 | } 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/dao/EmployeeDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.masai.dao; 2 | 3 | import java.sql.Connection; 4 | 5 | 6 | import java.sql.PreparedStatement; 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | import com.masai.exceptions.ComplainException; 13 | import com.masai.exceptions.EmployeeException; 14 | import com.masai.model.Complain; 15 | import com.masai.model.Employee; 16 | import com.masai.model.Eng_Com; 17 | import com.masai.utility.Color; 18 | import com.masai.utility.DBUtil; 19 | 20 | public class EmployeeDaoImpl implements EmployeeDao{ 21 | 22 | @Override 23 | public String registerEmployee(String name, String username, String password) { 24 | 25 | String message = "Employee Not Registered...!"; 26 | 27 | try(Connection conn = DBUtil.provideConnection()) { 28 | 29 | PreparedStatement ps = conn.prepareStatement("insert into employee(name,username,password) values(?,?,?)"); 30 | 31 | ps.setString(1, name); 32 | ps.setString(2, username); 33 | ps.setString(3, password); 34 | 35 | 36 | int x = ps.executeUpdate(); 37 | 38 | if(x > 0) { 39 | message = Color.ANSI_GREEN+"Employee Registered Sucessfully !"; 40 | } 41 | 42 | 43 | 44 | } catch (SQLException e) { 45 | 46 | message = e.getMessage(); 47 | } 48 | 49 | 50 | 51 | 52 | return message; 53 | } 54 | 55 | @Override 56 | public String registerEmployee2(Employee employee) { 57 | 58 | String message = "Employee Not Registered...."; 59 | 60 | try(Connection conn = DBUtil.provideConnection()) { 61 | 62 | PreparedStatement ps = conn.prepareStatement("insert into Employee(name,username,password) values(?,?,?)"); 63 | ps.setString(1, employee.getName()); 64 | ps.setString(2, employee.getUsername()); 65 | ps.setString(3, employee.getPassword()); 66 | 67 | int x = ps.executeUpdate(); 68 | 69 | if(x > 0) { 70 | message = "Employee Registered Sucessfully...!"; 71 | } 72 | 73 | } catch (SQLException e) { 74 | 75 | message = e.getMessage(); 76 | } 77 | 78 | 79 | return message; 80 | } 81 | 82 | @Override 83 | public String loginEmployee(String username, String password) throws EmployeeException { 84 | 85 | String message = "Invalid Credentials"; 86 | 87 | try(Connection conn = DBUtil.provideConnection()) { 88 | 89 | PreparedStatement ps = conn.prepareStatement("select * from Employee where username = ? AND password = ?"); 90 | 91 | ps.setString(1, username); 92 | ps.setString(2, password); 93 | 94 | ResultSet rs = ps.executeQuery(); 95 | 96 | if(rs.next()) { 97 | String name = rs.getString("name"); 98 | message = " Welcome "+ name; 99 | }else { 100 | message = "Wrong Credentials"; 101 | } 102 | 103 | } catch (SQLException e) { 104 | e.printStackTrace(); 105 | 106 | throw new EmployeeException("Employee Not Found...!"); 107 | } 108 | 109 | 110 | return message; 111 | 112 | } 113 | 114 | 115 | 116 | @Override 117 | public String registerComplain(String complainname, String category) { 118 | 119 | String message = "Complain Not Assigned...!"; 120 | 121 | try (Connection conn = DBUtil.provideConnection()) { 122 | 123 | PreparedStatement ps = conn.prepareStatement("insert into complain(ComplainName,Category) values(?,?)"); 124 | 125 | ps.setString(1, complainname); 126 | ps.setString(2, category); 127 | 128 | int x = ps.executeUpdate(); 129 | 130 | if(x > 0) { 131 | message = "Complain Assigned Sucessfully... !"; 132 | } 133 | 134 | 135 | } catch (SQLException e) { 136 | message = e.getMessage(); 137 | } 138 | 139 | return message; 140 | } 141 | 142 | @Override 143 | public List ComplainStatus(int EcomplainId) throws ComplainException { 144 | 145 | 146 | List list = new ArrayList<>(); 147 | 148 | try (Connection conn = DBUtil.provideConnection()) { 149 | PreparedStatement ps = conn.prepareStatement("select * from EngineerComplain where EcomplainId = ?"); 150 | 151 | ps.setInt(1, EcomplainId); 152 | 153 | ResultSet rs = ps.executeQuery(); 154 | 155 | while(rs.next()) { 156 | int engid = rs.getInt("engid"); 157 | String name = rs.getString("name"); 158 | String category = rs.getString("Category"); 159 | int complainId = rs.getInt("EComplainId"); 160 | String status = rs.getString("ComplainStatus"); 161 | 162 | Eng_Com ec = new Eng_Com(engid, name, category, EcomplainId, status); 163 | 164 | list.add(ec); 165 | } 166 | 167 | } catch (SQLException e) { 168 | 169 | throw new ComplainException(e.getMessage()); 170 | } 171 | if(list.size()==0) { 172 | throw new ComplainException("No Complain Found !!!!"); 173 | } 174 | 175 | return list; 176 | 177 | } 178 | 179 | @Override 180 | public List getComplainHistory(int empid) throws EmployeeException { 181 | 182 | List list = new ArrayList<>(); 183 | 184 | try (Connection conn = DBUtil.provideConnection()) { 185 | 186 | PreparedStatement ps = conn.prepareStatement("select * from Complain where empid = ?"); 187 | ps.setInt(1, empid); 188 | 189 | ResultSet rs = ps.executeQuery(); 190 | 191 | while(rs.next()) { 192 | 193 | int ComplainId = rs.getInt("ComplainId"); 194 | String ComplainName = rs.getString("ComplainName"); 195 | String Category = rs.getString("Category"); 196 | 197 | Complain com = new Complain(ComplainId, ComplainName, Category); 198 | 199 | list.add(com); 200 | 201 | } 202 | 203 | 204 | } catch (SQLException e) { 205 | e.getMessage(); 206 | } 207 | 208 | return list; 209 | 210 | } 211 | 212 | @Override 213 | public String changePassword(String password, int empid) throws EmployeeException { 214 | 215 | String message = "Password Not Changed...!"; 216 | 217 | try (Connection conn = DBUtil.provideConnection()) { 218 | 219 | PreparedStatement ps = conn.prepareStatement("Update Employee set password = ? where empid = ?"); 220 | 221 | ps.setString(1, password); 222 | ps.setInt(2, empid); 223 | 224 | int x = ps.executeUpdate(); 225 | 226 | if(x > 0) { 227 | message = "Password Updated Sucessfull..."; 228 | 229 | } 230 | 231 | 232 | 233 | } catch (SQLException e) { 234 | message = e.getMessage(); 235 | } 236 | 237 | 238 | return message; 239 | } 240 | 241 | } 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | -------------------------------------------------------------------------------- /OH-&-SS-System/src/com/masai/utility/Color.java: -------------------------------------------------------------------------------- 1 | package com.masai.utility; 2 | 3 | public class Color { 4 | 5 | public static final String ANSI_RESET = "\u001B[0m"; 6 | public static final String ANSI_BLACK = "\u001B[30m"; 7 | public static final String ANSI_RED = "\u001B[31m"; 8 | public static final String ANSI_GREEN = "\u001B[32m"; 9 | public static final String ANSI_YELLOW = "\u001B[33m"; 10 | public static final String ANSI_BLUE = "\u001B[34m"; 11 | public static final String ANSI_PURPLE = "\u001B[35m"; 12 | public static final String ANSI_CYAN = "\u001B[36m"; 13 | public static final String ANSI_WHITE = "\u001B[37m"; 14 | 15 | public static final String RESET = "\033[0m"; // Text Reset 16 | 17 | public static final String ERASE = "\033[H\033[2J"; 18 | 19 | public static final String HIDDEN = "\033[8;30m"; 20 | 21 | // Creates a black box around the word 22 | public static final String BOXING = "\033[0;51m"; // BLAK 23 | 24 | // This will create a black background and make the text previous color 25 | // Unless color black, then it will make it white 26 | public static final String TEXT_BACKGROUND = "\033[0;7m"; // BLACK 27 | 28 | // Regular Colors 29 | public static final String BLACK = "\033[0;30m"; // BLACK 30 | public static final String RED = "\033[0;31m"; // RED 31 | public static final String GREEN = "\033[0;32m"; // GREEN 32 | public static final String YELLOW = "\033[0;33m"; // YELLOW 33 | public static final String BLUE = "\033[0;34m"; // BLUE 34 | public static final String PURPLE = "\033[0;35m"; // PURPLE 35 | public static final String CYAN = "\033[0;36m"; // CYAN 36 | public static final String WHITE = "\033[0;37m"; // WHITE 37 | public static final String LIGHT_PURPLE = "\033[38;2;200;0;200m"; // LIGHT PURPLE 38 | public static final String TEAL = "\033[38;2;0;225;221m"; // TEAL 39 | public static final String ORANGE = "\033[38;2;225;153;0m"; // ORANGE 40 | public static final String LIGHT_GREEN = "\033[38;2;136;255;0m"; // LIGHT GREEN 41 | public static final String LIGHT_BLUE = "\033[38;2;120;172;255m"; // LIGHT BLUE 42 | public static final String DARK_BLUE = "\033[38;2;72;0;255m"; // DARK BLUE 43 | public static final String ROSY_PINK = "\033[38;2;255;0;162m"; // ROSY PINK 44 | public static final String BROWN = "\033[38;2;135;82;62m"; // BROWN 45 | public static final String FOREST_GREEN = "\033[38;2;62;135;81m"; // FOREST GREEN 46 | public static final String BANANA_YELLOW = "\033[38;2;240;238;113m"; // BANANA YELLOW 47 | public static final String DARK_RED = "\033[38;2;145;40;16m"; // DARK RED 48 | public static final String LIGHT_PINK = "\033[38;2;255;153;240m"; // LIGHT PINK 49 | 50 | // StrikeOut 51 | public static final String BLACK_STRIKE = "\033[9;30m"; // BLACK 52 | public static final String RED_STRIKE = "\033[9;31m"; // RED 53 | public static final String GREEN_STRIKE = "\033[9;32m"; // GREEN 54 | public static final String YELLOW_STRIKE = "\033[9;33m"; // YELLOW 55 | public static final String BLUE_STRIKE = "\033[9;34m"; // BLUE 56 | public static final String PURPLE_STRIKE = "\033[9;35m"; // PURPLE 57 | public static final String CYAN_STRIKE = "\033[9;36m"; // CYAN 58 | public static final String WHITE_STRIKE = "\033[9;37m"; // WHITE 59 | 60 | // Italic 61 | public static final String BLACK_ITALIC = "\033[3;30m"; // BLACK 62 | public static final String RED_ITALIC = "\033[3;31m"; // RED 63 | public static final String GREEN_ITALIC = "\033[3;32m"; // GREEN 64 | public static final String YELLOW_ITALIC = "\033[3;33m"; // YELLOW 65 | public static final String BLUE_ITALIC = "\033[3;34m"; // BLUE 66 | public static final String PURPLE_ITALIC = "\033[3;35m"; // PURPLE 67 | public static final String CYAN_ITALIC = "\033[3;36m"; // CYAN 68 | public static final String WHITE_ITALIC = "\033[3;37m"; // WHITE 69 | 70 | // Bold 71 | public static final String BLACK_BOLD = "\033[1;30m"; // BLACK 72 | public static final String RED_BOLD = "\033[1;31m"; // RED 73 | public static final String GREEN_BOLD = "\033[1;32m"; // GREEN 74 | public static final String YELLOW_BOLD = "\033[1;33m"; // YELLOW 75 | public static final String BLUE_BOLD = "\033[1;34m"; // BLUE 76 | public static final String PURPLE_BOLD = "\033[1;35m"; // PURPLE 77 | public static final String CYAN_BOLD = "\033[1;36m"; // CYAN 78 | public static final String WHITE_BOLD = "\033[1;37m"; // WHITE 79 | 80 | // Underline 81 | public static final String BLACK_UNDERLINED = "\033[4;30m"; // BLACK 82 | public static final String RED_UNDERLINED = "\033[4;31m"; // RED 83 | public static final String GREEN_UNDERLINED = "\033[4;32m"; // GREEN 84 | public static final String YELLOW_UNDERLINED = "\033[4;33m"; // YELLOW 85 | public static final String BLUE_UNDERLINED = "\033[4;34m"; // BLUE 86 | public static final String PURPLE_UNDERLINED = "\033[4;35m"; // PURPLE 87 | public static final String CYAN_UNDERLINED = "\033[4;36m"; // CYAN 88 | public static final String WHITE_UNDERLINED = "\033[4;37m"; // WHITE 89 | 90 | // Background 91 | public static final String BLACK_BACKGROUND = "\033[40m"; // BLACK 92 | public static final String RED_BACKGROUND = "\033[41m"; // RED 93 | public static final String GREEN_BACKGROUND = "\033[42m"; // GREEN 94 | public static final String YELLOW_BACKGROUND = "\033[43m"; // YELLOW 95 | public static final String BLUE_BACKGROUND = "\033[44m"; // BLUE 96 | public static final String PURPLE_BACKGROUND = "\033[45m"; // PURPLE 97 | public static final String CYAN_BACKGROUND = "\033[46m"; // CYAN 98 | public static final String WHITE_BACKGROUND = "\033[47m"; // WHITE 99 | public static final String LIGHT_PURPLE_BACKGROUND = "\033[48;2;200;0;200m"; // LIGHT PURPLE 100 | public static final String TEAL_BACKGROUND = "\033[48;2;0;225;221m"; // TEAL 101 | public static final String ORANGE_BACKGROUND = "\033[48;2;225;153;0m"; // ORANGE 102 | public static final String LIGHT_GREEN_BACKGROUND = "\033[48;2;136;255;0m"; // LIGHT GREEN 103 | public static final String LIGHT_BLUE_BACKGROUND = "\033[48;2;120;172;255m"; // LIGHT BLUE 104 | public static final String DARK_BLUE_BACKGROUND = "\033[48;2;72;0;255m"; // DARK BLUE 105 | public static final String ROSY_PINK_BACKGROUND = "\033[48;2;255;0;162m"; // ROSY PINK 106 | public static final String BROWN_BACKGROUND = "\033[48;2;135;82;62m"; // BROWN 107 | public static final String FOREST_GREEN_BACKGROUND = "\033[48;2;62;135;81m"; // FOREST GREEN 108 | public static final String BANANA_YELLOW_BACKGROUND = "\033[48;2;240;238;113m"; // BANANA YELLOW 109 | public static final String DARK_RED_BACKGROUND = "\033[48;2;145;40;16m"; // DARK RED 110 | public static final String LIGHT_PINK_BACKGROUND = "\033[48;2;255;153;240m"; // LIGHT PINK 111 | 112 | // High Intensity 113 | public static final String BLACK_BRIGHT = "\033[0;90m"; // BLACK 114 | public static final String RED_BRIGHT = "\033[0;91m"; // RED 115 | public static final String GREEN_BRIGHT = "\033[0;92m"; // GREEN 116 | public static final String YELLOW_BRIGHT = "\033[0;93m"; // YELLOW 117 | public static final String BLUE_BRIGHT = "\033[0;94m"; // BLUE 118 | public static final String PURPLE_BRIGHT = "\033[0;95m"; // PURPLE 119 | public static final String CYAN_BRIGHT = "\033[0;96m"; // CYAN 120 | public static final String WHITE_BRIGHT = "\033[0;97m"; // WHITE 121 | 122 | // Bold High Intensity 123 | public static final String BLACK_BOLD_BRIGHT = "\033[1;90m"; // BLACK 124 | public static final String RED_BOLD_BRIGHT = "\033[1;91m"; // RED 125 | public static final String GREEN_BOLD_BRIGHT = "\033[1;92m"; // GREEN 126 | public static final String YELLOW_BOLD_BRIGHT = "\033[1;93m";// YELLOW 127 | public static final String BLUE_BOLD_BRIGHT = "\033[1;94m"; // BLUE 128 | public static final String PURPLE_BOLD_BRIGHT = "\033[1;95m";// PURPLE 129 | public static final String CYAN_BOLD_BRIGHT = "\033[1;96m"; // CYAN 130 | public static final String WHITE_BOLD_BRIGHT = "\033[1;97m"; // WHITE 131 | 132 | // High Intensity backgrounds 133 | public static final String BLACK_BACKGROUND_BRIGHT = "\033[0;100m";// BLACK 134 | public static final String RED_BACKGROUND_BRIGHT = "\033[0;101m";// RED 135 | public static final String GREEN_BACKGROUND_BRIGHT = "\033[0;102m";// GREEN 136 | public static final String YELLOW_BACKGROUND_BRIGHT = "\033[0;103m";// YELLOW 137 | public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";// BLUE 138 | public static final String PURPLE_BACKGROUND_BRIGHT = "\033[0;105m"; // PURPLE 139 | public static final String CYAN_BACKGROUND_BRIGHT = "\033[0;106m"; // CYAN 140 | public static final String WHITE_BACKGROUND_BRIGHT = "\033[0;107m"; // WHITE 141 | 142 | } 143 | --------------------------------------------------------------------------------