private void SetAddUserRejectionParameters(int downloadId, FailedUserData failedUserData, AddUserRejectionParameters parameters) { parameters.DownloadId.Value = downloadId; parameters.LineNumber.Value = failedUserData.LineNumber; parameters.RejectionReason.Value = errorMessageService.GetErrorMessage(failedUserData); }
private void AddUserRejections(IDatabaseConnectionService databaseConnection, DbTransaction transaction, int downloadId, IEnumerable <FailedUserData> failedUsersData) { AddUserRejectionParameters parameters = CreateAddUserRejectionParameters(databaseConnection); using (DbCommand command = databaseConnection.CreateDbCommand()) { command.CommandText = Constants.StatsUploadDatabase.AddUserRejectionProcedureName; command.CommandType = CommandType.StoredProcedure; command.Transaction = transaction; command.Parameters.AddRange(parameters.AllParameters); foreach (FailedUserData failedUserData in failedUsersData ?? new FailedUserData[0]) { SetAddUserRejectionParameters(downloadId, failedUserData, parameters); command.ExecuteNonQuery(); } } }