private void modificaSalariatToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewAngajat.SelectedItems.Count > 0) { Forma2 fm = new Forma2(); listViewAngajat.SelectedIndexChanged += new EventHandler(fm.ActualizeazaControale); fm.Text = "Modificare angajat"; fm.ActualizeazaControale(listViewAngajat, e); fm.form = this; fm.ShowDialog(); } }
private void adaugaSalariatToolStripMenuItem_Click(object sender, EventArgs e) { ListViewItem lvi = new ListViewItem(new string[] { "", "", "", "", "", "" }); listViewAngajat.Items.Add(lvi); Angajat a = new Angajat("", "", "", " ", 0, false); lvi.Tag = a; lvi.Selected = true; Forma2 f2 = new Forma2(); f2.angajat = a; f2.form = this; f2.Text = "Adauga angajat"; f2.buttonActualizare.Text = "Adauga"; f2.ShowDialog(); if (f2.DialogResult != DialogResult.OK) { lvi.Remove(); //daca nu apesi pe buton nu ti adauga medicul } }