private void button1_Click(object sender, EventArgs e) { try { int marca = Convert.ToInt32(inputMarca.Text); string nume = inputNume.Text; int nrOre = Convert.ToInt32(inputNrOre.Text); int salariu = Convert.ToInt32(inputSalariu.Text); salariat s = new salariat(marca, nume, nrOre, salariu); f = f + s; MessageBox.Show("Succes!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { inputMarca.Clear(); inputNume.Clear(); inputNrOre.Clear(); inputSalariu.Clear(); } this.Close(); }
public Form1() { salariati = new List <salariat>(); f = new firma(salariati); salariati.Add(new salariat(111, "Cezin", 40, 20)); salariati.Add(new salariat(512, "Robert", 10, 5)); salariati.Add(new salariat(755, "Madalin", 30, 2)); InitializeComponent(); }
public int fondSalarii(firma f) { int suma = 0; foreach (salariat s in f.salariati) { suma += s.calculSalariu(s); } return(suma); }
private void adaugaSalariatToolStripMenuItem_Click(object sender, EventArgs e) { salariat salariat = new salariat(); AdaugareSalariat adaugare = new AdaugareSalariat(salariat); adaugare.ShowDialog(); f = f + salariat; listView1.Items.Clear(); foreach (salariat s in salariati) { ListViewItem itm = new ListViewItem(s.Marca.ToString()); itm.SubItems.Add(s.Nume); itm.SubItems.Add(s.Ore.ToString()); itm.SubItems.Add(s.Salariu.ToString()); itm.Tag = s; listView1.Items.Add(itm); } }
public MofificareSalariat(salariat s, firma f) { this.s = s; this.f = f; InitializeComponent(); }