Exemplo n.º 1
0
 internal Computer(Cpu cpu, IRam ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = videoCard;
     this.motherboard = new Motherboard(this.Cpu, this.Ram, this.VideoCard);
 }
        private static void InitializeComputers()
        {
            var manufacturer = Console.ReadLine();

            if (manufacturer == "HP")
            {
                // pc
                var ram = new RamMemory(2);
                var videoCard = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL);
                var motherboard = new Motherboard(videoCard, ram);
                var cpu = new Cpuu.Cpu(2, CpuType.BIT32, motherboard);

                pc = new PC(cpu, motherboard, new HardDriver(500, false, 0));

                var serverRam = new RamMemory(32);
                var serverVideo = VideoCardFactory.CrateVideoCard(VideoCardType.MONOCHROME);
                var serverMBoard = new Motherboard(serverVideo, serverRam);
                var serverCpu = new Cpu(4, CpuType.BIT32, serverMBoard);

                server = new Server(serverCpu, serverMBoard, new[] { new HardDriver(1000, true, 2) });

                var ramLaptop = new RamMemory(4);
                var videoCardLaptop = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL);
                var motherboardLaptop = new Motherboard(videoCardLaptop, ram);
                var cpuLaptop = new Cpuu.Cpu(2, CpuType.BIT64, motherboard);

                laptop = new Laptop(cpu, motherboard, new HardDriver(500, false, 0), new ComputerBuildingSystem.Computerr.LaptopBattery());
            }
            else if (manufacturer == "Dell")
            {
                // pc
                var ram = new RamMemory(8);
                var videoCard = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL);
                var motherboard = new Motherboard(videoCard, ram);
                var cpu = new Cpuu.Cpu(2, CpuType.BIT64, motherboard);

                pc = new PC(cpu, motherboard, new HardDriver(1000, false, 0));

                var serverRam = new RamMemory(64);
                var serverVideo = VideoCardFactory.CrateVideoCard(VideoCardType.MONOCHROME);
                var serverMBoard = new Motherboard(serverVideo, serverRam);
                var serverCpu = new Cpu(8, CpuType.BIT64, serverMBoard);

                server = new Server(serverCpu, serverMBoard, new[] { new HardDriver(2000, true, 2) });

                var ramLaptop = new RamMemory(8);
                var videoCardLaptop = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL);
                var motherboardLaptop = new Motherboard(videoCardLaptop, ram);
                var cpuLaptop = new Cpuu.Cpu(2, CpuType.BIT32, motherboard);

                laptop = new Laptop(cpu, motherboard, new HardDriver(1000, false, 0), new ComputerBuildingSystem.Computerr.LaptopBattery());
            }
            else
            {
                throw new InvalidArgumentException("Invalid manufacturer!");
            }
        }
Exemplo n.º 3
0
 public override Server MakeServer()
 {
     var cpu = new CPU(2, 128);
     var ram = new RAM(8);
     var hardDrives = new List<HardDrive>() { new HardDrive(500, true, 2), new HardDrive(500, true, 2) };
     var videoCard = new VideoCard(true);
     var motherboard = new Motherboard();
     var server = new Server(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, null, motherboard);
     return server;
 }
Exemplo n.º 4
0
 public override PC MakePC()
 {
     var cpu = new CPU(2, 64);
     var ram = new RAM(4);
     var hardDrives = new List<HardDrive>() { new HardDrive(2000, false, 0) };
     var videoCard = new VideoCard(true);
     var motherboard = new Motherboard();
     var pc = new PC(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, null, motherboard);
     return pc;
 }
Exemplo n.º 5
0
        public override PersonalComputer CreatePC()
        {
            var ram = new Ram((int)RamType.GB4);
            var videoCard = new VideoCard();
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard);
            var hardDrive = new HardDrive(2000);
            var pc = new PersonalComputer(motherBoard, cpu, hardDrive);

            return pc;
        }
Exemplo n.º 6
0
 public override Laptop MakeLaptop()
 {
     var cpu = new CPU(2, 64);
     var ram = new RAM(16);
     var hardDrives = new List<HardDrive>() { new HardDrive(1000, false, 0) };
     var videoCard = new VideoCard(false);
     var motherboard = new Motherboard();
     var battery = new Battery();
     var laptop = new Laptop(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, battery, motherboard);
     return laptop;
 }
Exemplo n.º 7
0
        public override IPersonalComputer MakePersonalComputer()
        {
            var ram = new Ram(2);
            var videoCard = new ColorVideoCard();
            var hardDrive = new[] { new HardDrive(500, false, 0) };
            IMotherboard motherboard = new Motherboard(ram, videoCard);
            Cpu cpu = new Cpu32Bit(2, motherboard, this.Random);

            var result = new PersonalComputer(motherboard, cpu, ram, hardDrive, videoCard);
            return result;
        }
Exemplo n.º 8
0
        public override Laptop CreateLaptop()
        {
            var ram = new Ram((int)RamType.GB16);
            var videoCard = new VideoCard(false);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard);
            var hardDrive = new HardDrive(1000);
            var laptopBattery = new LaptopBattery();
            var laptop = new Laptop(motherBoard, cpu, hardDrive, laptopBattery);

            return laptop;
        }
Exemplo n.º 9
0
 public override ILaptopComputer MakeLaptopComputer()
 {
     IVideoCard videoCard = new ColorVideoCard();
     Ram ram = new Ram(4);
     IMotherboard motherboard = new Motherboard(ram, videoCard);
     Cpu cpu = new Cpu64Bit(2, motherboard, this.Random);
     var hardDrive = new[]
     {
         new HardDrive(500, false, 0)
     };
     Battery.LaptopBattery battery = new Battery.LaptopBattery();
     ILaptopComputer laptop = new LaptopComputer(motherboard, cpu, ram, hardDrive, videoCard, battery);
     return laptop;
 }
Exemplo n.º 10
0
 void buyPart(Motherboard part)
 {
     if (part.price < funds)
     {
         mobo = part;
         funds -= part.price;
         print("Part purchased! Remaining Funds: " + funds);
         storeFront.Remove(part);
     }
     else
     {
         print("You must construct additional cash piles!");
     }
 }
Exemplo n.º 11
0
        public override IServerComputer MakeSeverComputer()
        {
            Ram serverRam = new Ram(8);
            IVideoCard serverVideo = new MonochromeVideoCard();
            IMotherboard motherboard = new Motherboard(serverRam, serverVideo);
            var hardDrive = new List<HardDrive>
            {
                new HardDrive(500, false, 0),
                new HardDrive(500, false, 0)
            };
            Cpu cpu = new Cpu128Bit(2, motherboard, this.Random);

            IServerComputer server = new ServerComputer(motherboard, cpu, serverRam, hardDrive, serverVideo);
            return server;
        }
Exemplo n.º 12
0
        public override Server CreateServer()
        {
            var ram = new Ram((int)RamType.GB8);
            var videoCard = new VideoCard();
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits128, motherBoard);
            var hardDriveOne = new HardDrive(500);
            var hardDriveTwo = new HardDrive(500);
            var raid = new Raid(500);
            raid.Add(hardDriveOne);
            raid.Add(hardDriveTwo);
            var server = new Server(motherBoard, cpu, raid);

            return server;
        }
Exemplo n.º 13
0
 public Reporting()
 {
     os = new OperatingSystem();
     cpu = new CPU();
     gfx = new GFX();
     hardDrive = new HardDrive();
     programs = new InstalledPrograms();
     mb = new Motherboard();
     pageFile = new PageFile();
     processes = new ProcessList();
     memory = new RAM();
     services = new ServiceList();
     startupItems = new StartupItems();
     hd = new HardDrive();
     report = "";
 }
