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(LearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var sfaPostCodeAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var learningDeliveryFamsEntities = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>(); var larsFundingEntities = larsLearningDelivery?.LARSFundings?.Select(BuildLARSFunding) ?? Enumerable.Empty <IDataEntity>(); var sfaAreaCostEntities = sfaPostCodeAreaCost?.Select(BuildSFAPostcodeAreaCost) ?? Enumerable.Empty <IDataEntity>(); var entity = 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.LearnActEndDate) }, { 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.NotionalNVQLevelv2, new AttributeData(larsLearningDelivery.NotionalNVQLevelv2) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDate) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdj) }, { Attributes.Outcome, new AttributeData(learningDelivery.Outcome) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdj) }, { Attributes.RegulatedCreditValue, new AttributeData(larsLearningDelivery.RegulatedCreditValue) }, } }; entity.AddChildren(learningDeliveryFamsEntities); entity.AddChildren(larsFundingEntities); entity.AddChildren(sfaAreaCostEntities); return(entity); }
public IDataEntity BuildLearningDeliveryDataEntity(LearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var larsFramework = larsLearningDelivery.LARSFrameworks? .Where(lf => lf.FworkCode == learningDelivery.FworkCode && lf.ProgType == learningDelivery.ProgType && lf.PwayCode == learningDelivery.PwayCode).FirstOrDefault(); var sfaAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var learningDeliveryFamsEntities = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>(); var larsAnnualValueEntities = larsLearningDelivery?.LARSAnnualValues?.Select(BuildLARSAnnualValue) ?? Enumerable.Empty <IDataEntity>(); var larsLearningDeliveryCategoryEntities = larsLearningDelivery?.LARSLearningDeliveryCategories?.Select(BuildLARSLearningDeliveryCategories) ?? Enumerable.Empty <IDataEntity>(); var sfaAreaCostEntities = sfaAreaCost?.Select(BuildSFAAreaCost) ?? Enumerable.Empty <IDataEntity>(); var larsFundingEntities = larsLearningDelivery?.LARSFundings?.Select(BuildLARSFunding) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AchDate, new AttributeData(learningDelivery.AchDate) }, { Attributes.AddHours, new AttributeData(learningDelivery.AddHours) }, { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) }, { Attributes.AimType, new AttributeData(learningDelivery.AimType) }, { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) }, { Attributes.DelLocPostCode, new AttributeData(learningDelivery.DelLocPostCode) }, { Attributes.EmpOutcome, new AttributeData(learningDelivery.EmpOutcome) }, { Attributes.EnglandFEHEStatus, new AttributeData(larsLearningDelivery.EnglandFEHEStatus) }, { Attributes.EnglPrscID, new AttributeData(larsLearningDelivery.EnglPrscID) }, { Attributes.FworkCode, new AttributeData(learningDelivery.FworkCode) }, { Attributes.FrameworkCommonComponent, new AttributeData(larsLearningDelivery.FrameworkCommonComponent) }, { Attributes.FrameworkComponentType, new AttributeData(larsFramework?.LARSFrameworkAim?.FrameworkComponentType) }, { Attributes.FundModel, new AttributeData(learningDelivery.FundModel) }, { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDate) }, { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) }, { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDate) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdj) }, { Attributes.Outcome, new AttributeData(learningDelivery.Outcome) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdj) }, { Attributes.ProgType, new AttributeData(learningDelivery.ProgType) }, { Attributes.PwayCode, new AttributeData(learningDelivery.PwayCode) } } }; entity.AddChildren(learningDeliveryFamsEntities); entity.AddChildren(larsAnnualValueEntities); entity.AddChildren(larsLearningDeliveryCategoryEntities); entity.AddChildren(sfaAreaCostEntities); entity.AddChildren(larsFundingEntities); return(entity); }
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(LearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var sfaAreaCost = _postcodesReferenceDataService.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode); var fcsContractData = _fcsDataReferenceDataService.FcsContractsForConRef(learningDelivery.ConRefNumber); var esfData = BuildEsfDataFromContract(fcsContractData); var learningDeliveryFamsEntities = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>(); var larsAnnualValueEntities = larsLearningDelivery?.LARSAnnualValues?.Select(BuildLARSAnnualValue) ?? Enumerable.Empty <IDataEntity>(); var sfaAreaCostEntities = sfaAreaCost?.Select(BuildSFAAreaCost) ?? Enumerable.Empty <IDataEntity>(); var larsFundingEntities = larsLearningDelivery?.LARSFundings?.Select(BuildLARSFunding) ?? Enumerable.Empty <IDataEntity>(); var esfEntities = esfData?.Select(BuildEsfDataEntity) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AchDate, new AttributeData(learningDelivery.AchDate) }, { Attributes.AddHours, new AttributeData(learningDelivery.AddHours) }, { 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.LearnActEndDate) }, { Attributes.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) }, { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) }, { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) }, { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDate) }, { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdj) }, { Attributes.Outcome, new AttributeData(learningDelivery.Outcome) }, { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdj) }, } }; entity.AddChildren(learningDeliveryFamsEntities); entity.AddChildren(larsAnnualValueEntities); entity.AddChildren(sfaAreaCostEntities); entity.AddChildren(esfEntities); entity.AddChildren(larsFundingEntities); return(entity); }
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() }); }