private void button_ListabaIr_Click(object sender, EventArgs e) { //-- A vezérlők adatai Listboxba írjuk if (comboBox_Konyvlista.SelectedIndex < 0) { MessageBox.Show("Válasszon könyvet!"); return; } if (comboBox_Berlolista.SelectedIndex < 0) { MessageBox.Show("Válassza ki a bérlőt!"); return; } if (numeric_Peldany.Value < 1) { MessageBox.Show("Adjon meg példányszámot!"); return; } Konyv konyv = Program.konyvek[comboBox_Konyvlista.SelectedIndex]; Berlo berlo = Program.berlok[comboBox_Berlolista.SelectedIndex]; listBox_Kolcsonzesek.Items.Add(new Kolcsonzes(konyv, berlo, (int)numeric_Peldany.Value)); comboBox_Konyvlista.SelectedIndex = -1; comboBox_Berlolista.SelectedIndex = -1; numeric_Peldany.Value = 1; }
public static void Konyvek_betoltese() { //-- Könyv adatok betöltése ------------------------ Program.sql.CommandText = "SELECT `Kód` AS kod,`Szerző` as szerzo,`Cím` as cim,`Kiadás éve` as kiadasEve,`ár` as ar,`ISBN` FROM `konyvek`;"; try { using (MySqlDataReader dr = Program.sql.ExecuteReader()) { while (dr.Read()) { Konyv uj = new Konyv(dr.GetString("kod"), dr.GetString("szerzo"), dr.GetString("cim"), dr.GetInt32("kiadasEve"), dr.GetInt32("ar"), dr.GetString("ISBN")); Program.konyvek.Add(uj); } } } catch (MySqlException ex) { MessageBox.Show(ex.Message); Environment.Exit(0); } }