private void EditBTN_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ContactTE.Text)) { patient.Name = NameTE.Text; patient.Surname = SurnameTE.Text; patient.Email = EmailTE.Text; patient.Contact = ContactTE.Text; if (_DB.UpdatePatient(patient)) { XtraMessageBox.Show("Patient is amended!"); NameTE.Text = string.Empty; SurnameTE.Text = string.Empty; EmailTE.Text = string.Empty; ContactTE.Text = string.Empty; } else { XtraMessageBox.Show("Patient was not amended"); } } else { XtraMessageBox.Show("All fields should be filled!"); } }
private void EditPatientBarItem_Click(object sender, EventArgs e) { if (patient != null && !string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ConactTE.Text) && DoctorLE.EditValue != null) { patient.Name = NameTE.Text; patient.Surname = SurnameTE.Text; patient.Email = EmailTE.Text; patient.Contact = ConactTE.Text; patient.Doctor = int.Parse(DoctorLE.EditValue.ToString()); if (!_DB.UpdatePatient(patient)) { XtraMessageBox.Show("Element is not edited!"); } _patient = _DB.GetPatient(); PatientGridControl.DataSource = _patient; ClearData(); patient = new Patient(); } else { XtraMessageBox.Show("All fields should be filled!"); } }