static void Main() { Components mcardVLC = new MotherBoard("VLC", (decimal)185.98); Components vcardRadeon = new GraphicsCard("Radeon", (decimal)102.34, "the best grafic card forever"); Components vcardGeForce = new GraphicsCard("GeForce", (decimal)154.45, "is not worth"); Components procIntel = new Processor("Intel", (decimal)346.563, "can be better"); Components procAMD = new Processor("AMD", (decimal)405.239, "always the best"); Components procMac = new Processor("IOS", 2000m, "It is okaaaay"); Computer mac = new Computer("Mac", new List<Components>() { mcardVLC, vcardRadeon, vcardGeForce }); Computer windows = new Computer("Windows"); windows.Components.Add(procIntel); windows.Components.Add(procAMD); windows.Components.Add(procMac); //Console.WriteLine(windows); Computer linux = new Computer("Linux", new List<Components>() { mcardVLC, vcardGeForce, vcardRadeon, procAMD, procIntel, procMac }); List<Computer> computers = new List<Computer>() { mac, windows, linux }; computers.OrderBy(p => p.TotalPrice).ToList().ForEach(p => Console.WriteLine(p.ToString())); //or //computers.OrderBy(a => a.TotalPrice); //foreach (var computer in computers) //{ // Console.WriteLine(computer); //} }
public static ICollection <GraphicsCard> GetGraphicsCards() { List <GraphicsCard> gpuList = new List <GraphicsCard>(); string[] requiredProperties = new string[] { "AdapterRAM", "Caption", "Description", "Name" }; WmiClassCollection classCollection = Wmi.Query(Wmi.VIDEOCONTROLLER_CLASSNAME, requiredProperties); if (classCollection == null) { return(gpuList); } foreach (WmiClass wmiClass in classCollection) { GraphicsCard gpu = new GraphicsCard( (uint?)wmiClass["AdapterRAM"].Value, (string)wmiClass["Caption"].Value, (string)wmiClass["Description"].Value, (string)wmiClass["Name"].Value); gpuList.Add(gpu); } return(gpuList); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price")] GraphicsCard graphicsCard) { if (id != graphicsCard.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(graphicsCard); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GraphicsCardExists(graphicsCard.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(graphicsCard)); }
public void MemberwiseCloneTest() { var gpu = new GraphicsCard { AmountOfRam = 4, GpuFrequency = 1.1m }; var computer = new Computer { AmountOfCores = 4, AmountOfRam = 32, CpuFrequency = 3.4m, DriveType = "ssd", Gpu = gpu }; var computer2 = (Computer)computer.Clone(); Assert.AreNotSame(computer2, computer); Assert.AreNotSame(computer2.AmountOfCores, computer.AmountOfCores); Assert.AreNotSame(computer2.AmountOfRam, computer.AmountOfRam); Assert.AreNotSame(computer2.CpuFrequency, computer.CpuFrequency); Assert.AreSame(computer2.DriveType, computer.DriveType); Assert.AreEqual(computer2.Gpu.AmountOfRam, computer.Gpu.AmountOfRam); Assert.AreEqual(computer2.Gpu.GpuFrequency, computer.Gpu.GpuFrequency); computer.Gpu.AmountOfRam = 8; Assert.AreNotEqual(computer2.Gpu.AmountOfRam, computer.Gpu.AmountOfRam); }
// Token: 0x06000056 RID: 86 RVA: 0x00002CF8 File Offset: 0x00000EF8 public static ICollection <GraphicsCard> GetGraphicsCards() { List <GraphicsCard> list = new List <GraphicsCard>(); string[] properties = new string[] { "AdapterRAM", "Caption", "Description", "Name" }; WmiClassCollection wmiClassCollection = Wmi.Query("Win32_VideoController", properties, null); bool flag = wmiClassCollection == null; ICollection <GraphicsCard> result; if (flag) { result = list; } else { foreach (WmiClass wmiClass in wmiClassCollection) { GraphicsCard item = new GraphicsCard((uint?)wmiClass["AdapterRAM"].Value, (string)wmiClass["Caption"].Value, (string)wmiClass["Description"].Value, (string)wmiClass["Name"].Value); list.Add(item); } result = list; } return(result); }
public async Task <IActionResult> Create(GraphicsCard model) { try { if (model.ImageFile != null) { model.ImageTitle = model.ImageFile.FileName; model.ImageData = ImageManager.GetByteArrayFromImage(model.ImageFile); } using (var httpClient = new HttpClient()) { var content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); using (HttpResponseMessage response = await httpClient.PostAsync(string.Format("{0}/{1}", this.apiBaseUrl, this.apiController), content)) { string apiResponse = await response.Content.ReadAsStringAsync(); //receivedReservation = JsonConvert.DeserializeObject<Reservation>(apiResponse); } } return(this.RedirectToAction(nameof(Index))); } catch { return(this.View()); } }
public async Task <IActionResult> Edit(Guid id, GraphicsCard model) { try { if (model == null) { return(this.NotFound()); } if (model.ImageFile != null) { model.ImageTitle = model.ImageFile.FileName; model.ImageData = ImageManager.GetByteArrayFromImage(model.ImageFile); } model.GraphicsCardId = id; string accessToken = await this.HttpContext.GetTokenAsync("access_token"); await ApiRequests.PutAsync(accessToken, string.Format("{0}/{1}", this.apiBaseUrl, this.apiController), model); return(this.RedirectToAction(nameof(Index))); } catch { return(this.View()); } }
public void MemberwiseCloneTest() { var gpu = new GraphicsCard { AmountOfRam = 4, GpuFrequency = 1.1m }; var computer = new Computer { AmountOfCores = 64, AmountOfRam = 256, CpuFrequency = 3.4m, DriveType = "ssd", Gpu = gpu }; var computer2 = (Computer)computer.Clone(); Assert.AreNotSame(computer2, computer); Assert.AreNotSame(computer2.AmountOfCores, computer.AmountOfCores); Assert.AreNotSame(computer2.AmountOfRam, computer.AmountOfRam); Assert.AreNotSame(computer2.CpuFrequency, computer.CpuFrequency); Assert.AreSame(computer2.DriveType, computer.DriveType); Assert.AreEqual(computer2.Gpu.AmountOfRam, computer.Gpu.AmountOfRam); Assert.AreEqual(computer2.Gpu.GpuFrequency, computer.Gpu.GpuFrequency); computer.Gpu.AmountOfRam = 8; Assert.AreNotEqual(computer2.Gpu.AmountOfRam, computer.Gpu.AmountOfRam); }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (Processor.Length != 0) { hash ^= Processor.GetHashCode(); } if (Motherboard.Length != 0) { hash ^= Motherboard.GetHashCode(); } if (GraphicsCard.Length != 0) { hash ^= GraphicsCard.GetHashCode(); } if (Ram.Length != 0) { hash ^= Ram.GetHashCode(); } if (Os.Length != 0) { hash ^= Os.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public Programmer() { poleProc = new Processor(null, null, null, 2100, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, null, 300, 0, 0); poleRAM = new RandomAccessMemory(null, null, 8, null, 0, 0); poleGCard = new GraphicsCard(null, null, 0, 0, 0); }
public override string ToString() { return($"PC Info:\n\t>>> Processor: {Processor} - {ProcessorInGHz} GHz - {ProcessorCount} cores.\n\t" + $">>> RAM: {RAMType.ToString()} {RAMSizeInGb} Gb.\n\t" + $">>> Graphics card: {GraphicsCard.ToString()} {GraphicsCardMemoryInMb} Mb.\n\t" + $">>> Hard Disk: {HardDiskType.ToString()} {HardDiskSizeInGb} Gb.\n\t" + $">>> OS: {OperatingSystemType.ToString()} {OperatingSystemVersion}."); }
public ActionResult DeleteConfirmed(int id) { GraphicsCard graphicsCard = db.GraphicsCards.Find(id); db.GraphicsCards.Remove(graphicsCard); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Initializes a new instance of the <see cref="Display"/> struct. /// </summary> /// <param name="index">The index of the <see cref="Display"/>.</param> /// <param name="deviceName">The name of the <see cref="Display"/>.</param> /// <param name="width">The with of the <see cref="Display"/>.</param> /// <param name="height">The height of the <see cref="Display"/>.</param> /// <param name="graphicsCard">The <see cref="GraphicsCard"/> this <see cref="Display"/> is connected to.</param> public Display(int index, string deviceName, int width, int height, GraphicsCard graphicsCard) { this.Index = index; this.DeviceName = deviceName; this.Width = width; this.Height = height; this.GraphicsCard = graphicsCard; }
public DeathStranding() { poleProc = new Processor(null, null, null, 3400, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, "ssd", 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 8, null, 0, 0); poleGCard = new GraphicsCard(null, null, 6, 0, 0); }
public DataScience() { poleProc = new Processor(null, null, null, 2100, 8, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 4, 0); poleMem = new MemoryDisc(null, null, null, 1000, 0, 0); poleRAM = new RandomAccessMemory(null, null, 32, null, 0, 0); poleGCard = new GraphicsCard(null, null, 11, 0, 0); }
public Photo() { poleProc = new Processor(null, null, null, 2100, 0, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, "ssd", 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 16, null, 0, 0); poleGCard = new GraphicsCard(null, null, 4, 0, 0); }
public Office() { poleProc = new Processor(null, null, null, 1600, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 4, 0); poleMem = new MemoryDisc(null, null, null, 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 4, null, 0, 0); poleGCard = new GraphicsCard(null, null, 0, 0, 0); }
/// <summary> /// Full computer constructor /// </summary> /// <param name="hardDrive">Its hard drive</param> /// <param name="motherboard">Its motherboard</param> /// <param name="cpu">Its CPU</param> /// <param name="memory">Its memory</param> /// <param name="graphicsCard">Its graphic card</param> /// <param name="case">Its case</param> public Computer(HardDrive hardDrive, Motherboard motherboard, Cpu cpu, Memory memory, GraphicsCard graphicsCard, Case @case) { HardDrive = hardDrive; Motherboard = motherboard; Cpu = cpu; Memory = memory; GraphicsCard = graphicsCard; Case = @case; }
// GET: GraphicsCards/Edit/5 public async Task <IActionResult> Edit(Guid id) { string accessToken = await this.HttpContext.GetTokenAsync("access_token"); string response = await ApiRequests.GetAsync(accessToken, string.Format("{0}/{1}/{2}", this.apiBaseUrl, this.apiController, id)); GraphicsCard graphicsCard = JsonConvert.DeserializeObject <GraphicsCard>(response); return(this.View(graphicsCard)); }
/// <summary> /// Gets all Parts in the GraphicsCard database /// </summary> /// <returns>A GraphicsCard[] of all Graphics Cards in the database</returns> public static GraphicsCard[] GetAll() { string[] result = Queries.Query("SELECT * FROM `graphicscard`"); GraphicsCard[] arr = new GraphicsCard[result.Length]; for (int i = 0; i < result.Length; i++) { arr[i] = GetFromQuery(result[i]); } return(arr); }
public ActionResult Edit([Bind(Include = "IDGraphicsCard,Name,Memory,Description,Price")] GraphicsCard graphicsCard) { if (ModelState.IsValid) { db.Entry(graphicsCard).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(graphicsCard)); }
public ActionResult Create([Bind(Include = "IDGraphicsCard,Name,Memory,Description,Price")] GraphicsCard graphicsCard) { if (ModelState.IsValid) { db.GraphicsCards.Add(graphicsCard); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(graphicsCard)); }
public async Task <IActionResult> Create([Bind("Id,Name,Price")] GraphicsCard graphicsCard) { if (ModelState.IsValid) { _context.Add(graphicsCard); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(graphicsCard)); }
public async Task <ActionResult <GraphicsCard> > Get(Guid Id) { GraphicsCard graphicsCard = await this._repository.Get(Id); if (graphicsCard == null) { return(this.NotFound()); } return(graphicsCard); }
private void findGCard(GraphicsCard theorGCard) { foreach (GraphicsCard GCard in Storage.graphicsCards) { if ((GCard.volume >= theorGCard.volume)) { poleGCard = GCard; break; } } }
/// <summary> /// Sets a graphics card to the computer and motherboard /// </summary> /// <param name="fanCount"></param> /// <param name="speed"></param> /// <param name="videoMemory"></param> /// <param name="amountOfCudaCores"></param> /// <returns>The computer builder</returns> public IComputerBuilder SetGraphicsCard(int fanCount, double speed, double videoMemory, int amountOfCudaCores) { var graphicsCard = new GraphicsCard(fanCount, speed, videoMemory, amountOfCudaCores); _computer.GraphicsCard = graphicsCard; if (_computer.Motherboard != null) { _computer.Motherboard.GraphicsCard = graphicsCard; } return(this); }
public Computer() { Board = new MotherBoard(); Board.Brand = "Dell"; Board.HasLanPort = 2; Board.USBPortsCount = 3; GPU = new GraphicsCard(); GPU.AmountOfRam = 4; GPU.GpuFrequency = 1.1; }
public Computer() { Board = new MotherBoard(); Board.Brand = "Dell"; Board.HasLanPort = 2; Board.USBPortsCount = 3; GPU = new GraphicsCard(); GPU.AmountOfRam = 4; GPU.GpuFrequency = 1.1; }
public ActionResult Delete(GraphicsCard item) { Derictory.Drop(item); if (Derictory.Error != null) { return(View("Error", Derictory.Error)); } else { return(RedirectToAction("Index")); } }
/// <summary> /// action that occurs when the user chooses a part type. will set the collection/datasource of the part dropdown menu to those that match /// the users selection. will also populate the description box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void partTypeBox_SelectedIndexChanged(object sender, EventArgs e) { String test = partTypeBox.SelectedItem.ToString(); Queries.Log(Queries.LogLevel.DEBUG, "Selected : " + test); string attribs = ""; if (test == "CPU") { partBox.DataSource = CPU.GetAll(); attribs = ((CPU)partBox.SelectedItem).GetAttributes(); } else if (test == "Cooling") { partBox.DataSource = Fan.GetAll(); attribs = ((Fan)partBox.SelectedItem).GetAttributes(); } else if (test == "Case") { partBox.DataSource = Case.GetAll(); attribs = ((Case)partBox.SelectedItem).GetAttributes(); } else if (test == "Memory") { partBox.DataSource = Memory.GetAll(); attribs = ((Memory)partBox.SelectedItem).GetAttributes(); } else if (test == "Power Supply") { partBox.DataSource = PowerSupply.GetAll(); attribs = ((PowerSupply)partBox.SelectedItem).GetAttributes(); } else if (test == "Storage") { partBox.DataSource = Storage.GetAll(); attribs = ((Storage)partBox.SelectedItem).GetAttributes(); } else if (test == "Graphics Card") { partBox.DataSource = GraphicsCard.GetAll(); attribs = ((GraphicsCard)partBox.SelectedItem).GetAttributes(); } else if (test == "Motherboard") { partBox.DataSource = MOBO.GetAll(); attribs = ((MOBO)partBox.SelectedItem).GetAttributes(); } partDescriptionBox.Text = attribs; priceTxtBox.Text = "$" + ((Part)partBox.SelectedItem).price; }
/// <summary> /// Converts a MySQL query result into a Computer /// </summary> /// <param name="result">The MySQL query result</param> /// <returns>The Computer found from the query</returns> public static Computer GetFromQuery(string result) { string[] arr = result.Split('\0'); CPU cpu = CPU.Get(int.Parse(arr[2])); Fan fan = Fan.Get(int.Parse(arr[3])); GraphicsCard gCard = GraphicsCard.Get(int.Parse(arr[4])); Memory memory = Memory.Get(int.Parse(arr[5])); MOBO mBoard = MOBO.Get(int.Parse(arr[6])); Case c = Case.Get(int.Parse(arr[7])); PowerSupply power = PowerSupply.Get(int.Parse(arr[8])); Storage storage = Storage.Get(int.Parse(arr[9])); return(new Computer(int.Parse(arr[0]), arr[1], c, cpu, fan, gCard, memory, mBoard, power, storage)); }
// GET: GraphicsCards/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GraphicsCard graphicsCard = db.GraphicsCards.Find(id); if (graphicsCard == null) { return(HttpNotFound()); } return(View(graphicsCard)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } GraphicsCard = await _context.GraphicsCards.FirstOrDefaultAsync(m => m.Id == id); if (GraphicsCard == null) { return(NotFound()); } return(Page()); }