Пример #1
0
        private void button5_Click_1(object sender, EventArgs e)
        {
            ADDoctor formUpdate1 = new ADDoctor("update");

            int index = Manageofhospital.listDoctor.IndexOf(this.DoctorSelected);

            ADDoctor.doctor.IDD          = DoctorSelected.IDD;
            ADDoctor.doctor.NameD        = DoctorSelected.NameD;
            ADDoctor.doctor.DistrictD    = DoctorSelected.DistrictD;
            ADDoctor.doctor.WardD        = DoctorSelected.WardD;
            ADDoctor.doctor.PatientD     = DoctorSelected.PatientD;
            ADDoctor.doctor.GenderD      = DoctorSelected.GenderD;
            ADDoctor.doctor.DateofbirthD = DoctorSelected.DateofbirthD;
            ADDoctor.doctor.RegencyD     = DoctorSelected.RegencyD;
            ADDoctor.doctor.NationalityD = DoctorSelected.NationalityD;
            formUpdate1.ShowDialog();

            Doctor D = (Doctor)listDoctor[index];

            D.IDD           = ADDoctor.doctor.IDD;
            D.NameD         = ADDoctor.doctor.NameD;
            D.DistrictD     = ADDoctor.doctor.DistrictD;
            D.WardD         = ADDoctor.doctor.WardD;
            D.PatientD      = ADDoctor.doctor.PatientD;
            D.GenderD       = ADDoctor.doctor.GenderD;
            D.DateofbirthD  = ADDoctor.doctor.DateofbirthD;
            D.RegencyD      = ADDoctor.doctor.RegencyD;
            D.NationalityD  = ADDoctor.doctor.NationalityD;
            ADDoctor.doctor = null;
            LoadDoctor();
            MessageBox.Show("Update successful");
        }
Пример #2
0
        private void button6_Click_1(object sender, EventArgs e)
        {
            ADDoctor formAdd2 = new ADDoctor("Add");

            formAdd2.ShowDialog();
            if (ADDoctor.doctor != null)
            {
                Doctor D = new Doctor(ADDoctor.doctor);

                if (string.IsNullOrEmpty(D.NameD.ToString()) || string.IsNullOrEmpty(D.DistrictD.ToString()) || string.IsNullOrEmpty(D.WardD.ToString()) || string.IsNullOrEmpty(D.GenderD.ToString()) || string.IsNullOrEmpty(D.PatientD.ToString()) || string.IsNullOrEmpty(D.DateofbirthD.ToString()) || string.IsNullOrEmpty(D.RegencyD.ToString()) || string.IsNullOrEmpty(D.NationalityD.ToString()))
                {
                    MessageBox.Show("Add successful but empty", "Notification");
                }
                else
                {
                    listDoctor.Add(D);
                    MessageBox.Show("Add successful", "Notification");
                    LoadDoctor();
                }
            }
        }