public IQueryable <iPow.Infrastructure.Crosscutting.Authorize.Dto.UserRoleDto> GetUserRoleDtoList() { var res = (from userRole in userRoleRepository.GetList() join user in adminUserRepository.GetList() on userRole.UserID equals user.id join role in rolesRepository.GetList() on userRole.RoleID equals role.RoleID select new iPow.Infrastructure.Crosscutting.Authorize.Dto.UserRoleDto { Id = userRole.Id, RoleID = userRole.RoleID, RoleName = role.Description, UserID = userRole.UserID, UserName = user.username }); //userRoleRepository.GetList().Select(e => new iPow.Infrastructure.Crosscutting.Authorize.Dto.UserRoleDto() //{ // Id = e.Id, // RoleID = e.RoleID, // UserID = e.UserID, // UserName = adminUserRepository.GetList().Where(d => d.id == e.UserID).FirstOrDefault() != null ? // adminUserRepository.GetList().Where(d => d.id == e.UserID).FirstOrDefault().username : "******", // //adminUserRepository.GetList(d => d.id == e.UserID).FirstOrDefault() != null ? // //adminUserRepository.GetList(d => d.id == e.UserID).FirstOrDefault().username : "******", // RoleName = rolesRepository.GetList().Where(r => r.RoleID == e.RoleID).FirstOrDefault() != null ? // rolesRepository.GetList().Where(r => r.RoleID == e.RoleID).FirstOrDefault().Description : "暂无角色" //}).AsQueryable(); return(res); }
public bool DeleteTrue(IList <int> idList, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser) { var res = false; if (idList != null && idList.Count > 0) { var delete = adminUserRepository.GetList(e => idList.Contains(e.id)).ToList(); if (delete != null && delete.Count > 0) { res = DeleteTrue(delete, operUser); } } return(res); }
public IQueryable <iPow.Infrastructure.Crosscutting.Authorize.Dto.UserRoleDto> GetUserRoleDtoList() { var res = userRoleRepository.GetList().Select(e => new iPow.Infrastructure.Crosscutting.Authorize.Dto.UserRoleDto() { Id = e.Id, RoleID = e.RoleID, UserID = e.UserID, UserName = adminUserRepository.GetList(d => d.id == e.UserID).FirstOrDefault() != null ? adminUserRepository.GetList(d => d.id == e.UserID).FirstOrDefault().username : "******", RoleName = rolesRepository.GetList(r => r.RoleID == e.RoleID).FirstOrDefault() != null ? rolesRepository.GetList(r => r.RoleID == e.RoleID).FirstOrDefault().Description : "暂无角色" }).AsQueryable(); return(res); }
/// <summary> /// Exists the user by name PWD. /// </summary> /// <param name="name">The name.</param> /// <param name="pwd">The PWD.</param> /// <param name="login">if set to <c>true</c> [login].</param> /// <returns></returns> public bool ExistUserByNamePwd(string name, string pwd, bool login) { bool b = false; pwd = iPow.Infrastructure.Crosscutting.Function.StringHelper.Tomd5(pwd); var user = adminUserRepository.GetList(e => e.username == name) .Where(e => e.password == pwd) .Where(d => d.Activity == true) .FirstOrDefault(); if (user != null) { b = true; var log = new Sys_AdminUserLog(); log.AddTime = System.DateTime.Now; log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP(); log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl(); log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl(); log.State = true; log.TypeId = 1; log.UserId = 0; log.UserId = 0; log.FullMessage = "ExistUserByNamePwd 用户Id号:" + user.id.ToString(); log.ShortMessage = "查找用户名:" + name + " 密码:" + pwd + "成功"; //查找成功 if (login) { user.lastloginip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP(); user.lastlogintime = System.DateTime.Now; user.logintimes += 1; //添加日志用户日志 log.ShortMessage = "用户名:" + name + " 密码:" + pwd + "登陆成功"; } iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log); } return(b); }