public BaseEmployeeFactory CreateFactory(IEmployee emp) { BaseEmployeeFactory returnValue = null; if (emp.EmployeeTypeID == 1) { returnValue = new PermanentEmployeeFactory(emp); } else if (emp.EmployeeTypeID == 2) { returnValue = new ContractEmployeeFactory(emp); } return(returnValue); }
public BaseEmployeeFactory GetFactory(Employee emp) { BaseEmployeeFactory returnValue = null; switch (emp.EmployeeTypeID) { case 1: returnValue = new PermanentEmployeeFactory(emp); break; case 2: returnValue = new ContractEmployeeFactory(emp); break; } return(returnValue); }
public BaseEmployeeFactory GetEmployeeManager(Employee employee) { BaseEmployeeFactory employeeFactory; switch (employee.EmployeeType) { case EmployeeType.Contract: employeeFactory = new ContractEmployeeFactory(employee); break; case EmployeeType.Permanent: employeeFactory = new PermanentEmployeeFactory(employee); break; default: throw new ArgumentOutOfRangeException(nameof(employee), employee, null); } return(employeeFactory); }