示例#1
0
 public DataSet GetUserList(int pageIndex, int pageSize, string filter)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.FindAll((pageIndex - 1) * pageSize, pageSize, filter));
     }
 }
示例#2
0
 public DataTable GetGroupUser(int groupID)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.FindUser(groupID.ToString()));
     }
 }
示例#3
0
 public DataSet GetUserOperateSubModule(string userName)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.FindUserOperateSubModule(userName));
     }
 }
示例#4
0
 public int GetRowCount(string filter)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.GetRowCount(filter));
     }
 }
示例#5
0
 public void DeleteUserQuickDesktop(string userID)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         userDao.DeleteUserQuickDesktop(userID);
     }
 }
示例#6
0
 public DataSet GetUserQuickDesktop(int userID)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.FindUserQuickDesktop(userID));
     }
 }
示例#7
0
 public void InsertUserQuickDesktop(string userID, string moduleID)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         userDao.InsertUserQuickDesktop(userID, moduleID);
     }
 }
示例#8
0
 public DataSet GetUserList(int pageIndex, int pageSize, string filter, string OrderByFields)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao UserDao = new SysUserDao();
         return(UserDao.QueryUser(strTableView, strPrimaryKey, strQueryFields, pageIndex, pageSize, OrderByFields, filter, strTableView));
     }
 }
示例#9
0
 public DataTable GetAll()
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysUserDao userDao = new SysUserDao();
         return(userDao.FindAll());
     }
 }
示例#10
0
        public DataSet GetAllUser()
        {
            string sql = "select UserName ,GroupName ,UserID from sys_UserList u left join sys_GroupList g on u.GroupID=g.GroupID ";

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                return(UserDao.GetUser(sql));
            }
        }
示例#11
0
        /// <summary>
        /// 按用户名查询
        /// </summary>
        /// <param name="sn"></param>
        /// <returns></returns>
        public SysUser FindByUsername(string username)
        {
            IList <SysUser> list = SysUserDao.FindByHql(" and username=?", new Object[] { username }, "id desc");
            SysUser         user = null;

            if (list.Count() > 0)
            {
                user = list[0];
            }
            return(user);
        }
示例#12
0
        public bool ChangePassword(string userName, string password)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao userDao = new SysUserDao();
                userDao.UpdateEntity(userName, password);
                flag = true;
            }
            return(flag);
        }
示例#13
0
        public bool SetUserQuickDesktop(string sql)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                UserDao.SetData(sql);
                flag = true;
            }
            return(flag);
        }
示例#14
0
        public bool AddUserToGroup(int groupID, string users)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao userDao = new SysUserDao();
                userDao.UpdateEntity(groupID, users);
                flag = true;
            }
            return(flag);
        }
示例#15
0
        public bool DeleteUserFromGroup(int userID)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao userDao = new SysUserDao();
                userDao.UpdateEntity(userID);
                flag = true;
            }
            return(flag);
        }
示例#16
0
        public bool Update(DataSet dataSet)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                UserDao.UpdateEntity(dataSet);
                flag = true;
            }
            return(flag);
        }
示例#17
0
        public bool DeleteUserFromGroup(int UserID)
        {
            string sql  = "Update  sys_UserList set GroupID='' where UserID=" + UserID;
            bool   flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                UserDao.DeleteEntity(sql);
                flag = true;
            }
            return(flag);
        }
示例#18
0
        public bool ChangePassword(string UserName, string NewPassword)
        {
            bool flag = false;

            using (PersistentManager persistentManager = new PersistentManager())
            {
                string     sql     = string.Format("update sys_UserList set UserPassword='******' where UserName='******'", NewPassword, UserName);
                SysUserDao UserDao = new SysUserDao();
                UserDao.SetData(sql);
                flag = true;
            }
            return(flag);
        }
示例#19
0
        /// <summary>
        /// 用户管理界面编辑用户信息
        /// </summary>
        /// <param name="modifyUserParam"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <BaseResponseModel> ModifyManagerUserAsync(ModifyUserParam modifyUserParam, UserCacheBo currentUser)
        {
            // 考虑是否验证上传的角色是当前租户下的
            var checkResult = await CheckRoleIds(modifyUserParam.RoleIds, currentUser);

            if (!checkResult.IsNullOrEmpty())
            {
                return(new ResponseModel().Fail(checkResult));
            }
            var result = await SysUserDao.ModifyManagerUserAsync(modifyUserParam.UserId, modifyUserParam.RoleIds, modifyUserParam.NickName, currentUser);

            return(result);
        }
