示例#1
0
 public IDataEntity BuildDPOutcome(DPOutcome dpOutcome)
 {
     return(new DataEntity(Attributes.EntityDPOutcome)
     {
         Attributes = new Dictionary <string, IAttributeData>()
         {
             { Attributes.OutCode, new AttributeData(dpOutcome.OutCode) },
             { Attributes.OutType, new AttributeData(dpOutcome.OutType) },
         }
     });
 }
示例#2
0
        public void BuildDPOutcome()
        {
            var dpOutcome = new DPOutcome()
            {
                OutCode = 1,
                OutType = "Type",
            };

            var dataEntity = NewService().BuildDPOutcome(dpOutcome);

            dataEntity.EntityName.Should().Be("DPOutcome");
            dataEntity.Attributes.Should().HaveCount(2);
            dataEntity.Attributes["OutCode"].Value.Should().Be(dpOutcome.OutCode);
            dataEntity.Attributes["OutType"].Value.Should().Be(dpOutcome.OutType);
        }
示例#3
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,
 };
        public void BuildDPOutcome()
        {
            var dpOutcome = new DPOutcome
            {
                OutCode      = 100,
                OutType      = "Type",
                OutCollDate  = new DateTime(2018, 1, 1),
                OutStartDate = new DateTime(2018, 1, 1),
            };

            var dataEntity = NewService().BuildDPOutcomes(dpOutcome);

            dataEntity.EntityName.Should().Be("DPOutcome");
            dataEntity.Attributes.Should().HaveCount(5);
            dataEntity.Attributes["OutCode"].Value.Should().Be(dpOutcome.OutCode);
            dataEntity.Attributes["OutType"].Value.Should().Be(dpOutcome.OutType);
            dataEntity.Attributes["OutCollDate"].Value.Should().Be(dpOutcome.OutCollDate);
            dataEntity.Attributes["OutStartDate"].Value.Should().Be(dpOutcome.OutStartDate);
            dataEntity.Attributes["OutEndDate"].Value.Should().Be(dpOutcome.OutEndDate);

            dataEntity.Children.Should().BeNullOrEmpty();
        }
示例#5
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));
                }
            }
        }