private async Task <(long, Guid)> AddDataLockEventNonPayablePeriod(Guid datalockEventId) { var dataLockEventNonPayablePeriod = new DataLockEventNonPayablePeriod { DataLockEventId = datalockEventId, DeliveryPeriod = 1, Amount = 1, TransactionType = 1, DataLockEventNonPayablePeriodId = Guid.NewGuid() }; await submissionDataContext.DataLockEventNonPayablePeriods.AddAsync(dataLockEventNonPayablePeriod); await submissionDataContext.SaveChangesAsync(); return(dataLockEventNonPayablePeriod.Id, dataLockEventNonPayablePeriod.DataLockEventNonPayablePeriodId); }
public void GivenTheDataLockServiceHasGeneratedTheFollowingEvents(Table table) { var dataContext = Container.Resolve <AuditDataContext>(); var submissions = table.CreateSet <SubmissionData>(); foreach (var submission in submissions) { var dataLockEvent = new DataLockEvent { EventId = Guid.NewGuid(), EarningEventId = Guid.NewGuid(), IlrSubmissionDateTime = submission.SubmissionTime, LearnerReferenceNumber = submission.Learner, LearningAimReference = "1", LearningAimFundingLineType = "2", Ukprn = TestSession.Ukprn, CollectionPeriod = 1, AcademicYear = 1 }; if (submission.Failure) { var nonPayablePeriod = new DataLockEventNonPayablePeriod { DataLockEventId = dataLockEvent.EventId, DataLockEventNonPayablePeriodId = Guid.NewGuid() }; dataContext.DataLockEventNonPayablePeriods.Add(nonPayablePeriod); var nonPayableFailures = new DataLockEventNonPayablePeriodFailures { DataLockEventNonPayablePeriodId = nonPayablePeriod.DataLockEventNonPayablePeriodId }; dataContext.DataLockEventNonPayablePeriodFailures.Add(nonPayableFailures); } else { var dataLockPayablePeriod = new DataLockPayablePeriod { DataLockEventId = dataLockEvent.EventId }; dataContext.DataLockPayablePeriods.Add(dataLockPayablePeriod); var priceEpisode = new DataLockEventPriceEpisode { PriceEpisodeIdentifier = "1", PlannedEndDate = DateTime.Now, DataLockEventId = dataLockEvent.EventId, }; dataContext.DataLockEventPriceEpisodes.Add(priceEpisode); } dataContext.DataLockEvents.Add(dataLockEvent); } dataContext.SaveChanges(); }