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 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); }