示例#20
0
        /// <summary>
        /// 用户管理界面创建用户
        /// </summary>
        /// <param name="param"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <BaseResponseModel> CreateManagerUserAsync(CreateUserParam param, UserCacheBo currentUser)
        {
            var result = new ResponseModel <bool>();

            // 考虑是否验证上传的角色是当前租户下的
            var checkResult = await CheckRoleIds(param.RoleIds, currentUser);

            if (!checkResult.IsNullOrEmpty())
            {
                return(result.Fail(checkResult));
            }

            if (await ExistUserAsync(param.Email))
            {
                result.Fail(ResponseCode.Fail, "该邮箱已存在", false);
                return(result);
            }

            var sysUser = new SysUser()
            {
                NickName             = param.NickName,
                PassWord             = param.Pwd.Md5Encrypt(),
                Email                = param.Email,
                Sex                  = 1,
                State                = 1,
                CreatedTime          = DateTime.Now,
                UpdatedTime          = DateTime.Now,
                TenantId             = currentUser.TenantId,
                UpdatedBy            = 0,
                CreatedBy            = currentUser.UserId,
                SysUserRoleRelations = new List <SysUserRoleRelation>()
            };

            param.RoleIds.ForEach(roleId =>
            {
                sysUser.SysUserRoleRelations.Add(new SysUserRoleRelation()
                {
                    TenantId    = currentUser.TenantId,
                    RoleId      = roleId,
                    State       = 1,
                    CreatedTime = DateTime.Now,
                    CreatedBy   = currentUser.UserId,
                    Deleted     = false,
                });
            });
            SysUserDao.Add(sysUser);
            var count = await SysUserDao.SaveChangesAsync();

            return(count > 0 ? result.Succeed(true) : result.Fail("保存失败", false));
        }
示例#21
0
        /// <summary>
        /// 查询用户
        /// </summary>
        /// <param name="sysUserId"></param>
        /// <returns></returns>
        public async Task <SysUser> GetOneSysUserById(Guid sysUserId)
        {
            using (IDAL.System.ISysUserDao sysUserDao = new SysUserDao())
            {
                var user = await sysUserDao.GetAllAsync()
                           .Where(m => m.Id == sysUserId)
                           .Include(m => m.SysDepart)
                           .Include(m => m.SysUserRoles)
                           .Include(m => m.SysUserRoles
                                    .Select(a => a.SysRole)).FirstAsync();


                return(user);
            }
        }
示例#22
0
        /// <summary>
        /// 获取用户有权限操作的二级模块
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public DataSet GetUserOperateSubModule(string UserName)
        {
            string sql = "select distinct(m.SubModuleCode),n.MenuParent,n.MenuTitle,n.ID,n.OrderIndex " +
                         " from sys_GroupOperationList o   " +
                         " left join sys_ModuleList  m on m.ModuleID=o.ModuleID " +
                         " left join sys_GroupList g on g.GroupID=o.GroupID " +
                         " left join sys_UserLIst  u on u.GroupID=g.GroupID " +
                         " left join sys_Menu      n on n.MenuCode=m.SubModuleCode " +
                         " where n.SystemName='WMS' AND UserName='******'order by n.OrderIndex ";

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                return(UserDao.GetData(sql));
            }
        }
示例#23
0
        /// <summary>
        /// 验证用户名是否存在
        /// </summary>
        /// <param name="username"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckIsExist(string username, Int32?id)
        {
            List <object> _listParam = new List <object>();
            String        _sql       = " and username=?";

            _listParam.Add(username);
            if (id != null)
            {
                _sql += " and id<>?";
                _listParam.Add(id);
            }

            int count = SysUserDao.FindCountByHql(_sql, _listParam.ToArray());

            return(count > 0 ? true : false);
        }
示例#24
0
        /// <summary>
        /// 找回密码 -- 修改当前用户密码
        /// </summary>
        /// <param name="retrievePwdParam"></param>
        /// <returns></returns>
        public async Task <ResponseModel <bool> > RetrievePwdAsync(RetrievePwdParam retrievePwdParam)
        {
            var result             = new ResponseModel <bool>();
            var verificationResult = await VerificationCaptchaAsync(CacheKeys.RETRIEVEPWDCAPTCHA, retrievePwdParam.Email, retrievePwdParam.Captcha, false);

            if (verificationResult != "验证通过")
            {
                return(result.Fail(verificationResult, false));
            }

            var uid = await SysUserDao.RetrievePwdAsync(retrievePwdParam);

            await LogoutAsync(new UserCacheBo()
            {
                UserId = uid
            });

            return(result.Succeed(true));
        }
