private void button6_Click(object sender, EventArgs e) { AddEQuipment formUpdate5 = new AddEQuipment("Update"); int index5 = FFood1.ListeQuipment.IndexOf(this.eQuipmentSelected); AddEQuipment.eQuipment.ID = eQuipmentSelected.ID; AddEQuipment.eQuipment.Name = eQuipmentSelected.Name; AddEQuipment.eQuipment.Unit = eQuipmentSelected.Unit; AddEQuipment.eQuipment.Kind = eQuipmentSelected.Kind; AddEQuipment.eQuipment.DateOfManufacture = eQuipmentSelected.DateOfManufacture; formUpdate5.ShowDialog(); EQuipment d = (EQuipment)ListeQuipment[index5]; d.ID = AddEQuipment.eQuipment.ID; d.Name = AddEQuipment.eQuipment.Name; d.Unit = AddEQuipment.eQuipment.Unit; d.Kind = AddEQuipment.eQuipment.Kind; d.DateOfManufacture = AddEQuipment.eQuipment.DateOfManufacture;; AddEQuipment.eQuipment = null; LoadEQuipment1(); MessageBox.Show("Update successful"); }
private void button4_Click(object sender, EventArgs e) { AddEQuipment formAddEquipment = new AddEQuipment("Add"); formAddEquipment.ShowDialog(); if (AddEQuipment.eQuipment != null) { EQuipment d5 = new EQuipment(AddEQuipment.eQuipment); if (string.IsNullOrEmpty(d5.ID.ToString()) || string.IsNullOrEmpty(d5.Name.ToString()) || string.IsNullOrEmpty(d5.Unit.ToString()) || string.IsNullOrEmpty(d5.Kind.ToString()) || string.IsNullOrEmpty(d5.DateOfManufacture.ToString())) { } else { ListeQuipment.Add(d5); MessageBox.Show("Add successful"); LoadEQuipment1(); } } }