Exemple #1
0
        /// <summary>
        /// 获取系统功能菜单Json 数据
        /// 添加人:周 鹏
        /// 添加时间:2014-03-26
        /// </summary>
        /// <history>
        /// 修改描述:时间+作者+描述
        /// </history>
        /// <returns></returns>
        public JsonResult GetLeftMenu(string menuId)
        {
            ComMenuEntity titleMenu = new ComMenuBll().GetMenuByID(menuId);
            var           menus     = new ComMenuBll().GetUserMenus(CurrentUser.CrmUser.Id);

            menus = menus.Where(t => t.Id.Substring(0, 4).ToString().Equals(menuId) && !t.Id.Equals(menuId)).ToList();
            var menuList = menus.Select(comMenuEntity => new ZTreeNode()
            {
                id       = comMenuEntity.Id,
                pId      = comMenuEntity.ParentMenuId,
                name     = comMenuEntity.MenuName,
                openFlag = comMenuEntity.OpenType.ToString(),
                icon     = string.IsNullOrEmpty(comMenuEntity.IconPic) ? "/Content/Theme/Default/Images/treesystem.gif" : comMenuEntity.IconPic,
                open     = false
            }).ToList();

            var rtEntity = new StatusModel <ZTreeNode>
            {
                rtData  = menuList,
                rtMsrg  = titleMenu.MenuName,
                rtState = 0
            };

            return(Json(rtEntity, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        /// <summary>
        /// 加载手风琴菜单
        /// 添加人:周 鹏
        /// 添加时间:2014-12-15
        /// </summary>
        /// <history>
        /// 修改描述:时间+作者+描述
        /// </history>
        /// <returns></returns>
        public JsonResult LoadAccordionMenu()
        {
            try
            {
                var currentUser = CurrentUser.CrmUser;
                var userMenus   = new ComMenuBll().GetUserMenus(currentUser.Id).Where(x => x.IsMenu == 1);
                var menuList    = userMenus.Select(comMenuEntity => new TreeMenuNode()
                {
                    ModuleId  = comMenuEntity.Id,
                    FullName  = comMenuEntity.MenuName,
                    Icon      = string.IsNullOrEmpty(comMenuEntity.IconPic) ? "messenger.png" : comMenuEntity.IconPic,
                    Location  = comMenuEntity.MenuUrl,
                    ParentId  = string.IsNullOrEmpty(comMenuEntity.ParentMenuId) ? "" : comMenuEntity.ParentMenuId,
                    MenuLevel = comMenuEntity.MenuLevel
                }).ToList();

                var json = Json(menuList, JsonRequestBehavior.AllowGet);
                return(json);
            }
            catch (Exception)
            {
                return(null);
            }
        }