Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            AddDoctor formUpdate = new AddDoctor("Update");
            int       index      = Doctor.listDoctor.IndexOf(this.doctorSelected);

            AddDoctor.doctor.ID      = doctorSelected.ID;
            AddDoctor.doctor.Name    = doctorSelected.Name;
            AddDoctor.doctor.Address = doctorSelected.Address;
            AddDoctor.doctor.Gender  = doctorSelected.Gender;
            formUpdate.ShowDialog();

            Models.Doctor d = (Models.Doctor)listDoctor[index];
            d.ID             = AddDoctor.doctor.ID;
            d.Name           = AddDoctor.doctor.Name;
            d.Address        = AddDoctor.doctor.Address;
            d.Gender         = AddDoctor.doctor.Gender;
            AddDoctor.doctor = null;
            LoadDoctor();
            MessageBox.Show("Update successful");
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddDoctor formAddDoctor = new AddDoctor("Add");

            formAddDoctor.ShowDialog();
            if (AddDoctor.doctor != null)
            {
                Models.Doctor d = new Models.Doctor(AddDoctor.doctor);


                if (string.IsNullOrEmpty(d.ID.ToString()) || string.IsNullOrEmpty(d.Address.ToString()) || string.IsNullOrEmpty(d.Name.ToString()) || string.IsNullOrEmpty(d.Gender.ToString()))
                {
                }
                else
                {
                    listDoctor.Add(d);
                    MessageBox.Show("Add successful");
                    LoadDoctor();
                }
            }
        }