コード例 #1
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);
        }
コード例 #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);
        }
コード例 #6
0
 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);
        }
コード例 #9
0
        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
ファイル: Program.cs プロジェクト: Rustam-carlos/DP_HW_2.2
        public void ClientMethod(IComputerFactory factory)
        {
            IMainboard mainboard = factory.CreateMainboard();
            IProcessor processor = factory.CreateProcessor();

            Console.WriteLine(processor.ShowProcessor());
            Console.WriteLine(processor.ShowProcessorStation(mainboard));
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: Plugarov/Telerik-Repo
        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
ファイル: Form1.cs プロジェクト: sleemjm1/IN710-sleemjm1
        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
ファイル: Form1.cs プロジェクト: sleemjm1/IN710-sleemjm1
        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
ファイル: Hp.cs プロジェクト: kalinalazarova1/TelerikAcademy
 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;
 }
コード例 #26
0
 public ComputerClient(IComputerFactory computerFactory, string computerType)
 {
     laptop  = computerFactory.GetLaptop(computerType);
     desktop = computerFactory.GetDesktop(computerType);
 }
コード例 #27
0
ファイル: ComputerCreator.cs プロジェクト: didimitrov/Algo
 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)
 {
 }