public PublishedFundingVersionBuilder WithOrganisationGroupTypeCode(OrganisationGroupTypeCode organisationGroupTypeCode) { _organisationGroupTypeCode = organisationGroupTypeCode; return(this); }
private IEnumerable <OrganisationIdentifier> GenerateIdentifiersForProvider(GroupingReason groupingReason, OrganisationGroupTypeCode organisationGroupTypeCode, Provider targetProvider) { if (_additionalIdentifierKeys[groupingReason].ContainsKey(organisationGroupTypeCode)) { foreach (OrganisationGroupTypeIdentifier organisationGroupTypeIdentifier in _additionalIdentifierKeys[groupingReason][organisationGroupTypeCode]) { string targetProviderGroupTypeIdentifierValue = GetOrganisationGroupIdentifier(targetProvider, organisationGroupTypeIdentifier); if (!string.IsNullOrWhiteSpace(targetProviderGroupTypeIdentifierValue)) { Enums.OrganisationGroupTypeIdentifier typeIdentifier; if (organisationGroupTypeIdentifier == OrganisationGroupTypeIdentifier.DfeEstablishmentNumber) { typeIdentifier = Enums.OrganisationGroupTypeIdentifier.DfeNumber; } else if (organisationGroupTypeIdentifier == OrganisationGroupTypeIdentifier.LocalAuthorityClassificationTypeCode) { typeIdentifier = Enums.OrganisationGroupTypeIdentifier.LocalAuthorityClassificationTypeCode; } else { typeIdentifier = organisationGroupTypeIdentifier.AsMatchingEnum <Enums.OrganisationGroupTypeIdentifier>(); } yield return(new OrganisationIdentifier { Type = typeIdentifier, Value = targetProviderGroupTypeIdentifierValue }); } } } }
private Func <Provider, string> GetProviderFieldForGrouping(OrganisationGroupTypeIdentifier identifierType, OrganisationGroupTypeCode organisationGroupTypeCode, GroupingReason groupingReason) { // If the grouping reason is for payment, then the organisation identifier needs to be returned as a UKPRN, but grouped on the type code if (groupingReason == GroupingReason.Payment) { switch (organisationGroupTypeCode) { case OrganisationGroupTypeCode.AcademyTrust: return(c => c.TrustCode); case OrganisationGroupTypeCode.LocalAuthority: return(c => c.LACode); case OrganisationGroupTypeCode.Provider: return(c => c.UKPRN); } } else { // TODO: Map all fields required switch (identifierType) { case OrganisationGroupTypeIdentifier.UKPRN: return(c => c.UKPRN); case OrganisationGroupTypeIdentifier.AcademyTrustCode: return(c => c.TrustCode); case OrganisationGroupTypeIdentifier.ParliamentaryConstituencyCode: return(c => c.ParliamentaryConstituencyCode); case OrganisationGroupTypeIdentifier.MiddleSuperOutputAreaCode: return(c => c.MiddleSuperOutputAreaCode); case OrganisationGroupTypeIdentifier.CensusWardCode: return(c => c.CensusWardCode); case OrganisationGroupTypeIdentifier.DistrictCode: return(c => c.DistrictCode); case OrganisationGroupTypeIdentifier.GovernmentOfficeRegionCode: return(c => c.GovernmentOfficeRegionCode); case OrganisationGroupTypeIdentifier.LowerSuperOutputAreaCode: return(c => c.LowerSuperOutputAreaCode); case OrganisationGroupTypeIdentifier.WardCode: return(c => c.WardCode); case OrganisationGroupTypeIdentifier.RscRegionCode: return(c => c.RscRegionCode); case OrganisationGroupTypeIdentifier.CountryCode: return(c => c.CountryCode); case OrganisationGroupTypeIdentifier.LACode: return(c => c.LACode); case OrganisationGroupTypeIdentifier.LocalAuthorityClassificationTypeCode: return(c => c.LocalGovernmentGroupTypeName); } } throw new Exception("Unknown OrganisationGroupTypeIdentifier for provider ID"); }
private Func <Provider, string> GetProviderFieldForGrouping(OrganisationGroupTypeIdentifier identifierType, OrganisationGroupTypeCode organisationGroupTypeCode, GroupingReason groupingReason, PaymentOrganisationSource paymentOrganisationSource) { if (groupingReason.IsForProviderPayment()) { if (paymentOrganisationSource == PaymentOrganisationSource.PaymentOrganisationAsProvider) { // If the grouping reason is for payment, then the organisation identifier needs to be returned as a UKPRN, but grouped on the type code switch (organisationGroupTypeCode) { case OrganisationGroupTypeCode.AcademyTrust: return(c => c.TrustCode); case OrganisationGroupTypeCode.LocalAuthority: return(c => c.LACode); case OrganisationGroupTypeCode.Provider: return(c => c.UKPRN); default: throw new InvalidOperationException($"Unknown organisation group type code to select for identifer for payment. '{organisationGroupTypeCode}'"); } } else if (paymentOrganisationSource == PaymentOrganisationSource.PaymentOrganisationFields) { return(p => p.PaymentOrganisationIdentifier); } else { throw new InvalidOperationException($"Unknown paymentOrganisationSource '{paymentOrganisationSource}'"); } } else if (groupingReason == GroupingReason.Information) { // TODO: Map all fields required switch (identifierType) { case OrganisationGroupTypeIdentifier.UKPRN: return(c => c.UKPRN); case OrganisationGroupTypeIdentifier.AcademyTrustCode: return(c => c.TrustCode); case OrganisationGroupTypeIdentifier.ParliamentaryConstituencyCode: return(c => c.ParliamentaryConstituencyCode); case OrganisationGroupTypeIdentifier.MiddleSuperOutputAreaCode: return(c => c.MiddleSuperOutputAreaCode); case OrganisationGroupTypeIdentifier.CensusWardCode: return(c => c.CensusWardCode); case OrganisationGroupTypeIdentifier.DistrictCode: return(c => c.DistrictCode); case OrganisationGroupTypeIdentifier.GovernmentOfficeRegionCode: return(c => c.GovernmentOfficeRegionCode); case OrganisationGroupTypeIdentifier.LowerSuperOutputAreaCode: return(c => c.LowerSuperOutputAreaCode); case OrganisationGroupTypeIdentifier.WardCode: return(c => c.WardCode); case OrganisationGroupTypeIdentifier.RscRegionCode: return(c => c.RscRegionCode); case OrganisationGroupTypeIdentifier.CountryCode: return(c => c.CountryCode); case OrganisationGroupTypeIdentifier.LACode: return(c => c.LACode); case OrganisationGroupTypeIdentifier.LocalAuthorityClassificationTypeCode: return(c => c.LocalGovernmentGroupTypeCode); } } throw new Exception("Unknown OrganisationGroupTypeIdentifier for provider ID"); }
public OrganisationGroupingConfigurationBuilder WithOrganisationGroupTypeCode(OrganisationGroupTypeCode groupTypeCode) { _config.OrganisationGroupTypeCode = groupTypeCode; return(this); }
public OrganisationGroupResultBuilder WithGroupTypeCode(OrganisationGroupTypeCode groupTypeCode) { _groupTypeCode = groupTypeCode; return(this); }