private void NewDoctorBarItem_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ContactTE.Text) && WorkingTimeLE.EditValue != null) { doctor = new Doctor(); doctor.Name = NameTE.Text; doctor.Surname = SurnameTE.Text; doctor.Email = EmailTE.Text; doctor.Contact = ContactTE.Text; doctor.Working_time = int.Parse(WorkingTimeLE.EditValue.ToString()); if (!_DB.InsertDoctor(doctor)) { XtraMessageBox.Show("Element is not added!"); } _doctor = _DB.GetDoctor(); DoctorGridControl.DataSource = _doctor; ClearData(); } else { XtraMessageBox.Show("All fields should be filled!"); } }