Exemple #1
0
        private async Task SaveEventPeriods(CancellationToken cancellationToken, DataLockStatusChanged dataLockStatusChangedEvent, int transactionTypeFlag, bool isError, string commitmentVersionId)
        {
            var collectionPeriod = dataLockStatusChangedEvent.CollectionPeriod.Period;

            var dataLockEventPeriod = new LegacyDataLockEventPeriod
            {
                DataLockEventId       = dataLockStatusChangedEvent.EventId,
                TransactionTypesFlag  = transactionTypeFlag,
                CollectionPeriodYear  = dataLockStatusChangedEvent.CollectionPeriod.AcademicYear,
                CollectionPeriodName  = $"{dataLockStatusChangedEvent.CollectionPeriod.AcademicYear}-{collectionPeriod:D2}",
                CollectionPeriodMonth = (collectionPeriod < 6) ? collectionPeriod + 7 : collectionPeriod - 5,
                IsPayable             = !isError,
                CommitmentVersion     = commitmentVersionId
            };

            logger.LogVerbose($"Saving DataLockEventPeriod {dataLockEventPeriod.CollectionPeriodName} for legacy DataLockEvent {dataLockStatusChangedEvent.EventId} for UKPRN {dataLockStatusChangedEvent.Ukprn}");

            await dataLockEventPeriodWriter.Write(dataLockEventPeriod, cancellationToken).ConfigureAwait(false);
        }
 private async Task SaveEventPeriods(LegacyDataLockEventPeriod period, PriceEpisodeStatusChange dataLockStatusChangedEvent, CancellationToken cancellationToken)
 {
     logger.LogVerbose($"Saving DataLockEventPeriod {period.CollectionPeriodName} for legacy DataLockEvent {dataLockStatusChangedEvent.DataLock.DataLockEventId} for UKPRN {dataLockStatusChangedEvent.DataLock.UKPRN}");
     await dataLockEventPeriodWriter.Write(period, cancellationToken).ConfigureAwait(false);
 }