예제 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            addPatient formUpdate = new addPatient("Update");
            int        index      = Information_Patient.listPatient.IndexOf(this.patientSelected);

            addPatient.patient.ID      = patientSelected.ID;
            addPatient.patient.Name    = patientSelected.Name;
            addPatient.patient.Address = patientSelected.Address;
            addPatient.patient.Phone   = patientSelected.Phone;
            addPatient.patient.Gender  = patientSelected.Gender;
            addPatient.patient.Status  = patientSelected.Status;
            formUpdate.ShowDialog();

            Patient p = (Patient)listPatient[index];

            p.ID               = addPatient.patient.ID;
            p.Name             = addPatient.patient.Name;
            p.Address          = addPatient.patient.Address;
            p.Phone            = addPatient.patient.Phone;
            p.Gender           = addPatient.patient.Gender;
            p.Status           = addPatient.patient.Status;
            addPatient.patient = null;
            LoadPatient();
            MessageBox.Show("Update Successful");
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            addPatient formAddPatient = new addPatient("Add");

            formAddPatient.ShowDialog();
            if (addPatient.patient != null)
            {
                Patient p = new Patient(addPatient.patient);

                if (string.IsNullOrEmpty(p.ID.ToString()) || string.IsNullOrEmpty(p.Name.ToString()) || string.IsNullOrEmpty(p.Address.ToString()) || string.IsNullOrEmpty(p.Phone.ToString()) || string.IsNullOrEmpty(p.Gender.ToString()) || string.IsNullOrEmpty(p.Status.ToString()))
                {
                }
                else
                {
                    listPatient.Add(p);
                    MessageBox.Show("Add Successful");
                    LoadPatient();
                }
            }
        }