public ActionResult Details(object id) { var item = _iSysRoleService.GetById(id); ViewBag.SysControllers = _sysControllerService.GetAll().ToList(); return(View(item)); }
/// <summary> /// </summary> /// <param name="id"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> DetailsAsync(string id) { var item = await _iSysRoleService.FindAsync(id); ViewBag.SysControllers = _sysControllerService.GetAll(a => a.Enable); return(View(item)); }
// // GET: /Platform/SysController/ /// <summary> /// /// </summary> /// <param name="keyword"></param> /// <param name="ordering"></param> /// <param name="pageIndex"></param> /// <returns></returns> public ActionResult Index(string keyword, string ordering, int pageIndex = 1, bool search = false) { var model = _sysControllerService.GetAll() .Select( a => new { SysArea = a.SysArea.Name, a.Name, a.ControllerName, a.ActionName, a.Parameter, a.SystemId, a.Display, a.Ico, a.Enable, a.TargetBlank, a.Id }).Search(keyword); if (search) { model = model.Search(Request.QueryString); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering, null); } return(View(model.ToPagedList(pageIndex))); }
/// <summary> /// </summary> /// <param name="DepartmentId"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> IndexAsync(string DepartmentId) { var user = await _iSysUserService.GetUserAsync(HttpContext.User); var deps = _ISysDepartmentSysUserService.GetAll(a => a.SysUserId == _iUserInfo.UserId); //切换部门 if (!string.IsNullOrEmpty(DepartmentId)) { deps = deps.Where(a => a.SysDepartment.SystemId == DepartmentId); } if (deps.Any()) { var claims = await _iSysUserService.GetClaimsAsync(user); await _iSysUserService.RemoveClaimsAsync(user, claims.Where(a => a.Type == "DepartmentId")); //保存到用户信息 await _iSysUserService.AddClaimAsync(user, new Claim("DepartmentId", deps.First().SysDepartment.SystemId)); await _signInManager.SignInAsync(user, true); } var userroles = await _iSysUserService.GetRolesAsync(user); ViewBag.MessageCount = _iSysMessageCenterService.GetAll(a => (a.AddresseeId == null || a.AddresseeId.Contains(_iUserInfo.UserId)) && a.SysMessageReceiveds.All(b => b.CreatedBy != _iUserInfo.UserId)).Count(); ViewBag.Menu = JsonConvert.SerializeObject(_sysControllerService.GetAll(a => a.Display && a.Enable && a.SysControllerSysActions.Any( b => b.SysRoleSysControllerSysActions.Any(c => userroles.Any(d => d == c.IdentityRole.Name) )) && a.SysArea.AreaName.Equals("Platform")).Select(a => new { id = a.SystemId, pId = a.SystemId.Substring(0, a.SystemId.Length - 3), name = a.Name, url = a.ControllerName == null ? "javascript:;" : "#" + Url.Action(a.ActionName, a.ControllerName), target = "_self" })); ViewBag.OffsiderbarHelp = _iSysHelpService.GetAll(); var nickName = HttpContext.User.FindFirstValue("Nickname"); if (string.IsNullOrEmpty(nickName)) { nickName = HttpContext.User.Identity.Name; } ViewBag.nickName = nickName; // 读取部门 ViewBag.Department = new SelectList(_ISysDepartmentSysUserService.GetAll(a => a.SysUserId == _iUserInfo.UserId).Select(a => a.SysDepartment).OrderBy(a => a.SystemId), "SystemId", "Name", _iUserInfo.DepartmentId); _logger.LogInformation("Access Platform Successful!"); return(View()); }
// GET: Platform/Index /// <summary> /// /// </summary> /// <param name="changesysenterprise"></param> /// <param name="loadPage"></param> /// <returns></returns> public async Task <ActionResult> Index(string changesysenterprise, string loadPage = "") { var ent = _iSysEnterpriseSysUserService.GetAll(a => a.SysUserId == _iUserInfo.UserId); if (!string.IsNullOrEmpty(changesysenterprise)) { if (ent.Any(a => a.SysEnterpriseId.Equals(changesysenterprise))) { var user = _iSysUserService.GetById(_iUserInfo.UserId); user.CurrentEnterpriseId = changesysenterprise; await _iUnitOfWork.CommitAsync(); return(RedirectToAction("Index")); } } ViewBag.sysEnterpriseSysUser = ent; ViewBag.UserId = _iUserInfo.UserId; ViewBag.UserName = _iUserInfo.UserName; ViewBag.OffsiderbarHelp = _iSysHelpService.GetAll().ToListAsync().Result; ViewBag.LoadPage = loadPage; ViewBag.sysEnterprises = new SelectList(ent.Select(a => a.SysEnterprise).Future(), "Id", "EnterpriseName", _iUserInfo.EnterpriseId); var area = (string)RouteData.DataTokens["area"]; ViewBag.Menu = _sysControllerService.GetAll(a => a.Display && a.Enable && a.SysControllerSysActions.Any( b => b.SysRoleSysControllerSysActions.Any( c => c.SysRole.EnterpriseId == _iUserInfo.EnterpriseId && c.SysRole.Users.Any( d => d.UserId == _iUserInfo.UserId))) && a.SysArea.AreaName.Equals(area)).Future(); //桌面统计 //近十天用户注册次数 ViewBag.SysUserCountDay = _iSysUserService.GetAll(a => a.CreatedDateTime > DbFunctions.AddDays(DateTimeLocal.Now.Date, -30)).GroupBy(a => a.CreatedDate).Select(a => new { a.Key, Count = a.Count() }).OrderBy(a => a.Key).ToDictionaryAsync(a => a.Key, a => (double)a.Count).Result; //近十天用户活动次数 ViewBag.SysUserLogCountDay = _iSysUserLogService.GetAll().GroupBy(a => a.CreatedDate).Select(a => new { a.Key, Count = a.Count() }).OrderBy(a => a.Key).ToDictionaryAsync(a => a.Key, a => (double)a.Count).Result; //执行速度 ViewBag.SysUserLogDayDuration = _iSysUserLogService.GetAll().GroupBy(a => a.CreatedDate).Select(a => new { a.Key, Duration = a.Average(b => b.Duration) }).OrderBy(a => a.Key).ToDictionaryAsync(a => a.Key, a => Math.Round(a.Duration, 3)).Result; return(View()); }
public ActionResult Menu() { var area = (string)RouteData.DataTokens["area"]; var model = _sysControllerService.GetAll(a => a.Display && a.Enable && a.SysControllerSysActions.Any( b => b.SysRoleSysControllerSysActions.Any( c => c.SysRole.Users.Any( d => d.UserId == _iUserInfo.UserId))) && a.SysArea.AreaName.Equals(area)).ToList(); ViewBag.CmsCategory = _iCmsCategoryService.GetAll(a => a.Enable && a.SystemId.Length == 3).OrderBy(a => a.SystemId).ToList(); return(View(model)); }
// GET: Platform/Index /// <summary> /// /// </summary> /// <param name="changesysenterprise"></param> /// <param name="loadPage"></param> /// <returns></returns> public async Task <ActionResult> Index(string changesysenterprise, string loadPage = "") { var ent = _iSysEnterpriseSysUserService.GetAll(a => a.SysUserId == _iUserInfo.UserId).Cacheable(); if (!string.IsNullOrEmpty(changesysenterprise)) { if (ent.Any(a => a.SysEnterpriseId.Equals(changesysenterprise))) { var user = _iSysUserService.GetById(_iUserInfo.UserId); user.CurrentEnterpriseId = changesysenterprise; await _iUnitOfWork.CommitAsync(); return(RedirectToAction("Index")); } } ViewBag.sysEnterpriseSysUser = ent; ViewBag.UserId = _iUserInfo.UserId; ViewBag.UserName = _iUserInfo.UserName; ViewBag.OffsiderbarHelp = _iSysHelpService.GetAll().Cacheable(); ViewBag.LoadPage = loadPage; ViewBag.sysEnterprises = new SelectList(ent.Select(a => a.SysEnterprise).Cacheable(), "Id", "EnterpriseName", _iUserInfo.EnterpriseId); var area = (string)RouteData.DataTokens["area"]; ViewBag.Menu = _sysControllerService.GetAll(a => a.Display && a.Enable && a.SysControllerSysActions.Any( b => b.SysRoleSysControllerSysActions.Any( c => c.SysRole.EnterpriseId == _iUserInfo.EnterpriseId && c.SysRole.Users.Any( d => d.UserId == _iUserInfo.UserId))) && a.SysArea.AreaName.Equals(area)).Cacheable(); return(View()); }
/// <summary> /// </summary> /// <param name="keyword"> /// </param> /// <param name="ordering"> /// </param> /// <param name="pageIndex"> /// </param> /// <param name="pageSize"> /// </param> /// <param name="search"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> Index(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool toExcelFile = false) { var model = _iSysControllerService.GetAll() .Select( a => new { a.Name, a.SystemId, a.Enable, a.SysArea.AreaName, a.ControllerName, a.ActionName, a.Parameter, a.Display, a.TargetBlank, a.Ico, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, pageSize))); }