Beispiel #1
0
        public JsonResult GetTreeByEasyui(string id)
        {
            //加入本地化
            CultureInfo info     = Thread.CurrentThread.CurrentCulture;
            string      infoName = info.Name;

            if (OpeCur.AccountNow != null)
            {
                //加入本地化
                AccountModel account = OpeCur.AccountNow;
                //OpeCur.UsrNowPers.Where(p=>p.ParentId == "0").ToList();
                List <PermissionModel> list = OpeCur.UsrNowPers.Where(p => p.ParentId == id && (p.OperationType == 1 || p.OperationType == 2)).ToList();
                var json = from r in list
                           select new SysModuleNavModel()
                {
                    id         = r.Id,
                    text       = infoName.IndexOf("zh") > -1 || infoName == "" ? r.Name : r.EnglishName,          //text
                    attributes = (infoName.IndexOf("zh") > -1 || infoName == "" ? "zh-CN" : "en-US") + "/" + r.AreasName == null ? "" : (r.AreasName + "/") + r.ControllerName + "/" + r.ActionName,
                    iconCls    = r.Iconic,
                    //state = (list.Where(p=>p.ParentId==r.Id).Count() > 0) ? "closed" : "open"
                    //state = (OpeCur.ServiceSession.SysModule.GetList(m => m.ParentId == r.Id).Count > 0) ? "closed" : "open"
                    state = r.State,
                };

                //return Json(json);
                return(OpeCur.AjaxMsgOK("成功获取", "", json));
            }
            else
            {
                return(OpeCur.AjaxMsgNoLogin("/Account/Index"));
            }
        }
Beispiel #2
0
        public JsonResult GetTopMenu()
        {
            //加入本地化
            CultureInfo info     = Thread.CurrentThread.CurrentCulture;
            string      infoName = info.Name;

            if (OpeCur.AccountNow != null)
            {
                //加入本地化
                AccountModel           account = OpeCur.AccountNow;
                List <PermissionModel> list    = OpeCur.UsrNowPers.Where(p => p.ParentId == "0" && p.OperationType == 1).ToList();
                var json = from r in list
                           select new SysModuleNavModel()
                {
                    id         = r.Id,
                    text       = infoName.IndexOf("zh") > -1 || infoName == "" ? r.Name : r.EnglishName,          //text
                    attributes = (infoName.IndexOf("zh") > -1 || infoName == "" ? "zh-CN" : "en-US") + "/" + r.AreasName == null ? "" : (r.AreasName + "/") + r.ControllerName + "/" + r.ActionName,
                    iconCls    = r.Iconic
                };
                //return Json(json);
                return(OpeCur.AjaxMsgOK("成功获取", "", json));
            }
            else
            {
                return(OpeCur.AjaxMsgNoLogin("/Account"));
            }
        }