public ProviderDocument CreateProviderApiDocument(CoreProvider provider) { var providerDocument = new ProviderDocument(ElasticsearchDocumentTypes.PROVIDER_API_DOCUMENT) { Ukprn = provider.Ukprn, IsHigherEducationInstitute = provider.IsHigherEducationInstitute, NationalProvider = provider.NationalProvider, CurrentlyNotStartingNewApprentices = provider.CurrentlyNotStartingNewApprentices, ProviderName = provider.Name, Aliases = provider.Aliases, Addresses = provider.Addresses, IsEmployerProvider = provider.IsEmployerProvider, Website = provider.ContactDetails?.Website, Phone = provider.ContactDetails?.Phone, Email = provider.ContactDetails?.Email, EmployerSatisfaction = provider.EmployerSatisfaction, LearnerSatisfaction = provider.LearnerSatisfaction, MarketingInfo = provider.MarketingInfo, IsLevyPayerOnly = provider.IsLevyPayerOnly, IsNew = provider.IsNew, HasParentCompanyGuarantee = provider.HasParentCompanyGuarantee, ProviderFeedback = provider.ProviderFeedback }; return(providerDocument); }
private ProviderDocument CreateStandardProviderDocument(CoreProvider provider, StandardInformation standardInformation, List <DeliveryInformation> deliveryInformation) { try { var standardProvider = new ProviderDocument(ElasticsearchDocumentTypes.PROVIDER_STANDARD_DOCUMENT) { StandardCode = standardInformation.Code, RegulatedStandard = standardInformation.RegulatedStandard }; PopulateDocumentSharedProperties(standardProvider, provider, standardInformation, deliveryInformation); return(standardProvider); } catch (Exception ex) when(ex is ArgumentNullException || ex is NullReferenceException) { throw new MappingException("Unable to map to Standard Provider Document", ex); } }
private ProviderDocument CreateFrameworkProviderDocument(CoreProvider provider, FrameworkInformation frameworkInformation, List <DeliveryInformation> deliveryInformation) { try { var frameworkProvider = new ProviderDocument(ElasticsearchDocumentTypes.PROVIDER_FRAMEWORK_DOCUMENT) { FrameworkCode = frameworkInformation.Code, PathwayCode = frameworkInformation.PathwayCode, FrameworkId = string.Format(_settings.FrameworkIdFormat, frameworkInformation.Code, frameworkInformation.ProgType, frameworkInformation.PathwayCode), Level = MapToLevelFromProgType(frameworkInformation.ProgType) }; PopulateDocumentSharedProperties(frameworkProvider, provider, frameworkInformation, deliveryInformation); return(frameworkProvider); } catch (Exception ex) when(ex is ArgumentNullException || ex is NullReferenceException) { throw new MappingException("Unable to map to Framework Provider Document", ex); } }
private void PopulateDocumentSharedProperties( ProviderDocument documentToPopulate, CoreProvider provider, IApprenticeshipInformation apprenticeshipInformation, List <DeliveryInformation> deliveryLocations) { var locations = GetTrainingLocations(deliveryLocations); var firstLoc = deliveryLocations.FirstOrDefault(); documentToPopulate.Id = Guid.NewGuid(); documentToPopulate.Ukprn = provider.Ukprn; documentToPopulate.IsHigherEducationInstitute = provider.IsHigherEducationInstitute; documentToPopulate.HasNonLevyContract = provider.HasNonLevyContract; documentToPopulate.HasParentCompanyGuarantee = provider.HasParentCompanyGuarantee; documentToPopulate.CurrentlyNotStartingNewApprentices = provider.CurrentlyNotStartingNewApprentices; documentToPopulate.IsNew = provider.IsNew; documentToPopulate.ProviderName = provider.Name; documentToPopulate.LegalName = provider.LegalName; documentToPopulate.NationalProvider = provider.NationalProvider; documentToPopulate.ProviderMarketingInfo = EscapeSpecialCharacters(provider.MarketingInfo); documentToPopulate.ApprenticeshipMarketingInfo = EscapeSpecialCharacters(apprenticeshipInformation.MarketingInfo); documentToPopulate.Phone = apprenticeshipInformation.ContactInformation.Phone; documentToPopulate.Email = apprenticeshipInformation.ContactInformation.Email; documentToPopulate.ContactUsUrl = apprenticeshipInformation.ContactInformation.Website; documentToPopulate.ApprenticeshipInfoUrl = apprenticeshipInformation.InfoUrl; documentToPopulate.LearnerSatisfaction = provider.LearnerSatisfaction; documentToPopulate.EmployerSatisfaction = provider.EmployerSatisfaction; documentToPopulate.DeliveryModes = firstLoc == null ? new List <string>().ToArray() : GenerateListOfDeliveryModes(firstLoc.DeliveryModes); documentToPopulate.Website = firstLoc == null ? string.Empty : firstLoc.DeliveryLocation.Contact.Website; documentToPopulate.TrainingLocations = locations; documentToPopulate.LocationPoints = GetLocationPoints(deliveryLocations); documentToPopulate.OverallAchievementRate = GetRoundedValue(apprenticeshipInformation.OverallAchievementRate); documentToPopulate.NationalOverallAchievementRate = GetRoundedValue(apprenticeshipInformation.NationalOverallAchievementRate); documentToPopulate.OverallCohort = apprenticeshipInformation.OverallCohort; documentToPopulate.HasNonLevyContract = provider.HasNonLevyContract; documentToPopulate.IsLevyPayerOnly = provider.IsLevyPayerOnly; documentToPopulate.ProviderFeedback = provider.ProviderFeedback; }
public ProviderDocument CreateFrameworkProviderDocument(CoreProvider provider, FrameworkInformation frameworkInformation, IEnumerable <DeliveryInformation> deliveryInformation) { return(CreateFrameworkProviderDocument(provider, frameworkInformation, deliveryInformation.ToList())); }
public ProviderDocument CreateFrameworkProviderDocument(CoreProvider provider, FrameworkInformation frameworkInformation, DeliveryInformation deliveryInformation) { return(CreateFrameworkProviderDocument(provider, frameworkInformation, new List <DeliveryInformation> { deliveryInformation })); }
public ProviderDocument CreateStandardProviderDocument(CoreProvider provider, StandardInformation standardInformation, IEnumerable <DeliveryInformation> deliveryInformation) { return(CreateStandardProviderDocument(provider, standardInformation, deliveryInformation.ToList())); }
public ProviderDocument CreateStandardProviderDocument(CoreProvider provider, StandardInformation standardInformation, DeliveryInformation deliveryInformation) { return(CreateStandardProviderDocument(provider, standardInformation, new List <DeliveryInformation> { deliveryInformation })); }