public IDataEntity BuildGlobalDataEntity(FM35LearnerDto learner, Global global) { var orgFunding = _organisationReferenceDataService.OrganisationFundingForUKPRN(global.UKPRN) .Where(f => f.OrgFundFactType.CaseInsensitiveEquals(Attributes.OrgFundFactorTypeAdultSkills)); var postcodeSpecialistResources = _organisationReferenceDataService.PostcodeSpecialistResourcesForUkprn(global.UKPRN).ToList(); var orgDataEntities = orgFunding.Any() ? orgFunding?.Select(BuildOrgFundingDataEntity).ToList() : new List <IDataEntity> { new DataEntity(Attributes.EntityOrgFunding) }; var specialistResourceEntities = postcodeSpecialistResources?.Select(BuildPostcodeSpecialistResource) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityGlobal) { Attributes = BuildGlobalAttributes(global) }; if (learner != null) { entity.AddChild(BuildLearnerDataEntity(learner)); entity.AddChildren(orgDataEntities); entity.AddChildren(specialistResourceEntities); } return(entity); }
public IDataEntity BuildLearnerDataEntity(FM36LearnerDto learner) { var dasPostDisadvantage = _postcodesReferenceDataService.DASDisadvantagesForPostcode(learner.PostcodePrior); var appsEarningsHistory = _appsEarningsHistoryReferenceDataService.AECEarningsHistory(learner.ULN); var learnerEmploymentStatusEntities = learner.LearnerEmploymentStatuses?.Select(BuildLearnerEmploymentStatus) ?? Enumerable.Empty <IDataEntity>(); var learningDeliveryEntities = learner.LearningDeliveries?.Where(ld => ld.FundModel == _fundModel).Select(BuildLearningDeliveryDataEntity) ?? Enumerable.Empty <IDataEntity>(); var dasPostDisadvantageEntities = dasPostDisadvantage?.Select(BuildDASPostcodeDisadvantage) ?? Enumerable.Empty <IDataEntity>(); var appsEarningsHistoryEntities = appsEarningsHistory?.Select(BuildApprenticeshipsEarningsHistory) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearner) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.LearnRefNumber, new AttributeData(learner.LearnRefNumber) }, { Attributes.DateOfBirth, new AttributeData(learner.DateOfBirth) }, { Attributes.ULN, new AttributeData(learner.ULN) }, { Attributes.PrevUKPRN, new AttributeData(learner.PrevUKPRN) }, { Attributes.PMUKPRN, new AttributeData(learner.PMUKPRN) } } }; entity.AddChildren(learningDeliveryEntities); entity.AddChildren(learnerEmploymentStatusEntities); entity.AddChildren(dasPostDisadvantageEntities); entity.AddChildren(appsEarningsHistoryEntities); return(entity); }
public IDataEntity BuildLearnerDataEntity(FM35LearnerDto learner) { var sfaPostDisadvantage = _postcodesReferenceDataService.SFADisadvantagesForPostcode(learner.PostcodePrior); var specialistResources = _organisationReferenceDataService.SpecialistResourcesForCampusIdentifier(learner.CampId); var learnerEmploymentStatusEntities = learner.LearnerEmploymentStatuses?.Select(BuildLearnerEmploymentStatus) ?? Enumerable.Empty <IDataEntity>(); var learningDeliveryEntities = learner.LearningDeliveries?.Select(BuildLearningDeliveryDataEntity) ?? Enumerable.Empty <IDataEntity>(); var sfaPostDisadvantageEntities = sfaPostDisadvantage?.Select(BuildSFAPostcodeDisadvantage) ?? Enumerable.Empty <IDataEntity>(); var specialistResourcesEntities = specialistResources?.Select(BuildSpecialistResources) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearner) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.LearnRefNumber, new AttributeData(learner.LearnRefNumber) }, { Attributes.DateOfBirth, new AttributeData(learner.DateOfBirth) }, } }; entity.AddChildren(learningDeliveryEntities); entity.AddChildren(learnerEmploymentStatusEntities); entity.AddChildren(sfaPostDisadvantageEntities); entity.AddChildren(specialistResourcesEntities); return(entity); }
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); }
private static DataEntity AddChildrenWithLazyValidation(this DataEntity source, IRelationshipDefinition rel, IEnumerable <DataEntity> children) { ValidateChildRelationship(source, rel); var validatingAction = ValidateNames(rel.RelatedObjectDefinitionFullName); var validatingEnumerable = children.ValidateEnumerable(validatingAction); return(source.AddChildren(rel.FullName, validatingEnumerable)); }
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 BuildLearnerDataEntity(FM81LearnerDto learner) { var learnerEmploymentStatusEntities = learner.LearnerEmploymentStatuses?.Select(BuildLearnerEmploymentStatus) ?? Enumerable.Empty <IDataEntity>(); var learningDeliveryEntities = learner.LearningDeliveries?.Where(ld => ld.FundModel == _fundModel && ld.ProgType == _progType) .Select(BuildLearningDeliveryDataEntity) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearner) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.LearnRefNumber, new AttributeData(learner.LearnRefNumber) }, { Attributes.DateOfBirth, new AttributeData(learner.DateOfBirth) }, } }; entity.AddChildren(learningDeliveryEntities); entity.AddChildren(learnerEmploymentStatusEntities); return(entity); }
public IDataEntity BuildLearningDeliveryDataEntity(LearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var larsStandard = _larsReferenceDataService.LARSStandardForStandardCode(learningDelivery.StdCode); var learningDeliveryFamsEntities = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>(); var appFinRecordEntities = learningDelivery?.AppFinRecords?.Select(BuildApprenticeshipFinancialRecord) ?? Enumerable.Empty <IDataEntity>(); var larsStandardCommonComponentEntities = larsStandard?.LARSStandardCommonComponents? .Select(ls => BuildLARSStandardCommonComponent(ls, larsStandard.StandardCode)) ?? Enumerable.Empty <IDataEntity>(); var larsStandardFundingEntities = larsStandard?.LARSStandardFundings?.Select(BuildLARSStandardFunding) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AchDate, new AttributeData(learningDelivery.AchDate) }, { 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.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) }, { 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.STDCode, new AttributeData(learningDelivery.StdCode) }, { Attributes.WithdrawReason, new AttributeData(learningDelivery.WithdrawReason) }, } }; entity.AddChildren(learningDeliveryFamsEntities); entity.AddChildren(appFinRecordEntities); entity.AddChildren(larsStandardCommonComponentEntities); entity.AddChildren(larsStandardFundingEntities); return(entity); }
public IDataEntity BuildLearnerDataEntity(FM25LearnerDto learner) { var postcode = (string.IsNullOrWhiteSpace(learner.PostcodePrior) || learner.PostcodePrior.CaseInsensitiveEquals(_tempPostcode)) ? learner.Postcode : learner.PostcodePrior; var efaDisadvantageUplift = _postcodesReferenceDataService.LatestEFADisadvantagesUpliftForPostcode(postcode); var specialistResources = _organisationReferenceDataService.SpecialistResourcesForCampusIdentifier(learner.CampId); var specialistResourcesEntities = specialistResources?.Select(BuildSpecialistResources) ?? Enumerable.Empty <IDataEntity>(); var dpOutcomesEntities = learner.DPOutcomes?.Select(BuildDPOutcome) ?? Enumerable.Empty <IDataEntity>(); var learningDeliveryEntities = learner.LearningDeliveries?.Select(BuildLearningDeliveryDataEntity) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearner) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.DateOfBirth, new AttributeData(learner.DateOfBirth) }, { Attributes.EngGrade, new AttributeData(learner.EngGrade) }, { Attributes.LearnRefNumber, new AttributeData(learner.LearnRefNumber) }, { Attributes.LrnFAM_ECF, new AttributeData(learner.LrnFAM_ECF) }, { Attributes.LrnFAM_EDF1, new AttributeData(learner.LrnFAM_EDF1) }, { Attributes.LrnFAM_EDF2, new AttributeData(learner.LrnFAM_EDF2) }, { Attributes.LrnFAM_EHC, new AttributeData(learner.LrnFAM_EHC) }, { Attributes.LrnFAM_HNS, new AttributeData(learner.LrnFAM_HNS) }, { Attributes.LrnFAM_MCF, new AttributeData(learner.LrnFAM_MCF) }, { Attributes.MathGrade, new AttributeData(learner.MathGrade) }, { Attributes.PlanEEPHours, new AttributeData(learner.PlanEEPHours) }, { Attributes.PlanLearnHours, new AttributeData(learner.PlanLearnHours) }, { Attributes.PostcodeDisadvantageUplift, new AttributeData(efaDisadvantageUplift) }, { Attributes.ULN, new AttributeData(learner.ULN) }, } }; entity.AddChildren(specialistResourcesEntities); entity.AddChildren(dpOutcomesEntities); entity.AddChildren(learningDeliveryEntities); return(entity); }
public IDataEntity BuildLearningDeliveryDataEntity(LearningDelivery learningDelivery) { var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef); var learningDeliveryFamsEntities = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>(); var larsValidityEntities = larsLearningDelivery?.LARSValidities?.Select(BuildLearningDeliveryLARSValidity) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearningDelivery) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) }, { Attributes.AimType, new AttributeData(learningDelivery.AimType) }, { Attributes.AwardOrgCode, new AttributeData(larsLearningDelivery.AwardOrgCode) }, { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) }, { Attributes.DelLocPostCode, new AttributeData(learningDelivery.DelLocPostCode) }, { Attributes.EFACOFType, new AttributeData(larsLearningDelivery.EFACOFType) }, { Attributes.FundModel, new AttributeData(learningDelivery.FundModel) }, { Attributes.GuidedLearningHours, new AttributeData(larsLearningDelivery.GuidedLearningHours) }, { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDate) }, { Attributes.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) }, { Attributes.LearnAimRefTitle, new AttributeData(larsLearningDelivery.LearnAimRefTitle) }, { Attributes.LearnAimRefType, new AttributeData(larsLearningDelivery.LearnAimRefType) }, { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) }, { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) }, { Attributes.PHours, new AttributeData(learningDelivery.PHours) }, { Attributes.NotionalNVQLevel, new AttributeData(larsLearningDelivery.NotionalNVQLevel) }, { Attributes.ProgType, new AttributeData(learningDelivery.ProgType) }, { Attributes.SectorSubjectAreaTier2, new AttributeData(larsLearningDelivery.SectorSubjectAreaTier2) }, { Attributes.WithdrawReason, new AttributeData(learningDelivery.WithdrawReason) }, }, }; entity.AddChildren(learningDeliveryFamsEntities); entity.AddChildren(larsValidityEntities); return(entity); }
public static DataEntity AddChildren(this DataEntity source, IRelationshipDefinition rel, IEnumerable <DataEntity> children) { ValidateChildRelationship(source, rel); var childList = children as List <DataEntity> ?? new List <DataEntity>(children); foreach (var entity in childList) { if (entity.ObjectDefinitionFullName != rel.RelatedObjectDefinitionFullName) { throw new InvalidOperationException(string.Format("Each entity in the collection of children must be of type {0}, but at least one was of type {1}.", rel.RelatedObjectDefinitionFullName, entity.ObjectDefinitionFullName)); } } return(source.AddChildren(rel.FullName, childList)); }
public void AddChildren() { var dataEntity = new DataEntity(null); var childOne = new DataEntity(null); var childTwo = new DataEntity(null); var children = new List <IDataEntity>() { childOne, childTwo }; dataEntity.AddChildren(children); dataEntity.Children.Should().HaveCount(2); dataEntity.Children.Should().Contain(children); }
public IDataEntity BuildLearnerDataEntity(ALBLearnerDto learner) { var learningDeliveryEntities = learner.LearningDeliveries? .Where(ld => ld.FundModel == Attributes.FundModel_99).Select(BuildLearningDeliveryDataEntity) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityLearner) { Attributes = new Dictionary <string, IAttributeData>() { { Attributes.LearnRefNumber, new AttributeData(learner.LearnRefNumber) }, } }; entity.AddChildren(learningDeliveryEntities); return(entity); }
public IDataEntity BuildGlobalDataEntity(FM25LearnerDto learner, Global global) { var postcodeSpecialistResources = _organisationReferenceDataService.PostcodeSpecialistResourcesForUkprn(global.UKPRN).ToList(); var specialistResourceEntities = postcodeSpecialistResources?.Select(BuildPostcodeSpecialistResource) ?? Enumerable.Empty <IDataEntity>(); var entity = new DataEntity(Attributes.EntityGlobal) { Attributes = BuildGlobalAttributes(global) }; if (learner != null) { entity.AddChild(BuildLearnerDataEntity(learner)); entity.AddChildren(specialistResourceEntities); } return(entity); }
public static DataEntity AddChildren <T>(this DataEntity source, IRelationshipDefinition rel, IEnumerable <T> children, Func <T, DataEntity> converter) { var dataEntites = children.Select(converter); return(source.AddChildren(rel, dataEntites)); }
/// <summary> /// Adds children DataEntities to the current DataEntity. /// </summary> /// <typeparam name="T">A type that is convertible to a DataEntity.</typeparam> /// <param name="source">The DataEntity.</param> /// <param name="relationshipName">The name of the relationship.</param> /// <param name="children">The Children to add.</param> /// <param name="converter">A function that converts a T into a DataEntity.</param> /// <returns></returns> public static DataEntity AddChildren <T>(this DataEntity source, string relationshipName, IEnumerable <T> children, Func <T, DataEntity> converter) { var convertedChildren = children.Select(converter); return(source.AddChildren(relationshipName, convertedChildren)); }