Ejemplo n.º 1
0
        public ActionResult GetTreeSelectJson()
        {
            var data     = moduleApp.GetList();
            var treeList = new List <TreeSelectModel>();

            foreach (Sys_Module item in data)
            {
                TreeSelectModel treeModel = new TreeSelectModel();
                treeModel.id       = item.F_Id;
                treeModel.text     = item.F_FullName;
                treeModel.parentId = item.F_ParentId;
                treeList.Add(treeModel);
            }
            return(Content(treeList.TreeSelectJson()));
        }
Ejemplo n.º 2
0
        public ActionResult GetCloneButtonTreeJson()
        {
            var moduledata = moduleApp.GetList();
            var buttondata = moduleButtonApp.GetList();
            var treeList   = new List <TreeViewModel>();

            foreach (Sys_Module item in moduledata)
            {
                TreeViewModel tree        = new TreeViewModel();
                bool          hasChildren = moduledata.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
                tree.id          = item.F_Id;
                tree.text        = item.F_FullName;
                tree.value       = item.F_EnCode;
                tree.parentId    = item.F_ParentId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = true;
                treeList.Add(tree);
            }
            foreach (Sys_ModuleButton item in buttondata)
            {
                TreeViewModel tree        = new TreeViewModel();
                bool          hasChildren = buttondata.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
                tree.id    = item.F_Id;
                tree.text  = item.F_FullName;
                tree.value = item.F_EnCode;
                if (item.F_ParentId == "0")
                {
                    tree.parentId = item.F_ModuleId;
                }
                else
                {
                    tree.parentId = item.F_ParentId;
                }
                tree.isexpand    = true;
                tree.complete    = true;
                tree.showcheck   = true;
                tree.hasChildren = hasChildren;
                if (item.F_Icon != "")
                {
                    tree.img = item.F_Icon;
                }
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }
Ejemplo n.º 3
0
        public ActionResult GetPermissionTree(string roleId)
        {
            var moduledata    = moduleApp.GetList();
            var buttondata    = moduleButtonApp.GetList();
            var authorizedata = new List <Sys_RoleAuthorize>();

            if (!string.IsNullOrEmpty(roleId))
            {
                authorizedata = roleAuthorizeApp.GetList(roleId);
            }
            var treeList = new List <TreeViewModel>();

            foreach (Sys_Module item in moduledata)
            {
                TreeViewModel tree        = new TreeViewModel();
                bool          hasChildren = moduledata.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
                tree.id          = item.F_Id;
                tree.text        = item.F_FullName;
                tree.value       = item.F_EnCode;
                tree.parentId    = item.F_ParentId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.showcheck   = true;
                tree.checkstate  = authorizedata.Count(t => t.F_ItemId == item.F_Id);
                tree.hasChildren = true;
                tree.img         = item.F_Icon == "" ? "" : item.F_Icon;
                treeList.Add(tree);
            }
            foreach (Sys_ModuleButton item in buttondata)
            {
                TreeViewModel tree        = new TreeViewModel();
                bool          hasChildren = buttondata.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
                tree.id          = item.F_Id;
                tree.text        = item.F_FullName;
                tree.value       = item.F_EnCode;
                tree.parentId    = item.F_ParentId == "0" ? item.F_ModuleId : item.F_ParentId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.showcheck   = true;
                tree.checkstate  = authorizedata.Count(t => t.F_ItemId == item.F_Id);
                tree.hasChildren = hasChildren;
                tree.img         = item.F_Icon == "" ? "" : item.F_Icon;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }