Ejemplo n.º 1
0
        private void button8_Click(object sender, EventArgs e)
        {
            ADDEquipment formUpdate2 = new ADDEquipment("update");

            int index = Manageofhospital.listEquipment.IndexOf(this.EquipmentSelected);

            ADDEquipment.equipment.IDE            = EquipmentSelected.IDE;
            ADDEquipment.equipment.NameE          = EquipmentSelected.NameE;
            ADDEquipment.equipment.OriginE        = EquipmentSelected.OriginE;
            ADDEquipment.equipment.AddressE       = EquipmentSelected.AddressE;
            ADDEquipment.equipment.PatientE       = EquipmentSelected.PatientE;
            ADDEquipment.equipment.PurposetouseE  = EquipmentSelected.PurposetouseE;
            ADDEquipment.equipment.Dateofpurchase = EquipmentSelected.Dateofpurchase;
            ADDEquipment.equipment.StatusE        = EquipmentSelected.StatusE;
            ADDEquipment.equipment.Doctor         = EquipmentSelected.Doctor;
            formUpdate2.ShowDialog();

            Equipment E = (Equipment)listEquipment[index];

            E.IDE                  = ADDEquipment.equipment.IDE;
            E.NameE                = ADDEquipment.equipment.NameE;
            E.OriginE              = ADDEquipment.equipment.OriginE;
            E.AddressE             = ADDEquipment.equipment.AddressE;
            E.PatientE             = ADDEquipment.equipment.PatientE;
            E.PurposetouseE        = ADDEquipment.equipment.PurposetouseE;
            E.Dateofpurchase       = ADDEquipment.equipment.Dateofpurchase;
            E.StatusE              = ADDEquipment.equipment.StatusE;
            E.Doctor               = ADDEquipment.equipment.Doctor;
            ADDEquipment.equipment = null;
            LoadEquipment();
            MessageBox.Show("Update successful");
        }
Ejemplo n.º 2
0
        private void button9_Click(object sender, EventArgs e)
        {
            ADDEquipment formAdd2 = new ADDEquipment("Add");

            formAdd2.ShowDialog();
            if (ADDEquipment.equipment != null)
            {
                Equipment E = new Equipment(ADDEquipment.equipment);

                if (string.IsNullOrEmpty(E.NameE.ToString()) || string.IsNullOrEmpty(E.OriginE.ToString()) || string.IsNullOrEmpty(E.AddressE.ToString()) || string.IsNullOrEmpty(E.PatientE.ToString()) || string.IsNullOrEmpty(E.PurposetouseE.ToString()) || string.IsNullOrEmpty(E.Dateofpurchase.ToString()) || string.IsNullOrEmpty(E.StatusE.ToString()) || string.IsNullOrEmpty(E.Doctor.ToString()))
                {
                    MessageBox.Show("Add successful but empty", "Notification");
                }
                else
                {
                    listEquipment.Add(E);
                    MessageBox.Show("Add successful", "Notification");
                    LoadEquipment();
                }
            }
        }