protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e) { try { int index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize; string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("InterestID")).Value; string SectorInterestName = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text; string AreaInterestName = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text; Session[RunningCache.InterestID] = HDnID; if (e.CommandName.Equals("view")) { try { bindSectorInterest(); bindAreaInterest(); DataTable dtInterest = objInterest.GetInterest(" where InterestID='" + HDnID + "'"); ddlSectorInterest1.SelectedValue = dtInterest.Rows[0]["InterestSector"].ToString(); ddlAreaInterest1.SelectedValue = dtInterest.Rows[0]["InterestArea"].ToString(); BtnSave.Text = "Update"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#addEdiModal').modal('show');"); sb.Append(@"</script>"); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false); upEdit.Update(); } catch (Exception ex) { } } if (e.CommandName.Equals("deleting")) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); try { if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString()))) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = Mains.Constant.FAIL_CRUD; UpdAdd.Update(); upCrudGrid.Update(); upDel.Update(); bindgrid(); return; } else { if (this.global_error.Visible) { this.global_error.Visible = false; } this.global_success.Visible = true; this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE; UpdAdd.Update(); upDel.Update(); upCrudGrid.Update(); bindgrid(); } } catch (Exception ex) { } } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { try { CultureInfo ci = new CultureInfo("en-GB"); l = 0; var format = "dd, MMMM yyyy"; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); if (!IsPostBack) { if (HttpContext.Current.Session["AlertOn"] != null) { if ((Boolean)HttpContext.Current.Session["AlertOn"] == true) { if (this.global_error.Visible) { this.global_error.Visible = false; } this.global_success.Visible = true; this.global_success_msg.Text = Mains.Constant.SUCCESS_INSERT; } HttpContext.Current.Session["AlertOn"] = null; } if (string.IsNullOrEmpty(Request.QueryString["vid"]) == false) { Session[RunningCache.InterestCode] = Request.QueryString["vid"]; DataTable dtInterest = objInterest.GetInterest(" where InterestCode='" + Session[RunningCache.InterestCode].ToString().Trim() + "'"); if (dtInterest.Rows.Count > 0) { Session[RunningCache.InterestID] = dtInterest.Rows[0]["InterestID"].ToString(); filldata(Session[RunningCache.InterestID].ToString()); bindgrid(Session[RunningCache.InterestCode].ToString()); } } } StrMonth = DateTime.Now.ToString("MMMM yyyy", ci).ToUpper(); StrToday = DateTime.Now.ToString(format, ci).ToUpper(); if (this.global_success.Visible) { this.global_success.Visible = false; } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; execTimeLit.Text = String.Format("{0:00} minute(s), {1:00} seconde(s), {2:00} milliseconde(s)", ts.Minutes, ts.Seconds, ts.Milliseconds / 10); } catch (Exception ex) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = ex.ToString(); } }