Exemple #1
0
 public void MakeOrder(HardDisc hardDisc, MotherBoard motherBoard, Processor processor, Screen screen)
 {
     builder.BuildHardDisk(storage.SearchHardDisc(hardDisc))
     .BuildMotherBoard(storage.SearchMotherBoard(motherBoard))
     .BuildProcessor(storage.SearchProcessor(processor))
     .BuildScreen(storage.SearchScreen(screen));
 }
        public Computer CreatePC(int cpuType, int coreCount, int ramSize, int hardCount, int hardCapacity)
        {
            IRAM ram = new RAM(ramSize);
            ICPU cpu;

            switch (cpuType)
            {
            case 32:
                cpu = new CPU32(ram, coreCount);
                break;

            case 64:
                cpu = new CPU64(ram, coreCount);
                break;

            case 128:
                cpu = new CPU128(ram, coreCount);
                break;

            default:
                break;
            }
            IVideoCard   videoCard     = new ColorfulVideoCard();
            IMotherboard motherBoard   = new MotherBoard();
            RAID         hardDriveRaid = new RAID();

            for (int i = 0; i < hardCount; i++)
            {
                HardDrive currentHardDrive = new HardDrive(hardCapacity, true);
                hardDriveRaid.AddHardDrive(currentHardDrive);
            }
            Computer pc = new PC(cpu, ram, videoCard, hardDriveRaid, motherBoard);

            return(pc);
        }
Exemple #3
0
        static void Main()
        {
            Components mcardVLC = new MotherBoard("VLC", (decimal)185.98);
            Components vcardRadeon = new GraphicsCard("Radeon", (decimal)102.34, "the best grafic card forever");
            Components vcardGeForce = new GraphicsCard("GeForce", (decimal)154.45, "is not worth");

            Components procIntel = new Processor("Intel", (decimal)346.563, "can be better");
            Components procAMD = new Processor("AMD", (decimal)405.239, "always the best");
            Components procMac = new Processor("IOS", 2000m, "It is okaaaay");

            Computer mac = new Computer("Mac", new List<Components>() { mcardVLC, vcardRadeon, vcardGeForce });
            Computer windows = new Computer("Windows");
            windows.Components.Add(procIntel);
            windows.Components.Add(procAMD);
            windows.Components.Add(procMac);
            //Console.WriteLine(windows);

            Computer linux = new Computer("Linux", new List<Components>() { mcardVLC, vcardGeForce, vcardRadeon, procAMD, procIntel, procMac });

            List<Computer> computers = new List<Computer>() { mac, windows, linux };

            computers.OrderBy(p => p.TotalPrice).ToList().ForEach(p => Console.WriteLine(p.ToString()));


            //or

            //computers.OrderBy(a => a.TotalPrice);

            //foreach (var computer in computers)
            //{
            //    Console.WriteLine(computer);
            //}
        }
Exemple #4
0
        static async Task UpdateGarysWorkingComputer()
        {
            using var db = new MyDbContext();
            var source = new Source
            {
                Name = "Tom"
            };

            db.Sources.Add(source);

            var transaction = new Transaction
            {
                Source  = source,
                SysTime = DateTime.UtcNow,
                User    = "******"
            };

            using var dbTransaction = await db.BeginTransactionAsync(transaction);

            var processor = new Processor {
                Name = "AMD A8-7680 OEM"
            };
            var motherBoard = new MotherBoard {
                Name = "ASRock FM2A68M-HD+"
            };
            var videoCard = new VideoCard {
                Name = "MSI AMD Radeon R7 240 LP [R7 240 2GD3 64bit LP]"
            };
            var ram1 = new RAM {
                Name = "Kingston ValueRAM [KVR16N11S8/4]"
            };
            var ram2 = new RAM {
                Name = "Kingston ValueRAM [KVR16N11S8/4]"
            };
            var soundCard = new SoundCard {
                Name = "ORICO SC2-BK"
            };

            db.Processors.Add(processor);
            db.MotherBoards.Add(motherBoard);
            db.VideoCards.Add(videoCard);
            db.RAMs.Add(ram1);
            db.RAMs.Add(ram2);
            db.SoundCards.Add(soundCard);
            await db.SaveChangesAsync();

            var workComputer = (await db.Users.Include(a => a.WorkComputer).FirstAsync(a => a.Name == GaryName)).WorkComputer;

            workComputer.Processor   = processor;
            workComputer.MotherBoard = motherBoard;
            workComputer.VideoCard   = videoCard;
            workComputer.RAM1        = ram1;
            workComputer.RAM2        = ram2;
            workComputer.SoundCard   = soundCard;

            await db.SaveChangesAsync();

            dbTransaction.Commit();
        }
