PurchaseBatchJournal.cs 1.2 KB

123456789101112131415161718192021222324
  1. using Admin.NET.Plugin.AiDOP.DataPlatform.Core;
  2. using MySqlConnector;
  3. namespace Admin.NET.DataPlatform.Worker;
  4. internal static class PurchaseBatchJournal
  5. {
  6. internal static async Task AppendAsync(MySqlConnection connection, MySqlTransaction transaction,
  7. PurchaseTaskLease scope, string eventCode, CancellationToken token, int? attempt = null,
  8. int? count = null, string? diagnostic = null)
  9. {
  10. using var command = new MySqlCommand(IngestBatchJournal.Insert, connection, transaction);
  11. command.Parameters.AddWithValue("@BatchId", scope.BatchId.ToString("D"));
  12. command.Parameters.AddWithValue("@TenantId", scope.TenantId);
  13. command.Parameters.AddWithValue("@FactoryId", scope.FactoryId);
  14. command.Parameters.AddWithValue("@DatasetId", scope.DatasetId);
  15. command.Parameters.AddWithValue("@SourceId", scope.SourceId);
  16. command.Parameters.AddWithValue("@EventCode", eventCode);
  17. command.Parameters.AddWithValue("@Attempt", (object?)attempt ?? DBNull.Value);
  18. command.Parameters.AddWithValue("@Count", (object?)count ?? DBNull.Value);
  19. command.Parameters.AddWithValue("@Diagnostic", (object?)diagnostic ?? DBNull.Value);
  20. await command.ExecuteNonQueryAsync(token);
  21. }
  22. }