Exemplo n.º 1
0
 public ActionResult ComboTree(string parentId)
 {
     AdminBiz adminBiz = AdminBiz.GetInstant();
     ICriteria icr = BaseZdBiz.CreateCriteria<MenuModel>();
     icr.Add(Restrictions.Eq("status", BaseModel.STATUS_ACTIVATE));
     IList<MenuModel> menus = icr.List<MenuModel>();
     IList<TreeNodeObject> nodes = adminBiz.createTree(menus,parentId);
     return JsonText(nodes, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 2
0
        public ActionResult Tree(string parentId)
        {
            AdminBiz adminBiz = AdminBiz.GetInstant();
            UserModel user = WebUtil.GetSessionAttr<UserModel>(AdminBiz.SESSION_KEY_USER);
            if (user == null)
            {
                //return new List<TreeNodeObject>();
            }

            RoleModel role =BaseZdBiz.Load<RoleModel>(user.roleFk);
            if (role == null)
            {
                //return new List<TreeNodeObject>();
            }

            string[] arrayMenuFk = role.getArrayMenuFk();
            ICriteria icr = BaseZdBiz.CreateCriteria<MenuModel>();
            icr.Add(Restrictions.In("id", arrayMenuFk));
            icr.Add(Restrictions.Eq("status",BaseModel.STATUS_ACTIVATE));
            IList<MenuModel> menus = icr.List<MenuModel>();
            IList<TreeNodeObject> nodes = adminBiz.createTree(menus,parentId);
            return JsonText(nodes,JsonRequestBehavior.AllowGet);
        }