예제 #1
0
        public static Employee GetEmployee(EmployeeDTO employeeDTO)
        {
            Employee employee = null;

            switch (employeeDTO.contractTypeName)
            {
            case "HourlySalaryEmployee":
                employee = new EmployeeHourly()
                {
                    hourlySalary = employeeDTO.hourlySalary
                };
                break;

            case "MonthlySalaryEmployee":
                employee = new EmployeeMonthly()
                {
                    monthlySalary = employeeDTO.monthlySalary
                };
                break;
            }

            employee.id               = employeeDTO.id;
            employee.name             = employeeDTO.name;
            employee.contractTypeName = employeeDTO.contractTypeName;
            employee.roleId           = employeeDTO.roleId;
            employee.roleName         = employeeDTO.roleName;
            employee.roleDescription  = employeeDTO.roleDescription;


            return(employee);
        }
예제 #2
0
        public static IEmployeeGateway CreateEmployeeGateway(Employee employee)
        {
            IEmployeeGateway gateway;

            switch (employee.ContractTypeName)
            {
            case "HourlySalaryEmployee":
                gateway = new EmployeeHourly(employee);
                break;

            case "MonthlySalaryEmployee":
            default:
                gateway = new EmployeeMonthly(employee);
                break;
            }

            return(gateway);
        }