Exemple #5
0
 public Laptop(CPU cpu, GPU gpu, Monitor monitor, MotherBoard motherBoard, RAM ram)
 {
     CPU         = cpu;
     GPU         = gpu;
     Monitor     = monitor;
     MotherBoard = motherBoard;
     RAM         = ram;
 }
        /// <summary>
        /// El método estático getTotalPrice suma todos los precios de los productos
        /// </summary>
        /// <param name="cpu">Objeto CPU del pedido</param>
        /// <param name="gpu">Objeto GPU del pedido</param>
        /// <param name="motherBoard">Objeto MotherBoard del pedido</param>
        /// <param name="pcBox">Objeto cpu del PcBox</param>
        /// <param name="ram">Objeto Ram del pedido</param>
        /// <returns>Retorna el precio total del pedido</returns>
        public static double GetTotalPrice(CPU cpu, GPU gpu, MotherBoard motherBoard, PcBox pcBox, Ram ram)
        {
            double price;

            price = cpu.Price + gpu.Price + motherBoard.Price + pcBox.Price + ram.Price;

            return(price);
        }
Exemple #7
0
 internal override Server ProduceServer()
 {
     var motherBoardHPServer = new MotherBoard(new Cpu(4, 32), new RamMemory(32), new VideoCard());
     var raidofHD = new RaidOfHD();
     raidofHD.AddHD(new HardDriver(1000));
     raidofHD.AddHD(new HardDriver(1000));
     return new Server(motherBoardHPServer, raidofHD);
 }
Exemple #8
0
        public bool EsCompatible(MotherBoard mother)
        {
            string info = mother.getConector();

            string[] mother_conector = info.Split("/");

            return(mother_conector[0] == conector);
        }
Exemple #9
0
 private void GetMbInfos()
 {
     searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
     foreach (var item in searcher.Get())
     {
         mb = new MotherBoard(item["Manufacturer"].ToString(), item["Product"].ToString());
     }
     searcher = null;
 }
Exemple #10
0
 public Laptop(CPU cpu, GPU gpu, string manufacturer, string model, Monitor monitor, MotherBoard motherBoard, RAM ram)
 {
     CPU          = cpu;
     GPU          = gpu;
     Manufacturer = manufacturer;
     Model        = model;
     Monitor      = monitor;
     MotherBoard  = motherBoard;
     RAM          = ram;
 }
 public OperationDetails CreateMotherBoard(MotherBoard motherBoard)
 {
     Database.MotherBoards.Create(motherBoard);
     SetOuterMemoryInterfaces(motherBoard, (List <MotherBoardOuterMemorySlot>)motherBoard.MotherBoardOuterMemorySlots);
     SetVideoCardInterfaces(motherBoard, (List <MotherBoardVideoCardSlot>)motherBoard.MotherBoardVideoCardSlots);
     SetPowerSupplyInterfaces(motherBoard, (List <MotherBoardPowerSupplySlot>)motherBoard.PowerSupplyMotherBoardSlots);
     SetRAMSlots(motherBoard, (List <MotherBoardRAMSlot>)motherBoard.MotherBoardRAMSlots);
     Database.Save();
     return(new OperationDetails(true, "Ok", ""));
 }
