private void DrawGrid() { DataTable tbl = Data.GetPendingDependents(session_id, rblstEmployees.SelectedValue); gvCvrg.DataSource = tbl; gvCvrg.DataBind(); btnSave.Visible = !tbl.Rows.Count.Equals(0); // btnNext.Enabled = tbl.Rows.Count.Equals(0); }
protected void btnSave_Click(object sender, EventArgs e) { DataTable tbl = gvCvrg.DataSource as DataTable; if (tbl == null) { tbl = Data.GetPendingDependents(session_id, rblstEmployees.SelectedValue); } RadioButtonList rblst = null; string strRecord_id = ""; Oracle.DataAccess.Client.OracleConnection conn = SQLStatic.SQL.OracleConnection(); Oracle.DataAccess.Client.OracleTransaction tx = conn.BeginTransaction(); try { foreach (DataRow dr in tbl.Rows) { //rblst = FindControl ("rblst_" + dr["Record_id"].ToString()) as RadioButtonList; rblst = Bas_Utility.Utilities.GetRadioButtonList(Page, "rblst_" + dr["Record_id"].ToString()); strRecord_id = rblst.ID.Replace("rblst_", ""); if (rblst.SelectedValue.Equals("1")) { Data.MoveOutOfPending(session_id, strRecord_id, ViewState["User_Name"].ToString(), ViewState["email_apprve"].ToString()); ViewState["email_apprve"] = "0"; } else if (rblst.SelectedValue.Equals("0")) { Data.Deney_pending_Dep(session_id, strRecord_id, ViewState["User_Name"].ToString(), ViewState["email_descline"].ToString()); ViewState["email_descline"] = "0"; } else { //tx.Rollback(); //string strError = "<script>alert('You must ckeck all the dependents first')</script>"; //Page.ClientScript.RegisterStartupScript(Page.GetType(), "strError", strError); //return; } } tx.Commit(); } catch { tx.Rollback(); throw; } finally { SQLStatic.SQL.CloseConnection(conn); } jscriptsFunctions.Misc.AlertSaved(Page); if (!string.IsNullOrEmpty(Request.Params["ee"])) { if (!Data.HasMorePendingDep(Request.Params["ee"])) { Response.Redirect("default.aspx?SkipCheck=YES", true); } } if (!string.IsNullOrEmpty(Request.Params["ee"])) { DrawGrid(); if (!btnSave.Visible) { //btnNext.Enabled = true; lblNoPending.Visible = true; gvCvrg.Visible = false; return; } } Bulid_EEList(); if (rblstEmployees.Items.Count.Equals(0)) { Response.Redirect("Dependents.aspx?SkipCheck=YES&ee=" + Request.Params["ee"], true); } DrawGrid(); }