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);
        }
Exemplo n.º 2
0
        public IComputerFactory Create(IEmployee e)
        {
            IComputerFactory returnValue = null;

            if (e.EmployeeTypeID == 1)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new MackBookFactory();
                }
                else
                {
                    returnValue = new IMacFactory();
                }
            }
            else if (e.EmployeeTypeID == 2)
            {
                if (e.JobDescription == "Manager")
                {
                    returnValue = new DellLaptopFactory();
                }
                else
                {
                    returnValue = new DellDesktopFactory();
                }
            }
            return(returnValue);
        }
Exemplo n.º 3
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);
        }
        public IComputerFactory Create(Employee e)
        {
            IComputerFactory returValue = null;

            if (e.EmployeeTypeId == 1)
            {
                if (e.Position == "Manager")
                {
                    returValue = new MACLaptopFactory();
                }
                else
                {
                    returValue = new MACFactory();
                }
            }
            else if (e.EmployeeTypeId == 2)
            {
                if (e.Position == "Manager")
                {
                    returValue = new DellLaptopFactory();
                }
                else
                {
                    returValue = new DellFactory();
                }
            }
            return(returValue);
        }
Exemplo n.º 5
0
        public IComputerFactory CreateFactory(Employee emp)
        {
            IComputerFactory returnValue = null;

            if (emp.EmployeeTypeId == Convert.ToInt32(EmployeeType.Permanent.GetHashCode()))
            {
                if (emp.JobDetails == "Manager")
                {
                    returnValue = new MACLaptopFactory();
                }
                else
                {
                    returnValue = new MACFactory();
                }
            }
            else if (emp.EmployeeTypeId == Convert.ToInt32(EmployeeType.Contract.GetHashCode()))
            {
                if (emp.JobDetails == "Manager")
                {
                    returnValue = new DELLLaptopFactory();
                }
                else
                {
                    returnValue = new DELLFactory();
                }
            }
            return(returnValue);
        }
 public Сomputer(IComputerFactory factory)
 {
     Cpu = factory.GetCpu();
     Hdd = factory.GetHdd();
     Ram = factory.GetRam();
     Vga = factory.GetVga();
 }
Exemplo n.º 7
0
        public IComputerFactory Create(Employee employee)
        {
            IComputerFactory computerFactory = null;

            if (employee.EmployeeTypeID == 1)
            {
                if (employee.JobDescription == "Manager")
                {
                    computerFactory = new MacLaptopFactory();
                }
                else
                {
                    computerFactory = new MacFactory();
                }
            }
            else if (employee.EmployeeTypeID == 2)
            {
                if (employee.JobDescription == "Manager")
                {
                    computerFactory = new DellLaptopFactory();
                }
                else
                {
                    computerFactory = new DellFactory();
                }
            }

            return(computerFactory);
        }
Exemplo n.º 8
0
        public IComputerFactory Create(Employee emp)
        {
            IComputerFactory returnValue = null;

            if (emp.EmployeeTypeId == 1)
            {
                if (emp.JobDescription == "Manager")
                {
                    returnValue = new MacLaptopFactory();
                }
                else
                {
                    returnValue = new MacFactory();
                }
            }

            if (emp.EmployeeTypeId == 2)
            {
                if (emp.JobDescription == "Manager")
                {
                    returnValue = new DellLaptopFactory();
                }
                else
                {
                    returnValue = new DellFactory();
                }
            }
            return(returnValue);
        }
        public void GetInfo(IComputerFactory computerFactory)
        {
            IMainBoard mainBoard = computerFactory.CreateMainBoard();
            IProcesor  procesor  = computerFactory.CreateProcessor();

            Console.WriteLine(mainBoard.GetDescription());
            Console.WriteLine(mainBoard.GetProcessorType(procesor));
        }
Exemplo n.º 10
0
        public void ClientMethod(IComputerFactory factory)
        {
            IMainboard mainboard = factory.CreateMainboard();
            IProcessor processor = factory.CreateProcessor();

            Console.WriteLine(processor.ShowBatteryVolume());
            Console.WriteLine(processor.ShowBatteryChargeLevel(mainboard));
        }
Exemplo n.º 11
0
        public void ClientMethod(IComputerFactory factory)
        {
            IMainboard mainboard = factory.CreateMainboard();
            IProcessor processor = factory.CreateProcessor();

            Console.WriteLine(processor.ShowProcessor());
            Console.WriteLine(processor.ShowProcessorStation(mainboard));
        }
Exemplo n.º 12
0
        public static void Main()
        {
            var manufacturer         = Console.ReadLine();
            IComputerFactory factory = CreateFactory(manufacturer);

            var laptop = factory.CreateLaptop();
            var pc     = factory.CreatePc();
            var server = factory.CreateServer();

            while (true)
            {
                var c = Console.ReadLine();

                if (c == null)
                {
                    break;
                }

                if (c.StartsWith("Exit"))
                {
                    break;
                }

                var cp = c.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (cp.Length != 2)
                {
                    {
                        throw new ArgumentException("Invalid command!");
                    }
                }

                var cn = cp[0];
                var ca = int.Parse(cp[1]);

                if (cn == "Charge")
                {
                    laptop.ChargeBattery(ca);
                }
                else if (cn == "Process")
                {
                    server.Process(ca);
                }
                else if (cn == "Play")
                {
                    pc.Play(ca);
                }
                else
                {
                    Console.WriteLine("Invalid command!");
                }
            }
        }
