protected void gvResult_UpdateCommand(object source, DataGridCommandEventArgs e) { int Id = (int)gvResult.DataKeys[e.Item.ItemIndex]; LiveIntSel l_LiveIntSel = ((LiveIntSel)((System.Web.UI.WebControls.TableRow)(e.Item)). Cells[3].FindControl("LiveIntSel2")); ///----------------------------------------------- if (!PubEntAdminManager.LenVal(((TextBox)((System.Web.UI.WebControls.TableRow)(e.Item)). Cells[2].FindControl("txtSubjName")).Text.Trim(), 50)) { Response.Redirect("InvalidInput.aspx"); } if (PubEntAdminManager.OtherVal(((TextBox)((System.Web.UI.WebControls.TableRow)(e.Item)). Cells[2].FindControl("txtSubjName")).Text.Trim())) { Response.Redirect("InvalidInput.aspx"); } foreach (ListItem li in l_LiveIntSel.Items) { if (PubEntAdminManager.OtherVal(li.Text) || PubEntAdminManager.OtherVal(li.Value)) { Response.Redirect("InvalidInput.aspx"); } } if (PubEntAdminManager.SpecialVal2(((TextBox)((System.Web.UI.WebControls.TableRow)(e.Item)). Cells[2].FindControl("txtSubjName")).Text.Replace(" ", ""))) { Response.Redirect("InvalidInput.aspx"); } foreach (ListItem li in l_LiveIntSel.Items) { if (PubEntAdminManager.SpecialVal2(li.Text.Replace(" ", "")) || PubEntAdminManager.SpecialVal2(li.Value.Replace(" ", ""))) { Response.Redirect("InvalidInput.aspx"); } } ///----------------------------------------------- bool blnSubjSave = PE_DAL.SetSubject(ref Id, ((TextBox)((System.Web.UI.WebControls.TableRow)(e.Item)).Cells[2].FindControl("txtSubjName")).Text.Trim(), System.Convert.ToInt32(l_LiveIntSel.InNCIPL), System.Convert.ToInt32(l_LiveIntSel.InROO), System.Convert.ToInt32(l_LiveIntSel.InExh), System.Convert.ToInt32(l_LiveIntSel.InCatalog), System.Convert.ToInt32(((CheckBox)((System.Web.UI.WebControls.TableRow)(e.Item)).Cells[4].FindControl("ckboxHasSubCat")).Checked)); if (blnSubjSave) { this.gvResult.EditItemIndex = -1; Session.Remove("SubjectEditItemIndex"); this.BindData(); } }
protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e) { SeriesCollection dt = ((SeriesCollection)this.gvResult.DataSource); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { PubEntAdmin.BLL.Series l_conf = dt[e.Item.ItemIndex]; ((Label)e.Item.Cells[1].Controls[1]).Text = Server.HtmlEncode(l_conf.SreName); //delete btn col //Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } #region Label_NCIPL_CC Label lblLiveIntName2 = e.Item.Cells[3].Controls[1] as Label; if (l_conf.InNCIPL == true && l_conf.InNCIPL_CC == true) { lblLiveIntName2.Text = "NCIPL<br/>NCIPLcc"; } else if (l_conf.InNCIPL == true) { lblLiveIntName2.Text = "NCIPL"; } else if (l_conf.InNCIPL_CC == true) { lblLiveIntName2.Text = "NCIPLcc"; } #endregion //#region Label_NCIPL_CC //if (l_conf.InNCIPL == true && l_conf.InNCIPL_CC == true) // ((Label) e.Item.Cells[3].Controls[1]).Text = "NCIPL<br/>NCIPLcc"; //else if (l_conf.InNCIPL == true) // ((Label)e.Item.Cells[3].Controls[1]).Text = "NCIPL"; //else if (l_conf.InNCIPL_CC == true) // ((Label)e.Item.Cells[3].Controls[1]).Text = "NCIPLcc"; //#endregion } else if (e.Item.ItemType == ListItemType.EditItem) { PubEntAdmin.BLL.Series l_conf = dt[e.Item.ItemIndex]; String status = ""; if (l_conf.Checked == true) { status = "Active"; } else { status = "Inactive"; } ((Label)e.Item.Cells[2].Controls[1]).Text = status; //if (e.Item.Cells[3].Controls[2] is Button) if (e.Item.Cells[4].Controls[2] is Button) { //Button l_btnCancel = ((Button)e.Item.Cells[3].Controls[2]); Button l_btnCancel = ((Button)e.Item.Cells[4].Controls[2]); l_btnCancel.ID = "gvResult_Cancel"; Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; //e.Item.Cells[3].Controls.Add(l_panel); //e.Item.Cells[3].Controls.Add(l_mpe); //e.Item.Cells[3].Controls.Add(l_cbe); e.Item.Cells[4].Controls.Add(l_panel); e.Item.Cells[4].Controls.Add(l_mpe); e.Item.Cells[4].Controls.Add(l_cbe); } //delete btn col //Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } #region Checkboxes_NCIPL_CC LiveIntSel LiveIntSel2 = (LiveIntSel)e.Item.Cells[3].Controls[1]; LiveIntSel2.SetInterfacesToShow("Series"); //Hide unwanted interfaces if (l_conf.InNCIPL) { LiveIntSel2.InNCIPL = true; } if (l_conf.InNCIPL_CC) { LiveIntSel2.InROO = true; } #endregion } }
protected void gvResult_UpdateCommand(object source, DataGridCommandEventArgs e) { SeriesCollection dt = ((SeriesCollection)this.gvResult.DataSource); PubEntAdmin.BLL.Series l_conf = dt[e.Item.ItemIndex]; int Sreid = l_conf.SreID; string Srename = ((TextBox)e.Item.Cells[1].Controls[1]).Text; int Active = 0; string sActive = ((Label)e.Item.Cells[2].Controls[1]).Text; if (sActive == "Active") { Active = 1; } else { Active = 0; } Boolean valid = false; Boolean validnum = false; Boolean validlen = false; if (Srename.Length != 0) { valid = PubEntAdminManager.OtherVal(Srename); validnum = PubEntAdminManager.SpecialVal2(Srename); validlen = PubEntAdminManager.LenVal(Srename, 50); } if ((valid == false) && (validnum == false) && (validlen == true)) { #region NCIPL_CC_Checks //Added check LiveIntSel LiveIntSel2 = (LiveIntSel)e.Item.Cells[3].Controls[0]; if (!LiveIntSel2.SelectedAny) { Label lblMessage = e.Item.Cells[6].Controls[0] as Label; lblMessage.Text = "At least one Live Interface should be selected."; return; } //Check whether there are associations before removing an Interface if (LiveIntSel2.InNCIPL == false) { bool ValExists = LU_DAL.CheckSeriesInterfaceAssociation(Sreid, "NCIPL"); if (ValExists) { Label lblMessage = e.Item.Cells[6].Controls[0] as Label; //lblMessage.Text = "This Series has associations on the NCIPL tab for one or more publications."; lblMessage.Text = "Unable to Update, value associated with publication(s) on the NCIPL tab."; return; } } if (LiveIntSel2.InROO == false) { bool ValExists = LU_DAL.CheckSeriesInterfaceAssociation(Sreid, "NCIPL_CC"); if (ValExists) { Label lblMessage = e.Item.Cells[6].Controls[0] as Label; //lblMessage.Text = "This Series has associations on the ROO tab for one or more publications."; lblMessage.Text = "Unable to Update, value associated with publication(s) on the NCIPLcc tab."; return; } } #endregion //NCIPL_CC LU_DAL.UpdateSeriesLU(Sreid, Srename, Active); LU_DAL.UpdateSeriesLU(Sreid, Srename, Active, (LiveIntSel2.InNCIPL == true) ? 1 : 0, (LiveIntSel2.InROO == true) ? 1 : 0); Response.Redirect("~/LookupMgmt.aspx?sub=serie"); } else { Response.Redirect("InvalidInput.aspx"); } }