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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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();
 }
예제 #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);
        }
예제 #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));
        }
예제 #10
0
        public void ClientMethod(IComputerFactory factory)
        {
            IMainboard mainboard = factory.CreateMainboard();
            IProcessor processor = factory.CreateProcessor();

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

            Console.WriteLine(processor.ShowProcessor());
            Console.WriteLine(processor.ShowProcessorStation(mainboard));
        }
예제 #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!");
                }
            }
        }
예제 #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));
        }
예제 #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();
        }
예제 #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();
        }
예제 #16
0
 public LenovoFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }
예제 #17
0
 public ComputerClient(IComputerFactory computerFactory, ComputerType type)
 {
     laptop  = computerFactory.GetLaptop(type);
     desktop = computerFactory.GetDesktop(type);
 }
예제 #18
0
 public EmployeeSystemManager(IComputerFactory iComputerFactory)
 {
     IComputerFactory = iComputerFactory;
 }
 public DELLFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }
예제 #20
0
 public MachineSpecPrinter(IComputerFactory computerMaker, ListBox listBox)
 {
     this.computerMaker = computerMaker;
     this.listBox       = listBox;
 }
예제 #21
0
 public EmployeeSystemManager(IComputerFactory computerFactory)
 {
     this.computerFactory = computerFactory;
 }
예제 #22
0
파일: Engine.cs 프로젝트: didimitrov/Algo
        private void CreateComputers(IComputerFactory factory)
        {
            var creator = new ComputerCreator(factory);

            this.Desktop = creator.AssembleDesktop();
            this.Server = creator.AssembleServer();
            this.Laptop = creator.AssembleLaptop();
        }
예제 #23
0
 public Hp(IComputerFactory factory, IStringBuilderDrawer drawer)
 {
     this.factory = factory;
     this.drawer = drawer;
 }
예제 #24
0
 public MachineSpecPrinter(IComputerFactory computerMaker, ListBox listBox)
 {
     this.computerMaker = computerMaker;
     this.listBox = listBox;
 }
예제 #25
0
 public AbstractManufacturerFactory(IComputerFactory compFactory)
 {
     this.ComputerFactory = compFactory;
 }
 public ComputerClient(IComputerFactory computerFactory, string computerType)
 {
     laptop  = computerFactory.GetLaptop(computerType);
     desktop = computerFactory.GetDesktop(computerType);
 }
예제 #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);
        }
예제 #29
0
 public EmployeeSystemManager(IComputerFactory IComputerFactory)
 {
     _IComputerFactory = IComputerFactory;
 }
 public HPFactory(IComputerFactory compFactory) : base(compFactory)
 {
 }