private void btnTulajdonosFelvetel_Click(object sender, EventArgs e) { if (tbEmail.Text == string.Empty) { try { Tulajdonosok.TulajdonosFelvetele(tbVnev.Text, tbKnev.Text, dtpSzulDatum.Value, tbIrszam.Text, tbVaros.Text, tbLakcim.Text, tbMobilSzam.Text); MessageBox.Show("A tulajdonos mentésre került!", "Sikeres mentés"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sikertelen mentés"); } } else { try { Tulajdonosok.TulajdonosFelvetele(tbVnev.Text, tbKnev.Text, dtpSzulDatum.Value, tbIrszam.Text, tbVaros.Text, tbLakcim.Text, tbMobilSzam.Text, tbEmail.Text); MessageBox.Show("A tulajdonos mentésre került!", "Sikeres mentés"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sikertelen mentés"); } } }
private void btnIgen_Click(object sender, EventArgs e) { if (Tulajdonosok.TulajdonosokLista.Count > 0) { foreach (Tulajdonos tulajdonos in Tulajdonosok.TulajdonosokLista) { if (tulajdonos.Id == ID) { Tulajdonosok.TulajdonosTorles(tulajdonos); MessageBox.Show("A tulajdonos sikeresen eltávolítva!", "Sikeres törlés"); this.Close(); } } } }
public Form1() { InitializeComponent(); Tulajdonosok.TulajdonosFelvetele("Somogyi", "Dávid", DateTime.ParseExact("2000.03.08", "yyyy.mm.dd", null), "2660", "Balassagyarmat", "Szabó Püspök u.", "+36307415497"); Tulajdonosok.TulajdonosFelvetele("Somogyi", "Dávid", DateTime.ParseExact("2000.03.08", "yyyy.mm.dd", null), "2660", "Balassagyarmat", "Szabó Püspök u.", "+36307415497"); }