Exemple #12
0
        public override ILaptop CreateLaptop()
        {
            var cpu         = new Cpu64Bit(2);
            var harddrives  = new[] { new HardDrive(500, false, 0) };
            var ram         = new Ram(4);
            var motherboard = new MotherBoard(cpu, ram, harddrives, this.colorfullVideoCard);

            this.laptop = new Laptop(motherboard, this.battery);
            return(this.laptop);
        }
Exemple #13
0
        public override IComputer CreateComputer()
        {
            this.ram        = new Ram(8);
            this.cpu        = new Cpu64Bit(4);
            this.hardDrives = new[] { new HardDrive(1000, false, 0) };
            var motherboard = new MotherBoard(this.cpu, this.ram, this.hardDrives, this.colorfullVideoCard);

            this.pc = new Computer(motherboard);
            return(this.pc);
        }
Exemple #14
0
        public override IComputer CreateComputer()
        {
            var ram         = new Ram(4);
            var cpu         = new Cpu64Bit(4);
            var hardrives   = new[] { new HardDrive(2000, false, 0) };
            var motherboard = new MotherBoard(cpu, ram, hardrives, this.monoChromeVideoCard);

            this.pc = new Computer(motherboard);
            return(this.pc);
        }
Exemple #15
0
        public override IComputer CreateComputer()
        {
            var cpu         = new Cpu32Bit(2);
            var harddrives  = new[] { new HardDrive(500, false, 0) };
            var ram         = new Ram(2);
            var motherboard = new MotherBoard(cpu, ram, harddrives, this.colorfullVideoCard);

            this.pc = new Computer(motherboard);
            return(this.pc);
        }
Exemple #16
0
        static void CallFacade()
        {
            CPU         cpu         = new CPU("Core i5 CPU");
            MotherBoard motherBoard = new MotherBoard("ASUS ROG");
            SSD         ssd         = new SSD("Kingston SSD");

            Facade facade = new Facade(cpu, ssd, motherBoard);

            facade.StartPC();
            facade.ShutDownPC();
        }
        public Computer()
        {
            Board = new MotherBoard();
            Board.Brand = "Dell";
            Board.HasLanPort = 2;
            Board.USBPortsCount = 3;


            GPU = new GraphicsCard();
            GPU.AmountOfRam = 4;
            GPU.GpuFrequency = 1.1;
        }
Exemple #18
0
        public override ILaptop CreateLaptop()
        {
            this.ram        = new Ram(8);
            this.cpu        = new Cpu32Bit(4);
            this.hardDrives = new[] { new HardDrive(1000, false, 0) };

            var motherboard = new MotherBoard(this.cpu, this.ram, this.hardDrives, this.colorfullVideoCard);

            this.laptop = new Laptop(motherboard, new LaptopBattery());

            return(this.laptop);
        }
        public Computer()
        {
            Board               = new MotherBoard();
            Board.Brand         = "Dell";
            Board.HasLanPort    = 2;
            Board.USBPortsCount = 3;


            GPU              = new GraphicsCard();
            GPU.AmountOfRam  = 4;
            GPU.GpuFrequency = 1.1;
        }
        public async Task <Guid> Upsert(MotherBoard model)
        {
            model.Brand     = _appContext.Brands.Find(model.Brand.Id);
            model.CpuSocket = _appContext.CpuSockets.Find(model.CpuSocket.Id);
            model.Format    = _appContext.Formats.Find(model.Format.Id);
            model.RamType   = _appContext.RamTypes.Find(model.RamType.Id);

            _appContext.MotherBoards.Update(model);
            await _appContext.SaveChangesAsync();

            return(model.Id.Value);
        }