Exemplo n.º 14
0
        public override PersonalComputer MakePersonalComputer()
        {
            var ram = new RandomAcessMemory(PersonalComputerRam);
            var videoCard = new VideoCard(PersonalComputerMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new CentralProcessingUnit(PersonalComputerNumberOfCores, PersonalComputerBits, motherBoard);
            var hardDrive = new HardDriver(PersonalComputerHardDriveCapacity, false, 0);

            var dellPersonalComputer = new PersonalComputer(
                cpu,
                ram,
                new List<HardDriver> { hardDrive },
                videoCard,
                motherBoard);
            return dellPersonalComputer;
        }
Exemplo n.º 15
0
        public void TestMethod1()
        {
            var computer = new Computer(); // composite
                var motherboard = new Motherboard(125); // composite
                    var cpu = new Cpu(250); // leaf
                    var ram = new Ram(160); // leaf
                var drive = new Ssd(250); // leaf

            motherboard.Add(cpu);
            motherboard.Add(ram);

            computer.Add(motherboard);
            computer.Add(drive);

            Assert.AreEqual(computer.Price, 785);
        }
Exemplo n.º 16
0
        public override Server MakeServer()
        {
            // TODO:make raid
            var ram = new RandomAcessMemory(ServerRam);
            var videoCard = new VideoCard(ServerMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new CentralProcessingUnit(ServerNumberOfCores, ServerBits, motherBoard);
            var hardDrive = new HardDriver(ServerHardDriveCapacity, false, 0);

            var dellServer = new Server(
                cpu,
                ram,
                new List<HardDriver> { hardDrive },
                videoCard,
                motherBoard);
            return dellServer;
        }
Exemplo n.º 17
0
        public override Laptop MakeLaptop()
        {
            var ram = new RandomAcessMemory(LaptopRam);
            var videoCard = new VideoCard(LaptopMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new CentralProcessingUnit(LaptopNumberOfCores, LaptopBits, motherBoard);
            var hardDrive = new HardDriver(LaptopHardDriveCapacity, false, 0);
            var battery = new LaptopBattery();

            var dellLaptop = new Laptop(
                cpu,
                ram,
                new List<HardDriver> { hardDrive },
                videoCard,
                motherBoard,
                battery);
            return dellLaptop;
        }
Exemplo n.º 18
0
        public static void SaveMotherboardToDB(string partid)
        {
            JObject  chosenpart = GetPartData(partid);
            Entities ORM        = new Entities();

            Motherboard tempObj = new Motherboard(chosenpart["title"].ToString());

            List <Motherboard> z = new List <Motherboard>();

            z = ORM.Motherboards.Where(x => x.ProductID == partid).ToList();

            if (z.Count < 1)
            {
                tempObj.ProductID    = chosenpart["product_id"].ToString();
                tempObj.Description  = "x"; //chosenpart["product_description"].ToString();
                tempObj.Brand        = chosenpart["brand"].ToString();
                tempObj.Price        = int.Parse(chosenpart["price"].ToString());
                tempObj.Stars        = float.Parse(chosenpart["stars"].ToString());
                tempObj.ImageLink    = chosenpart["main_image"].ToString();
                tempObj.Manufacturer = "x";
                tempObj.Wattage      = null;
                tempObj.Socket       = GetSocketType(ParseToArray(chosenpart["feature_bullets"]));
                tempObj.SLILimit     = null; // (ParseToArray(chosenpart["feature_bullets"]));
                try
                {
                    tempObj.SATASlots = GetSATA_Slots(ParseToArray(chosenpart["feature_bullets"]));
                }
                catch
                {
                    tempObj.SATASlots = null;
                }
                tempObj.RAMType        = GetRAMType(ParseToArray(chosenpart["feature_bullets"]));
                tempObj.RAMSlots       = GetRAMSlots(ParseToArray(chosenpart["feature_bullets"]));
                tempObj.PCISlots       = GetPCI_Slots(ParseToArray(chosenpart["feature_bullets"]));
                tempObj.FormFactor     = GetFormFactor(ParseToArray(chosenpart["feature_bullets"]));
                tempObj.CrossfireLimit = null; // (ParseToArray(chosenpart["feature_bullets"]));
                tempObj.Chipset        = GetChipset(ParseToArray(chosenpart["feature_bullets"]));

                ORM.Motherboards.Add(tempObj);
                ORM.SaveChanges();
            }
        }
Exemplo n.º 19
0
        public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation)
        {
            CheckThatComputerWithThisIdExist(computerId);

            var findComputer = this.computers.FirstOrDefault(c => c.Id == computerId);

            if (this.components.Any(c => c.Id == id))
            {
                throw new ArgumentException($"Component with this id already exists.");
            }

            IComponent component = null;

            switch (componentType)
            {
                case "CentralProcessingUnit":
                    component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                case "Motherboard":
                    component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                case "PowerSupply":
                    component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                case "RandomAccessMemory":
                    component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                case "SolidStateDrive":
                    component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                case "VideoCard":
                    component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation);
                    break;
                default:
                    throw new ArgumentException($"Component type is invalid.");
            }

            this.components.Add(component);
            findComputer.AddComponent(component);

            return $"Component {componentType} with id {id} added successfully in computer with id {computerId}.";
        }
Exemplo n.º 20
0
        public async Task <IActionResult> Put([FromBody] Motherboard model)
        {
            try
            {
                if (model != null)
                {
                    model.ModifiedDate = DateTime.UtcNow;

                    await this._repository.Update(model);

                    return(this.StatusCode(StatusCodes.Status201Created, model));
                }

                return(this.StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
Exemplo n.º 21
0
        public IActionResult Edit(int id, [Bind("MotherboardId,Model,Manufacturer,Price,CpuSocket")] Motherboard motherboard)
        {
            if (id != motherboard.MotherboardId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var image = Request.Form.Files.GetFile("image");
                if (image != null)
                {
                    _driveService.DeleteFile(Request.Form["ImgUrl"]);
                    motherboard.ImgUrl = _driveService.UploadFile(image);
                }
                _service.Update(motherboard);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(motherboard));
        }
Exemplo n.º 22
0
        public List <Motherboard> GetMotherboardList()
        {
            List <Motherboard> motherboardList = new List <Motherboard>();

            using ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");

            foreach (ManagementObject mo in mos.Get())
            {
                Motherboard motherboard = new Motherboard
                {
                    Manufacturer = GetPropertyString(mo["Manufacturer"]),
                    Product      = GetPropertyString(mo["Product"]),
                    SerialNumber = GetPropertyString(mo["SerialNumber"])
                };

                motherboardList.Add(motherboard);
            }

            return(motherboardList);
        }
Exemplo n.º 23
0
        public override Server MakeServer()
        {
            // TODO:make raid
            var ram         = new RandomAcessMemory(ServerRam);
            var videoCard   = new VideoCard(ServerMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu         = new CentralProcessingUnit(ServerNumberOfCores, ServerBits, motherBoard);
            var hardDrive   = new HardDriver(ServerHardDriveCapacity, false, 0);

            var dellServer = new Server(
                cpu,
                ram,
                new List <HardDriver> {
                hardDrive
            },
                videoCard,
                motherBoard);

            return(dellServer);
        }
        public async Task <IActionResult> Create(Motherboard model)
        {
            try
            {
                if (model.ImageFile != null)
                {
                    model.ImageTitle = model.ImageFile.FileName;
                    model.ImageData  = ImageManager.GetByteArrayFromImage(model.ImageFile);
                }

                string accessToken = await this.HttpContext.GetTokenAsync("access_token");

                await ApiRequests.PostAsync(accessToken, string.Format("{0}/{1}", this.apiBaseUrl, this.apiController), model);

                return(this.RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(this.View());
            }
        }
Exemplo n.º 25
0
 public EditMotherboard(Motherboard motherboard)
 {
     Motherboard = motherboard;
     Original    = new Motherboard()
     {
         Id           = motherboard.Id,
         Name         = motherboard.Name,
         Manufacturer = motherboard.Manufacturer,
         PCICount     = motherboard.PCICount,
         PCIEx16Count = motherboard.PCIEx16Count,
         PCIExCount   = motherboard.PCIExCount
     };
     Manufacturer    = Motherboard.Manufacturer;
     MotherboardName = Motherboard.Name;
     Socket          = Motherboard.Socket;
     PCICount        = Motherboard.PCICount.ToString();
     PCIEx16Count    = Motherboard.PCIEx16Count.ToString();
     PCIExCount      = Motherboard.PCIExCount.ToString();
     InitializeComponent();
     DataContext = this;
 }
Exemplo n.º 26
0
        public ICollection <Motherboard> getMotherboardsFromExcel(XLWorkbook workBook)
        {
            ICollection <Motherboard> result = new List <Motherboard>();
            var worksheet = workBook.Worksheet("Материнські плати");

            foreach (IXLRow row in worksheet.RowsUsed().Skip(1))
            {
                var item = new Motherboard();
                //item.Id = int.Parse(row.Cell(1).Value.ToString());
                item.Name           = row.Cell(2).Value.ToString();
                item.GpuinterfaceId = int.Parse(row.Cell(3).Value.ToString());
                item.SocketId       = int.Parse(row.Cell(4).Value.ToString());
                item.Formfactor     = row.Cell(5).Value.ToString();
                item.RamtypeId      = int.Parse(row.Cell(6).Value.ToString());
                item.Ramcount       = int.Parse(row.Cell(7).Value.ToString());
                item.Usbcount       = int.Parse(row.Cell(8).Value.ToString());
                item.Price          = int.Parse(row.Cell(9).Value.ToString());
                result.Add(item);
            }
            return(result);
        }
Exemplo n.º 27
0
        private PhccHardwareSupportModule(Motherboard motherboard) : this()
        {
            if (motherboard == null)
            {
                throw new ArgumentNullException(nameof(motherboard));
            }
            _device              = CreateDevice(motherboard.ComPort);
            _analogInputSignals  = CreateAnalogInputSignals(_device, motherboard.ComPort);
            _digitalInputSignals = CreateDigitalInputSignals(_device, motherboard.ComPort);
            CreateOutputSignals(_device, motherboard, out _digitalOutputSignals, out _analogOutputSignals,
                                out _peripheralByteStates, out _peripheralFloatStates);

            CreateInputEventHandlers();
            RegisterForInputEvents(_device, _analogInputChangedEventHandler, _digitalInputChangedEventHandler,
                                   _i2cDataReceivedEventHandler);
            try { SendCalibrations(_device, motherboard); }
            catch (Exception e) { _log.Error(e.Message, e); }

            try { StartTalking(_device); }
            catch (Exception e) { _log.Error(e.Message, e); }
        }
Exemplo n.º 28
0
        public override Laptop MakeLaptop()
        {
            var ram         = new RandomAcessMemory(LaptopRam);
            var videoCard   = new VideoCard(LaptopMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu         = new CentralProcessingUnit(LaptopNumberOfCores, LaptopBits, motherBoard);
            var hardDrive   = new HardDriver(LaptopHardDriveCapacity, false, 0);
            var battery     = new LaptopBattery();

            var dellLaptop = new Laptop(
                cpu,
                ram,
                new List <HardDriver> {
                hardDrive
            },
                videoCard,
                motherBoard,
                battery);

            return(dellLaptop);
        }
Exemplo n.º 29
0
    //void renderInfoPane(float left, float top, float width, float height
    Motherboard fabricateDebugRig()
    {
        Motherboard returnMobo = new Motherboard();

        returnMobo.name = "Mother of All Boards";

        CPU         debugCPU        = new CPU           ("Hammond DebugHammer 750XL",           Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 30, 0, 1, 6, 32);
        GPU         debugGPU        = new GPU           ("Zhu Industries Mothra 8800",          Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 20, 0, 3, 1);
        HDD         debugHDD        = new HDD           ("DataPlatter Stack 5",                 Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 2, 0, 10, 8);
        RAM         debugRAM        = new RAM           ("RYAM Interceptor 1 MB",               Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 1, 0, 1, 10, 1);
        PowerSupply debugPower      = new PowerSupply   ("ArEmEs 200W Power Supply",            Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 200);
        CompInput   debugInput      = new CompInput     ("Cobra Katana",                        Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 50, 60, false);
        CompOutput  debugOutput     = new CompOutput    ("AudiVisual AV2350",                   Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 320, 30, 5);
        CompNetwork debugNet        = new CompNetwork   ("Digiline Dial-up Package",            Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, NetworkType.DIALUP, 40, 4);
        Chassis     debugChassis    = new Chassis       ("CompuTech Tower of Power",            Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 10);

        GPU         badGPU          = new GPU           ("Bad GPU",                             Company.COMPUTECH, 125.0f, "Pudding Cup Interface", 20, 0, 3, 1);

        returnMobo.CPUInterface         = DEBUG_INTERFACE;
        returnMobo.GPUInterface         = DEBUG_INTERFACE;
        returnMobo.HDDInterface         = DEBUG_INTERFACE;
        returnMobo.RAMInterface         = DEBUG_INTERFACE;
        returnMobo.powerInterface       = DEBUG_INTERFACE;
        returnMobo.compInputInterface   = DEBUG_INTERFACE;
        returnMobo.compOutputInterface  = DEBUG_INTERFACE;
        returnMobo.networkInterface     = DEBUG_INTERFACE;
        returnMobo.formFactor           = DEBUG_INTERFACE;

        returnMobo.plugIn(debugCPU);
        returnMobo.plugIn(debugGPU);
        returnMobo.plugIn(debugHDD);
        returnMobo.plugIn(debugRAM);
        returnMobo.plugIn(debugInput);
        returnMobo.plugIn(debugOutput);
        returnMobo.plugIn(debugNet);
        returnMobo.plugIn(debugPower);
        returnMobo.plugIn(debugChassis);

        return returnMobo;
    }
Exemplo n.º 30
0
 private static void SendCalibrations(p.Device device, Motherboard motherboard)
 {
     if (device == null)
     {
         throw new ArgumentNullException(nameof(device));
     }
     if (motherboard == null)
     {
         throw new ArgumentNullException(nameof(motherboard));
     }
     foreach (var peripheral in motherboard.Peripherals)
     {
         if (peripheral is Doa8Servo)
         {
             var servoConfig = peripheral as Doa8Servo;
             try
             {
                 SendServoCalibrations(device, servoConfig);
             }
             catch (Exception e)
             {
                 _log.Error(e.Message, e);
             }
         }
         else if (peripheral is DoaAnOut1)
         {
             var anOut1Config = peripheral as DoaAnOut1;
             try
             {
                 SendAnOut1Calibrations(device, anOut1Config);
             }
             catch (Exception e)
             {
                 _log.Error(e.Message, e);
             }
         }
     }
 }
Exemplo n.º 31
0
    static void FetchAndLogRecord(Record record)
    {
        string line;

        M4ATX.Update(record);
        Motherboard.Update(record);
        nVidiaGPU.Update(record);

        Log.ToCloud(record);

        line = string.Format(
            "{0} |     {1}\x00B0     |    {2}\x00B0    {3}\x00B0    {4}\x00B0    {5}\x00B0    {6}\x00B0    |" +
            "     {7}\x00B0     |    {8,4:#0.0}W    {9,4:#0.0}W    {10,4:#0.0}W    | {11,4:#0.0}W |" +
            "   {12,4:#0.0}V    {13,4:#0.0}V    {14,4:#0.0}V    {15,4:#0.0}V",


            DateTime.UtcNow,

            record[DataPoint.M4ATXTemperature],
            record[DataPoint.CPUPackageTemperature],
            record[DataPoint.CPUCore0Temperature],
            record[DataPoint.CPUCore1Temperature],
            record[DataPoint.CPUCore2Temperature],
            record[DataPoint.CPUCore3Temperature],
            record[DataPoint.GPUCoreTemperature],
            record[DataPoint.CPUPackagePower],
            record[DataPoint.CPUCoresPower],
            record[DataPoint.CPUDRAMPower],
            record[DataPoint.GPUPower],
            record[DataPoint.M4ATXVoltageIn],
            record[DataPoint.M4ATXVoltageOn12V],
            record[DataPoint.M4ATXVoltageOn3V],
            record[DataPoint.M4ATXVoltageOn5V]
            );


        Log.WriteLine(line);
    }
Exemplo n.º 32
0
        static void Main()
        {
            IComponent  component  = new Motherboard(1, "idik", "asd", 20m, 20, 1);
            IPeripheral peripheral = new Headset(1, "idik", "asd", 20m, 20, "idk");
            IComputer   computer   = new DesktopComputer(2, "asd", "ddsds", 200);

            computer.AddComponent(component);
            computer.AddPeripheral(peripheral);
            computer.ToString();

            string pathFile = Path.Combine("..", "..", "..", "output.txt");

            File.Create(pathFile).Close();

            IReader             reader             = new ConsoleReader();
            IWriter             writer             = new ConsoleWriter();
            ICommandInterpreter commandInterpreter = new CommandInterpreter();
            IController         controller         = new Controller();

            IEngine engine = new Engine(reader, writer, commandInterpreter, controller);

            engine.Run();
        }
Exemplo n.º 33
0
        public void ComputerShallowClone()
        {
            var motherboard = new Motherboard
            {
                Processor   = "Intel i7",
                GraphicCard = "Titan X",
                Memory      = "32GB DDR4"
            };
            var computer = new Computer(motherboard)
            {
                ProjectName = "Test",
                Case        = "Zalman Z9"
            };
            var shallowClone = computer.ShallowClone() as Computer;

            AreEqual("Test", shallowClone.ProjectName);
            AreEqual("Zalman Z9", shallowClone.Case);
            AreEqual("Intel i7", shallowClone.Motherboard.Processor);
            AreEqual("Titan X", shallowClone.Motherboard.GraphicCard);
            AreEqual("32GB DDR4", shallowClone.Motherboard.Memory);
            AreNotSame(shallowClone, computer);
            AreSame(shallowClone.Motherboard, computer.Motherboard);
        }
Exemplo n.º 34
0
        public IComponent CreateComponent(int id, string componentType, string manufacturer, string model,
                                          decimal price,
                                          double overallPerformance, int generation)
        {
            IComponent comp = null;

            if (componentType == "CentralProcessingUnit")
            {
                comp = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation);
            }
            else if (componentType == "Motherboard")
            {
                comp = new Motherboard(id, manufacturer, model, price, overallPerformance, generation);
            }
            else if (componentType == "PowerSupply")
            {
                comp = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation);
            }
            else if (componentType == "RandomAccessMemory")
            {
                comp = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation);
            }
            else if (componentType == "SolidStateDrive")
            {
                comp = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation);
            }
            else if (componentType == "VideoCard")
            {
                comp = new VideoCard(id, manufacturer, model, price, overallPerformance, generation);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidComponentType);
            }

            return(comp);
        }
Exemplo n.º 35
0
    static void FetchAndLogRecord(Record record)
    {
        string line;

        try
        {
            M4ATX.Update(record);
        }
        catch (Exception e)
        {
            LogException(e);
        }

        Motherboard.Update(record);

        line = string.Format(
            "{0} |     {1}\x00B0     |    {2}\x00B0    {3}\x00B0    {4}\x00B0    {5}\x00B0    {6}\x00B0    |     {7}\x00B0  {8,4:#0.0}W    |    {9,4:#0.0}W    {10,4:#0.0}W    {11,4:#0.0}W    |   {12:#0.0}V",

            DateTime.UtcNow,
            record.Get(Record.DataPoint.M4ATXTemperature),

            record.Get(Record.DataPoint.CPUPackageTemperature),
            record.Get(Record.DataPoint.CPUCore0Temperature),
            record.Get(Record.DataPoint.CPUCore1Temperature),
            record.Get(Record.DataPoint.CPUCore2Temperature),
            record.Get(Record.DataPoint.CPUCore3Temperature),

            record.Get(Record.DataPoint.GPUCoreTemperature),
            record.Get(Record.DataPoint.GPUPower),
            record.Get(Record.DataPoint.CPUPackagePower),
            record.Get(Record.DataPoint.CPUCoresPower),
            record.Get(Record.DataPoint.CPUDRAMPower),
            record.Get(Record.DataPoint.M4ATXVoltageIn)
            );

        WriteLine(line);
    }
Exemplo n.º 36
0
        public async Task <IActionResult> Edit(Guid id, Motherboard model)
        {
            try
            {
                if (model == null)
                {
                    return(this.NotFound());
                }

                if (model.ImageFile != null)
                {
                    model.ImageTitle = model.ImageFile.FileName;
                    model.ImageData  = ImageManager.GetByteArrayFromImage(model.ImageFile);
                }

                using (var httpClient = new HttpClient())
                {
                    model.MotherboardId = id;
                    string json        = JsonConvert.SerializeObject(model, Formatting.Indented);
                    var    httpContent = new StringContent(json, Encoding.UTF8, "application/json");

                    using (HttpResponseMessage response = await httpClient.PutAsync(string.Format("{0}/{1}", this.apiBaseUrl, this.apiController), httpContent))
                    {
                        string apiResponse = await response.Content.ReadAsStringAsync();    // returns object, todo: change response in api to return successfull message

                        //ViewBag.Result = "Success";
                        //receivedReservation = JsonConvert.DeserializeObject<Reservation>(apiResponse);
                    }
                }

                return(this.RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(this.View());
            }
        }
Exemplo n.º 37
0
        public Part CreatePart(PartType type)
        {
            Part part = null;

            switch (type)
            {
            case PartType.Case:
                part = new Case(Manufacturer.Lenovo, 130);
                break;

            case PartType.GraphicsCard:
                part = new GraphicsCard(Manufacturer.Lenovo, 275);
                break;

            case PartType.Memory:
                part = new Memory(Manufacturer.Lenovo, 85);
                break;

            case PartType.Motherboard:
                part = new Motherboard(Manufacturer.Lenovo, 170);
                break;

            case PartType.NetworkCard:
                part = new NetworkCard(Manufacturer.Lenovo, 60);
                break;

            case PartType.Processor:
                part = new Processor(Manufacturer.Lenovo, 320);
                break;

            default:
                throw new NotImplementedException();
            }

            return(part);
        }
Exemplo n.º 38
0
        static void Main(string[] args)
        {
            Component ram8      = new DynamicMemory("RAM 8 GB", "DDR3 1600 Mhz", 85);
            Component ram4      = new DynamicMemory("RAM 4 GB", "DDR3 1066 Mhz", 35);
            Component simpleRam = new DynamicMemory("Simple RAM 2GB", 10);

            Component gpuGeForce = new GraphicCard("GeForce GPU", "2Gb DDR5", 100);
            Component gpuAti     = new GraphicCard("Ati Radeon GPU", "1Gb DDR5", 70);
            Component simpleGpu  = new GraphicCard("Simple GPU", 15);

            Component boardGood   = new Motherboard("Intel Desktop Board DH55TC", "Intel H55 Express Chipset", 75);
            Component simpleBoard = new Motherboard("Simple motherboard", 25);

            Component intelI7      = new Processor("Intel i3 Processor", "3.4 Ghz Cache: 12Mb", 300);
            Component intelCeleron = new Processor("Intel Celeron", "2.66 Ghz Cache: 1Mb", 89);
            Component simpleCpu    = new Processor("Simple CPU", 49);

            Component bigScreen    = new Screen("HP Z-24", "24 in FULL HD display", 300);
            Component simpleScreen = new Screen("Simple Screen - 17 in", 80);

            Component ssd1Tb    = new StorageDrive("Crucial M550", "1TB SSD", 400);
            Component hdd1Tb    = new StorageDrive("HDD", "1TB", 150);
            Component simpleHdd = new StorageDrive("Simple HDD", "320 Gb", 50);

            Computer goodComp      = new Computer("Zverska-Machine", new Component[] { intelI7, ram8, gpuGeForce, ssd1Tb, bigScreen, boardGood });
            Computer workComp      = new Computer("Work-Horse", new Component[] { intelCeleron, ram4, gpuAti, hdd1Tb, simpleScreen, boardGood });
            Computer averageComp   = new Computer("FacebookAndYoutubeAreGreat", new Component[] { simpleCpu, simpleRam, simpleGpu, simpleHdd, simpleScreen, simpleBoard });
            Computer simplComputer = new Computer("Email-Opener", new Component[] { simpleCpu, simpleRam, simpleHdd, simpleBoard });

            Computer[] computers = new Computer[] { goodComp, workComp, averageComp, simplComputer };

            foreach (var computer in computers)
            {
                Console.WriteLine(computer);
            }
        }
Exemplo n.º 39
0
        // GET: Build
        public ActionResult Index()
        {
            Case        Case        = (Case)Session["cases"];
            CPU         cpu         = (CPU)Session["Cpu"];
            VideoCard   videoCard   = (VideoCard)Session["videocard"];
            Motherboard motherBoard = (Motherboard)Session["motherboard"];
            PowerSupply powerSupply = (PowerSupply)Session["powersupply"];
            Memory      memory      = (Memory)Session["memory"];
            Storage     storage     = (Storage)Session["storage"];
            var         build       = new BuildViewModel()
            {
                Cpu      = cpu,
                CpuBrand = _context.Brands.Where(m => m.Id == cpu.BrandId).SingleOrDefault(),

                Case      = Case,
                CaseBrand = _context.Brands.Where(m => m.Id == Case.BrandId).SingleOrDefault(),

                Videocard      = videoCard,
                VideocardBrand = _context.Brands.Where(m => m.Id == videoCard.BrandId).SingleOrDefault(),

                Motherboard      = motherBoard,
                MotherboardBrand = _context.Brands.Where(m => m.Id == motherBoard.BrandId).SingleOrDefault(),

                Powersupply      = powerSupply,
                PowersupplyBrand = _context.Brands.Where(m => m.Id == powerSupply.BrandId).SingleOrDefault(),

                Memory      = memory,
                MemoryBrand = _context.Brands.Where(m => m.Id == memory.BrandId).SingleOrDefault(),

                Storage      = storage,
                StorageBrand = _context.Brands.Where(m => m.Id == storage.BrandId).SingleOrDefault()
            };

            ViewBag.Total = cpu.Price + Case.Price + videoCard.Price + motherBoard.Price + powerSupply.Price + memory.Price + storage.Price;
            return(View("Index", build));
        }
Exemplo n.º 40
0
        static void Main(string[] args)
        {
            User user = new User(
                "Клиент",
                "Москва",
                5000,
                550
                );

            Console.WriteLine("Список товаров:");

            CPU intel_4770 = new CPU(
                "Intel 4770",
                700,
                "Intel"
                );

            Console.WriteLine("Процессор:");
            Console.WriteLine("Название: " + intel_4770.Name);
            Console.WriteLine("Цена: " + intel_4770.Price);
            Console.WriteLine("Производитель: " + intel_4770.Brand);
            Console.WriteLine(new String('-', 25));

            GPU gtx_780 = new GPU(
                "GTX 780",
                1000,
                "NVIDIA"
                );

            Console.WriteLine("Видеокарта:");
            Console.WriteLine("Название: " + gtx_780.Name);
            Console.WriteLine("Цена: " + gtx_780.Price);
            Console.WriteLine("Производитель: " + gtx_780.Brand);
            Console.WriteLine(new String('-', 25));

            GPU r9_270x = new GPU(
                "R9 270X",
                800,
                "AMD"
                );

            Console.WriteLine("Видеокарта:");
            Console.WriteLine("Название: " + r9_270x.Name);
            Console.WriteLine("Цена: " + r9_270x.Price);
            Console.WriteLine("Производитель: " + r9_270x.Brand);
            Console.WriteLine(new String('-', 25));

            Motherboard maximus_7_ranger = new Motherboard(
                "Maximus VII Ranger",
                500,
                "ASUS",
                "ATX",
                "Z97"
                );

            Console.WriteLine("Материнская плата:");
            Console.WriteLine("Название: " + maximus_7_ranger.Name);
            Console.WriteLine("Цена: " + maximus_7_ranger.Price);
            Console.WriteLine("Производитель: " + maximus_7_ranger.Brand);
            Console.WriteLine("Формфактор: " + maximus_7_ranger.Form);
            Console.WriteLine("Чипсет: " + maximus_7_ranger.Chipset);
            Console.WriteLine(new String('-', 25));

            Power rm850i = new Power(
                "RM850i",
                400,
                "Corsair",
                850
                );

            Console.WriteLine("Блок питания:");
            Console.WriteLine("Название: " + rm850i.Name);
            Console.WriteLine("Цена: " + rm850i.Price);
            Console.WriteLine("Производитель: " + rm850i.Brand);
            Console.WriteLine("Мощность: " + rm850i.Value);
            Console.WriteLine(new String('-', 25));

            Power cx550 = new Power(
                "CX550",
                100,
                "Corsair",
                550
                );

            Console.WriteLine("Блок питания:");
            Console.WriteLine("Название: " + rm850i.Name);
            Console.WriteLine("Цена: " + rm850i.Price);
            Console.WriteLine("Производитель: " + rm850i.Brand);
            Console.WriteLine("Мощность: " + rm850i.Value);
            Console.WriteLine(new String('-', 25));


            Product[] products = new Product[] {
                intel_4770,
                gtx_780,
                r9_270x,
                maximus_7_ranger,
                rm850i,
                cx550
            };

            Check check = new Check();

            while (true)
            {
                Console.WriteLine();
                Console.WriteLine($"Здравствуйте, {user.Name}. Ваш баланс: {user.Balance}");
                Console.WriteLine(new String('-', 25));

                for (int i = 0; i < products.Length; i++)
                {
                    Console.WriteLine($"Товар {i+1} {products[i].Name} по цене {products[i].Price}");
                }
                Console.WriteLine(new String('-', 25));
                Console.WriteLine("Выберете номер товара и нажмите Enter:");

                string str           = Console.ReadLine();
                int    productNumber = Convert.ToInt32(str) - 1;

                if (productNumber >= 0 && productNumber < products.Length)
                {
                    if (products[productNumber].Price < user.Balance)
                    {
                        check.Buy(user, products[productNumber]);
                    }
                    else
                    {
                        Console.WriteLine(new String('-', 25));
                        Console.WriteLine("У Вас недостаточно средств!");
                        Console.WriteLine(new String('-', 25));
                    }
                }
                else
                {
                    Console.WriteLine(new String('-', 25));
                    Console.WriteLine("Таких товаров нет!");
                    Console.WriteLine(new String('-', 25));
                }
            }
        }
Exemplo n.º 41
0
        public void ReadXml(XmlReader reader)
        {
            Brand = reader["brand"];
            Size = reader["size"];
            Color = reader["color"];

            reader.ReadToFollowing("motherboard");
            Mobo = new Motherboard();
            Mobo.ReadXml(reader);

            reader.ReadToFollowing("processor");
            CPU = new Processor();
            CPU.ReadXml(reader);

            reader.ReadToFollowing("ram");
            Ram = new RAM();
            Ram.ReadXml(reader);

            reader.ReadToFollowing("videocard");
            Videocard = new VideoCard();
            Videocard.ReadXml(reader);

            reader.ReadToFollowing("diskdrive");
            Diskdrive = new DiskDrive();
            Diskdrive.ReadXml(reader);

            reader.ReadToFollowing("fans");
            while (true)
            {
                reader.Read();
                if (reader.Name == "fan")
                {
                    Fan fan = new Fan();
                    fan.ReadXml(reader);
                    AddFan(fan);
                }
                else if (reader.Name == "LED")
                {
                    Fans[Fans.Count - 1].HasLED = true;
                    LED led = new LED();
                    led.ReadXml(reader);
                    Fans[Fans.Count - 1].Led = led;
                    reader.Read();
                }

                if (reader.EOF)
                    break;
            }
        }
Exemplo n.º 42
0
    void renderDebugMenu()
    {
        GUI.Box(new Rect(10, 10, 200, 200), "PC Sim 2013");
        if (GUI.Button(new Rect(35, 30, 150, 20), "Give Self Debug Rig"))
        {
            mobo = fabricateDebugRig();
        }
        if (GUI.Button(new Rect(35, 60, 150, 20), "Just Give Debug Mobo"))
        {
            Motherboard returnMobo = new Motherboard();
            returnMobo.name = "Mother of All Boards";
            returnMobo.CPUInterface         = DEBUG_INTERFACE;
            returnMobo.GPUInterface         = DEBUG_INTERFACE;
            returnMobo.HDDInterface         = DEBUG_INTERFACE;
            returnMobo.RAMInterface         = DEBUG_INTERFACE;
            returnMobo.powerInterface       = DEBUG_INTERFACE;
            returnMobo.compInputInterface   = DEBUG_INTERFACE;
            returnMobo.compOutputInterface  = DEBUG_INTERFACE;
            returnMobo.networkInterface     = DEBUG_INTERFACE;
            returnMobo.formFactor           = DEBUG_INTERFACE;

            mobo = returnMobo;
        }
        if (GUI.Button(new Rect(35, 90, 150, 20), "Go to Store"))
        {
            gameState = PlayerGUIState.STORE_SCREEN;
        }
        if (GUI.Button(new Rect(35, 120, 150, 20), "Populate Store"))
        {
            //CPU debugCPU = new CPU("Hammond DebugHammer 750XL", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 30, 0, 1, 6, 32);
            //GPU debugGPU = new GPU("Zhu Industries Mothra 8800", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 20, 0, 3, 1);
            //HDD debugHDD = new HDD("DataPlatter Stack 5", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 2, 0, 10, 8);
            //RAM debugRAM = new RAM("RYAM Interceptor 1 MB", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 1, 0, 1, 10, 1);
            //PowerSupply debugPower = new PowerSupply("ArEmEs 200W Power Supply", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 200);
            //CompInput debugInput = new CompInput("Cobra Katana", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 50, 60, false);
            //CompOutput debugOutput = new CompOutput("AudiVisual AV2350", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 320, 30, 5);
            //CompNetwork debugNet = new CompNetwork("Digiline Dial-up Package", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, NetworkType.DIALUP, 40, 4);
            //Chassis debugChassis = new Chassis("CompuTech Tower of Power", Company.COMPUTECH, 125.0f, DEBUG_INTERFACE, 0, 0, 10);

            shop.generateInventory();

            foreach (Motherboard part in shop.moboInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.cpuInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.gpuInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.ramInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.hddInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.inputInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.outputInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.pSupplyInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.chassisInventory)
            {
                storeFront.Add(part);
            }
            foreach (Part part in shop.networkInventory)
            {
                storeFront.Add(part);
            }

            //GPU badGPU = new GPU("Bad GPU", Company.COMPUTECH, 125.0f, "Pudding Cup Interface", 20, 0, 3, 1);
            //storeFront.Add(debugCPU);
            //storeFront.Add(debugGPU);
            //storeFront.Add(debugRAM);
            //storeFront.Add(debugHDD);
            //storeFront.Add(debugPower);
            //storeFront.Add(debugInput);
            //storeFront.Add(debugOutput);
            //storeFront.Add(debugNet);
            //storeFront.Add(debugChassis);
        }
        if (GUI.Button(new Rect(35, 150, 150, 20), "View Rig"))
        {
            gameState = PlayerGUIState.MAIN_SCREEN;
        }
        GUI.TextField(new Rect(35, 180, 150, 20), "Money: $" + funds);
    }
Exemplo n.º 43
0
        public string AddComponent
            (int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation)
        {
            if (computers.Any(c => c.Id == id))
            {
                bool IsValidType = Enum.TryParse <ComponentType>(componentType, out ComponentType componType);
                if (IsValidType)
                {
                    Component component = null;
                    string    message   = string.Empty;

                    switch (componType)
                    {
                    case ComponentType.CentralProcessingUnit:
                        component = new CentralProcessingUnit(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    case ComponentType.Motherboard:
                        component = new Motherboard(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    case ComponentType.PowerSupply:
                        component = new PowerSupply(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    case ComponentType.RandomAccessMemory:
                        component = new RandomAccessMemory(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    case ComponentType.SolidStateDrive:
                        component = new SolidStateDrive(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    case ComponentType.VideoCard:
                        component = new VideoCard(overallPerformance, price, model, manufacturer, id, generation);
                        if (components.Any(c => c.Id == id))
                        {
                            throw new ArgumentException(ExceptionMessages.ExistingComponentId);
                        }
                        else
                        {
                            components.Add(component);
                            message = string.Format(SuccessMessages.AddedComponent, id);
                        }
                        break;

                    default:
                        break;
                    }

                    return(message);
                }
                else
                {
                    throw new ArgumentException(ExceptionMessages.InvalidComponentType);
                }
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.NotExistingComputerId);
            }
        }
Exemplo n.º 44
0
        public SpecificProperties(Item item)
        {
            if (item is Case)
            {
                Case pcCase = item as Case;
                this.BuiltInFanNumber     = pcCase.BuiltInFanNumber;
                this.SupportedMotherboard = EnumExtensionMethods.GetDescription(pcCase.SupportedMotherboard);
                this.Height    = pcCase.Height;
                this.Width     = pcCase.Width;
                this.Depth     = pcCase.Depth;
                this.HDDNumber = pcCase.HDDNumber;
            }

            if (item is Cpu)
            {
                Cpu cpu = item as Cpu;
                this.ProcessorFamily = cpu.ProcessorFamily;
                this.Technology      = cpu.Technology;
                this.CoreNumber      = cpu.CoreNumber;
                this.ThreadNumber    = cpu.ThreadNumber;
                this.Socket          = Socket;
                this.BaseClock       = cpu.BaseClock;
                this.TDP             = cpu.TDP;
            }

            if (item is GraphicsCard)
            {
                GraphicsCard gpu = item as GraphicsCard;
                this.BuiltInMemory         = gpu.BuiltInMemory;
                this.MemoryClock           = gpu.MemoryClock;
                this.BandWidth             = gpu.BandWidth;
                this.CoolerType            = gpu.CoolerType;
                this.MemoryType            = MemoryType;
                this.PowerSupplyConnection = gpu.PowerSupplyConnection;
                this.BaseClock             = gpu.BaseClock;
                this.TDP = gpu.TDP;
            }

            if (item is HardDrive)
            {
                HardDrive drive = item as HardDrive;
                this.Size        = drive.Size;
                this.ReadSpeed   = drive.ReadSpeed;
                this.WriteSpeed  = drive.WriteSpeed;
                this.Weight      = drive.Weight;
                this.DriveSocket = drive.Socket;
            }

            if (item is Memory)
            {
                Memory mem = item as Memory;
                this.BaseClock = mem.BaseClock;
                this.Capacity  = mem.Capacity;
                this.MemoryTypeForMmoryCard = mem.MemoryType;
                this.Timing = mem.Timing;
                this.Kit    = mem.Kit;
            }

            if (item is Motherboard)
            {
                Motherboard board = item as Motherboard;
                this.Type    = board.Type;
                this.Chipset = board.Chipset;
                this.CpuSocketForMotherboard = board.Socket;
                this.SupportedMemoryType     = board.SupportedMemoryType;
                this.SupportedMemorySpeed    = board.SupportedMemorySpeed;
                this.MemorySocketNumber      = board.MemorySocketNumber;
            }

            if (item is PowerSupply)
            {
                PowerSupply psu = item as PowerSupply;
                this.ATXConnector        = psu.ATXConnector;
                this.MolexConnector      = psu.MolexConnector;
                this.SixPinConnector     = psu.SixPinConnector;
                this.SixPlusTwoConnector = psu.SixPlusTwoConnector;
                this.Efficiency          = psu.Efficiency;
                this.IsModular           = psu.IsModular;
            }
            if (item is CompletPC)
            {
                CompletPC pc = item as CompletPC;
                this.Case        = pc.Case;
                this.Motherboard = pc.Motherboard;
                this.Cpu         = pc.Cpu;
                this.Gpu         = pc.Gpu;
                this.Memories    = pc.Memories;
                this.Drives      = pc.Drives;
                this.PowerSupply = pc.PowerSupply;
            }
        }
Exemplo n.º 45
0
        public void OrderMotherBoard(EOriginCountry eOriginCountry)
        {
            var creatorMotherBoard = new CreatorMotherBoard();

            _motherboard = creatorMotherBoard.CreateMotherBoard(eOriginCountry);
        }
Exemplo n.º 46
0
        private void BtnAddEquipment_Click(object sender, RoutedEventArgs e)   //Добавление на склад
        {
            try
            {
                switch (KindOfEquipment.SelectedItem.ToString())
                {
                case "Процессор":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        Processor processor = new Processor();
                        processor.ProcessorName  = TextAddEquipment.Text;
                        processor.ProcessorPrice = Int32.Parse(TextPriceEquipment.Text);
                        processor.NumOfProcessor = Int32.Parse(TextNumEquipment.Text);
                        db.Processors.Add(processor);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Материнская плата":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        Motherboard motherboard = new Motherboard();
                        motherboard.MotherboardName  = TextAddEquipment.Text;
                        motherboard.MotherboardPrice = Int32.Parse(TextPriceEquipment.Text);
                        motherboard.NumOfMotherboard = Int32.Parse(TextNumEquipment.Text);
                        db.Motherboards.Add(motherboard);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Оперативная память":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        RAM ram = new RAM();
                        ram.RAMName  = TextAddEquipment.Text;
                        ram.RAMPrice = Int32.Parse(TextPriceEquipment.Text);
                        ram.NumOfRam = Int32.Parse(TextNumEquipment.Text);
                        db.RAMs.Add(ram);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Жесткий диск":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        HardDisk hardDisk = new HardDisk();
                        hardDisk.HardDiskName  = TextAddEquipment.Text;
                        hardDisk.HardDiskPrice = Int32.Parse(TextPriceEquipment.Text);
                        hardDisk.NumOfHardDisk = Int32.Parse(TextNumEquipment.Text);
                        db.HardDisks.Add(hardDisk);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Видео карта":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        VideoCard videoCard = new VideoCard();
                        videoCard.VideoCardName  = TextAddEquipment.Text;
                        videoCard.VideoCardPrice = Int32.Parse(TextPriceEquipment.Text);
                        videoCard.NumOfVideoCard = Int32.Parse(TextNumEquipment.Text);
                        db.VideoCards.Add(videoCard);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Корпус":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        Case cases = new Case();
                        cases.CaseName  = TextAddEquipment.Text;
                        cases.CasePrice = Int32.Parse(TextPriceEquipment.Text);
                        cases.NumOfCase = Int32.Parse(TextNumEquipment.Text);
                        db.Cases.Add(cases);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }

                case "Монитор":
                {
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        Monitor monitor = new Monitor();
                        monitor.MonitorName  = TextAddEquipment.Text;
                        monitor.MonitorPrice = Int32.Parse(TextPriceEquipment.Text);
                        monitor.NumOfMonitor = Int32.Parse(TextNumEquipment.Text);
                        db.Monitors.Add(monitor);
                        db.SaveChanges();
                    }
                    MessageBox.Show($"{TextAddEquipment.Text} успешно добавлен на склад");
                    break;
                }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Не заполнены корректно все поля");
            }
        }
        /// <summary>
        /// Adds the selected product to the cart's items.
        /// </summary>
        /// <param name="obj"></param>
        private void ExecAddToCart(object obj)
        {
            ProductListUserControl productListUC = CartView.CartUC.ProductsUC;
            CartItem cartItem = new CartItem();

            cartItem.Cart     = Cart;
            cartItem.Quantity = 1;

            if (productListUC.CPUList.SelectedIndex != -1) // CPU
            {
                CPU cpu = (CPU)productListUC.CPUList.SelectedItem;
                CPUs.Remove(cpu);
                cartItem.Product = cpu;
                cartItem.Price   = cpu.Price;
            }
            else if (productListUC.GPUList.SelectedIndex != -1) // GPU
            {
                GPU gpu = (GPU)productListUC.GPUList.SelectedItem;
                GPUs.Remove(gpu);
                cartItem.Product = gpu;
                cartItem.Price   = gpu.Price;
            }
            else if (productListUC.MotherboardList.SelectedIndex != -1) // Motherboard
            {
                Motherboard motherboard = (Motherboard)productListUC.MotherboardList.SelectedItem;
                Motherboards.Remove(motherboard);
                cartItem.Product = motherboard;
                cartItem.Price   = motherboard.Price;
            }
            else if (productListUC.MemoryList.SelectedIndex != -1) // Memory
            {
                Memory memory = (Memory)productListUC.MemoryList.SelectedItem;
                Rams.Remove(memory);
                cartItem.Product = memory;
                cartItem.Price   = memory.Price;
            }
            else if (productListUC.StorageList.SelectedIndex != -1) // Storage
            {
                Storage storage = (Storage)productListUC.StorageList.SelectedItem;
                StorageComponents.Remove(storage);
                cartItem.Product = storage;
                cartItem.Price   = storage.Price;
            }
            else if (productListUC.PSUList.SelectedIndex != -1) // PSU
            {
                PSU psu = (PSU)productListUC.PSUList.SelectedItem;
                PSUs.Remove(psu);
                cartItem.Product = psu;
                cartItem.Price   = psu.Price;
            }
            else // Case
            {
                Case pcCase = (Case)productListUC.CaseList.SelectedItem;
                Cases.Remove(pcCase);
                cartItem.Product = pcCase;
                cartItem.Price   = pcCase.Price;
            }

            cartItem.Product.Stock--;
            Cart.Total += cartItem.Price;
            Cart.Items.Add(cartItem);
        }
Exemplo n.º 48
0
    public object generatePart(Type partType, Company company)
    {
        object returnPart = null;
        if (partType == typeof(CPU))
        {
            /*
            CPU = new CPU(
                generatePartName(partType, company),
                companyToString(company),
                499.0f,
                "Generic Interface",
                100,
                1
                )
             * */

            returnPart = new CPU(generatePartName(partType, company),
                company,
                500.0f * (float)CPU[company] * (float)CPU[company],
                "Debug",
                100 * (int)((float)CPU[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.cpu_CoresRange.getLeft(), ranges.PE1980.cpu_CoresRange.getRight() + 1),
                rand.Next(ranges.PE1980.cpu_ClockRange.getLeft(), ranges.PE1980.cpu_ClockRange.getRight() + 1),
                rand.Next(ranges.PE1980.cpu_BitsRange.getLeft(), ranges.PE1980.cpu_BitsRange.getRight() + 1)
                );

            //returnPart = new CPU(generatePartName(partType, company),
            //    company,
            //    500.0f * (float)CPU[company] * (float)CPU[company],
            //    "Debug",
            //    100 * (int)((float)CPU[company] * 100.0f) / 100,
            //    1.0f,
            //    rand.Next(ranges.PE1980.cpu_CoresRange.getLeft(), ranges.PE1980.cpu_CoresRange.getRight() + 1), 1, 1);

        }
        else if (partType == typeof(GPU))
        {
            returnPart = new GPU(generatePartName(partType, company),
                company,
                 500.0f * (float)GPU[company] * (float)GPU[company],
                "Debug",
                200 * (int)((float)GPU[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.gpu_MegaflopsRange.getLeft(), ranges.PE1980.gpu_MegaflopsRange.getRight() + 1),
                rand.Next(ranges.PE1980.gpu_MemoryRange.getLeft(), ranges.PE1980.gpu_MemoryRange.getRight() + 1)
                );
        }
        else if (partType == typeof(HDD))
        {
            returnPart = new HDD(generatePartName(partType, company),
                company,
                 500.0f * (float)HDD[company] * (float)HDD[company],
                "Debug",
                5 * (int)((float)HDD[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.hdd_SizeRange.getLeft(), ranges.PE1980.hdd_SizeRange.getRight() + 1),
                rand.Next(ranges.PE1980.hdd_SpeedRange.getLeft(), ranges.PE1980.hdd_SpeedRange.getRight() + 1)
                );
        }
        else if (partType == typeof(RAM))
        {
            returnPart = new RAM(generatePartName(partType, company),
                company,
                 500.0f * (float)RAM[company] * (float)RAM[company],
                "Debug",
                5 * (int)((float)RAM[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.ram_SizeRange.getLeft(), ranges.PE1980.ram_SizeRange.getRight() + 1),
                rand.Next(ranges.PE1980.ram_SpeedRange.getLeft(), ranges.PE1980.ram_SpeedRange.getRight() + 1),
                rand.Next(ranges.PE1980.ram_ChannelsRange.getLeft(), ranges.PE1980.ram_ChannelsRange.getRight() + 1)
                );
        }
        else if (partType == typeof(CompInput))
        {
            returnPart = new CompInput(generatePartName(partType, company),
                company,
                 500.0f * (float)INPUT[company] * (float)INPUT[company],
                "Debug",
                5 * (int)((float)INPUT[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.input_DPIRange.getLeft(), ranges.PE1980.input_DPIRange.getRight() + 1),
                rand.Next(ranges.PE1980.input_PollingRange.getLeft(), ranges.PE1980.input_PollingRange.getRight() + 1),
                rand.Next(10) <= 7 ? false : true
                );
        }
        else if (partType == typeof(CompOutput))
        {
            returnPart = new CompOutput(generatePartName(partType, company),
                company,
                 500.0f * (float)OUTPUT[company] * (float)OUTPUT[company],
                "Debug",
                50 * (int)((float)OUTPUT[company] * 100.0f) / 100,
                1.0f,
                rand.Next(ranges.PE1980.output_ResolutionRange.getLeft(), ranges.PE1980.output_ResolutionRange.getRight() + 1),
                rand.Next(ranges.PE1980.output_RefreshRange.getLeft(), ranges.PE1980.output_RefreshRange.getRight() + 1),
                rand.Next(ranges.PE1980.output_SQRange.getLeft(), ranges.PE1980.output_SQRange.getRight() + 1)
                );
        }
        else if (partType == typeof(CompNetwork))
        {
            returnPart = new CompNetwork(generatePartName(partType, company),
                company,
                 500.0f * (float)NETWORK[company] * (float)NETWORK[company],
                "Debug",
                0,
                1.0f,
                rand.Next(2) == 0 ? ranges.PE1980.network_TypeRange.getLeft() : ranges.PE1980.network_TypeRange.getRight(),
                rand.Next(ranges.PE1980.network_PingRange.getLeft(), ranges.PE1980.network_PingRange.getRight() + 1),
                rand.Next(ranges.PE1980.network_BandwidthRange.getLeft(), ranges.PE1980.network_BandwidthRange.getRight() + 1)
                );
        }
        else if (partType == typeof(PowerSupply))
        {
            returnPart = new PowerSupply(generatePartName(partType, company),
                company,
                 500.0f * (float)PSU[company] * (float)PSU[company],
                "Debug",
                0,
                1.0f,
                rand.Next(ranges.PE1980.pSupply_WattageRange.getLeft(), ranges.PE1980.pSupply_WattageRange.getRight() + 1)
                );
        }
        else if (partType == typeof(Chassis))
        {
            returnPart = new Chassis(generatePartName(partType, company),
                company,
                 500.0f * (float)CHASSIS[company] * (float)CHASSIS[company],
                "Debug",
                0,
                1.0f,
                rand.Next(ranges.PE1980.chassis_CoolRange.getLeft(), ranges.PE1980.chassis_CoolRange.getRight() + 1)
                );
        }
        else if (partType == typeof(Motherboard))
        {
            returnPart = new Motherboard(generatePartName(partType, company),
                500.0f * (float)MOBO[company] * (float)MOBO[company],
                1.0f,
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                "Debug",
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null
                );
        }
        return returnPart;
    }
 public bool EsCompatible(Motherboard motherboard)
 {
     return(Sata == motherboard.PedirSata);
 }
Exemplo n.º 50
0
    void renderComputerStats(float left, float top, float width, float height, float margin, Motherboard mobo)
    {
        if (mobo != null)
        {
            if(GUI.Button(new Rect(left, top, width, height), "MOBO: " + mobo.name))
            {
                viewPart = mobo;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top, width, height), "MOBO: None");
        }

        if (mobo.cpu != null)
        {
            if(GUI.Button(new Rect(left, top + (height + margin), width, height), "CPU: " + mobo.cpu.name))
            {
                viewPart = mobo.cpu;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + (height + margin), width, height), "CPU: None");
        }

        if (mobo.gpu != null)
        {
            if(GUI.Button(new Rect(left, top + 2 * (height + margin), width, height), "GPU: " + mobo.gpu.name))
            {
                viewPart = mobo.gpu;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 2 * (height + margin), width, height), "GPU: None");
        }

        if (mobo.ram != null)
        {
            if(GUI.Button(new Rect(left, top + 3 * (height + margin), width, height), "RAM: " + mobo.ram.name))
            {
                viewPart = mobo.ram;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 3 * (height + margin), width, height), "RAM: None");
        }

        if (mobo.hdd != null)
        {
            if (GUI.Button(new Rect(left, top + 4 * (height + margin), width, height), "HDD: " + mobo.hdd.name))
            {
                viewPart = mobo.hdd;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 4 * (height + margin), width, height), "HDD: None");
        }

        if (mobo.pSupply != null)
        {
            if(GUI.Button(new Rect(left, top + 5 * (height + margin), width, height), "Power Supply: " + mobo.pSupply.name))
            {
                viewPart = mobo.pSupply;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 5 * (height + margin), width, height), "Power Supply: None");
        }

        if (mobo.input != null)
        {
            if(GUI.Button(new Rect(left, top + 6 * (height + margin), width, height), "Input: " + mobo.input.name))
            {
                viewPart = mobo.input;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 6 * (height + margin), width, height), "Input: None");
        }

        if (mobo.output != null)
        {
            if(GUI.Button(new Rect(left, top + 7 * (height + margin), width, height), "Output: " + mobo.output.name))
            {
                viewPart = mobo.output;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 7 * (height + margin), width, height), "Output: None");
        }

        if (mobo.network != null)
        {
            if(GUI.Button(new Rect(left, top + 8 * (height + margin), width, height), "Network Service: " + mobo.network.name))
            {
                viewPart = mobo.network;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 8 * (height + margin), width, height), "Network Service: None");
        }

        if (mobo.chassis != null)
        {
            if (GUI.Button(new Rect(left, top + 9 * (height + margin), width, height), "Chassis: " + mobo.chassis.name))
            {
                viewPart = mobo.chassis;
            }
        }
        else
        {
            GUI.Button(new Rect(left, top + 9 * (height + margin), width, height), "Chassis: None");
        }
    }
Exemplo n.º 51
0
        private void MainComboEquipment_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ListOfEquipment.Columns.Clear();
                ListOfEquipment.Items.Refresh();

                switch (MainComboEquipment.SelectedItem)
                {
                case "Процессор":

                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.Processors)
                        {
                            list.Add(new TempData(item.ProcessorName, item.NumOfProcessor, item.ProcessorPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Материнская плата":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        Motherboard motherboard = new Motherboard();
                        foreach (var item in db.Motherboards)
                        {
                            list.Add(new TempData(item.MotherboardName, item.NumOfMotherboard, item.MotherboardPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Оперативная память":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.RAMs)
                        {
                            list.Add(new TempData(item.RAMName, item.NumOfRam, item.RAMPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Жесткий диск":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.HardDisks)
                        {
                            list.Add(new TempData(item.HardDiskName, item.NumOfHardDisk, item.HardDiskPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Видео карта":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.VideoCards)
                        {
                            list.Add(new TempData(item.VideoCardName, item.NumOfVideoCard, item.VideoCardPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Корпус":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.Cases)
                        {
                            list.Add(new TempData(item.CaseName, item.NumOfCase, item.CasePrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }

                case "Монитор":
                {
                    list.Clear();
                    list = new List <TempData>();
                    using (CompStorEntity db = new CompStorEntity())
                    {
                        foreach (var item in db.Monitors)
                        {
                            list.Add(new TempData(item.MonitorName, item.NumOfMonitor, item.MonitorPrice));
                        }
                    }
                    ListOfEquipment.ItemsSource = list;
                    break;
                }
                }
            }
            catch (Exception ex)

            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 52
0
        public void Seed(DatabaseContext context)
        {
            if (!context.Cases.Any())
            {
                var case1 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX", "mIATX"
                    },
                    Title          = "Carcasa Deepcool Tesseract BF black",
                    CoolerHeight   = 160,
                    Fans           = 1,
                    TotalFans      = 6,
                    ImageUrl       = "https://2.grgs.ro/images/products/1/634551/836749/full/tesseract-bf-black-9cf09a4f48b548f5b5374b800642349e.jpg",
                    NumberOfSlots  = 7,
                    Price          = 118.22,
                    Type           = "MiddleTower",
                    VideoCardWidth = 420,
                    Url            = "https://www.pcgarage.ro/carcase/deepcool/tesseract-bf-black/"
                };
                var case2 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX", "mIATX"
                    },
                    Title          = "Carcasa Segotep SG-K8 Black",
                    CoolerHeight   = 180,
                    Fans           = 1,
                    TotalFans      = 6,
                    ImageUrl       = "https://5.grgs.ro/images/products/1/1175151/1509310/full/sg-k8-black-e96126214d7b03f844ab330e1115b758.jpg",
                    NumberOfSlots  = 7,
                    Price          = 269.99,
                    Type           = "MiddleTower",
                    VideoCardWidth = 430,
                    Url            = "https://www.pcgarage.ro/carcase/segotep/sg-k8-black/"
                };
                var case3 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX"
                    },
                    Title          = "Carcasa Segotep Halo 5 Black",
                    CoolerHeight   = 165,
                    Fans           = 0,
                    TotalFans      = 7,
                    ImageUrl       = "https://1.grgs.ro/images/products/1/1469758/1582154/full/halo-5-black-ba466a1679747f9aa63734bb4da33dab.jpg",
                    NumberOfSlots  = 7,
                    Price          = 101.23,
                    Type           = "MiddleTower",
                    VideoCardWidth = 350,
                    Url            = "https://www.pcgarage.ro/carcase/segotep/halo-5-black/"
                };
                var case4 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX"
                    },
                    Title          = "Carcasa Zalman Z3 Plus",
                    CoolerHeight   = 160,
                    Fans           = 4,
                    TotalFans      = 5,
                    ImageUrl       = "https://4.grgs.ro/images/products/1/1/738746/full/z3-plus-81152446c4614a5058ebede7087e7993.jpg",
                    NumberOfSlots  = 7,
                    Price          = 192.78,
                    Type           = "MiddleTower",
                    VideoCardWidth = 360,
                    Url            = "https://www.pcgarage.ro/carcase/zalman/z3-plus/"
                };
                var case5 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX", "mITX"
                    },
                    Title          = "Carcasa Redragon Sidewipe Black",
                    CoolerHeight   = 160,
                    Fans           = 4,
                    TotalFans      = 7,
                    ImageUrl       = "https://4.grgs.ro/images/products/1/1630882/1632942/full/sidewipe-black-688744b8d79556ffef6047075a6c21e1.jpg",
                    NumberOfSlots  = 7,
                    Price          = 259.99,
                    Type           = "MiddleTower",
                    VideoCardWidth = 350,
                    Url            = "https://www.pcgarage.ro/carcase/redragon/sidewipe-black/"
                };
                var case6 = new Case
                {
                    _motherboardFormFactor = new List <string> {
                        "ATX", "mATX", "mITX"
                    },
                    Title          = "Carcasa Floston RED FIRE",
                    CoolerHeight   = 165,
                    Fans           = 2,
                    TotalFans      = 7,
                    ImageUrl       = "https://1.grgs.ro/images/products/1/1169071/1502262/full/red-fire-d3db42cd158464ce2c0f5df2c43b254c.jpg  ",
                    NumberOfSlots  = 7,
                    Price          = 110.63,
                    Type           = "MiddleTower",
                    VideoCardWidth = 350,
                    Url            = "https://www.pcgarage.ro/carcase/floston/red-fire/"
                };

                context.Cases.AddRange(case1, case2, case3, case4, case5, case6);
                context.SaveChanges();
            }
            if (!context.Cpus.Any())
            {
                var cpu1 = new Cpu
                {
                    Title    = "Intel Kaby Lake, Celeron Dual-Core G3930 2.90GHz box",
                    Price    = 162.99,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/959008/1441458/full/kaby-lake-celeron-dual-core-g3930-290ghz-box-f81190764abefa7f81d2e59aff5aa45e.jpg",
                    Socket           = "1151",
                    Series           = "Celeron Dual-Core",
                    BaseFrequency    = 2.9,
                    Cache            = 2,
                    Core             = "Kaby Lake",
                    Cores            = 2,
                    Threads          = 2,
                    HasStockCooler   = true,
                    TurboFrequency   = 2.9,
                    RamFrequency     = 2133,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/intel/kaby-lake-celeron-dual-core-g3930-290ghz-box/"
                };
                var cpu2 = new Cpu
                {
                    Title    = "AMD Ryzen 3 1200 3.1GHz box",
                    Price    = 421.99,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/1363661/1513246/full/ryzen-3-1200-31ghz-box-ae4e3d76ff92ca08e199b752537cb517.jpg",
                    Socket           = "AM4",
                    Series           = "Ryzen 3",
                    BaseFrequency    = 3.1,
                    Cache            = 8,
                    Core             = "Summit Ridge",
                    Cores            = 4,
                    Threads          = 4,
                    HasStockCooler   = true,
                    TurboFrequency   = 3.4,
                    RamFrequency     = 2400,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/amd/ryzen-3-1200-31ghz-box/"
                };
                var cpu3 = new Cpu
                {
                    Title    = "Intel Coffee Lake, Core i3 8100 3.60GHz box",
                    Price    = 533.79,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/1505170/1580274/full/coffee-lake-core-i3-8100-360ghz-box-35efcb7c044b3247c394a045b4d7926c.jpg",
                    Socket           = "1151 V2",
                    Series           = "Core i3 8th gen",
                    BaseFrequency    = 3.6,
                    Cache            = 6,
                    Core             = "Coffee Lake",
                    Cores            = 4,
                    Threads          = 4,
                    HasStockCooler   = true,
                    TurboFrequency   = 3.6,
                    RamFrequency     = 2400,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/intel/coffee-lake-core-i3-8100-360ghz-box/"
                };
                var cpu4 = new Cpu
                {
                    Title    = "Intel Kaby Lake, Core i7 7700K 4.20GHz box",
                    Price    = 1399.99,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/1427502/1437442/full/kaby-lake-core-i7-7700k-420ghz-box-db92e85515a9b91c41fe2d051410b229.jpg",
                    Socket           = "1151",
                    Series           = "Core i7 7th gen",
                    BaseFrequency    = 4.2,
                    Cache            = 8,
                    Core             = "Kaby Lake",
                    Cores            = 4,
                    Threads          = 8,
                    HasStockCooler   = false,
                    TurboFrequency   = 4.5,
                    RamFrequency     = 2400,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/intel/kaby-lake-core-i7-7700k-420ghz-box/"
                };
                var cpu5 = new Cpu
                {
                    Title    = "AMD Ryzen 7 2700X 3.7GHz box",
                    Price    = 1604.99,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1416562/1675620/full/ryzen-7-2700x-37ghz-box-40321da45d1494ae3de24d95f96624b3.jpg",
                    Socket           = "AM4",
                    Series           = "Ryzen 7",
                    BaseFrequency    = 3.7,
                    Cache            = 16,
                    Core             = "Pinnacle Ridge",
                    Cores            = 8,
                    Threads          = 16,
                    HasStockCooler   = true,
                    TurboFrequency   = 4.3,
                    RamFrequency     = 2933,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/amd/ryzen-7-2700x-37ghz-box/"
                };
                var cpu6 = new Cpu
                {
                    Title    = "Intel Kaby Lake, Core i3 7100 3.9GHz box",
                    Price    = 502.40,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/1109408/1440114/full/intel-kaby-lake-core-i3-7100-39-ghz-box-21bf9b82937b94d75b8f20872eb5453f.jpg",
                    Socket           = "1151",
                    Series           = "Core i3 7th gen",
                    BaseFrequency    = 3.9,
                    Cache            = 3,
                    Core             = "Kaby Lake",
                    Cores            = 2,
                    Threads          = 4,
                    HasStockCooler   = true,
                    TurboFrequency   = 3.9,
                    RamFrequency     = 2400,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Url = "https://www.pcgarage.ro/procesoare/intel/kaby-lake-core-i3-7100-39ghz-box/"
                };
                context.Cpus.AddRange(cpu1, cpu2, cpu3, cpu4, cpu5, cpu6);
                context.SaveChanges();
            }
            if (!context.Coolers.Any())
            {
                var cooler1 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156",
                        "1151 V2"
                    },
                    Title    = "Cooler CPU Deepcool CK-11509",
                    Price    = 11.42,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/959008/1192699/full/ck-11509-f8e7eddf9b6194283d19ace9e9a9e192.jpg",
                    Fans      = 1,
                    FanSize   = 92,
                    FanSpeed  = "2200 RPM",
                    HeatPipes = 1,
                    Height    = 56,
                    Noise     = "26.1 dBA",
                    Type      = "Air",
                    Url       = "https://www.pcgarage.ro/coolere/deepcool/ck-11509-1/"
                };
                var cooler2 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156", "AM2", "AM3", "FM1", "AM4"
                    },
                    Title    = "Cooler CPU Deepcool GAMMAXX 200T",
                    Price    = 46.80,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/3/1137703/full/gammaxx-200t-08df8365e72f5284e08f1a6f8c499eaa.jpg",
                    Fans      = 1,
                    FanSize   = 120,
                    FanSpeed  = "900 - 1600 RPM",
                    HeatPipes = 1,
                    Height    = 131,
                    Noise     = "17.8 - 26.1 dBA",
                    Type      = "Air",
                    Url       = "https://www.pcgarage.ro/coolere/deepcool/gammaxx-200t/"
                };
                var cooler3 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156", "2011"
                    },
                    Title    = "Cooler CPU ID-Cooling ICEKIMO 120 Blue",
                    Price    = 243.26,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/959008/1429930/full/icekimo-120-blue-db1d26a4483dfd83864b524218eb2343.jpg",
                    Fans      = 1,
                    FanSize   = 120,
                    FanSpeed  = "600 - 1600 RPM",
                    HeatPipes = 1,
                    Height    = 56,
                    Noise     = "16.2 - 30.5 dBA",
                    Type      = "Water",
                    Url       = "https://www.pcgarage.ro/coolere/id-cooling/icekimo-120-blue/"
                };
                var cooler4 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156", "2011", "AM4"
                    },
                    Title    = "Cooler CPU Deepcool GAMMAXX 300",
                    Price    = 80.07,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/4/369867/full/gammaxx300-a3dc52ee426b5980936d02dbb2a88749.jpg",
                    Fans      = 1,
                    FanSize   = 120,
                    FanSpeed  = "900 - 1600 rpm",
                    HeatPipes = 3,
                    Height    = 136,
                    Noise     = "17.8 - 21 dB(A)",
                    Type      = "Air",
                    Url       = "https://www.pcgarage.ro/coolere/deepcool/gammaxx300/"
                };
                var cooler5 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156", "2011", "AM4"
                    },
                    Title    = "Cooler CPU ID-Cooling SE-213v2",
                    Price    = 72.77,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1088254/1136948/full/se-213v2-c268f602dfef68c9e200d8b607508eb8.jpg",
                    Fans      = 1,
                    FanSize   = 120,
                    FanSpeed  = "800 - 1600 RPM",
                    HeatPipes = 3,
                    Height    = 140,
                    Noise     = "16 - 20.2 dBA",
                    Type      = "Air",
                    Url       = "https://www.pcgarage.ro/coolere/id-cooling/se-213v2/"
                };
                var cooler6 = new Cooler
                {
                    _compatibleSockets = new List <string>
                    {
                        "775",
                        "1150",
                        "1151",
                        "1155",
                        "1156", "2011"
                    },
                    Title    = "Cooler CPU Deepcool Captain 120 EX",
                    Price    = 243.26,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/1052635/1386829/full/captain-120-ex-0c1d28bdb97b86f9f3eac11c6d0e7af6.jpg",
                    Fans      = 1,
                    FanSize   = 120,
                    FanSpeed  = "500 - 1800 RPM",
                    HeatPipes = 1,
                    Height    = 56,
                    Noise     = "17.6 - 31.3 dBA",
                    Type      = "Water",
                    Url       = "https://www.pcgarage.ro/coolere/deepcool/captain-120-ex/"
                };
                context.AddRange(cooler1, cooler2, cooler3, cooler4, cooler5, cooler6);
                context.SaveChanges();
            }
            if (!context.Motherboards.Any())
            {
                var motherboard1 = new Motherboard
                {
                    Title    = "ASRock A320M-DGS",
                    Price    = 224.12,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/1469770/1506238/full/a320m-dgs-97a358a6820b3c5bd713b94babdfab48.jpg",
                    FormFactor       = "mATX",
                    Socket           = "AM4",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 4,
                    M2               = 1,
                    RamSlots         = 2,
                    RamFrequency     = 3200,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 32,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/asrock/a320m-dgs/"
                };
                var motherboard2 = new Motherboard
                {
                    Title    = "ASUS H110M-K",
                    Price    = 229.71,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/1088099/1145358/full/h110m-k-37d2ce4102228154aff209d5cb306595.jpg",
                    FormFactor       = "mATX",
                    Socket           = "1151",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 4,
                    M2               = 0,
                    RamSlots         = 2,
                    RamFrequency     = 2133,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 32,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/asus/h110m-k/"
                };
                var motherboard3 = new Motherboard
                {
                    Title    = "MSI H310M PRO-VD",
                    Price    = 285.29,
                    ImageUrl =
                        "https://1.grgs.ro/images/products/1/1664836/1675040/full/h310m-pro-vd-4f8bf71c8343100814de80c6be07487c.jpg",
                    FormFactor       = "mATX",
                    Socket           = "1151 v2",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 4,
                    M2               = 0,
                    RamSlots         = 2,
                    RamFrequency     = 2666,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 32,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/msi/h310m-pro-vd/"
                };
                var motherboard4 = new Motherboard
                {
                    Title    = "GIGABYTE GA-B250M-D3H",
                    Price    = 365.49,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1088254/1438642/full/ga-b250m-d3h-eb62a3e51ed0b7073e16ec84a3c20fcc.jpg",
                    FormFactor       = "mATX",
                    Socket           = "1151",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 6,
                    M2               = 1,
                    RamSlots         = 4,
                    RamFrequency     = 2400,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/gigabyte/b250m-d3h/"
                };
                var motherboard5 = new Motherboard
                {
                    Title    = "MSI B350 PC MATE",
                    Price    = 404.22,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/1358815/1474654/full/b350-pc-mate-9622702829f1cb1a4292bccf809fe445.jpg",
                    FormFactor       = "mATX",
                    Socket           = "AM4",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 4,
                    M2               = 1,
                    RamSlots         = 4,
                    RamFrequency     = 3200,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/msi/b350-pc-mate/"
                };
                var motherboard6 = new Motherboard
                {
                    Title    = "GIGABYTE AORUS Z370 Gaming K3",
                    Price    = 653.06,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1409094/1541334/full/z370-aorus-gaming-k3-5473ecf4d47af90ae1b88abd190d21ab.jpg",
                    FormFactor       = "ATX",
                    Socket           = "1151 v2",
                    GraphicInterface = "PCI Express x16 3.0",
                    Sata             = 6,
                    M2               = 2,
                    RamSlots         = 4,
                    RamFrequency     = 4000,
                    TypeOfRam        = "DDR4",
                    MaximumRamMemory = 64,
                    Network          = "10/100/1000 Mbps",
                    Url              = "https://www.pcgarage.ro/placi-de-baza/gigabyte/aorus-z370-gaming-k3/"
                };
                context.Motherboards.AddRange(motherboard1, motherboard2, motherboard3, motherboard4, motherboard5, motherboard6);
                context.SaveChanges();
            }
            if (!context.Rams.Any())
            {
                var ram1 = new Ram
                {
                    Title     = "Patriot Signature 8GB DDR4 2400MHz CL17 1.2V Dual Channel Kit",
                    Price     = 443.74,
                    ImageUrl  = "https://4.grgs.ro/images/products/1/922/1644880/full/signature-8gb-ddr4-2400mhz-cl17-12v-dual-channel-kit-5c3e89801c913cadf8371488fef881f8.jpeg",
                    Capacity  = 8,
                    Frequency = 2400,
                    Latency   = "17 CL",
                    Standard  = "PC4-19200",
                    Type      = "DDR4",
                    Url       = "https://www.pcgarage.ro/memorii/patriot/signature-8gb-ddr4-2400mhz-cl17-12v-dual-channel-kit/"
                };
                var ram2 = new Ram
                {
                    Title     = "Patriot Signature Line Heatspreader 8GB DDR3 1333MHz CL9 Dual Channel Kit 1.5v",
                    Price     = 313.70,
                    ImageUrl  = "https://4.grgs.ro/images/products/1/735074/806485/full/signature-line-heatspreader-8gb-ddr3-1333mhz-cl9-dual-channel-kit-15v-f139779e54e7cd5c4da771606c05acf6.jpg",
                    Capacity  = 8,
                    Frequency = 1333,
                    Latency   = "9 CL",
                    Standard  = "PC3-10600",
                    Type      = "DDR3",
                    Url       = "https://www.pcgarage.ro/memorii/patriot/signature-line-heatspreader-8gb-ddr3-1333mhz-cl9-dual-channel-kit-15v/"
                };
                var ram3 = new Ram
                {
                    Title     = "Corsair Dominator Platinum 8GB DDR4 3200MHz CL16 Dual Channel Kit",
                    Price     = 727.11,
                    ImageUrl  = "https://5.grgs.ro/images/products/1/1263508/1509726/full/dominator-platinum-8gb-ddr4-3200mhz-cl16-dual-channel-kit-69f8a4a5864c59f174acd70a00069ff5.jpg",
                    Capacity  = 8,
                    Frequency = 3200,
                    Latency   = "16 CL",
                    Standard  = "PC4-25600",
                    Type      = "DDR4",
                    Url       = "https://www.pcgarage.ro/memorii/corsair/dominator-platinum-8gb-ddr4-3200mhz-cl16-dual-channel-kit/"
                };
                var ram4 = new Ram
                {
                    Title     = "HyperX Fury Red 8GB DDR4 2400MHz CL15 1.2v",
                    Price     = 434.15,
                    ImageUrl  = "https://2.grgs.ro/images/products/1/812812/1479858/full/fury-red-8gb-ddr4-2400mhz-cl15-12v-bc58ca971de5d9a290d1c51c662a9f7a.jpg",
                    Capacity  = 8,
                    Frequency = 2400,
                    Latency   = "15 CL",
                    Standard  = "PC4-19200",
                    Type      = "DDR4",
                    Url       = "https://www.pcgarage.ro/memorii/hyperx/fury-red-8gb-ddr4-2400mhz-cl15-12v/"
                };
                var ram5 = new Ram
                {
                    Title = "Corsair Vengeance LPX Black 16GB DDR4 2133MHz CL13 Quad Channel Kit",
                    Price = 1032.41,
                    ImageUrl
                              = "https://5.grgs.ro/images/products/1/3/981307/full/vengeance-lpx-black-16gb-ddr4-2400mhz-cl14-quad-channel-kit-2e21bbdaac59e5c55e29758c59e38566.jpg",
                    Capacity  = 16,
                    Frequency = 2133,
                    Latency   = "13 CL",
                    Standard  = "PC4-17000",
                    Type      = "DDR4",
                    Url       = "https://www.pcgarage.ro/memorii/corsair/vengeance-lpx-black-16gb-ddr4-2133mhz-cl13-quad-channel-kit/"
                };
                var ram6 = new Ram
                {
                    Title    = "Corsair Dominator Platinum 16GB DDR4 2666MHz CL15 Quad Channel Kit",
                    Price    = 1296.34,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/2/882902/full/dominator-platinum-16gb-ddr4-2660mhz-cl15-quad-channel-kit-7a5c41c6cf5734dff94f7eb6f7d17f52.jpg",
                    Capacity  = 16,
                    Frequency = 2666,
                    Latency   = "15 CL",
                    Standard  = "PC4-21300",
                    Type      = "DDR4",
                    Url       = "https://www.pcgarage.ro/memorii/corsair/dominator-platinum-16gb-ddr4-2660mhz-cl15-quad-channel-kit/"
                };
                context.Rams.AddRange(ram1, ram2, ram3, ram4, ram5, ram6);
                context.SaveChanges();
            }
            if (!context.VideoCards.Any())
            {
                var videocard1 = new VideoCard
                {
                    Title    = "Sapphire Radeon RX 560 PULSE 2GB DDR5 128-bit Lite",
                    Price    = 666.54,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1420862/1598530/full/radeon-rx-560-pulse-2gb-ddr5-128-bit-b3afe28abc822bd03cd620b3e354c35a.jpg",
                    Interface       = "PCI Express x8 3.0",
                    BaseFrequency   = 1226,
                    GpuBoostClock   = 1226,
                    MemoryFrequency = 6000,
                    MemorySize      = 2,
                    MemoryBus       = 128,
                    Resolution      = "3840x2160 pixels",
                    Type            = "GDDR5",
                    Width           = 210,
                    Url             = "https://www.pcgarage.ro/placi-video/sapphire/radeon-rx-560-pulse-2gb-ddr5-128-bit-lite/"
                };
                var videocard2 = new VideoCard
                {
                    Title    = "MSI GeForce GTX 1050 Ti GAMING X 4GB DDR5 128-bit",
                    Price    = 1013.23,
                    ImageUrl =
                        "https://2.grgs.ro/images/products/1/1416562/1422550/full/geforce-gtx-1050-ti-gaming-x-4gb-ddr5-128-bit-72e7b5b7bc239016033069836ea2c98e.jpg",
                    Interface       = "PCI Express x16 3.0",
                    BaseFrequency   = 1379,
                    GpuBoostClock   = 1493,
                    MemoryFrequency = 7008,
                    MemorySize      = 4,
                    MemoryBus       = 128,
                    Resolution      = "7680x4320 pixels",
                    Type            = "GDDR5",
                    Width           = 229,
                    Url             = "https://www.pcgarage.ro/placi-video/msi/geforce-gtx-1050-ti-gaming-x-4gb-ddr5-128-bit/"
                };
                var videocard3 = new VideoCard
                {
                    Title    = "GIGABYTE GeForce GTX 1060 G1 GAMING 3GB DDR5 192-bit",
                    Price    = 1401.18,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/1355434/1402571/full/geforce-gtx-1060-g1-gaming-6gb-ddr5-192-bit-03a069572d97f70319d04dbc2d2e1532.jpg",
                    Interface       = "PCI Express x16 3.0",
                    BaseFrequency   = 1594,
                    GpuBoostClock   = 1847,
                    MemoryFrequency = 8008,
                    MemorySize      = 3,
                    MemoryBus       = 192,
                    Resolution      = "7680x4320 pixels",
                    Type            = "GDDR5",
                    Width           = 278,
                    Url             = "https://www.pcgarage.ro/placi-video/gigabyte/geforce-gtx-1060-g1-gaming-3gb-ddr5-192-bit/"
                };
                var videocard4 = new VideoCard
                {
                    Title    = "GIGABYTE GeForce GTX 1080 Ti GAMING OC 11GB DDR5X 352-bit",
                    Price    = 4601.79,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/1415042/1474626/full/geforce-gtx-1080-ti-gaming-oc-11gb-ddr5x-352-bit-9339afd86a8c30d416dbc05616195577.jpg",
                    Interface       = "PCI Express x16 3.0",
                    BaseFrequency   = 1544,
                    GpuBoostClock   = 1657,
                    MemoryFrequency = 11010,
                    MemorySize      = 11,
                    MemoryBus       = 352,
                    Resolution      = "7680x4320 pixels",
                    Type            = "GDDR5",
                    Width           = 280,
                    Url             = "https://www.pcgarage.ro/placi-video/gigabyte/geforce-gtx-1080-ti-gaming-oc-11gb-ddr5x-352-bit/"
                };
                var videocard5 = new VideoCard
                {
                    Title    = "Palit GeForce GTX 1080 Super JetStream 8GB GDDR5X 256-bit",
                    Price    = 2732.66,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/1094679/1406166/full/geforce-gtx-1080-super-jetstream-8gb-gddr5x-256-bit-b337f7f2c59786ca00fd010b901aa8b9.jpg",
                    Interface       = "PCI Express x16 3.0",
                    BaseFrequency   = 1708,
                    GpuBoostClock   = 1847,
                    MemoryFrequency = 10000,
                    MemorySize      = 8,
                    MemoryBus       = 256,
                    Resolution      = "7680x4320 pixels",
                    Type            = "GDDR5",
                    Width           = 285,
                    Url             = "https://www.pcgarage.ro/placi-video/palit/geforce-gtx-1080-super-jetstream-8gb-gddr5x-256-bit/"
                };
                var videocard6 = new VideoCard
                {
                    Title    = "ASUS GeForce GTX 1070 Ti STRIX GAMING A8G 8GB DDR5 256-bit",
                    Price    = 2960.39,
                    ImageUrl =
                        "https://1.grgs.ro/images/products/1/1475490/1597666/full/geforce-gtx-1070-ti-strix-gaming-a8g-8gb-ddr5-256-bit-544cdff8fc922c847f1b391e413e8b0d.jpg",
                    Interface       = "PCI Express x16 3.0",
                    BaseFrequency   = 1607,
                    GpuBoostClock   = 1759,
                    MemoryFrequency = 8008,
                    MemorySize      = 8,
                    MemoryBus       = 256,
                    Resolution      = "7680x4320 pixeli",
                    Type            = "GDDR5",
                    Width           = 298,
                    Url             = "https://www.pcgarage.ro/placi-video/asus/geforce-gtx-1070-ti-strix-gaming-a8g-8gb-ddr5-256-bit/"
                };
                context.VideoCards.AddRange(videocard1, videocard2, videocard3, videocard4, videocard5, videocard6);
                context.SaveChanges();
            }
            if (!context.Storages.Any())
            {
                var storage1 = new Storage
                {
                    Title      = "SSD Kingston A400 120GB SATA-III 2.5 inch",
                    Price      = 145.99,
                    ImageUrl   = "https://1.grgs.ro/images/products/1/1427502/1487666/full/a400-120gb-sata-iii-25-inch-ace5ac38fb969418fdf46f467226e385.jpg",
                    Capacity   = "120 GB",
                    FormFactor = "2.5 inch",
                    Interface  = "SATA-III",
                    ReadSpeed  = "500 MB/s",
                    WriteSpeed = "320 MB/s",
                    Rpm        = "0",
                    Url        = "https://www.pcgarage.ro/ssd/kingston/a400-120gb-sata-iii-25-inch/"
                };
                var storage2 = new Storage
                {
                    Title      = "SSD WD NEW Green 120GB SATA-III M.2 2280",
                    Price      = 156.68,
                    ImageUrl   = "https://5.grgs.ro/images/products/1/1094679/1619870/full/green-120gb-sata-iii-m2-2280-97217b3c0f7074000c5a992caa221ed6.jpg",
                    Capacity   = "120 GB",
                    FormFactor = "M.2",
                    Interface  = "SATA-III",
                    ReadSpeed  = "540 MB/s",
                    WriteSpeed = "430 MB/s",
                    Rpm        = "0",
                    Url        = "https://www.pcgarage.ro/ssd/western-digital/new-green-120gb-sata-iii-m2-2280/"
                };
                var storage3 = new Storage
                {
                    Title      = "Hard disk WD Blue 1TB SATA-III 7200 RPM 64MB",
                    Price      = 209.99,
                    ImageUrl   = "https://1.grgs.ro/images/products/1/5/376435/full/blue-1tb-sata-iii-7200-rpm-64mb-c80ce3c15c30d4fb80c1af17bd3757e5.jpg",
                    Capacity   = "1 TB",
                    FormFactor = "3.5 inch",
                    Interface  = "SATA-III",
                    ReadSpeed  = "",
                    WriteSpeed = "",
                    Rpm        = "7200 RPM",
                    Url        = "https://www.pcgarage.ro/hard-disk-uri/western-digital/1tb-sata-iii-7200-rpm-64mb-caviar-blue/"
                };
                var storage4 = new Storage
                {
                    Title      = "Seagate BarraCuda 4TB SATA-III 5900RPM 64MB",
                    Price      = 599.99,
                    ImageUrl   = "https://3.grgs.ro/images/products/1/1025736/1407646/full/barracuda-500gb-sata-iii-7200rpm-16mb-c03782da177728a63b5f5d6b944018d2.jpg",
                    Capacity   = "4 TB",
                    FormFactor = "3.5 inch",
                    Interface  = "SATA-III",
                    ReadSpeed  = "",
                    WriteSpeed = "",
                    Rpm        = "5900 RPM",
                    Url        = "https://www.pcgarage.ro/hard-disk-uri/seagate/barracuda-4tb-sata-iii-5900rpm-64mb/"
                };
                var storage5 = new Storage
                {
                    Title      = "Hard disk WD Blue 1TB SATA-III 7200 RPM 64MB",
                    Price      = 219.99,
                    ImageUrl   = "https://2.grgs.ro/images/products/1/1457254/1531027/full/545s-series-256gb-sata-iii-25-inch-e9ec1523e5079617dfba68a045b48ccf.jpg",
                    Capacity   = "128 GB",
                    FormFactor = "2.5 inch",
                    Interface  = "SATA-III",
                    ReadSpeed  = "550 MB/s",
                    WriteSpeed = "440 MB/s",
                    Rpm        = "0",
                    Url        = "https://www.pcgarage.ro/ssd/intel/ssd-intel-545s-series-128gb-sata-iii-25-inch/"
                };
                var storage6 = new Storage
                {
                    Title      = "Intel 760p Series 128GB PCI Express 3.0 x4 M.2 2280",
                    Price      = 382.11,
                    ImageUrl   = "https://4.grgs.ro/images/products/1/1634078/1637132/full/760p-series-256gb-pci-express-30-x4-m2-2280-ea223a0073fbd79fab00ed0d9febbe47.jpg",
                    Capacity   = "128 GB",
                    FormFactor = "M.2",
                    Interface  = "SATA-III",
                    ReadSpeed  = "1640 MB/s",
                    WriteSpeed = "650 MB/s",
                    Rpm        = "0",
                    Url        = "https://www.pcgarage.ro/ssd/intel/760p-series-128gb-pci-express-30-x4-m2-2280/"
                };
                context.Storages.AddRange(storage1, storage2, storage3, storage4, storage5, storage6);
                context.SaveChanges();
            }
            if (!context.PowerSupplies.Any())
            {
                var powersupply1 = new PowerSupply
                {
                    Title    = "Sursa Inter-Tech SL-500 PLUS 500W",
                    Price    = 119.56,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/986897/1166167/full/sl-500-plus-500w-397fbe5517714543cdba0349681d4746.jpg",
                    Certificate = "-",
                    Cooler      = "1x 120 mm",
                    Efficiency  = "90.2 %",
                    IsModular   = false,
                    Pfc         = "Active",
                    Power       = "500 W"
                };
                var powersupply2 = new PowerSupply
                {
                    Title    = "Sursa Corsair VS Series VS550, 80+ , 550W",
                    Price    = 213.44,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1630882/1633630/full/vs-series-vs550-80-plus-550w-eebbc36465833303550c5b2e5ab47955.jpg",
                    Certificate = "80+",
                    Cooler      = "1x 120 mm",
                    Efficiency  = "85 %",
                    IsModular   = false,
                    Pfc         = "Active",
                    Power       = "550 W"
                };
                var powersupply3 = new PowerSupply
                {
                    Title    = "Sursa Seasonic M12II-620 EVO Edition Bronze 620W",
                    Price    = 324.99,
                    ImageUrl =
                        "https://3.grgs.ro/images/products/1/1/796171/full/m12ii-620-evo-edition-bronze-620w-483c4147ce1f871ef3828319b7535f0d.jpg",
                    Certificate = "80+ Bronze",
                    Cooler      = "1x 120 mm",
                    Efficiency  = "87 %",
                    IsModular   = true,
                    Pfc         = "Active",
                    Power       = "620 W"
                };
                var powersupply4 = new PowerSupply
                {
                    Title    = "Seasonic M12II-620 EVO Edition Bronze 620W",
                    Price    = 179.74,
                    ImageUrl =
                        "https://1.grgs.ro/images/products/1/1703884/1704464/full/fx700b-700w-bulk-25b092993f2415a8a546223fe595f417.jpg",
                    Certificate = "-",
                    Cooler      = "1x 140 mm",
                    Efficiency  = "85 %",
                    IsModular   = true,
                    Pfc         = "Active",
                    Power       = "700 W",
                    Url         = "https://www.pcgarage.ro/surse/keepout/fx700b-700w-bulk/"
                };
                var powersupply5 = new PowerSupply
                {
                    Title    = "Seasonic M12II-620 EVO Edition Bronze 620W",
                    Price    = 196.50,
                    ImageUrl =
                        "https://5.grgs.ro/images/products/1/1517618/1536738/full/hpe-500br-a12s-646c638df72662db7d8c60ab51f6c980.jpg",
                    Certificate = "80+ Bronze",
                    Cooler      = "1x 120 mm",
                    Efficiency  = "85 %",
                    IsModular   = true,
                    Pfc         = "Active",
                    Power       = "500 W",
                    Url         = "https://www.pcgarage.ro/surse/sirtec-high-power/500br-a12s-80-plus-bronze-500w/"
                };
                var powersupply6 = new PowerSupply
                {
                    Title    = "Segotep H9PLUS+ 520W",
                    Price    = 209.99,
                    ImageUrl =
                        "https://4.grgs.ro/images/products/1/1175151/1429762/full/segotep-nuclear-aircraft-carrier-h9plus-plus-520w-modular-psu-34faf545f2102abdd4d03715cc2ecd65.jpg",
                    Certificate = "80+ Bronze",
                    Cooler      = "1x 120 mm",
                    Efficiency  = "87 %",
                    IsModular   = true,
                    Pfc         = "Active",
                    Power       = "520 W",
                    Url         = "https://www.pcgarage.ro/surse/segotep/h9plus-plus-520w/"
                };
                context.PowerSupplies.AddRange(powersupply1, powersupply2, powersupply3, powersupply4, powersupply5, powersupply6);
                context.SaveChanges();
            }
        }
Exemplo n.º 53
0
    void renderComputerInfoBox(float left, float top, float width, float height, float textAreaHeight, float textAreaMargin, Motherboard mobo)
    {
        GUI.Box(new Rect(left, top, width, height), "Your Rig");

        renderComputerStats(left + 10, top + 25, width - 20, textAreaHeight, textAreaMargin, mobo);
    }