Exemple #1
0
        private void btnUpdateRefill_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to update this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult == DialogResult.Yes)
            {
                try
                {
                    //get the values
                    string   prescriptionID = txtPrescriptionID.Text.Trim();
                    DateTime time           = dtpTime.Value;

                    //Send it throug the datatier
                    PharmacyDataTier bPharm = new PharmacyDataTier();
                    DataSet          ds1    = new DataSet();
                    ds1 = bPharm.UpdateFulfillment(myFulfillmentID, originalPrescriptionID, prescriptionID, time);
                    MessageBox.Show("Refill updated successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    string myException = ex.ToString();
                    if (myException.Contains("Prescription is out of refills"))
                    {
                        MessageBox.Show("Prescription is out of refills", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
            }
        }