Exemple #21
0
 //инициализация всех компонентов(декораторов)
 public Facade(PC pc, VideoCard videoCard, Processor processor, MotherBoard motherBoard, ChargeBlock chargeBlock)
 {
     this.pc      = pc;
     _videoCard   = videoCard;
     _processor   = processor;
     _motherBoard = motherBoard;
     _chargeBlock = chargeBlock;
     //добавление каждого декоратора в лист
     decorators.Add(videoCard);
     decorators.Add(processor);
     decorators.Add(motherBoard);
     decorators.Add(chargeBlock);
 }
        public IActionResult Get(string id)
        {
            MotherBoard motherBoard = _motherBoardService.GetMotherBoardById(id);

            if (motherBoard != null)
            {
                return(Ok(motherBoard));
            }
            else
            {
                return(NotFound());
            }
        }
 public OperationDetails UpdateMotherBoard(MotherBoard motherBoard)
 {
     Database.MotherBoards.Update(motherBoard);
     SetOuterMemoryInterfaces(motherBoard, (List <MotherBoardOuterMemorySlot>)motherBoard.MotherBoardOuterMemorySlots);
     SetVideoCardInterfaces(motherBoard, (List <MotherBoardVideoCardSlot>)motherBoard.MotherBoardVideoCardSlots);
     SetPowerSupplyInterfaces(motherBoard, (List <MotherBoardPowerSupplySlot>)motherBoard.PowerSupplyMotherBoardSlots);
     SetRAMSlots(motherBoard, (List <MotherBoardRAMSlot>)motherBoard.MotherBoardRAMSlots);
     Database.Save();
     motherBoard = GetMotherBoard(motherBoard.Id);
     _computerAssemblyService.OnMotherBoardChange(motherBoard);
     Database.Save();
     return(new OperationDetails(true, "Ok", ""));
 }
Exemple #24
0
        /// <summary>
        /// El método acceptData creará una lista de productos
        /// y asignará esa lista a la lista para poder visualizar
        /// el detalle del pedido
        /// </summary>
        /// <remarks>
        /// Usando una observable collection, vamos a ir rellenando los datos
        /// Por otra parte, vamos a asignar a la variable order el Pedido.
        /// </remarks>
        /// <returns></returns>
        private async Task AcceptData()
        {
            //creamos una lista de objetos y la asignamos
            ObservableCollection <Producto> productList = new ObservableCollection <Producto>();

            //obtenemos todos los datos de los productos
            if (pickerCpu.SelectedItem != null && pickerGpu.SelectedItem != null && pickerMotherBoard.SelectedItem != null &&
                pickerPcBox.SelectedItem != null && pickerRam.SelectedItem != null)
            {
                CPU         cpu   = (CPU)pickerCpu.SelectedItem;
                GPU         gpu   = (GPU)pickerGpu.SelectedItem;
                MotherBoard board = (MotherBoard)pickerMotherBoard.SelectedItem;
                PcBox       box   = (PcBox)pickerPcBox.SelectedItem;
                Ram         ram   = (Ram)pickerRam.SelectedItem;

                double total;

                //creamos los productos
                productList.Add(new Producto {
                    ProductName = cpu.Name, Price = cpu.Price
                });
                productList.Add(new Producto {
                    ProductName = gpu.Name, Price = gpu.Price
                });
                productList.Add(new Producto {
                    ProductName = board.Name, Price = board.Price
                });
                productList.Add(new Producto {
                    ProductName = box.Name, Price = box.Price
                });
                productList.Add(new Producto {
                    ProductName = ram.Name, Price = ram.Price
                });

                //pasamos la lista al listView
                lstPedidos.ItemsSource = productList;
                //calculamos el total
                total         = OperationUtils.GetTotalPrice(cpu, gpu, board, box, ram);
                lblTotal.Text = total.ToString();
                order         = new Pedido
                {
                    IdCase        = box.IdCase,
                    IdCpu         = cpu.IdCpu,
                    IdGpu         = gpu.IdGpu,
                    IdMotherBoard = board.IdMotherBoard,
                    IdRam         = ram.IdRam,
                    IdUser        = user.IdUser,
                    Price         = total
                };
            }
        }
