Example #1
0
        public UserActivateQM UpdateUserPassword(UserPasswordCM userPasswordCM)
        {
            UserActivateQM userActivateQM;

            using (var connection = new DbConnectionProvider().CreateConnection())
            {
                connection.Open();

                var registrationInsertCommand = new UserPasswordCommand {
                    Connection = connection
                };
                userActivateQM = registrationInsertCommand.Execute(userPasswordCM);
            }
            return(userActivateQM);
        }
        public UserActivateResponseDto UpdateUserPassword(UserPasswordRequestDto userPasswordRequestDto)
        {
            UserActivateResponseDto userActivateResponseDto = new UserActivateResponseDto();
            var keyNew   = Helper.GeneratePassword(25);
            var password = Helper.EncodePassword(userPasswordRequestDto.NewPassword, keyNew);
            var cModel   = new UserPasswordCM
            {
                UserId       = userPasswordRequestDto.UserId,
                UserPassword = password,
                PasswordSalt = keyNew
            };
            var response = authenticationRepository.UpdateUserPassword(cModel);

            userActivateResponseDto.RegisteredUserId = response.RegisteredUserId;
            return(userActivateResponseDto);
        }
        public UserActivateQM Execute(UserPasswordCM userPasswordCM)
        {
            UserActivateQM userActivateQM = new UserActivateQM();

            using (var sqlCommand = CreateCommand())
            {
                sqlCommand.Connection  = Connection;
                sqlCommand.CommandText = "[dbo].[uspUpdateUserPassword]";
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.Add(this.AddParameter("@UserId", SsDbType.UniqueIdentifier, ParameterDirection.Input, userPasswordCM.UserId));
                sqlCommand.Parameters.Add(this.AddParameter("@UpdatedBy", SsDbType.UniqueIdentifier, ParameterDirection.Input, userPasswordCM.UserId));
                sqlCommand.Parameters.Add(this.AddParameter("@UpdatedDateTime", SsDbType.DateTime, ParameterDirection.Input, DateTime.Now));
                sqlCommand.Parameters.Add(this.AddParameter("@UserPassword", SsDbType.NVarChar, ParameterDirection.Input, userPasswordCM.UserPassword));
                sqlCommand.Parameters.Add(this.AddParameter("@PasswordSalt", SsDbType.NVarChar, ParameterDirection.Input, userPasswordCM.PasswordSalt));
                sqlCommand.Parameters.Add(this.AddParameter("@RegisteredUserId", SsDbType.UniqueIdentifier, ParameterDirection.Output));

                var reader = sqlCommand.ExecuteNonQuery();
                userActivateQM.RegisteredUserId = (Guid)sqlCommand.Parameters["@RegisteredUserId"].Value;
            }
            return(userActivateQM);
        }