Exemplo n.º 13
0
        public IComputer SellComputer(ComputerProducer producer, ComputerType type)
        {
            IComputerFactory factory = null;

            if (producer == ComputerProducer.DELL)
            {
                factory = DellComputerFactory.Instance;
            }
            else if (producer == ComputerProducer.HP)
            {
                factory = HpComputerFactory.Instance;
            }
            return(factory?.CreateComputer(type));
        }
Exemplo n.º 14
0
        private void btnPrintSpec_Click(object sender, EventArgs e)
        {
            if (rbGaming.Checked)
                currentComputerFactory = new GamingComputerFactory();
            else if (rbBusiness.Checked)
                currentComputerFactory = new BusinessComputerFactory();
            else if (rbMultimedia.Checked)
                currentComputerFactory = new MultimediaComputerFactory();
            else
                currentComputerFactory = new LaptopComputerFactory();

            MachineSpecPrinter currentSpecPrinter = new MachineSpecPrinter(currentComputerFactory, listDisplay);
            currentSpecPrinter.printSpec();
        }
Exemplo n.º 15
0
        private void btnPrintSpec_Click(object sender, EventArgs e)
        {
            if (rbGaming.Checked)
            {
                currentComputerFactory = new GamingComputerFactory();
            }
            else if (rbBusiness.Checked)
            {
                currentComputerFactory = new BusinessComputerFactory();
            }
            else if (rbMultimedia.Checked)
            {
                currentComputerFactory = new MultimediaComputerFactory();
            }
            else
            {
                currentComputerFactory = new LaptopComputerFactory();
            }

            MachineSpecPrinter currentSpecPrinter = new MachineSpecPrinter(currentComputerFactory, listDisplay);

            currentSpecPrinter.printSpec();
        }
Exemplo n.º 16
0
 public LenovoFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }
Exemplo n.º 17
0
 public ComputerClient(IComputerFactory computerFactory, ComputerType type)
 {
     laptop  = computerFactory.GetLaptop(type);
     desktop = computerFactory.GetDesktop(type);
 }
Exemplo n.º 18
0
 public EmployeeSystemManager(IComputerFactory iComputerFactory)
 {
     IComputerFactory = iComputerFactory;
 }
 public DELLFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }
Exemplo n.º 20
0
 public MachineSpecPrinter(IComputerFactory computerMaker, ListBox listBox)
 {
     this.computerMaker = computerMaker;
     this.listBox       = listBox;
 }
Exemplo n.º 21
0
 public EmployeeSystemManager(IComputerFactory computerFactory)
 {
     this.computerFactory = computerFactory;
 }
Exemplo n.º 22
0
        private void CreateComputers(IComputerFactory factory)
        {
            var creator = new ComputerCreator(factory);

            this.Desktop = creator.AssembleDesktop();
            this.Server = creator.AssembleServer();
            this.Laptop = creator.AssembleLaptop();
        }
Exemplo n.º 23
0
 public Hp(IComputerFactory factory, IStringBuilderDrawer drawer)
 {
     this.factory = factory;
     this.drawer = drawer;
 }
Exemplo n.º 24
0
 public MachineSpecPrinter(IComputerFactory computerMaker, ListBox listBox)
 {
     this.computerMaker = computerMaker;
     this.listBox = listBox;
 }
Exemplo n.º 25
0
 public AbstractManufacturerFactory(IComputerFactory compFactory)
 {
     this.ComputerFactory = compFactory;
 }
 public ComputerClient(IComputerFactory computerFactory, string computerType)
 {
     laptop  = computerFactory.GetLaptop(computerType);
     desktop = computerFactory.GetDesktop(computerType);
 }
Exemplo n.º 27
0
 public ComputerCreator(IComputerFactory computerFactory)
 {
     this.computerFactory = computerFactory;
 }
        private static AbstractManufacturerFactory CreateManufacturer(string manufacturerName, IComputerFactory computerFactory)
        {
            AbstractManufacturerFactory manufacturer;

            if (manufacturerName == DELLFactory.DELLFactoryName)
            {
                manufacturer = new DELLFactory(computerFactory);
            }
            else if (manufacturerName == HPFactory.HPFactoryName)
            {
                manufacturer = new HPFactory(computerFactory);
            }
            else
            {
                manufacturer = new LenovoFactory(computerFactory);
            }

            return(manufacturer);
        }
Exemplo n.º 29
0
 public EmployeeSystemManager(IComputerFactory IComputerFactory)
 {
     _IComputerFactory = IComputerFactory;
 }
 public HPFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }