Ejemplo n.º 1
0
        public void CreateMenu(TreeView menu)
        {
            if (!UserAccount.Authentication)
            {
                return;
            }


            if (HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] != null)
            {
                DataMenu = (List <UserMenu>)HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()];
            }
            else
            {
                DataMenu = MenuEngineService.FindAllMenu();
                HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] = DataMenu;
            }

            var CurrentMenuData = SortDataMenu();


            Hashtable hashMenu = new Hashtable();

            menu.Nodes.Clear();
            foreach (UserMenu item in CurrentMenuData)
            {
                if (item.MenuMainID == item.MenuID)
                {
                    if (!hashMenu.ContainsKey(item.MenuID))
                    {
                        TreeNode ParentNode = new TreeNode(item.MenuName == null ? "#" : item.MenuName, item.MenuID.ToString(), null, item.ProgramPath == null ? "#" : "~/" + item.ProgramPath, null);
                        hashMenu.Add(item.MenuID, ParentNode);
                        menu.Nodes.Add(ParentNode);
                    }
                }
                else
                {
                    if (!hashMenu.ContainsKey(item.MenuID))
                    {
                        TreeNode ChildNode = new TreeNode(item.MenuName == null ? "#" : item.MenuName, item.MenuID.ToString(), null, item.ProgramPath == null ? "#" : "~/" + item.ProgramPath, null);
                        hashMenu.Add(item.MenuID, ChildNode);
                        TreeNode ParentItem = hashMenu[item.MenuMainID] as TreeNode;
                        ParentItem.ChildNodes.Add(ChildNode);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private List <UserMenu> GetDataMenu()
        {
            if (HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] != null)
            {
                DataMenu = (List <UserMenu>)HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()];
            }
            else
            {
                DataMenu = MenuEngineService.FindAllMenu();
                HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] = DataMenu;
            }
            return(DataMenu);

            //DataMenu = MenuEngineService.FindAllMenu();
            //HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] = DataMenu;
            //return DataMenu;
        }
Ejemplo n.º 3
0
 public void UpdateDataMenu()
 {
     DataMenu = MenuEngineService.FindAllMenu();
     HttpContext.Current.Application[ApplicationEnum.WebApplication.DataMenu.ToString()] = DataMenu;
 }