Beispiel #1
0
 private void NewBarItem_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(DescriptionME.Text) && DateTE.DateTime != null && DateTE.DateTime > DateTime.Now && PatientLE.EditValue != null && DoctorLE.EditValue != null && !string.IsNullOrWhiteSpace(NameTE.Text))
     {
         prescription             = new Prescription();
         prescription.Date        = DateTE.DateTime;
         prescription.Description = DescriptionME.Text;
         prescription.Doctor      = int.Parse(DoctorLE.EditValue.ToString());
         prescription.Patient     = int.Parse(PatientLE.EditValue.ToString());
         prescription.Name        = NameTE.Text;
         if (!_DB.InsertPrescription(prescription))
         {
             XtraMessageBox.Show("Element is not added!");
         }
         ClearData();
         _prescription = _DB.GetPrescription();
         PresciptionGridControl.DataSource = _prescription;
     }
     else
     {
         XtraMessageBox.Show("All fields should be filled!");
     }
 }
Beispiel #2
0
        public PrescriptionForm(DBCommunication.DBCommunicationAdmin _db)
        {
            InitializeComponent();
            _DB           = _db;
            _prescription = _DB.GetPrescription();
            PresciptionGridControl.DataSource = _prescription;

            _doctor = _DB.GetDoctor();
            DoctorLE.Properties.DataSource = _doctor;

            _patient = _DB.GetPatient();
            PatientLE.Properties.DataSource = _patient;

            DoctorLE.Properties.DisplayMember = "Surname";
            DoctorLE.Properties.ValueMember   = "ID";

            PatientLE.Properties.DisplayMember = "Surname";
            PatientLE.Properties.ValueMember   = "ID";

            DateTE.DateTime = DateTime.Now;
        }