private static void CreateBatches(List <DTOs.Result <DTOs.BatchSet> > batches, IRSAPIClient proxy) { foreach (var batch in batches) { var newBatch = new DTOs.BatchSet() { Name = batch.Artifact.Name, BatchPrefix = batch.Artifact.BatchPrefix, AutoBatch = batch.Artifact.AutoBatch, BatchDataSource = batch.Artifact.BatchDataSource, BatchUnitField = batch.Artifact.BatchUnitField, FamilyField = batch.Artifact.FamilyField, ReviewedField = batch.Artifact.ReviewedField, MaximumBatchSize = batch.Artifact.MaximumBatchSize }; if (batch.Artifact.AutoBatch == true) { newBatch.AutoCreateRateMinutes = batch.Artifact.AutoCreateRateMinutes; newBatch.MinimumBatchSize = batch.Artifact.MinimumBatchSize; } DTOs.WriteResultSet <DTOs.BatchSet> results = new DTOs.WriteResultSet <DTOs.BatchSet>(); try { results = proxy.Repositories.BatchSet.Create(newBatch); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } if (results.Success) { Console.WriteLine(string.Format("ID of the new Batch Set: {0}", results.Results[0].Artifact.ArtifactID)); } else { Console.WriteLine($"Batch Set creation was unsuccessful."); Console.WriteLine($"{results.Results[0].Message}"); } } }
private static void CreateBatches(List <DTOs.Result <DTOs.BatchSet> > batches, IRSAPIClient proxy) { foreach (var batch in batches) { // i have to create a new batchset from the batchset DTO; no idea why var newBatch = new DTOs.BatchSet() { Name = batch.Artifact.Name, BatchPrefix = batch.Artifact.BatchPrefix, AutoBatch = batch.Artifact.AutoBatch, BatchDataSource = batch.Artifact.BatchDataSource, BatchUnitField = batch.Artifact.BatchUnitField, FamilyField = batch.Artifact.FamilyField, ReviewedField = batch.Artifact.ReviewedField, MaximumBatchSize = batch.Artifact.MaximumBatchSize }; if (batch.Artifact.AutoBatch == true) { newBatch.AutoCreateRateMinutes = batch.Artifact.AutoCreateRateMinutes; newBatch.MinimumBatchSize = batch.Artifact.MinimumBatchSize; } DTOs.WriteResultSet <DTOs.BatchSet> results = new DTOs.WriteResultSet <DTOs.BatchSet>(); try { results = proxy.Repositories.BatchSet.Create(newBatch); } catch (Exception ex) { _logger.LogError("Exception when querying for batches: {message}", ex); } if (results.Success) { _logger.LogInformation("New batch set: {ArtifactID}", results.Results[0].Artifact.ArtifactID); } else { _logger.LogError("Batch Set creation unsuccessful: {message}", results.Results[0].Message); } } }