private void NewBarItem_ItemClick(object sender, ItemClickEventArgs e) { if (!string.IsNullOrWhiteSpace(DescriptionME.Text) && DateTE.DateTime != null && DateTE.DateTime > DateTime.Now && !string.IsNullOrWhiteSpace(NameTE.Text)) { prescription = new Prescription(); prescription.Date = DateTE.DateTime; prescription.Description = DescriptionME.Text; prescription.Doctor = doctor; prescription.Patient = patient; prescription.Name = NameTE.Text; if (!_DB.InsertPrescription(prescription)) { XtraMessageBox.Show("Element is not added!"); } ClearData(); _prescription = _DB.GetPrescriptionForPatient(patient); PresciptionGridControl.DataSource = _prescription; } else { XtraMessageBox.Show("All fields should be filled!"); } }