public bool UpdatePassword(Guid id, UpdatePasswordArgs args)
        {
            List <CommandParameter> list = new List <CommandParameter>();

            list.Add(new CommandParameter("@id", id));
            list.Add(new CommandParameter("@password", args.Password));
            list.Add(new CommandParameter("@newPassword", args.NewPassword));
            return(this._dataBase.ExecuteNonQuery("UPDATE [User] SET [Password] = @newPassword WHERE [Id] = @id AND [Password] = @password", list) == 1);
        }
Exemple #2
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public CommandResult <int> UpdateUserPassword(UpdatePasswordArgs args)
        {
            ArgumentHelper.Require(args.SchoolId, "SchoolId", Arguments.Positive);
            ArgumentHelper.Require(args.UserId, "UserId", Arguments.Positive);
            ArgumentHelper.Require(args.ModifyBy, "ModifyBy", Arguments.Positive);
            ArgumentHelper.Require(args.Password, "Password", Arguments.NotEmptyOrWhitespace);

            return(ContainerFactory <IUserRepository> .Instance.UpdateUserPassword(args));
        }
        public ActionResult UpdatePassword()
        {
            UpdatePasswordArgs updatePasswordArgs = RequestArgs <UpdatePasswordArgs>();

            if (updatePasswordArgs == null)
            {
                return(RespondResult(false, "参数无效。"));
            }
            bool success = _userManager.UpdatePassword(UserContext.User.Id, updatePasswordArgs);

            return(RespondResult(success, string.Empty));
        }
Exemple #4
0
        public CommandResult <int> UpdateUserPassword(UpdatePasswordArgs args)
        {
            try
            {
                var result = ContainerFactory <ISqlExcuteContext> .Instance.ExcuteProceDure(0, "update_userinfo_password", args);

                return(result);
            }
            catch (Exception e)
            {
                LogHelper.Error(this.GetType(), "用户模块--修改密码失败", e);
                return(CommandResult.Failure <int>(e.ToString()));
            }
        }
        public ActionResult UpdatePassword()
        {
            UpdatePasswordArgs args = RequestArgs <UpdatePasswordArgs>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            args.UserId = this.UserContext.UserId;

            NormalResult result = _userManager.UpdatePassword(args);

            return(ApiResult(result.Successful, result.Message));
        }
Exemple #6
0
        public NormalResult UpdatePassword(UpdatePasswordArgs args)
        {
            using (Entities db = new Entities())
            {
                IQueryable <User> queryable = db.User;

                User dbUser = queryable.FirstOrDefault(e => e.id == args.UserId && e.password == args.OldPassword);
                if (dbUser == null)
                {
                    return(new NormalResult("旧密码不正确。"));
                }

                dbUser.password = args.NewPassword;

                db.SaveChanges();
            }

            return(new NormalResult());
        }