public IEmployeeSalaryManager GetEmployeeSalaryManager(String emptype) { IEmployeeSalaryManager ReturnValue = null; if (emptype == "permanent") { ReturnValue = new PermanentEmployeeSalaryManager(); } if (emptype == "contract") { ReturnValue = new ContractEmployeeSalaryManager(); } return(ReturnValue); }
public void UpdateEmployee(Employee emp) { if (emp.EmployeeTypeId == 1) { PermanentEmployeeSalaryManager pe = new PermanentEmployeeSalaryManager(); emp.HourlyPay = pe.CalculateHourlyPay(); emp.BonusRate = pe.CalculateBonusRate(); } else if (emp.EmployeeTypeId == 2) { ContractEmployeeSalaryManager ce = new ContractEmployeeSalaryManager(); emp.HourlyPay = ce.CalculateHourlyPay(); emp.BonusRate = ce.CalculateBonusRate(); } commandRepository.UpdateEmployee(emp); }