Example #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            AddPatient1 formUpdate1 = new AddPatient1("Update");
            int         index1      = Doctor.listPatient.IndexOf(this.patientSelected);

            AddPatient1.patient.ID        = patientSelected.ID;
            AddPatient1.patient.Name      = patientSelected.Name;
            AddPatient1.patient.Address   = patientSelected.Address;
            AddPatient1.patient.Gender    = patientSelected.Gender;
            AddPatient1.patient.Email     = patientSelected.Email;
            AddPatient1.patient.Phone     = patientSelected.Phone;
            AddPatient1.patient.Status    = patientSelected.Status;
            AddPatient1.patient.Datecheck = patientSelected.Datecheck;
            formUpdate1.ShowDialog();

            Patient d1 = (Patient)listPatient[index1];

            d1.ID               = AddPatient1.patient.ID;
            d1.Name             = AddPatient1.patient.Name;
            d1.Address          = AddPatient1.patient.Address;
            d1.Gender           = AddPatient1.patient.Gender;
            d1.Email            = AddPatient1.patient.Email;
            d1.Phone            = AddPatient1.patient.Phone;
            d1.Status           = AddPatient1.patient.Status;
            d1.Datecheck        = AddPatient1.patient.Datecheck;
            AddPatient1.patient = null;
            LoadPatient1();
            MessageBox.Show("Update successful");
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            AddPatient1 formPatient1 = new AddPatient1("Add");

            formPatient1.ShowDialog();
            if (AddPatient1.patient != null)
            {
                Patient d1 = new Patient(AddPatient1.patient);

                if (string.IsNullOrEmpty(d1.ID.ToString()) || string.IsNullOrEmpty(d1.Address.ToString()) || string.IsNullOrEmpty(d1.Name.ToString()) || string.IsNullOrEmpty(d1.Gender.ToString()) || string.IsNullOrEmpty(d1.Email.ToString()) || string.IsNullOrEmpty(d1.Phone.ToString()) || string.IsNullOrEmpty(d1.Status.ToString()) || string.IsNullOrEmpty(d1.Datecheck.ToString()))
                {
                }
                else
                {
                    listPatient.Add(d1);
                    MessageBox.Show("Add successful");
                    LoadPatient1();
                }
            }
        }