protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { try { if (validate()) { dt = new DataTable(); objBE.Year = ddlYear.SelectedValue.Trim(); objBE.CatId = ddlCategory.SelectedValue.Trim(); objBE.ActionBy = "ADMIN"; objBE.Action = "DIST"; dt = ObjDL.TargetAllotment_IUDR(objBE, con); GVDistAllot.DataSource = dt; GVDistAllot.DataBind(); btnGetTotal.Visible = true; lbltotal.Visible = true; BtnSave.Visible = true; gridid.Visible = true; } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString()); Response.Redirect("~/Error.aspx"); } }
protected void BindGrid() { dt = new DataTable(); try { objBE.ActionBy = "ADMIN"; objBE.Action = "R"; objBE.Year = ddlYear.SelectedValue.Trim(); objBE.CatId = ddlCategory.SelectedValue.Trim(); objBE.DistCode = lblDistCode.Text.Trim(); dt = ObjDL.TargetAllotment_IUDR(objBE, con); if (dt.Rows.Count > 0) { GVDistAllot.DataSource = dt; GVDistAllot.DataBind(); gridid.Visible = true; //btnGetTotal.Visible = true; } else { GVDistAllot.DataSource = null; GVDistAllot.DataBind(); } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString()); Response.Redirect("~/Error.aspx"); } }
protected void FreezeAllotments(object sender, EventArgs e) { try { DataTable dtfreeze = new DataTable(); dtfreeze.Columns.Add("allot_id", typeof(string)); int j = 0; foreach (GridViewRow gr in GVDistAllot.Rows) { if (((CheckBox)gr.FindControl("chkSelct")).Checked == true) { dtfreeze.Rows.Add(); dtfreeze.Rows[j]["allot_id"] = ((Label)gr.FindControl("lblAllotedId")).Text; j++; } } if (j == 0) { ObjCommon.ShowAlertMessage("Select atleast one row to freeze"); } else { objBE.TVP = dtfreeze; objBE.Action = "ADMIN"; dt = ObjDL.FreezeTargetDetails(objBE, con); if (dt.Rows.Count > 0) { ObjCommon.ShowAlertMessage("Not freezed, try again"); } else { ObjCommon.ShowAlertMessage("data freezed"); GVDistAllot.DataSource = null; GVDistAllot.DataBind(); BindGrid(); FreezedDataGrid(); } } } catch (Exception ex) { // ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString()); // Response.Redirect("../Error.aspx"); } }