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); }
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); }
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); }
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(); }
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); }
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)); }
public void ClientMethod(IComputerFactory factory) { IMainboard mainboard = factory.CreateMainboard(); IProcessor processor = factory.CreateProcessor(); Console.WriteLine(processor.ShowBatteryVolume()); Console.WriteLine(processor.ShowBatteryChargeLevel(mainboard)); }
public void ClientMethod(IComputerFactory factory) { IMainboard mainboard = factory.CreateMainboard(); IProcessor processor = factory.CreateProcessor(); Console.WriteLine(processor.ShowProcessor()); Console.WriteLine(processor.ShowProcessorStation(mainboard)); }
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!"); } } }
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)); }
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(); }
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(); }
public LenovoFactory(IComputerFactory compFactory) : base(compFactory) { }
public ComputerClient(IComputerFactory computerFactory, ComputerType type) { laptop = computerFactory.GetLaptop(type); desktop = computerFactory.GetDesktop(type); }
public EmployeeSystemManager(IComputerFactory iComputerFactory) { IComputerFactory = iComputerFactory; }
public DELLFactory(IComputerFactory compFactory) : base(compFactory) { }
public MachineSpecPrinter(IComputerFactory computerMaker, ListBox listBox) { this.computerMaker = computerMaker; this.listBox = listBox; }
public EmployeeSystemManager(IComputerFactory computerFactory) { this.computerFactory = computerFactory; }
private void CreateComputers(IComputerFactory factory) { var creator = new ComputerCreator(factory); this.Desktop = creator.AssembleDesktop(); this.Server = creator.AssembleServer(); this.Laptop = creator.AssembleLaptop(); }
public Hp(IComputerFactory factory, IStringBuilderDrawer drawer) { this.factory = factory; this.drawer = drawer; }
public AbstractManufacturerFactory(IComputerFactory compFactory) { this.ComputerFactory = compFactory; }
public ComputerClient(IComputerFactory computerFactory, string computerType) { laptop = computerFactory.GetLaptop(computerType); desktop = computerFactory.GetDesktop(computerType); }
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); }
public EmployeeSystemManager(IComputerFactory IComputerFactory) { _IComputerFactory = IComputerFactory; }
public HPFactory(IComputerFactory compFactory) : base(compFactory) { }