private void AddBTN_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ContactTE.Text)) { patient = new Patient(); patient.Name = NameTE.Text; patient.Surname = SurnameTE.Text; patient.Email = EmailTE.Text; patient.Contact = ContactTE.Text; patient.Doctor = doctor; if (_DB.InsertPatient(patient)) { XtraMessageBox.Show("Patient is added!"); NameTE.Text = string.Empty; SurnameTE.Text = string.Empty; EmailTE.Text = string.Empty; ContactTE.Text = string.Empty; } else { XtraMessageBox.Show("Patient was not added"); } } else { XtraMessageBox.Show("All fields should be filled!"); } }
private void NewPatientBarItem_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ConactTE.Text) && DoctorLE.EditValue != null) { patient = new Patient(); 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.InsertPatient(patient)) { XtraMessageBox.Show("Element is not added!"); } _patient = _DB.GetPatient(); PatientGridControl.DataSource = _patient; ClearData(); } else { XtraMessageBox.Show("All fields should be filled!"); } }