Ejemplo n.º 1
0
        public IComputerFactory Create(EmployeeModel emp)
        {
            IComputerFactory returnvalue = null;

            if (emp.EmployeeId == 1)
            {
                if (emp.JobDescription == "Manger")
                {
                    returnvalue = new MacLaptopFactory();
                }
                else
                {
                    returnvalue = new MacDesktopFactory();
                }
            }
            else if (emp.EmployeeId == 2)
            {
                if (emp.JobDescription == "Manger")
                {
                    returnvalue = new DellLaptopFactory();
                }
                else
                {
                    returnvalue = new DellDesktopFactory();
                }
            }

            return(returnvalue);
        }
Ejemplo n.º 2
0
        public IComputerFactory Create(Employee e)
        {
            IComputerFactory returnValue = null;

            if (e.EmployeeTypeID == 1)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new MACLaptopFactory();
                }
                else
                {
                    returnValue = new MACFactory();
                }
            }
            else if (e.EmployeeTypeID == 2)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new DellLaptopFactory();
                }
                else
                {
                    returnValue = new DellFactory();
                }
            }
            return(returnValue);
        }
Ejemplo n.º 3
0
 public static IDeviceFactory GetDevice(IBaseEmployee employee)
 {
     return(employee.RequestedDeviceType switch
     {
         DeviceType.Laptop => DellLaptopFactory.GetDevice(employee),
         DeviceType.Desktop => DellDesktopFactory.GetDevice(employee),
         _ => DellDesktopFactory.GetDevice(employee)
     });