Example #1
0
        public ActionResult GetMenuNodeList()
        {
            string       fucId    = Request.Params[0].Trim();
            string       userId   = HttpContext.Session["User"].ToString();
            MenuNodeList nodeList = new MenuNodeList(userId);
            MenuNode     root     = nodeList.GetCurrentRootNode(fucId);

            IList <MenuNodeDTO> result = new List <MenuNodeDTO>();

            foreach (MenuNode child in root.Children)
            {
                MenuNodeDTO dto = new MenuNodeDTO();
                dto.id   = child.ID;
                dto.text = child.Name;
                dto.url  = child.Url;
                dto.leaf = true;
                if (child.Children.Count > 0)
                {
                    dto.leaf       = false;
                    dto.childNodes = new List <MenuNodeDTO>();
                    AddToRoot(child, dto.childNodes);
                }

                result.Add(dto);
            }

            return(this.Json(result));
        }
Example #2
0
        public ActionResult GetMenuNodeList()
        {
            string fucId = Request.Params[0].Trim();
            string userId = HttpContext.Session["User"].ToString();
            MenuNodeList nodeList = new MenuNodeList(userId);
            MenuNode root = nodeList.GetCurrentRootNode(fucId);

            IList<MenuNodeDTO> result = new List<MenuNodeDTO>();
            foreach (MenuNode child in root.Children)
            {
                MenuNodeDTO dto = new MenuNodeDTO();
                dto.id = child.ID;
                dto.text = child.Name;
                dto.url = child.Url;
                dto.leaf = true;
                if (child.Children.Count > 0)
                {
                    dto.leaf = false;
                    dto.childNodes = new List<MenuNodeDTO>();
                    AddToRoot(child, dto.childNodes);
                }

                result.Add(dto);
            }

            return this.Json(result);
        }