예제 #1
0
    protected void GvTestDtls_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            GridViewRow row      = (GridViewRow)GvTestDtls.Rows[e.RowIndex];
            Label       lblTcode = (Label)row.FindControl("lblTcode");

            DataTable dt = new DataTable();
            dt.Columns.Add("TestCode", typeof(int));
            dt.Columns.Add("TestName", typeof(string));
            dt.Columns.Add("TotalTestFee", typeof(int));
            dt.Columns.Add("FeePaidByGovt", typeof(int));
            int i = 0;
            foreach (GridViewRow gr in GvTestDtls.Rows)
            {
                dt.Rows.Add();
                dt.Rows[i]["TestCode"]      = ((Label)gr.FindControl("lblTcode")).Text;
                dt.Rows[i]["TestName"]      = ((Label)gr.FindControl("lblTname")).Text;
                dt.Rows[i]["TotalTestFee"]  = ((Label)gr.FindControl("lblAmount")).Text;
                dt.Rows[i]["FeePaidByGovt"] = ((Label)gr.FindControl("lblPaidBygovt")).Text;
                // dt.Rows[i]["Amount"] = ((Label)gr.FindControl("lblAmount")).Text;
                i++;
            }
            Label TestCode = (Label)GvTestDtls.Rows[e.RowIndex].FindControl("lblTcode");
            foreach (ListItem item in chktest.Items)
            {
                if (item.Value == TestCode.Text)
                {
                    item.Selected = false;
                    break;
                }
            }
            List <String> TestID_list   = new List <string>();
            List <String> TestName_list = new List <string>();

            foreach (System.Web.UI.WebControls.ListItem item in chktest.Items)
            {
                if (item.Selected)
                {
                    TestID_list.Add(item.Value);
                    TestName_list.Add(item.Text);
                }

                lblTestcode.Text = String.Join(",", TestID_list.ToArray());
                //lblDName.Text = String.Join(",", TestName_list.ToArray());
            }
            dt.Rows.RemoveAt(e.RowIndex);
            GvTestDtls.DataSource = null;
            GvTestDtls.DataSource = dt;
            GvTestDtls.DataBind();
            if (dt.Rows.Count > 0)
            {
                GvTestDtls.HeaderRow.Cells[0].Attributes["data-class"] = "expand";
                GvTestDtls.HeaderRow.Cells[1].Attributes["data-hide"]  = "phone";
                GvTestDtls.HeaderRow.Cells[2].Attributes["data-hide"]  = "phone";
                GvTestDtls.HeaderRow.Cells[3].Attributes["data-hide"]  = "phone";


                GvTestDtls.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("~/Error.aspx");
        }
    }
예제 #2
0
    protected void BindDiagTestGrid()
    {
        try
        {
            if (rdExempted.SelectedIndex < 0)
            {
                objCommon.ShowAlertMessage("Select an option for Exempted Category");
                rdExempted.Focus();

                foreach (ListItem item in chktest.Items)
                {
                    item.Selected = false;
                }
                return;
            }
            List <String> TestID_list   = new List <string>();
            List <String> TestName_list = new List <string>();

            foreach (System.Web.UI.WebControls.ListItem item in chktest.Items)
            {
                if (item.Selected)
                {
                    TestID_list.Add(item.Value);
                    TestName_list.Add(item.Text);
                }

                lblTestcode.Text = String.Join(",", TestID_list.ToArray());
                //lblDName.Text = String.Join(",", TestName_list.ToArray());
            }

            ddt = objDiag.GetTestDtlsBAL(Session["UniqueInstId"].ToString(), lblTestcode.Text, ConnKey);
            if (ddt.Rows.Count > 0)
            {
                /*IF EXEMPTED CATEGORY IS YES THEN FEE PAYABLE IS ZERO*/
                if (rdExempted.SelectedValue == "Yes")
                {
                    for (int i = 0; i < ddt.Rows.Count; i++)
                    {
                        ddt.Rows[i]["FeePaidByGovt"] = ddt.Rows[i]["TotalTestFee"].ToString();
                    }
                }
                else
                {
                    /*IF ANIMAL IS DOG OR CAT  , ONLY THEN TEST FEE SHOULD BE COLLECTED ,, ELSE IT IS ZERO*/
                    if (ViewState["Animal"].ToString() != "Cat" && ViewState["Animal"].ToString() != "Dog")
                    {
                        for (int i = 0; i < ddt.Rows.Count; i++)
                        {
                            ddt.Rows[i]["FeePaidByGovt"] = ddt.Rows[i]["TotalTestFee"].ToString();
                        }
                    }
                }
                GvTestDtls.Visible    = true;
                GvTestDtls.DataSource = ddt;
                GvTestDtls.DataBind();
                btn_Save.Visible = true;
            }
            else
            {
                GvTestDtls.DataSource = null;
                GvTestDtls.DataBind();
                btn_Save.Visible = false;
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("~/Error.aspx");
        }
    }