예제 #1
0
 // GET: AdmDepartments
 public IActionResult Index()
 {
     string userSession = HttpContext.Session.GetString("AdmUserSession");
     if (!string.IsNullOrEmpty(userSession) && JsonConvert.DeserializeObject<AdmUser>(userSession).Id > 0)
     {
         Task<List<AdmDepartment>> task = Task.Run(() => _dataTree.GetDepIdListByAcountUser(_context, JsonConvert.DeserializeObject<AdmUser>(userSession), out depIdList, out depGuidList));
         task.Wait();
         if (task.Result.Count > 0)
         {
             deps = task.Result;
             GetAcountUserAdmDepsTree();
             if (DepsList.Count>0)
             {
                 return View(DepsList);
             }
         }
         return RedirectToAction("Index", "Error", new ResultModel() { StateCode = (int)ResultEnum.NODEP, Message = _toolUnit.GetEnumDescriptionByReflex(ResultEnum.NODEP) });
     }
     return RedirectToAction("Index", "Login");
 }
        // GET: AdmRoles
        public IActionResult Index()
        {
            string userSession = HttpContext.Session.GetString("AdmUserSession");

            if (!string.IsNullOrEmpty(userSession) && JsonConvert.DeserializeObject <AdmUser>(userSession).Id > 0)
            {
                Task <List <AdmRole> > task = Task.Run(() => _dataTree.GetAcountUserRolesListByAcountUser(_context, JsonConvert.DeserializeObject <AdmUser>(userSession), out DepIDList, out DepGuidList, out roleIDList, out admRolesGuidList));
                task.Wait();
                if (task.Result.Count > 0)
                {
                    admRoles = task.Result;
                    return(View(task.Result));
                }
                return(RedirectToAction("Index", "Error", new ResultModel()
                {
                    StateCode = (int)ResultEnum.NOROLE, Message = _toolUnit.GetEnumDescriptionByReflex(ResultEnum.NOROLE)
                }));
            }
            return(RedirectToAction("Index", "Login"));
            // return View("此用户暂无权限相关配置,请联系管理员!");
        }