Beispiel #1
0
 public List <CollectionDetail> BuildCollectionDetails(int ukprn, ILooseHeader header)
 {
     return(new List <CollectionDetail>
     {
         new CollectionDetail
         {
             UKPRN = ukprn,
             Collection = header.CollectionDetailsEntity.CollectionString,
             FilePreparationDate = header.CollectionDetailsEntity.FilePreparationDate,
             Year = header.CollectionDetailsEntity.YearString,
         },
     });
 }
Beispiel #2
0
        private void PopulateInvalidLearners(IDataStoreCache cache, int ukprn, ILooseHeader header, IReadOnlyCollection <ILooseSourceFile> sourceFileCollection, IEnumerable <ILooseLearner> learners, IEnumerable <ILooseLearnerDestinationAndProgression> learnerDestinationAndProgressions)
        {
            var source = header.SourceEntity;

            int sourceFileId                        = 1;
            int learnerId                           = 1;
            int learnerDeliveryId                   = 1;
            int learnerEmploymentStatusId           = 1;
            int learnerEmploymentStatusMonitoringId = 1;
            int learningDeliveryHEId                = 1;
            int learnerDeliveryFamId                = 1;
            int appFinRecordId                      = 1;
            int learningDeliveryWorkPlacementId     = 1;
            int learnerFAMId                        = 1;
            int learnerHEId                         = 1;
            int learnerHEFinancialSupportId         = 1;
            int providerSpecLearnerMonitoringId     = 1;
            int providerSpecDeliveryMonitoringId    = 1;
            int contactPreferenceId                 = 1;
            int lLDDandHealthProblemID              = 1;
            int learnerDestinationandProgressionId  = 1;
            int dPOutcomeId                         = 1;

            cache.AddRange(BuildCollectionDetails(ukprn, header));
            cache.AddRange(BuildLearningProviders(ukprn));
            cache.AddRange(BuildSources(ukprn, source));

            if (sourceFileCollection == null)
            {
                cache.Add(new List <SourceFile>());
            }
            else
            {
                sourceFileCollection.NullSafeForEach(sourceFile => cache.Add(BuildSourceFiles(ukprn, sourceFile, sourceFileId++)));
            }

            learners.NullSafeForEach(learner =>
            {
                cache.Add(BuildInvalidLearner(ukprn, learner, learnerId));

                learner.ContactPreferences.NullSafeForEach(
                    contactPreference =>
                    cache.Add(BuildContactPreference(ukprn, learner, contactPreference, learnerId, contactPreferenceId++)));

                learner.LearningDeliveries.NullSafeForEach(learningDelivery =>
                {
                    cache.Add(BuildLearningDelivery(ukprn, learner, learningDelivery, learnerId, learnerDeliveryId));

                    learningDelivery.LearningDeliveryHEs.NullSafeForEach(learningDeliveryHE => cache.Add(BuildLearningDeliveryHERecord(ukprn, learner, learningDelivery, learningDeliveryHE, learningDeliveryHEId++)));

                    learningDelivery.AppFinRecords.NullSafeForEach(
                        appFinRecord =>
                        cache.Add(BuildLearningDeliveryAppFinRecord(ukprn, learner, learningDelivery, appFinRecord, learnerDeliveryId, appFinRecordId++)));

                    learningDelivery.LearningDeliveryFAMs.NullSafeForEach(
                        famRecord =>
                        cache.Add(BuildLearningDeliveryFAMRecord(ukprn, learner, learningDelivery, famRecord, learnerDeliveryId, learnerDeliveryFamId++)));

                    learningDelivery.LearningDeliveryWorkPlacements.NullSafeForEach(workPlacement =>
                                                                                    cache.Add(BuildLearningDeliveryWorkPlacement(ukprn, learner, learningDelivery, workPlacement, learnerDeliveryId, learningDeliveryWorkPlacementId++)));

                    learningDelivery.ProviderSpecDeliveryMonitorings.NullSafeForEach(monitoring =>
                                                                                     cache.Add(BuildProviderSpecDeliveryMonitoring(ukprn, learner, learningDelivery, monitoring, learnerDeliveryId, providerSpecDeliveryMonitoringId++)));

                    learnerDeliveryId++;
                });

                learner.LearnerEmploymentStatuses.NullSafeForEach(employmentStatus =>
                {
                    cache.Add(BuildLearnerEmploymentStatus(ukprn, learner, employmentStatus, learnerId, learnerEmploymentStatusId));
                    employmentStatus.EmploymentStatusMonitorings.NullSafeForEach(monitoring =>
                                                                                 cache.Add(BuildEmploymentStatusMonitoring(ukprn, learner, employmentStatus, monitoring, learnerEmploymentStatusId, learnerEmploymentStatusMonitoringId++)));

                    learnerEmploymentStatusId++;
                });

                learner.LearnerFAMs.NullSafeForEach(fam => cache.Add(BuildLearnerFAM(ukprn, learner, fam, learnerId, learnerFAMId++)));

                learner.LearnerHEs.NullSafeForEach(learnerHE =>
                {
                    cache.Add(BuildLearnerHE(ukprn, learner, learnerHE, learnerId, learnerHEId++));
                    learnerHE.LearnerHEFinancialSupports.NullSafeForEach(support => cache.Add(BuildLearnerHEFinancialSupport(ukprn, learner, support, learnerHEFinancialSupportId++)));
                });

                learner.LLDDAndHealthProblems.NullSafeForEach(problem => cache.Add(BuildLLDDAndHealthProblem(ukprn, learner, problem, learnerId, lLDDandHealthProblemID++)));

                learner.ProviderSpecLearnerMonitorings.NullSafeForEach(monitoring => cache.Add(BuildProviderSpecLearnerMonitorings(ukprn, learner, monitoring, learnerId, providerSpecLearnerMonitoringId++)));

                learnerId++;
            });

            learnerDestinationAndProgressions.NullSafeForEach(learnerDestinationAndProgression =>
            {
                cache.Add(BuildLearnerDestinationandProgression(ukprn, learnerDestinationAndProgression, learnerDestinationandProgressionId));

                learnerDestinationAndProgression.DPOutcomes.NullSafeForEach(dpOutcome => cache.Add(BuildDpOutcome(ukprn, learnerDestinationAndProgression, dpOutcome, dPOutcomeId++, learnerDestinationandProgressionId)));

                learnerDestinationandProgressionId++;
            });
        }