protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PrescriptionDataTier dataTier = new PrescriptionDataTier();
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    DataSet dataSet = new DataSet();
                    string  precid  = Request.QueryString["ID"];
                    dataSet = dataTier.GetPrescriptionByID(precid);

                    if (Request.QueryString["ID"].Trim().ToUpper() == "EDIT")
                    {
                    }
                    else
                    {
                        //Response.Redirect("~/ViewPatients.aspx");
                        lblPrescriptionID.Text = dataSet.Tables[0].Rows[0]["prescription_id"].ToString();

                        txtRXNum.Text          = dataSet.Tables[0].Rows[0]["rx_number"].ToString();
                        txtMedicationName.Text = dataSet.Tables[0].Rows[0]["medication_name"].ToString();
                        txtRefillAmt.Text      = dataSet.Tables[0].Rows[0]["refill_amt"].ToString();
                        lblRefillDate.Text     = dataSet.Tables[0].Rows[0]["refill_date"].ToString();
                        txtDosage.Text         = dataSet.Tables[0].Rows[0]["dosage"].ToString();
                        txtIntakeMethod.Text   = dataSet.Tables[0].Rows[0]["intake_method"].ToString();
                        txtFrequency.Text      = dataSet.Tables[0].Rows[0]["frequency"].ToString();
                        txtPatID.Text          = dataSet.Tables[0].Rows[0]["patient_id"].ToString();
                        txtPhyID.Text          = dataSet.Tables[0].Rows[0]["physician_id"].ToString();
                    }
                }
            }
        }
Beispiel #2
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            try
            {
                CheckBox             chk    = new CheckBox();
                Label                lbl    = new Label();
                string               precid = "";
                PrescriptionDataTier std    = new PrescriptionDataTier();

                if (grdStudents.Rows.Count > 0)
                {
                    foreach (GridViewRow row in grdStudents.Rows)
                    {
                        chk = (CheckBox)row.FindControl("chkPreID");

                        if (chk.Checked)
                        {
                            lbl    = (Label)row.Controls[0].FindControl("hidPreID");
                            precid = lbl.Text.Trim();

                            std.DeletePrescription(precid);
                        }
                    }
                    DataBind();
                }
            }
            catch
            {
            }
        }
Beispiel #3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string choice = ddlAction.Text.ToString();

            if (choice == "Add")
            {
                if (txtAmount.Text.Trim() == "" || txtAmount.Text.ToString() == null)
                {
                    lblDisplay.Text = "Please input a value";
                }
                else
                {
                    lblDisplay.Text = "Success";
                    PrescriptionDataTier dataTier = new PrescriptionDataTier();
                    dataTier.AddRefill(ddlPrescriptionID.SelectedItem.ToString(), Convert.ToDecimal(txtAmount.Text), Convert.ToDateTime(lblRefillDate.Text.ToString()));
                }
            }
            else
            {
                if (txtAmount.Text.Trim() == "" || txtAmount.Text.ToString() == null)
                {
                    lblDisplay.Text = "Please input a value";
                }
                else
                {
                    lblDisplay.Text = "Success";
                    PrescriptionDataTier dataTier = new PrescriptionDataTier();
                    dataTier.SubRefill(ddlPrescriptionID.SelectedItem.ToString(), Convert.ToDecimal(txtAmount.Text), Convert.ToDateTime(lblRefillDate.Text.ToString()));
                }
            }
        }
Beispiel #4
0
        private void DataBind()
        {
            PrescriptionDataTier aDatatier = new PrescriptionDataTier();

            DataSet aDataSet = new DataSet();

            aDataSet = aDatatier.ViewPrescription("");

            grdStudents.DataSource = aDataSet.Tables[0];

            // Cache for a while
            if (Cache["CustomerData"] != null)
            {
                Cache.Add("StudentData", new DataView(aDataSet.Tables[0]),
                          null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(10),
                          System.Web.Caching.CacheItemPriority.Default, null);
            }
            grdStudents.DataBind();
        }
        protected void btnHidden_Click(object sender, EventArgs e)
        {
            string reply;

            // Adds into SQL database
            try
            {
                PrescriptionDataTier.UpdatePrescription(lblPrescriptionID.Text, txtRXNum.Text, txtMedicationName.Text, Convert.ToDecimal(txtRefillAmt.Text), Convert.ToDateTime(lblRefillDate.Text), txtDosage.Text,
                                                        txtIntakeMethod.Text, txtFrequency.Text, Convert.ToInt32(txtPhyID.Text));

                reply           = "Success";
                lblDisplay.Text = reply;
            }
            catch (Exception Ex)
            {
                throw new Exception(Ex.Message);
            }
            finally
            {
            }
        }
        private void DataBind()
        {
            PrescriptionDataTier aDatatier = new PrescriptionDataTier();

            ViewState["vprescid"] = txtPrescriptionID.Text.Trim();

            DataSet aDataSet = new DataSet();

            aDataSet = aDatatier.getprescription(Convert.ToInt32(ViewState["vprescid"]));

            grdStudents.DataSource = aDataSet.Tables[0];

            // Cache for a while
            if (Cache["CustomerData"] != null)
            {
                Cache.Add("PrescriptionData", new DataView(aDataSet.Tables[0]),
                          null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(10),
                          System.Web.Caching.CacheItemPriority.Default, null);
            }
            grdStudents.DataBind();
        }
Beispiel #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string reply;

            // Adds into SQL database
            try
            {
                PrescriptionDataTier.AddPrescription(Convert.ToString(txtRXNum.Text), txtMedicationName.Text, decimal.Parse(txtRefillAmount.Text),
                                                     DateTime.Parse(txtRefillDate.Text), Convert.ToString(txtDosage.Text), txtIntakeMethod.Text, txtFrequency.Text, Convert.ToInt32(ddlPatientID.SelectedItem.ToString()),
                                                     Convert.ToInt32(ddlPhysID.SelectedItem.ToString()));

                reply           = "Success";
                lblDisplay.Text = reply;
            }
            catch (Exception Ex)
            {
                throw new Exception(Ex.Message);
            }
            finally
            {
            }
        }