protected void btnUpdate_Click(object sender, EventArgs e)
    {
        MedicationTime medicationTime = new MedicationTime();

        medicationTime = MedicationTimeManager.GetMedicationTimeByID(Int32.Parse(Request.QueryString["medicationTimeID"]));
        MedicationTime tempMedicationTime = new MedicationTime();

        tempMedicationTime.MedicationTimeID = medicationTime.MedicationTimeID;

        tempMedicationTime.TakingTime  = txtTakingTime.Text;
        tempMedicationTime.MedicineID  = Int32.Parse(ddlMedicine.SelectedValue);
        tempMedicationTime.ResidentID  = Int32.Parse(ddlResident.SelectedValue);
        tempMedicationTime.Quantity    = txtQuantity.Text;
        tempMedicationTime.Quality     = txtQuality.Text;
        tempMedicationTime.Frequency   = txtFrequency.Text;
        tempMedicationTime.ExtraField1 = txtExtraField1.Text;
        tempMedicationTime.ExtraField2 = txtExtraField2.Text;
        tempMedicationTime.AddedBy     = Int32.Parse(txtAddedBy.Text);
        tempMedicationTime.AddedDate   = DateTime.Now;
        tempMedicationTime.UpdateBy    = Int32.Parse(txtUpdateBy.Text);
        tempMedicationTime.UpdateDate  = txtUpdateDate.Text;
        bool result = MedicationTimeManager.UpdateMedicationTime(tempMedicationTime);

        Response.Redirect("AdminMedicationTimeDisplay.aspx");
    }
    private void showMedicationTimeData()
    {
        MedicationTime medicationTime = new MedicationTime();

        medicationTime = MedicationTimeManager.GetMedicationTimeByID(Int32.Parse(Request.QueryString["medicationTimeID"]));

        txtTakingTime.Text        = medicationTime.TakingTime;
        ddlMedicine.SelectedValue = medicationTime.MedicineID.ToString();
        ddlResident.SelectedValue = medicationTime.ResidentID.ToString();
        txtQuantity.Text          = medicationTime.Quantity;
        txtQuality.Text           = medicationTime.Quality;
        txtFrequency.Text         = medicationTime.Frequency;
        txtExtraField1.Text       = medicationTime.ExtraField1;
        txtExtraField2.Text       = medicationTime.ExtraField2;
        txtAddedBy.Text           = medicationTime.AddedBy.ToString();
        txtUpdateBy.Text          = medicationTime.UpdateBy.ToString();
        txtUpdateDate.Text        = medicationTime.UpdateDate;
    }
Example #3
0
    protected void lbEdit_Click(object sender, EventArgs e)
    {
        ImageButton linkButton = new ImageButton();

        linkButton = (ImageButton)sender;
        int id;

        id = Convert.ToInt32(linkButton.CommandArgument);

        MedicationTime medicationTime = MedicationTimeManager.GetMedicationTimeByID(id);

        hfMedicationTimeID.Value = medicationTime.MedicationTimeID.ToString();
        txtTakingTime.Text       = medicationTime.TakingTime == "PRN" ? "" : medicationTime.TakingTime;
        chkPRN.Checked           = medicationTime.TakingTime == "PRN" ? true : false;
        string medicationName = MedicineManager.GetMedicineByID(medicationTime.MedicineID).MedicineName;
        int    medicaitonID   = 0;

        foreach (ListItem item in ddlMedicine.Items)
        {
            if (item.Text == medicationName)
            {
                medicaitonID = int.Parse(item.Value);
            }
        }

        ddlMedicine.SelectedValue = medicaitonID.ToString();


        txtQuantity.Text              = medicationTime.Quantity;
        txtQuality.Text               = medicationTime.Quality;
        txtFrequency.Text             = medicationTime.Frequency;
        txtEXNo.Text                  = medicationTime.ExtraField1;
        ddlRouteOfAdmin.SelectedValue = medicationTime.ExtraField2;
        txtAmount.Text                = medicationTime.ExtraField3;
        txtpharmacyName.Text          = medicationTime.ExtraField4;
        ddlStatus.SelectedValue       = medicationTime.ExtraField6 != null ? medicationTime.ExtraField6 : "Active";
        //chkAddDischargeRecord.Checked=bool.Parse(medicationTime.ExtraField5);
    }