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!"); } }
public PrescriptionFormD(DBCommunication.DBCommunicationAdmin _db, int doctorID, int patientID) { InitializeComponent(); _DB = _db; _prescription = _DB.GetPrescriptionForPatient(patientID); PresciptionGridControl.DataSource = _prescription; _doctor = _DB.GetDoctor(); _patient = _DB.GetPatient(); patient = patientID; doctor = doctorID; }