Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                EPV.SetError(cboDrug, "");
                EPV.SetError(cboPhysicianID, "");
                string physicianID = cboPhysicianID.SelectedValue.ToString();
                try
                {
                    //get the values

                    string   NDCPackageCode = cboDrug.SelectedValue.ToString();
                    string   totalRefills   = txtRefill.Text.Trim();
                    DateTime time           = dtpDatePrescribed.Value;

                    //Send it throug the datatier
                    PharmacyDataTier bPharm = new PharmacyDataTier();
                    DataSet          ds1    = new DataSet();
                    ds1 = bPharm.AddPrescription(NDCPackageCode, myPatientID, physicianID, totalRefills, time);
                    MessageBox.Show("Prescription succesfully added.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    EPV.SetError(cboDrug, "must select a drug from the list");
                    MessageBox.Show("Must select a drug in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                EPV.SetError(cboPhysicianID, "Must select a physician from the list");
                MessageBox.Show("Must select a physician in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
 private void txtRefill_TextChanged(object sender, EventArgs e)
 {
     //disables the button if the refills is less than 0
     try
     {
         if (int.Parse(txtRefill.Text.Trim()) > 0)
         {
             EPV.SetError(txtRefill, "");
             btnAdd.Enabled = true;
         }
         else
         {
             EPV.SetError(txtRefill, "Must have one or more fulfillments");
             btnAdd.Enabled = false;
         }
     }
     catch (Exception)
     {
         EPV.SetError(txtRefill, "Must have one or more fulfillments");
         btnAdd.Enabled = false;
     }
 }