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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }