//Method to update employee details public static bool UpdateEmployee(Employee emp) { bool isUpdated = false; try { //Validating employee details if (ValidateEmployee(emp)) { //Updating the employee details by calling DAL Update method isUpdated = EmployeeOperations.UpdateEmployee(emp); } else { throw new EmployeeException("Please provide valid employee details"); } } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(isUpdated); }
//Method to Deserialize Employee public static List <Employee> DeserializeEmployee() { List <Employee> empList = null; try { //deserializing employee by calling DAL deserialize method empList = EmployeeOperations.DeserializeEmployee(); } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(empList); }
//Method to serialize employee details public static bool SerializeEmployee() { bool isSerialized = false; try { //Serializing by calling DAL serialize method isSerialized = EmployeeOperations.SerializeEmployee(); } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(isSerialized); }
//Method to display all employees public static List <Employee> DisplayEmployees() { List <Employee> empList = null; try { //displaying employee by calling DAL display method empList = EmployeeOperations.DisplayEmployees(); } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(empList); }
//Method to search employee public static Employee SearchEmployee(int empID) { Employee emp = null; try { //Searching employee by calling DAL search method emp = EmployeeOperations.SearchEmployee(empID); } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(emp); }
//Method to delete employee details public static bool DeleteEmployee(int empID) { bool isDeleted = false; try { //Deleting employee by calling delete method of DAL isDeleted = EmployeeOperations.DeleteEmployee(empID); } catch (EmployeeException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(isDeleted); }