Exemple #25
0
 public DesktopPC(Case pcCase, Cooler cooler, CPU cpu, GPU gpu, HDD hdd, Keyboard keyboard, Monitor monitor, MotherBoard motherBoard, Mouse mouse, PSU psu, RAM ram)
 {
     Case        = pcCase;
     Cooler      = cooler;
     CPU         = cpu;
     GPU         = gpu;
     HDD         = hdd;
     Keyboard    = keyboard;
     Monitor     = monitor;
     MotherBoard = motherBoard;
     Mouse       = mouse;
     PSU         = psu;
     RAM         = ram;
 }
Exemple #26
0
        public override IServer CreateServer()
        {
            var ram       = new Ram(64);
            var cpu       = new Cpu128Bit(2);
            var hardrives = new List <IHardDrive> {
                new HardDrive(0, true, 2, new List <IHardDrive> {
                    new HardDrive(500, false, 0), new HardDrive(500, false, 0)
                })
            };
            var motherboard = new MotherBoard(cpu, ram, hardrives, this.monoChromeVideoCard);

            this.server = new Server(motherboard);
            return(this.server);
        }
Exemple #27
0
        public static Computer GenerateComputer()
        {
            var memory = new Memory
            {
                Capacity      = 300,
                Type          = RamType.DDR3,
                Ghz           = 5000004,
                BankLabel     = "BANKA",
                DeviceLocator = "UNKNOWN",
                Generation    = 4
            };
            var disk = new Disk
            {
                Type     = DiskType.HDD,
                Rpm      = 5000,
                Capacity = 1000000,
                Model    = "Samsung Eva"
            };
            var processor = new Processor
            {
                Name         = "Intel core i6",
                GHz          = 500045546,
                NumOfCores   = 4,
                Architecture = Architecture.X64,
                Manufacturer = "Intel"
            };
            var motherBoard = new MotherBoard
            {
                DdrSockets      = 2,
                MaxRam          = 400000,
                SataConnections = 2,
                Architecture    = Architecture.X64,
                Manufacturer    = "IBM",
                Product         = "BLA"
            };
            var gpu = GenerateGpu();

            var computer = new Computer
            {
                ComputerType = ComputerType.LAPTOP,
                Memories     = new[] { memory },
                Disks        = new[] { disk },
                Processor    = processor,
                MotherBoard  = motherBoard,
                Gpus         = new[] { gpu }
            };

            return(computer);
        }
Exemple #28
0
        public bool DeleteMotherBoardById(string id)
        {
            MotherBoard motherBoard = _unitOfWork.MotherBoards.Get(id);

            if (motherBoard == null)
            {
                return(false);
            }
            else
            {
                _unitOfWork.MotherBoards.Remove(motherBoard);
                _unitOfWork.SaveChanges();
                return(true);
            }
        }
Exemple #29
0
        public override IServer CreateServer()
        {
            this.ram        = new Ram(64);
            this.cpu        = new Cpu64Bit(8);
            this.hardDrives = new List <IHardDrive> {
                new HardDrive(0, true, 2, new List <IHardDrive> {
                    new HardDrive(2000, false, 0), new HardDrive(2000, false, 0)
                })
            };

            var motherboard = new MotherBoard(this.cpu, this.ram, this.hardDrives, this.monochromeVideoCard);

            this.server = new Server(motherboard);
            return(this.server);
        }
Exemple #30
0
        public void UpdateMotherBoard(string computerLogin, MotherBoardDTO motherBoard)
        {
            MotherBoard oldMotherBoard = _unitOfWork.MotherBoards
                                         .GetMotherBoardByComputerLogin(computerLogin);

            if (oldMotherBoard != null)
            {
                _unitOfWork.MotherBoards.Remove(oldMotherBoard);
            }
            MotherBoard newMotherBoard = _mapper.Map <MotherBoardDTO, MotherBoard>(motherBoard);

            newMotherBoard.ComputerId = _unitOfWork.Computers.GetIdByLogin(computerLogin);
            _unitOfWork.MotherBoards.Add(newMotherBoard);
            _unitOfWork.SaveChanges();
        }
