예제 #1
0
        public ActionResult GetFunction(int roleId)
        {
            List <SYS_Function> FuncList = new SYS_FunctionManager().Where(x => x.ParentID == null);
            List <object>       json     = new List <object>();

            foreach (var item in FuncList)
            {
                var info = new
                {
                    id         = item.FunctionID,
                    text       = item.FunctionName,
                    selectable = true, //标记节点是否可以选择。false表示节点应该作为扩展标题,不会触发选择事件。  string
                    //icon = "glyphicon glyphicon-play-circle", //节点上显示的图标,支持bootstrap的图标  string
                    //selectedIcon = "glyphicon glyphicon-ok "//节点被选中时显示的图标       string
                    //nodes = new List<object>()
                };



                //var list = new SYS_FunctionManager().Where(x => x.ParentID == item.FunctionID);

                json.Add(DG(item.FunctionID, info, new SYS_RoleManager().GetByPK(roleId)));
            }


            return(Json(json, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        private dynamic DG(int functionId, dynamic info, SYS_Role role)
        {
            SYS_FunctionManager bll = new SYS_FunctionManager();
            var list = bll.Where(x => x.ParentID == functionId);

            if (list.Count > 0)
            {
                dynamic newInfo = new
                {
                    id = functionId,
                    info.text,
                    nodes = new List <object>(),
                    state = GetState(role, functionId)
                };

                foreach (var item in list)
                {
                    var sub = new
                    {
                        id           = item.FunctionID,
                        text         = item.FunctionName,
                        icon         = "glyphicon glyphicon-unchecked", //节点上显示的图标,支持bootstrap的图标  string
                        selectedIcon = "glyphicon glyphicon-check ",    //节点被选中时显示的图标       string
                        state        = GetState(role, item.FunctionID)
                                                                        //nodes = new List<object>()
                    };

                    newInfo.nodes.Add(DG(item.FunctionID, sub, role));
                }

                return(newInfo);
            }
            return(info);
        }
예제 #3
0
        public ActionResult GetFunction()
        {
            var json = new SYS_FunctionManager().GetFunction((Session["SYSUSER"] as SYS_User).UserId);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }