private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox1_rendszam.Text)) { MessageBox.Show("Nem töltötte ki a rendszám mezőt!", "Hiányzó adat", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox1_rendszam.Focus(); } else if (String.IsNullOrEmpty(comboBox1_gepjarmuTipusa.Text)) { MessageBox.Show("Nem választotta ki a gépjármű típusát!", "Hiányzó adat", MessageBoxButtons.OK, MessageBoxIcon.Warning); comboBox1_gepjarmuTipusa.Focus(); } else if (String.IsNullOrEmpty(textBox2_gyartasiIdo.Text)) { MessageBox.Show("Nem töltötte ki a gyártási idő mezőt!", "Hiányzó adat", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox2_gyartasiIdo.Focus(); } else if (String.IsNullOrEmpty(textBox3_teljesitmeny.Text)) { MessageBox.Show("Nem töltötte ki a teljesítmény mezőt!", "Hiányzó adat", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox3_teljesitmeny.Focus(); } else { Gepjarmu gepjarmu = new Gepjarmu(); gepjarmu.rendszam = textBox1_rendszam.Text; gepjarmu.tipus = comboBox1_gepjarmuTipusa.Text; gepjarmu.gyartasEv = Convert.ToInt32(textBox2_gyartasiIdo.Text); gepjarmu.teljesitmeny = Convert.ToInt32(textBox3_teljesitmeny.Text); listBox1_rogzitettAdatok.Items.Add(gepjarmu); } }
private void listBox1_rogzitettAdatok_SelectedIndexChanged(object sender, EventArgs e) { Gepjarmu gepjarmu = (Gepjarmu)listBox1_rogzitettAdatok.Items[listBox1_rogzitettAdatok.SelectedIndex]; textBox1_rendszam.Text = gepjarmu.rendszam; comboBox1_gepjarmuTipusa.Text = gepjarmu.tipus; textBox2_gyartasiIdo.Text = Convert.ToString(gepjarmu.gyartasEv); textBox3_teljesitmeny.Text = Convert.ToString(gepjarmu.teljesitmeny); }
public IActionResult Create(GepjarmuCreateViewModel gepjarmu) { if (ModelState.IsValid) { Gepjarmu temp = new Gepjarmu { Tipus = gepjarmu.Tipus, Rendszam = gepjarmu.Rendszam, FutottKm = gepjarmu.FutottKm, Kategoria = gepjarmu.Kategoria, SzervizCiklus = gepjarmu.SzervizCiklus, UtolsoSzerviz = DateTime.Parse(gepjarmu.UtolsoSzerviz), TelephelyID = int.Parse(gepjarmu.SelectedTelephelyCim), Telephely = _context.Telephelyek.Find(int.Parse(gepjarmu.SelectedTelephelyCim)) }; _context.Gepjarmuvek.Add(temp); _context.SaveChanges(); return(RedirectToAction("Index", "Gepjarmus")); } gepjarmu.Telephelyek = GetTelephelyek(); return(View(gepjarmu)); }
public void insertGepjarmuToDatabase(Gepjarmu e) { database.Gepjarmuvek.InsertOnSubmit(e); // database.SubmitChanges(); }