Exemple #31
0
        public void ShowComputerSpecs()
        {
            StringBuilder manufAndModel = new StringBuilder();

            manufAndModel.Append(Manufacturer);
            manufAndModel.Append(" ");
            manufAndModel.Append(Model);
            manufAndModel.Append(" Specs:");
            Console.WriteLine(manufAndModel);
            CPU.ToString();
            GPU.ToString();
            HDD.ToString();
            Monitor.ToString();
            MotherBoard.ToString();
            RAM.ToString();
        }
Exemple #32
0
        /// <summary>
        /// Método que obtiene la placa base en función del ID
        /// </summary>
        /// <remarks>
        /// Creamos una sentencia SQL con el código de SQLite en la cual obtendremos
        /// la placa base en función de su id
        /// </remarks>
        /// <returns>Retorna la placa base consultada</returns>
        public async Task <MotherBoard> GetMotherBoardId(int id)
        {
            MotherBoard u = null;

            try
            {
                var motherBoard = from p in conn.Table <MotherBoard>()
                                  where p.IdMotherBoard == id
                                  select p;
                u = await motherBoard.FirstAsync();
            }
            catch (Exception ex)
            {
                StatusMessage = string.Format("Failed to retrieve data. {0}", ex.Message);
            }
            return(u);
        }
        private OperationDetails SetOuterMemoryInterfaces(MotherBoard motherBoard, List <MotherBoardOuterMemorySlot> outerMemories)
        {
            if (motherBoard.Id > -1 && outerMemories != null)
            {
                var oldOuterMemory = Database.MotherBoardOuterMemorySlots.GetAll().Where(m => m.MotherBoardId == motherBoard.Id);
                foreach (var item in oldOuterMemory)
                {
                    Database.MotherBoardOuterMemorySlots.Delete(item.Id);
                }
                foreach (var item in outerMemories)
                {
                    item.MotherBoardId = motherBoard.Id;
                    this.Database.MotherBoardOuterMemorySlots.Create(item);
                }
            }

            return(new OperationDetails(true, "Ok", ""));
        }
Exemple #34
0
 public Command(MotherBoard motherboard)
 {
     this.motherboard = motherboard;
 }
 public ChargeCommand(MotherBoard motherboard)
     : base(motherboard)
 {
 }
 public Computer(MotherBoard motherBoard, IHardDrive hardDrives)
 {
     this.MotherBoard = motherBoard;
     this.HardDrives = hardDrives;
 }
 public ExitCommand(MotherBoard motherboard)
     : base(motherboard)
 {
 }
 public ProcessCommand(MotherBoard motherboard)
     : base(motherboard)
 {
 }
Exemple #39
0
 internal override PersonalComputer ProducePC()
 {
     var motherBoardHPPC = new MotherBoard(new Cpu(2, 32), new RamMemory(2), new VideoCard());
     return new PersonalComputer(motherBoardHPPC, new HardDriver(500));
 }
Exemple #40
0
 internal override Laptop ProduceLaptop()
 {
     var motherBoardHPLaptop = new MotherBoard(new Cpu(2, 64), new RamMemory(4), new VideoCard());
     return new Laptop(motherBoardHPLaptop, new HardDriver(500), new Battery());
 }
 public PlayCommand(MotherBoard motherboard)
     : base(motherboard)
 {
 }
 public Laptop(MotherBoard motherBoard, IHardDrive hardDrives, Battery battery)
     : base(motherBoard, hardDrives)
 {
     this.Battery = battery;
 }
 public PersonalComputer(MotherBoard motherBoard, IHardDrive hardDrives)
     : base(motherBoard, hardDrives)
 {
 }