Beispiel #1
0
        public IDataEntity BuildLearningDeliveryDataEntity(ILearningDelivery learningDelivery)
        {
            var learningDeliveryFAMDenormalized   = BuildLearningDeliveryFAMDenormalized(learningDelivery.LearningDeliveryFAMs);
            var larsLearningDelivery              = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef);
            var larsStandardAppenticeshipFunding  = _larsReferenceDataService.LARSStandardApprenticeshipFunding(learningDelivery.StdCodeNullable, learningDelivery.ProgTypeNullable);
            var larsFrameworkAppenticeshipFunding = _larsReferenceDataService.LARSFrameworkApprenticeshipFunding(learningDelivery.FworkCodeNullable, learningDelivery.ProgTypeNullable, learningDelivery.PwayCodeNullable);
            var larsFrameworkCommonComponent      = _larsReferenceDataService.LARSFrameworkCommonComponent(learningDelivery.LearnAimRef, learningDelivery.FworkCodeNullable, learningDelivery.ProgTypeNullable, learningDelivery.PwayCodeNullable);
            var larsStandardCommonComponent       = _larsReferenceDataService.LARSStandardCommonComponent(learningDelivery.StdCodeNullable);
            var larsFunding = _larsReferenceDataService.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef);

            return(new DataEntity(Attributes.EntityLearningDelivery)
            {
                Attributes = new Dictionary <string, IAttributeData>()
                {
                    { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) },
                    { Attributes.AimType, new AttributeData(learningDelivery.AimType) },
                    { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) },
                    { Attributes.FrameworkCommonComponent, new AttributeData(larsLearningDelivery.FrameworkCommonComponent) },
                    { Attributes.FworkCode, new AttributeData(learningDelivery.FworkCodeNullable) },
                    { Attributes.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) },
                    { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDateNullable) },
                    { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) },
                    { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) },
                    { Attributes.LrnDelFAM_EEF, new AttributeData(learningDeliveryFAMDenormalized.EEF) },
                    { Attributes.LrnDelFAM_LDM1, new AttributeData(learningDeliveryFAMDenormalized.LDM1) },
                    { Attributes.LrnDelFAM_LDM2, new AttributeData(learningDeliveryFAMDenormalized.LDM2) },
                    { Attributes.LrnDelFAM_LDM3, new AttributeData(learningDeliveryFAMDenormalized.LDM3) },
                    { Attributes.LrnDelFAM_LDM4, new AttributeData(learningDeliveryFAMDenormalized.LDM4) },
                    { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDateNullable) },
                    { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdjNullable) },
                    { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdjNullable) },
                    { Attributes.ProgType, new AttributeData(learningDelivery.ProgTypeNullable) },
                    { Attributes.PwayCode, new AttributeData(learningDelivery.PwayCodeNullable) },
                    { Attributes.STDCode, new AttributeData(learningDelivery.StdCodeNullable) },
                },
                Children = (
                    learningDelivery?
                    .LearningDeliveryFAMs?
                    .Select(BuildLearningDeliveryFAM) ?? new List <IDataEntity>())
                           .Union(
                    learningDelivery?
                    .AppFinRecords?
                    .Select(BuildApprenticeshipFinancialRecord) ?? new List <IDataEntity>())
                           .Union(
                    larsStandardAppenticeshipFunding?
                    .Select(BuildLARSStandardApprenticeshipFunding) ?? new List <IDataEntity>())
                           .Union(
                    larsFrameworkAppenticeshipFunding?
                    .Select(BuildLARSFrameworkApprenticeshipFunding) ?? new List <IDataEntity>())
                           .Union(
                    larsFrameworkCommonComponent?
                    .Select(BuildLARSFrameworkCommonComponent) ?? new List <IDataEntity>())
                           .Union(
                    larsStandardCommonComponent?
                    .Select(BuildLARSStandardCommonComponent) ?? new List <IDataEntity>())
                           .Union(
                    larsFunding?
                    .Select(BuildLARSFunding) ?? new List <IDataEntity>())
                           .ToList()
            });
        }