private void FindSelectedMainItem(int?id, List <MenuNodeDataView> allNodes) { MenuNodeDataView parentNode = allNodes.FirstOrDefault(n => n.idNode == id); int?mainNodeId = parentNode.parentNode; this.ddlMainMenuItems.Items.FindByValue(mainNodeId.ToString()).Selected = true; }
private XmlElement FillXmlNodeData(XmlElement xmlNode, MenuNodeDataView node) { xmlNode.SetAttribute("NodeID", node.idNode.ToString()); xmlNode.SetAttribute("NodeName", node.name); return(xmlNode); }
private void HiddenControlsLoad(string nodeId = null) { List <MenuNodeDataView> allnodes = this.ownerPage.AdminClientRef.GetAllMenuNode(this.ownerPage.CallContext); if (nodeId == null) { List <MenuNodeDataView> nodeListRootItems = allnodes.Where(m => m.parentNode == 0).ToList(); AddDefaultEmtryValue(nodeListRootItems, BaseHelper.GetCaptionString("UI_Please_Select")); this.ddlMainMenuItems.DataSource = nodeListRootItems; this.ddlMainMenuItems.DataBind(); } else { List <MenuNodeDataView> listRootsAndParentsNodes = allnodes.Where(n => (n.type == "root") || n.type == "parent").ToList(); List <MenuNodeDataView> rootNodes = allnodes.Where(n => (n.type == "root")).ToList(); List <MenuNodeDataView> parentNodes = allnodes.Where(n => n.type == "parent").ToList(); MenuNodeDataView edittedNode = allnodes.FirstOrDefault(n => n.idNode == int.Parse(nodeId)); NavURL navUrl = this.ownerPage.AdminClientRef.GetUrlNavById(edittedNode.idNavURL); SetEddingNodeValues(nodeId, edittedNode, navUrl); bool isSelectedNodeInRoots = rootNodes.Any(n => n.idNode == int.Parse(nodeId)); if (isSelectedNodeInRoots) { this.hdnEditingNodeType.Value = "root"; this.hdnEditingNodeParent.Value = Constants.INVALID_ID_ZERO_STRING; this.lbNodePlace.Visible = true; this.lbNodePlace.Text = BaseHelper.GetCaptionString("Can_Only_Change_Name_And_URL"); } else { bool isEditedInParentNodes = parentNodes.Any(n => n.idNode == int.Parse(nodeId)); this.hdnEditingNodeParent.Value = edittedNode.parentNode.ToString(); if (isEditedInParentNodes) { this.hdnEditingNodeType.Value = "parent"; AddDefaultEmtryValue(rootNodes, BaseHelper.GetCaptionString("Make_Node_Root")); BindDdl(rootNodes, ddlCurrentNodePlace, BaseHelper.GetCaptionString("Can_Change_Position_In_Root_Menu") , lbNodePlace, edittedNode.parentNode.ToString()); } else { this.hdnEditingNodeType.Value = "link"; AddDefaultEmtryValue(listRootsAndParentsNodes, BaseHelper.GetCaptionString("Make_Node_Root")); BindDdl(listRootsAndParentsNodes, ddlCurrentNodePlace, BaseHelper.GetCaptionString("Can_Change_Position_In_Root_And_Parent_Menu") , lbNodePlace, edittedNode.parentNode.ToString()); } } } }
private void SetEddingNodeValues(string nodeId, MenuNodeDataView edittedNode, NavURL navUrl) { this.hdnEditingIndexValue.Value = nodeId; this.hdnEditingNodeUrlIndex.Value = edittedNode.idNavURL.ToString(); this.btnAddMenuItem.Text = BaseHelper.GetCaptionString("Save_Btn"); this.txvNavUrl.Text = navUrl.URL; this.tbxNewMenuItemName.Text = edittedNode.name; this.lbNewMenuItemName.Text = BaseHelper.GetCaptionString("New_Node_Name"); this.tbxQueryParams.Text = navUrl.QueryParams; this.ddlMainMenuItems.Visible = false; this.ddlSubMenuItems.Visible = false; lbMainNodesDll.Visible = false; lbSubMenuItems.Visible = false; this.PopUpHeadline.InnerText = BaseHelper.GetCaptionString("Editing_Nodes"); this.lbResultContext.Attributes.Remove("class"); this.lbResultContext.Text = string.Empty; }
protected override void OnInit(EventArgs e) { base.OnInit(e); ///Страници, които не изискват login if ( this.UserProps == null && this.CurrentPageFullName() != Share.Login.formResource.PageFullName ) { Response.Redirect(Share.Login.formResource.PagePath); } UserProps userProps = GetOnlineUsers().Where(s => s.SessionID == this.Session.SessionID).FirstOrDefault() as UserProps; if (userProps != null && userProps.IsKilled) { Session.RemoveAll(); Session.Abandon(); Response.Redirect(Share.Login.formResource.PagePath); } if (userProps != null && CurrentPagePath() != OnlineUsersList.formResource.PagePath) { userProps.LastPageName = CurrentPagePath(); ModuleDataView module = DictionaryModules.Where(m => m.Key == CurrentModule()).FirstOrDefault().Value; MenuNodeDataView node = null; if (FormContext.QueryString["Node"] != null) { node = DictionaryMenuNodes.Where(m => m.Key == FormContext.QueryString["Node"].ToString()).FirstOrDefault().Value; } if (module != null) { userProps.LastModuleName = module.ModuleName; } if (node != null) { userProps.LastPageName = node.name; } } #region filter by ip this.currentModuleObject = this.AdminClientRef.GetModuleBySysName(this.CurrentModule()); if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName && this.currentModuleObject != null && this.currentModuleObject.NeedCheck && !Request.UserHostAddress.Equals("::1")) { AllowIP allowIP = this.AdminClientRef.GetEntityByIPAddress(Request.UserHostAddress); if (allowIP == null || !allowIP.Allow) { Response.Redirect("~/UI/InternalPageInfo.aspx"); } } #endregion #region filter by modules List <string> listPermittedModules = new List <string>() { Constants.MODULE_NOMENCLATURES, Constants.MODULE_SUPPORT_HISTORY, Constants.MODULE_SETTINGS, Constants.MODULE_PERMISSION, Constants.MODULE_INOUTDOCUMENT, }; if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName && currentModuleObject != null && this.UserProps.Roles.Any(a => a.Name == "VIEW") && listPermittedModules.Any(s => s == currentModuleObject.ModuleSysName)) { Response.Redirect("~/UI/InternalPageInfo.aspx"); } #endregion if (!IsPostBack) { InitReloadParentPageControl(); } AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "IsNumeric", BaseHelper.JS_SCRIPT_IS_NUMERIC, false); }