示例#25
0
        public DataSet GetUserQuickDesktop(int UserID)
        {
            string sql = "SELECT m.MenuParent, m.MenuTitle, q.ModuleID, m.MenuImage, m.DestopImage, m.MenuUrl " +
                         "FROM dbo.sys_QuickDestop AS q LEFT OUTER JOIN  dbo.sys_Menu AS m ON q.ModuleID = m.ID " +
                         "WHERE     (q.UserID = " + UserID + ") AND (q.ModuleID IN " +
                         "(SELECT DISTINCT n.ID " +
                         " FROM dbo.sys_GroupOperationList AS o LEFT OUTER JOIN " +
                         "dbo.sys_ModuleList AS m ON m.ModuleID = o.ModuleID LEFT OUTER JOIN " +
                         "dbo.sys_GroupList AS g ON g.GroupID = o.GroupID LEFT OUTER JOIN " +
                         "dbo.sys_UserList AS u ON u.GroupID = g.GroupID LEFT OUTER JOIN " +
                         " dbo.sys_Menu AS n ON n.MenuCode = m.SubModuleCode " +
                         "WHERE (u.UserID = " + UserID + "))) order by m.MenuCode";

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                return(UserDao.GetData(sql));
            }
        }
示例#26
0
        public SResult Update(SysUser sysUser)
        {
            SResult rst = new SResult();

            //验证用户名是否重复
            if (this.CheckIsExist(sysUser.Username, sysUser.Id))
            {
                rst.success = false;
                rst.message = "[" + sysUser.Username + "]已存在!";
            }
            else
            {
                SysUserDao.Update(sysUser);
                rst.success = true;
                rst.data    = sysUser;
                rst.message = "修改成功!";
            }
            return(rst);
        }
示例#27
0
        /// <summary>
        /// 修改角色
        /// </summary>
        /// <param name="sysUserId"></param>
        /// <param name="sysRoleId"></param>
        /// <returns></returns>
        public async Task EditSysUserRole(Guid sysUserId, Guid[] sysRoleId)
        {
            using (var sysUserRoleDao = new SysUserRoleDao())
            {
                using (var sysUserDao = new SysUserDao())
                {
                    var user = await sysUserDao.GetOneByIdAsync(sysUserId);

                    foreach (var userRole in user.SysUserRoles)
                    {
                        if (sysRoleId.Contains(userRole.SysRoleId))
                        {
                            await sysUserRoleDao.EditAsync(userRole, false);
                        }
                    }
                    await sysUserRoleDao.Save();
                }
            }
        }
示例#28
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageNum"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public SPagintion <SysUser> FindByPagination(int pageNum, int pageSize, string code, string name)
        {
            List <object> listParam = new List <object>();
            String        whereSql  = "";

            if (code != null && code.Length > 0)
            {
                whereSql += " and code like ? ";
                listParam.Add("%" + code + "%");
            }
            if (name != null && name.Length > 0)
            {
                whereSql += " and name like ? ";
                listParam.Add("%" + name + "%");
            }

            SPagintion <SysUser> page = SysUserDao.FindByPagintion(whereSql, listParam.ToArray(), "id desc", pageSize, pageNum);

            return(page);
        }
示例#29
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageNum"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public SPagintion <SysUser> FindByPagination(int pageNum, int pageSize, string username, string fullName)
        {
            List <object> listParam = new List <object>();
            String        whereSql  = "";

            if (username != null && username.Length > 0)
            {
                whereSql += " and username like ? ";
                listParam.Add("%" + username + "%");
            }
            if (fullName != null && fullName.Length > 0)
            {
                whereSql += " and fullName like ? ";
                listParam.Add("%" + fullName + "%");
            }

            SPagintion <SysUser> page = SysUserDao.FindByPagintion(whereSql, listParam.ToArray(), "id desc", pageSize, pageNum);

            return(page);
        }
示例#30
0
        public DataSet GetUserInfo(string UserName)
        {
            string sql = string.Format("select a.*," +
                                       " d.sys_PageCount,d.grid_ColumnTitleFont,d.grid_ContentFont," +
                                       " d.grid_ColumnTextAlign,d.grid_ContentTextAlign,d.grid_NumberColumnAlign," +
                                       " d.grid_MoneyColumnAlign,d.grid_SelectMode,d.grid_OddRowColor," +
                                       " d.grid_EvenRowColor,d.grid_IsRefreshBeforeAdd,d.grid_IsRefreshBeforeUpdate," +
                                       " d.grid_IsRefreshBeforeDelete,d.sys_PrintForm,d.pager_ShowPageIndex," +
                                       " e.ParameterValue as SessionTimeOut" +
                                       "  from sys_UserList a" +
                                       " left join sys_UserConfigPlan b on a.UserID=b.UserID " +
                                       " left join sys_ConfigPlan c on b.ConfigPlanID=c.ConfigPlanID " +
                                       " left join sys_UserSysInfo d on a.UserID=d.UserID " +
                                       " left join sys_SystemParameter e on e.ParameterName='sys_SessionTimeOut' " +
                                       "where UserName='******'", UserName);

            using (PersistentManager persistentManager = new PersistentManager())
            {
                SysUserDao UserDao = new SysUserDao();
                return(UserDao.GetUser(sql));
            }
        }