private void EditDoctorBarItem_Click(object sender, EventArgs e) { if (doctor != null && !string.IsNullOrWhiteSpace(NameTE.Text) && !string.IsNullOrWhiteSpace(SurnameTE.Text) && !string.IsNullOrWhiteSpace(EmailTE.Text) && !string.IsNullOrWhiteSpace(ContactTE.Text) && WorkingTimeLE.EditValue != null) { 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.UpdateDoctor(doctor)) { XtraMessageBox.Show("Element is not edited!"); } ClearData(); _doctor = _DB.GetDoctor(); DoctorGridControl.DataSource = _doctor; } else { XtraMessageBox.Show("All fields should be filled!"); } }