private List <PlacaVideo> setAllVideoCards() { List <PlacaVideo> videoCardList = new List <PlacaVideo>(6); DataTable dtbl = initializeDataTable("SELECT * FROM PlacaVideo"); foreach (DataRow row in dtbl.Rows) { PlacaVideo pv = new PlacaVideo { ID = Convert.ToInt32(row[0]), Producator = Convert.ToString(row[1]), Serie = Convert.ToString(row[2]), Model = Convert.ToString(row[3]), Intefata = Convert.ToString(row[4]), ProducatorChipset = Convert.ToString(row[5]), DimensiuneMemorie = Convert.ToInt32(row[6]), TipMemorie = Convert.ToString(row[7]), PortVGA = Convert.ToBoolean(row[8]), PortDVI = Convert.ToBoolean(row[9]), PortHDMI = Convert.ToBoolean(row[10]), PortDP = Convert.ToBoolean(row[11]), DimensiuneRacire = Convert.ToString(row[12]), RecomandatGaming = Convert.ToBoolean(row[13]), Overclocked = Convert.ToBoolean(row[14]), PutereDisipata = Convert.ToInt32(row[15]), Pret = Convert.ToDouble(row[16]), }; videoCardList.Add(pv); } return(videoCardList); }
public ActionResult DeleteConfirmed(int id) { PlacaVideo placaVideo = db.PlacaVideos.Find(id); db.PlacaVideos.Remove(placaVideo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Nome,Descricao,Marca,PrecoMedio,ConsumoWatts,NotaPerformance,Barramento,Link")] PlacaVideo placaVideo) { if (ModelState.IsValid) { db.Entry(placaVideo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(placaVideo)); }
public static PlacaVideoEntity ConverterPlacaVideoModelParaPlacaVideoEntity(PlacaVideo placaVideoModel) { PlacaVideoEntity placaVideo = new PlacaVideoEntity(); placaVideo.Clock = placaVideoModel.Clock; placaVideo.Descricao = placaVideoModel.Descricao; placaVideo.ID = placaVideoModel.ID; placaVideo.IDPlacaEquivalente = placaVideoModel.IDPlacaEquivalente; placaVideo.Potencia = placaVideoModel.Potencia; return(placaVideo); }
private void btnSacar_Click(object sender, EventArgs e) { int memoria; if (!(int.TryParse(this.nUDMemoria.Text, out memoria))) { memoria = 0; } PlacaVideo p = new PlacaVideo(this.txtMarca.Text, this.txtModelo.Text, memoria); MessageBox.Show(m - p); }
// GET: PlacaVideo/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlacaVideo placaVideo = db.PlacaVideos.Find(id); if (placaVideo == null) { return(HttpNotFound()); } return(View(placaVideo)); }
public bool VerificarSeJogoEhCompativel(int idJogo, int iDPlacaVideo, int iDProcessador, double memoria, double hD) { Jogo jogoSelecionado = JogoDataAccess.ObterJogoComRequisitos(idJogo); if (jogoSelecionado.MinimoHD <= hD && jogoSelecionado.MinimoMemoria <= memoria) { PlacaVideo placaJogo = jogoSelecionado.PlacasCompativeis.FirstOrDefault(); Processador processadorJogo = jogoSelecionado.ProcessadoresCompativeis.FirstOrDefault(); if (placaJogo.ID == iDPlacaVideo && processadorJogo.ID == iDProcessador) { return(true); } return(PlacaVideoBusiness.VerificarSePlacaVideoEhMelhorOuEquivalente(iDPlacaVideo, placaJogo) && ProcessadorBusiness.VerificarSeProcessadorEhMelhorOuEquivalente(iDProcessador, processadorJogo)); } return(false); }
static void Main(string[] args) { ConsoleColor aux = Console.ForegroundColor; Maquina m = new Maquina("LAB01PC03"); // Agrega Periferico e = new PlacaVideo("ASUS", "P360-A", 64); Console.WriteLine(m + e); // Agrega Console.WriteLine(m + new Teclado("GENIUS", "J961-P", EConector.PS2, Teclado.EDistribucion.AZERTY)); // Agrega Console.WriteLine(m + new Teclado("GENIUS", "JRR-10", EConector.USB)); // No agrega por cantidad superada Console.WriteLine(m + new PlacaVideo("SENTEY", "P361-A", 32)); // Cambio Max Perisfericos y agrego m.CantidadMaximaPerifericos = 5; Console.WriteLine(m + new PlacaVideo("SENTEY", "P361-A", 32)); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Cantidad Máxima Perisfericos: " + m.CantidadMaximaPerifericos); Console.ForegroundColor = aux; // Quito una Console.WriteLine(m - new PlacaVideo("ASUS", "P360-A", 64)); // No agrega por repetida Console.WriteLine(m + new Teclado("GENIUS", "J961-P", EConector.PS2, Teclado.EDistribucion.AZERTY)); // Agrega Console.WriteLine(m + new PlacaVideo("ASUS", "P360-A", 64)); Console.WriteLine("\n------------------------"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(new PlacaVideo("ASUS", "P360-A", 64).ExponerDatos()); Console.WriteLine(new Teclado("GENIUS", "JRR-10", EConector.USB).ExponerDatos()); Console.ForegroundColor = aux; Console.WriteLine("\n------------------------"); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(m.SystemInfo); Console.ForegroundColor = aux; Console.ReadKey(); }
private void btnSacar_Click(object sender, EventArgs e) { PlacaVideo placa = new PlacaVideo(txtMarca.Text, txtModelo.Text, (int)nudMemoria.Value); MessageBox.Show(maquina - (Periferico)placa); }
private void vizualizareDetaliiToolStripMenuItem_Click(object sender, EventArgs e) { if (componentaSelectata != null) { if (componentaSelectata.GetType().Name == "HardDisk") { HardDisk hd = (HardDisk)componentaSelectata; cb_componenta.SelectedIndex = 0; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); tb_capacitateHardD.Text = hd.Capacitate.ToString(); tb_vitezaHardD.Text = hd.Viteza.ToString(); gb_componenta.Enabled = false; } if (componentaSelectata.GetType().Name == "Memorie") { Memorie m = (Memorie)componentaSelectata; cb_componenta.SelectedIndex = 1; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); tb_capacitateMemorie.Text = m.Capacitate.ToString(); tb_frecvMemorie.Text = m.Frecventa.ToString(); cb_tipMemorie.SelectedItem = m.Tip.ToString(); gb_componenta.Enabled = false; } if (componentaSelectata.GetType().Name == "PlacaDeBaza") { PlacaDeBaza pb = (PlacaDeBaza)componentaSelectata; cb_componenta.SelectedIndex = 2; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); numericNrSloturiPlacaBaza.Value = pb.NumarSloturi; numericNrConectoriPlacaBaza.Value = pb.Conectori; cb_formatPlacaBaza.SelectedItem = pb.Format.ToString(); gb_componenta.Enabled = false; } if (componentaSelectata.GetType().Name == "PlacaVideo") { PlacaVideo pv = (PlacaVideo)componentaSelectata; cb_componenta.SelectedIndex = 3; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); tb_SeriePlacaVideo.Text = pv.Serie; tb_porturiPlacaVideo.Text = pv.Porturi; tb_FrecventaProcesorPlacaVideo.Text = pv.FrecventaProcesor.ToString(); tb_capacitatePlacaVideo.Text = pv.CapacitateMemorie.ToString(); gb_componenta.Enabled = false; } if (componentaSelectata.GetType().Name == "Procesor") { Procesor p = (Procesor)componentaSelectata; cb_componenta.SelectedIndex = 4; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); tb_memorieMaxProcesor.Text = p.MemorieMax.ToString(); tb_frecventaProcesor.Text = p.Frecventa; numericNrNucleeProcesor.Value = p.NumarNuclee; numericNrThreadsProcesor.Value = p.NumarThreads; gb_componenta.Enabled = false; } if (componentaSelectata.GetType().Name == "SursaTensiune") { SursaTensiune st = (SursaTensiune)componentaSelectata; cb_componenta.SelectedIndex = 5; tb_model.Text = componentaSelectata.Model; tb_producator.Text = componentaSelectata.Producator; cb_anFabricatie.SelectedItem = componentaSelectata.AnFabricatie.ToString(); tb_putereSursaTensiune.Text = st.Putere.ToString(); numericNrConectoriSursaTensiune.Value = st.Conectori; gb_componenta.Enabled = false; } } }
private void bt_adaugareListView_Click(object sender, EventArgs e) { string componentaAleasa = cb_componenta.Text; if (cb_componenta.Text.CompareTo("Hard Disk") == 0) { HardDisk newC = new HardDisk(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); if (string.IsNullOrEmpty(tb_capacitateHardD.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Capacitate = Convert.ToInt32(tb_capacitateHardD.Text); if (string.IsNullOrEmpty(tb_vitezaHardD.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Viteza = Convert.ToInt32(tb_vitezaHardD.Text); addListView(newC, "Hard Disk"); clearHardDisk(); } if (cb_componenta.Text.CompareTo("Memorie") == 0) { Memorie newC = new Memorie(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); if (cb_tipMemorie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Tip = cb_tipMemorie.Text; if (string.IsNullOrEmpty(tb_capacitateMemorie.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Capacitate = Convert.ToInt32(tb_capacitateMemorie.Text); if (string.IsNullOrEmpty(tb_frecvMemorie.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Frecventa = Convert.ToInt32(tb_frecvMemorie.Text); addListView(newC, "Memorie"); clearMemorie(); } if (cb_componenta.Text.CompareTo("Placa de Baza") == 0) { PlacaDeBaza newC = new PlacaDeBaza(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); if (cb_formatPlacaBaza.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Format = cb_formatPlacaBaza.Text; newC.NumarSloturi = Convert.ToInt32(numericNrSloturiPlacaBaza.Value); newC.Conectori = Convert.ToInt32(numericNrConectoriPlacaBaza.Value); addListView(newC, "Placa de Baza"); clearPlacaDeBaza(); } if (cb_componenta.Text.CompareTo("Placa Video") == 0) { PlacaVideo newC = new PlacaVideo(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); if (string.IsNullOrEmpty(tb_capacitatePlacaVideo.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.CapacitateMemorie = Convert.ToInt32(tb_capacitatePlacaVideo.Text); if (string.IsNullOrEmpty(tb_FrecventaProcesorPlacaVideo.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.FrecventaProcesor = Convert.ToInt32(tb_FrecventaProcesorPlacaVideo.Text); if (string.IsNullOrEmpty(tb_porturiPlacaVideo.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Porturi = tb_porturiPlacaVideo.Text; if (string.IsNullOrEmpty(tb_SeriePlacaVideo.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Serie = tb_SeriePlacaVideo.Text; addListView(newC, "Placa Video"); clearPlacaVideo(); } if (cb_componenta.Text.CompareTo("Procesor") == 0) { Procesor newC = new Procesor(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); newC.NumarNuclee = Convert.ToInt32(numericNrNucleeProcesor.Value); newC.NumarThreads = Convert.ToInt32(numericNrThreadsProcesor.Value); if (string.IsNullOrEmpty(tb_memorieMaxProcesor.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.MemorieMax = Convert.ToInt32(tb_memorieMaxProcesor.Text); if (string.IsNullOrEmpty(tb_frecventaProcesor.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Frecventa = tb_frecventaProcesor.Text; addListView(newC, "Procesor"); clearProcesor(); } if (cb_componenta.Text.CompareTo("Sursa Tensiune") == 0) { SursaTensiune newC = new SursaTensiune(); if (string.IsNullOrEmpty(tb_producator.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Producator = tb_producator.Text; if (string.IsNullOrEmpty(tb_model.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Model = tb_model.Text; if (cb_anFabricatie.SelectedItem == null) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.AnFabricatie = Convert.ToInt32(cb_anFabricatie.Text); newC.Conectori = Convert.ToInt32(numericNrConectoriSursaTensiune.Value); if (string.IsNullOrEmpty(tb_putereSursaTensiune.Text)) { MessageBox.Show("Toate campurile sunt obligatorii!"); return; } newC.Putere = Convert.ToInt32(tb_putereSursaTensiune.Text); addListView(newC, "Sursa Tensiune"); clearSursaTensiune(); } }
private void btnAgregar_Click(object sender, EventArgs e) { PlacaVideo placa = new PlacaVideo(txtMarca.Text, txtModelo.Text, (int)nudMemoria.Value); MessageBox.Show(m + placa); }
public bool VerificarSePlacaVideoEhMelhorOuEquivalente(int iDPlacaVideoUsuario, PlacaVideo placa) { PlacaVideo placaUsuario = PlacaVideoDataAccess.ObterPlacaVideo(iDPlacaVideoUsuario); return(placaUsuario.ID == placa.IDPlacaEquivalente || placaUsuario.Potencia >= placa.Potencia); }
public PlacaVideoEntity ObterPlacaVideo(int idPlaca) { PlacaVideo placa = PlacaVideoDataAccess.ObterPlacaVideo(idPlaca); return(ConversorModelEntity.ConverterPlacaVideoModelParaPlacaVideoEntity(placa)); }