protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { _termEdit = (BaseTermEditPage.TermEdit)Context.Items[Common.Names._CNTXT_TermEdit]; if (_termEdit.EditMode != EditMode.Add) throw new Exception(string.Format("Received edit mode {0} when edit mode {1} was expected.", _termEdit.EditMode.ToString(), EditMode.Add.ToString())); (header as Kindred.Knect.ITAT.Web.StandardHeader).PageTitle = _termEdit.TermHandler == BaseTermEditPage.TermHandler.ComplexListField ? "Add Field" : "Add Term"; txtTermName.Text = Helper.GetDefaultBasicTermName(_template); LoadTermTypes(); //Store the Term Group SetTermGroupInViewState(); } }
protected void grd_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument); int termIndex = _template.FindTermIndex((Guid)grdTerm.DataKeys[rowIndex].Value, _template.BasicTerms); switch (e.CommandName) { case Common.Names._GRID_COMMAND_EditRow: Term t = _template.FindTerm((Guid)grdTerm.DataKeys[rowIndex].Value); BaseTermEditPage.TermEdit termEdit = new BaseTermEditPage.TermEdit(); Context.Items[Common.Names._CNTXT_Template] = _template; termEdit.EditMode = EditMode.Edit; termEdit.TermIndex = termIndex; //Term Group selection if (_template.SecurityModel == SecurityModel.Advanced) Context.Items[Common.Names._CNTXT_SelectedTermGroupIndex] = grdTermGroup.SelectedIndex; termEdit.TermHandler = BaseTermEditPage.TermHandler.BasicTerm; Context.Items[Common.Names._CNTXT_TermEdit] = termEdit; Server.Transfer(Helper.TemplateTermEditPage(t.TermType)); break; case Common.Names._GRID_COMMAND_DeleteRow: IsChanged = TryDeleteTerm(termIndex); break; case Common.Names._GRID_COMMAND_SingleClick: case Common.Names._GRID_COMMAND_DoubleClick: break; default: break; } }
protected void btnAdd_Command(object sender, CommandEventArgs e) { if ((string)e.CommandArgument == "Term") { BaseTermEditPage.TermEdit termEdit = new BaseTermEditPage.TermEdit(); termEdit.EditMode = EditMode.Add; Context.Items[Common.Names._CNTXT_Template] = _template; if (_template.SecurityModel == SecurityModel.Advanced) Context.Items[Common.Names._CNTXT_SelectedTermGroupIndex] = grdTermGroup.SelectedIndex; termEdit.TermHandler = BaseTermEditPage.TermHandler.BasicTerm; Context.Items[Common.Names._CNTXT_TermEdit] = termEdit; Server.Transfer("TermAdd.aspx", true); return; } if ((string)e.CommandArgument == "TermGroup") { Context.Items[Common.Names._CNTXT_EditMode] = EditMode.Add; Context.Items[Common.Names._CNTXT_Template] = _template; Server.Transfer("TemplateTermGroupAddEdit.aspx", true); return; } throw new Exception(string.Format("ERROR: the button's CommandArgument was {0}. Valid values are Term, TermGroup.", (string)e.CommandArgument)); }
protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); _termEdit = (BaseTermEditPage.TermEdit)ViewState[_KH_VS_TERM_EDIT]; }
protected void grd_RowCommand(object sender, GridViewCommandEventArgs e) { Kindred.Common.Controls.KindredGridView grd = (Kindred.Common.Controls.KindredGridView)sender; int rowIndex = Convert.ToInt32(e.CommandArgument); switch (e.CommandName) { case Common.Names._GRID_COMMAND_EditRow: BaseTermEditPage.TermEdit termEdit = new BaseTermEditPage.TermEdit(); Term t = _template.ComplexLists[rowIndex]; //IsChanged related change if (IsChanged) Context.Items[Common.Names._CNTXT_IsChanged] = true; Context.Items[Common.Names._CNTXT_Template] = _template; termEdit.EditMode = EditMode.Edit; termEdit.TermHandler = BaseTermEditPage.TermHandler.ComplexList; termEdit.TermIndex = rowIndex; Context.Items[Common.Names._CNTXT_TermEdit] = termEdit; Server.Transfer(Helper.TemplateTermEditPage(t.TermType)); break; case Common.Names._GRID_COMMAND_DeleteRow: //20071019_DEG Commented out these two lines - the 'conflicts' dialog was appearing on every other attempt. //if (_deleteStatus == DeleteStatus.Cancelled) // _deleteStatus = DeleteStatus.None; //else IsChanged = TryDeleteTerm(rowIndex); break; case Common.Names._GRID_COMMAND_SingleClick: case Common.Names._GRID_COMMAND_DoubleClick: break; default: break; } }
protected void btnAdd_Command(object sender, CommandEventArgs e) { Business.Term newTerm = Helper.CreateTerm(Business.TermType.ComplexList, false, _template.IsManagedItem, _template, false); newTerm.Name = Business.ComplexList.NewTermName(_template); _template.ComplexLists.Add(newTerm); _template.Refresh(); Context.Items[Common.Names._CNTXT_Template] = _template; BaseTermEditPage.TermEdit termEdit = new BaseTermEditPage.TermEdit(); termEdit.EditMode = EditMode.Add; termEdit.TermHandler = BaseTermEditPage.TermHandler.ComplexList; termEdit.TermIndex = _template.ComplexLists.Count - 1; //item just added Context.Items[Common.Names._CNTXT_TermEdit] = termEdit; Server.Transfer(Helper.TemplateTermEditPage(TermType.ComplexList), true); return; }