コード例 #1
0
 private AimAndDeliverableReportRow BuildRow(
     LearningDelivery learningDelivery,
     DPOutcome dpOutcome,
     ESFDPOutcome esfDpOutcome,
     LARSLearningDelivery larsLearningDelivery,
     FCSDeliverableCodeMapping fcsDeliverableCodeMapping,
     ESFLearningDeliveryDeliverablePeriod deliverablePeriod = null,
     string reportMonth = null)
 => new AimAndDeliverableReportRow()
 {
     LearningDelivery          = learningDelivery,
     DPOutcome                 = dpOutcome,
     ESFDPOutcome              = esfDpOutcome,
     LarsLearningDelivery      = larsLearningDelivery,
     DeliverablePeriod         = deliverablePeriod,
     FcsDeliverableCodeMapping = fcsDeliverableCodeMapping,
     ReportMonth               = reportMonth,
 };
コード例 #2
0
        public IEnumerable <AimAndDeliverableReportRow> BuildReportRows(
            string startYear,
            string endYear,
            ICollection <LearningDelivery> learningDeliveries,
            ICollection <DPOutcome> dpOutcomes,
            ICollection <ESFLearningDeliveryDeliverablePeriod> deliverablePeriods,
            ICollection <ESFDPOutcome> esfDpOutcomes,
            ICollection <LARSLearningDelivery> larsLearningDeliveries,
            ICollection <FCSDeliverableCodeMapping> fcsDeliverableCodeMappings)
        {
            var periodMonthLookup            = BuildPeriodReportMonthLookup(startYear, endYear);
            var fcsDeliverableCodeNameLookup = BuildFcsDeliverableCodeNameLookup(fcsDeliverableCodeMappings);
            var larsLearningDeliveryLookup   = BuildLarsLearningDeliveryLookup(larsLearningDeliveries);
            var dpOutcomeLookup    = BuildDpOutcomeLookup(dpOutcomes);
            var esfDpOutcomeLookup = BuildESFDpOutcomeLookup(esfDpOutcomes);
            var learningDeliverablePeriodLookup = BuildEsfLearningDeliveryDeliverableLookup(deliverablePeriods);

            var roundTwoLearningDeliveries = learningDeliveries.Where(ld => ld != null && IsRoundTwoContract(ld.ConRefNumber));

            foreach (var learningDelivery in roundTwoLearningDeliveries)
            {
                DPOutcome    dpOutcome    = null;
                ESFDPOutcome esfDpOutcome = null;

                if (IsDpOutcomeKey(learningDelivery))
                {
                    var dpOutcomeKey = BuildDpOutcomeKeyForLearningDelivery(learningDelivery);

                    dpOutcome    = dpOutcomeLookup.GetValueOrDefault(dpOutcomeKey);
                    esfDpOutcome = esfDpOutcomeLookup.GetValueOrDefault(dpOutcomeKey);
                }

                var larsLearningDelivery = larsLearningDeliveryLookup.GetValueOrDefault(learningDelivery.LearnAimRef);

                var learningDeliverableKey = new ESFLearningDeliveryDeliverableKey(learningDelivery.LearnRefNumber, learningDelivery.AimSeqNumber, learningDelivery.DeliverableCode);

                var deliverablePeriodsForLearningDelivery = learningDeliverablePeriodLookup.GetValueOrDefault(learningDeliverableKey);

                var deliverablePeriodRowCreated = false;

                var deliverableName = fcsDeliverableCodeNameLookup.GetValueOrDefault(learningDelivery.DeliverableCode);

                if (deliverablePeriodsForLearningDelivery != null && deliverablePeriodsForLearningDelivery.Any())
                {
                    var deliverablePeriodsToBeDisplayed = deliverablePeriodsForLearningDelivery.Where(DisplayOnReport).ToList();

                    if (deliverablePeriodsToBeDisplayed.Any())
                    {
                        foreach (var deliverablePeriod in deliverablePeriodsToBeDisplayed)
                        {
                            var reportMonth = periodMonthLookup.GetValueOrDefault(deliverablePeriod.Period);

                            deliverablePeriodRowCreated = true;

                            yield return(BuildRow(learningDelivery, dpOutcome, esfDpOutcome, larsLearningDelivery, deliverableName, deliverablePeriod, reportMonth));
                        }
                    }
                }

                if (!deliverablePeriodRowCreated)
                {
                    yield return(BuildRow(learningDelivery, dpOutcome, esfDpOutcome, larsLearningDelivery, deliverableName));
                }
            }
        }