Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (ddlExistingRecord.SelectedValue != "0")
        {
            string DateRange = " and MedicineDate >= '" + DateTime.Parse(ddlExistingRecord.SelectedValue) + "' and MedicineDate <= '" + DateTime.Parse(ddlExistingRecord.SelectedValue).AddMinutes(1) + "'";
            MedicineTimenDateManager.DeleteMedicineTimenDateByResidentID(int.Parse(Request.QueryString["ResidentID"]), DateRange);
        }
        foreach (GridViewRow gvr in gvMedicaiton.Rows)
        {
            CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect");
            if (chkSelect.Checked)
            {
                TextBox           txtComment        = (TextBox)gvr.FindControl("txtComment");
                MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

                medicineTimenDate.MedicationTimeID = Int32.Parse(chkSelect.ValidationGroup);
                medicineTimenDate.MedicineDate     = ddlExistingRecord.SelectedValue == "0" ? DateTime.Now : DateTime.Parse(ddlExistingRecord.SelectedValue);
                medicineTimenDate.ExtraField1      = txtComment.Text;
                medicineTimenDate.ExtraField2      = getLogin().LoginID.ToString();
                medicineTimenDate.ExtraField3      = getLogin().ExtraField4;
                MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate);
            }
        }

        lblMsg.Visible = true;
        lblNewMedicationAddedSuccessfully.Visible = false;


        loadMedicineTimenDateDate();
        foreach (GridViewRow gvr in gvMedicaiton.Rows)
        {
            CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect");
            chkSelect.Checked = false;
        }
    }
Ejemplo n.º 2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

        medicineTimenDate.MedicationTimeID = Int32.Parse(ddlMedicationTime.SelectedValue);
        medicineTimenDate.MedicineDate     = txtMedicineDate.Text;
        int resutl = MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate);

        Response.Redirect("AdminMedicineTimenDateDisplay.aspx");
    }