Exemplo n.º 1
0
        public IActionResult JQueryLeftTree2(string id)
        {
            var dal = new FunctionDal();
            var roleAndFunctionDal  = new RoleAndFunctionDal();
            var roleAndFunctionList = roleAndFunctionDal.QueryByRoleId(CurrentAdmin.RoleId);

            IList <FunctionDefinition> list = dal.Query();
            var tree = from item in list
                       join roleAndFunction in roleAndFunctionList on item.FunctionId equals roleAndFunction.FunctionId
                       where item.ParentId == id && item.Display
                       //where item.Display
                       orderby item.Postion
                       select new
            {
                id         = item.FunctionId,
                text       = item.Name,
                state      = list.FirstOrDefault(o => o.ParentId == item.FunctionId) == null ? "open" : "closed",
                attributes = new
                {
                    page = item.Page
                }
            };

            return(Json(tree));
        }
Exemplo n.º 2
0
 public IActionResult JQueryTreeGrid2(string id)
 {
     try
     {
         var dal = new FunctionDal();
         var roleAndFunctionDal          = new RoleAndFunctionDal();
         var roleAndFunctionList         = roleAndFunctionDal.QueryByRoleId(CurrentAdmin.RoleId);
         IList <FunctionDefinition> list = dal.Query();
         var tree = from item in list
                    join roleAndFunction in roleAndFunctionList on item.FunctionId equals roleAndFunction.FunctionId
                    where item.ParentId == id
                    orderby item.Postion
                    select new
         {
             functionId = item.FunctionId,
             name       = item.Name,
             state      = list.FirstOrDefault(o => o.ParentId == item.FunctionId) == null ? "open" : "closed",
             parentId   = item.ParentId,
             parentName = list.FirstOrDefault(o => o.FunctionId == item.ParentId) == null ? ""
                        : list.FirstOrDefault(o => o.FunctionId == item.ParentId).Name,
             page    = item.Page,
             display = item.Display ? "显示" : "隐藏",
             postion = item.Postion,
             op      = "<ahref=\"/function/Delete?id=" + item.FunctionId + "\" onclick=\"return confirm('您确认要删除该记录吗?');\">删除</a>"
         };
         return(Json(tree));
     }
     catch (Exception ex)
     {
         return(Json(ex.Message));
     }
 }
Exemplo n.º 3
0
        public IActionResult QueryRoleByRoleId(string roleId)
        {
            var roleAndCommandDal   = new RoleAndCommandDal();
            var roleAndCommandList  = roleAndCommandDal.QueryByRoleId(roleId).Select(o => o.CommandId).ToList();
            var roleAndFunctionDal  = new RoleAndFunctionDal();
            var roleAndFunctionList = roleAndFunctionDal.QueryByRoleId(roleId).Select(o => o.FunctionId).ToList();

            return(Json(roleAndCommandList.Concat(roleAndFunctionList).ToList()));
        }