public bool ChangePwd(string loginId, string password)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE BaseUsers SET PassWord=@PassWord WHERE LoginId=@LoginId");
            return(_repository.Execute(strSql.ToString(), new { PassWord = password, LoginId = loginId }) > -1);
        }
        public OperationResult <bool> Update(BaseUsersDto dto)
        {
            // throw new NotImplementedException();
            //  BaseUsers model = Mapper.Map<BaseUsersDto, BaseUsers>(dto);
            OperationResult <bool> req = new OperationResult <bool>(OperationResultType.Success);

            _unitOfWork.Begin();
            try
            {
                var user = GetDto(dto.LoginId);
                if (user != null && user.Id != dto.Id)
                {
                    req.ResultError("已存在相同的登录账号!");
                    req.Data = false;
                    _unitOfWork.Rollback();
                    return(req);
                }

                if (!_usersRepository.Update <BaseUsersDto>(dto))
                {
                    req.ResultError("用户数据更新失败!");
                    req.Data = false;
                    _unitOfWork.Rollback();
                    return(req);
                }

                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"UPDATE BaseUserRoleMap SET RoleId=@RoleId WHERE UserId=@UserId");

                if (_usersRepository.Execute(strSql.ToString(), new{ RoleId = dto.RoleId, UserId = dto.Id }) < 0)
                {
                    req.ResultError("角色关联失败!");
                    req.Data = false;
                    _unitOfWork.Rollback();
                    return(req);
                }

                _unitOfWork.Commit();
                req.Data    = true;
                req.Message = "更新成功!";
            }
            catch (Exception ex)
            {
                req.ResultError(ex.Message);
                req.Data = false;
                _unitOfWork.Rollback();
                //  return req;
            }
            finally
            {
                _unitOfWork.Dispose();
            }

            return(req);
        }