Esempio n. 1
0
 private void btnDosageSave_Click(object sender, EventArgs e)
 {
     if (txtDosageForm.Text != "")
     {
         DosageForm doForm = new DosageForm();
         if (_dosageFormId != 0)
         {
             doForm.LoadByPrimaryKey(_dosageFormId);
         }
         else
         {
             doForm.AddNew();
         }
         doForm.Form        = txtDosageForm.Text;
         doForm.Description = txtDosageDescription.Text;
         doForm.TypeID      = ((rdDosDrug.Checked) ? 1 : 2);
         doForm.Save();
         doForm.LoadAll();
         PopulateDosageForm(doForm);
         ResetDosageForm();
     }
     else
     {
         txtDosageForm.BackColor = Color.White;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Handles the gridViewDosageForm focused node changed and updates the form accordingly
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridViewDosageForm_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridViewDosageForm.GetFocusedDataRow();

            if (dr != null)
            {
                DosageForm doForm = new DosageForm();
                int        formId = Convert.ToInt32(dr["ID"]);
                doForm.LoadByPrimaryKey(formId);
                txtDosageForm.Text        = doForm.Form;
                txtDosageDescription.Text = doForm.Description;
                // if (doForm.TypeID == 1)
                rdDosDrug.Checked   = ((doForm.TypeID == 1) ? true : false);
                rdDosSupply.Checked = ((doForm.TypeID == 2) ? true : false);
                _dosageFormId       = doForm.ID;
                btnDosageSave.Text  = "Update";
            }
        }