private void button2_Click_1(object sender, EventArgs e) { ADDPATIENT formUpdate = new ADDPATIENT("update"); int index = Manageofhospital.listPatient.IndexOf(this.PatientSelected); ADDPATIENT.patient.Id = PatientSelected.Id; ADDPATIENT.patient.Name = PatientSelected.Name; ADDPATIENT.patient.District = PatientSelected.District; ADDPATIENT.patient.Ward = PatientSelected.Ward; ADDPATIENT.patient.Indentitycard = PatientSelected.Indentitycard; ADDPATIENT.patient.Gender = PatientSelected.Gender; ADDPATIENT.patient.Dateofbirth = PatientSelected.Dateofbirth; ADDPATIENT.patient.Sick = PatientSelected.Sick; ADDPATIENT.patient.Nationality = PatientSelected.Nationality; formUpdate.ShowDialog(); Patient1 a = (Patient1)listPatient[index]; a.Id = ADDPATIENT.patient.Id; a.Name = ADDPATIENT.patient.Name; a.District = ADDPATIENT.patient.District; a.Ward = ADDPATIENT.patient.Ward; a.Indentitycard = ADDPATIENT.patient.Indentitycard; a.Gender = ADDPATIENT.patient.Gender; a.Dateofbirth = ADDPATIENT.patient.Dateofbirth; a.Sick = ADDPATIENT.patient.Sick; a.Nationality = ADDPATIENT.patient.Nationality; ADDPATIENT.patient = null; LoadPatient(); MessageBox.Show("Update successful"); }
private void button1_Click_1(object sender, EventArgs e) { ADDPATIENT formAdd1 = new ADDPATIENT("Add"); formAdd1.ShowDialog(); if (ADDPATIENT.patient != null) { Patient1 p = new Patient1(ADDPATIENT.patient); if (string.IsNullOrEmpty(p.Name.ToString()) || string.IsNullOrEmpty(p.District.ToString()) || string.IsNullOrEmpty(p.Ward.ToString()) || string.IsNullOrEmpty(p.Gender.ToString()) || string.IsNullOrEmpty(p.Indentitycard.ToString()) || string.IsNullOrEmpty(p.Dateofbirth.ToString()) || string.IsNullOrEmpty(p.Sick.ToString()) || string.IsNullOrEmpty(p.Nationality.ToString())) { MessageBox.Show("Add successful but empty", "Notification"); } else { listPatient.Add(p); MessageBox.Show("Add successful", "Notification"); LoadPatient(); } } }