public IDataEntity BuildLearningDeliveryDataEntity(ILearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var sfaPostCodeAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var subsidyPilotPostcodeArea = _postcodesReferenceDataService.CareerLearningPilotsForPostcode(learningDelivery.DelLocPostCode); var learningDeliveryFAMDenormalized = BuildLearningDeliveryFAMDenormalized(learningDelivery.LearningDeliveryFAMs); var larsFunding = _larsReferenceDataService.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef); return(new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) }, { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) }, { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDateNullable) }, { Attributes.LearnAimRefType, new AttributeData(larsLearningDelivery.LearnAimRefType) }, { Attributes.LearnDelFundModel, new AttributeData(learningDelivery.FundModel) }, { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) }, { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) }, { Attributes.LrnDelFAM_ADL, new AttributeData(learningDeliveryFAMDenormalized.ADL) }, { 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.LrnDelFAM_RES, new AttributeData(learningDeliveryFAMDenormalized.RES) }, { Attributes.NotionalNVQLevelv2, new AttributeData(larsLearningDelivery.NotionalNVQLevelv2) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDateNullable) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdjNullable) }, { Attributes.Outcome, new AttributeData(learningDelivery.OutcomeNullable) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdjNullable) }, { Attributes.RegulatedCreditValue, new AttributeData(larsLearningDelivery.RegulatedCreditValue) }, }, Children = ( learningDelivery? .LearningDeliveryFAMs? .Select(BuildLearningDeliveryFAM) ?? new List <IDataEntity>()) .Union( larsLearningDelivery? .LARSCareerLearningPilot? .Select(BuildLARSCareerLearningPilot) ?? new List <IDataEntity>()) .Union( larsFunding? .Select(BuildLARSFunding) ?? new List <IDataEntity>()) .Union( _postcodesReferenceDataService .SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode) .Select(BuildSFAPostcodeAreaCost) ?? new List <IDataEntity>()) .Union( _postcodesReferenceDataService .CareerLearningPilotsForPostcode(learningDelivery.DelLocPostCode) .Select(BuildSubsidyPilotPostcodeArea) ?? new List <IDataEntity>()) .ToList() }); }
public IDataEntity BuildLearningDeliveryDataEntity(ILearningDelivery learningDelivery) { var learningDeliveryFAMDenormalized = BuildLearningDeliveryFAMDenormalized(learningDelivery.LearningDeliveryFAMs); var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var larsAnnualValue = _larsReferenceDataService.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef); var larsFunding = _larsReferenceDataService.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef); var sfaAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var fcsContractData = _fcsDataReferenceDataService.FcsContractsForConRef(learningDelivery.ConRefNumber); var esfData = BuildEsfDataFromContract(fcsContractData); return(new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AchDate, new AttributeData(learningDelivery.AchDateNullable) }, { Attributes.AddHours, new AttributeData(learningDelivery.AddHoursNullable) }, { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) }, { Attributes.CalcMethod, new AttributeData(esfData.Select(c => c.CalcMethod).FirstOrDefault()) }, { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) }, { Attributes.ConRefNumber, new AttributeData(learningDelivery.ConRefNumber) }, { Attributes.GenreCode, new AttributeData(larsLearningDelivery.LearningDeliveryGenre) }, { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDateNullable) }, { Attributes.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) }, { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) }, { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) }, { 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.LrnDelFAM_RES, new AttributeData(learningDeliveryFAMDenormalized.RES) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDateNullable) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdjNullable) }, { Attributes.Outcome, new AttributeData(learningDelivery.OutcomeNullable) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdjNullable) }, }, Children = ( larsAnnualValue? .Select(BuildLARSAnnualValue) ?? new List <IDataEntity>()) .Union( sfaAreaCost? .Select(BuildSFAAreaCost) ?? new List <IDataEntity>()) .Union( larsFunding? .Select(BuildLARSFunding) ?? new List <IDataEntity>()) .Union( esfData? .Select(BuildEsfDataEntity) ?? new List <IDataEntity>()) .ToList() }); }
public IDataEntity BuildLearningDeliveryDataEntity(ILearningDelivery learningDelivery) { var learningDeliveryFAMDenormalized = BuildLearningDeliveryFAMDenormalized(learningDelivery.LearningDeliveryFAMs); var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var larsFrameworkAims = _larsReferenceDataService.LARSFFrameworkAimsForLearnAimRef(learningDelivery.LearnAimRef); var larsFunding = _larsReferenceDataService.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef); var larsAnnualValue = _larsReferenceDataService.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef); var larsLearningDeliveryCategories = _larsReferenceDataService.LARSLearningDeliveryCategoriesForLearnAimRef(learningDelivery.LearnAimRef); var sfaAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var larsFwkAims = larsFrameworkAims?.ToList(); int?frameworkComponentType = null; if (larsFrameworkAims != null && learningDelivery.FworkCodeNullable != null && learningDelivery.ProgTypeNullable != null && learningDelivery.PwayCodeNullable != null) { frameworkComponentType = larsFrameworkAims .Where(fwa => learningDelivery.FworkCodeNullable == fwa.FworkCode && learningDelivery.ProgTypeNullable == fwa.ProgType && learningDelivery.PwayCodeNullable == fwa.PwayCode) .Select(fwct => fwct.FrameworkComponentType).FirstOrDefault(); } return(new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AchDate, new AttributeData(learningDelivery.AchDateNullable) }, { Attributes.AddHours, new AttributeData(learningDelivery.AddHoursNullable) }, { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) }, { Attributes.AimType, new AttributeData(learningDelivery.AimType) }, { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) }, { Attributes.EmpOutcome, new AttributeData(learningDelivery.EmpOutcomeNullable) }, { Attributes.EnglandFEHEStatus, new AttributeData(larsLearningDelivery.EnglandFEHEStatus) }, { Attributes.EnglPrscID, new AttributeData(larsLearningDelivery.EnglPrscID) }, { Attributes.FworkCode, new AttributeData(learningDelivery.FworkCodeNullable) }, { Attributes.FrameworkCommonComponent, new AttributeData(larsLearningDelivery.FrameworkCommonComponent) }, { Attributes.FrameworkComponentType, new AttributeData(frameworkComponentType) }, { 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.LrnDelFAM_FFI, new AttributeData(learningDeliveryFAMDenormalized.FFI) }, { Attributes.LrnDelFAM_RES, new AttributeData(learningDeliveryFAMDenormalized.RES) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDateNullable) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdjNullable) }, { Attributes.Outcome, new AttributeData(learningDelivery.OutcomeNullable) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdjNullable) }, { Attributes.ProgType, new AttributeData(learningDelivery.ProgTypeNullable) }, { Attributes.PwayCode, new AttributeData(learningDelivery.PwayCodeNullable) } }, Children = ( learningDelivery? .LearningDeliveryFAMs? .Select(BuildLearningDeliveryFAM) ?? new List <IDataEntity>()) .Union( larsAnnualValue? .Select(BuildLARSAnnualValue) ?? new List <IDataEntity>()) .Union( larsLearningDeliveryCategories? .Select(BuildLARSLearningDeliveryCategories) ?? new List <IDataEntity>()) .Union( sfaAreaCost? .Select(BuildSFAAreaCost) ?? new List <IDataEntity>()) .Union( larsFunding? .Select(BuildLARSFunding) ?? new List <IDataEntity>()) .ToList() }); }
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() }); }