コード例 #1
0
        /// <summary>
        /// 获取功能视图数据
        /// </summary>
        /// <returns></returns>
        private object GetModuleColumnData()
        {
            var data       = authorizeBLL.GetModuleColumnList(SystemInfo.CurrentUserId);
            var dataModule = data.Distinct(new Comparint <ModuleColumnEntity>("ModuleId"));
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (ModuleColumnEntity item in dataModule)
            {
                var columnList = data.Where(t => t.ModuleId.Equals(item.ModuleId));
                dictionary.Add(item.ModuleId, columnList);
            }
            return(dictionary);
        }
コード例 #2
0
        public ActionResult ModuleColumnTreeJson(string roleId)
        {
            var existModuleColumn = permissionBLL.GetModuleColumnList(roleId);
            var moduleData        = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId);
            var moduleColumnData  = authorizeBLL.GetModuleColumnList(SystemInfo.CurrentUserId);
            var treeList          = new List <TreeEntity>();

            foreach (ModuleEntity item in moduleData)
            {
                TreeEntity tree = new TreeEntity();
                tree.id          = item.ModuleId;
                tree.text        = item.FullName;
                tree.value       = item.ModuleId;
                tree.checkstate  = existModuleColumn.Count(t => t.ItemId == item.ModuleId);
                tree.showcheck   = true;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = true;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon;
                treeList.Add(tree);
            }
            foreach (ModuleColumnEntity item in moduleColumnData)
            {
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = moduleColumnData.Count(t => t.ParentId == item.ModuleColumnId) == 0 ? false : true;
                tree.id    = item.ModuleColumnId;
                tree.text  = item.FullName;
                tree.value = item.ModuleColumnId;
                if (item.ParentId == "0")
                {
                    tree.parentId = item.ModuleId;
                }
                else
                {
                    tree.parentId = item.ParentId;
                }
                tree.checkstate  = existModuleColumn.Count(t => t.ItemId == item.ModuleColumnId);
                tree.showcheck   = true;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.img         = "fa fa-filter " + item.ModuleId;
                tree.hasChildren = hasChildren;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeToJson()));
        }