Пример #1
0
        private string GetOrganisationGroupName(Provider provider, OrganisationGroupTypeIdentifier identifierType)
        {
            switch (identifierType)
            {
            case OrganisationGroupTypeIdentifier.AcademyTrustCode:
                return(provider.TrustName);

            case OrganisationGroupTypeIdentifier.UKPRN:
                return(provider.Name);

            case OrganisationGroupTypeIdentifier.LACode:
                return(provider.Authority);

            case OrganisationGroupTypeIdentifier.DfeEstablishmentNumber:
                return(provider.DfeEstablishmentNumber);

            case OrganisationGroupTypeIdentifier.ParliamentaryConstituencyCode:
                return(provider.ParliamentaryConstituencyName);

            case OrganisationGroupTypeIdentifier.MiddleSuperOutputAreaCode:
                return(provider.MiddleSuperOutputAreaName);

            case OrganisationGroupTypeIdentifier.CensusWardCode:
                return(provider.CensusWardName);

            case OrganisationGroupTypeIdentifier.DistrictCode:
                return(provider.DistrictName);

            case OrganisationGroupTypeIdentifier.GovernmentOfficeRegionCode:
                return(provider.GovernmentOfficeRegionName);

            case OrganisationGroupTypeIdentifier.LocalGovernmentGroupTypeCode:
                return(provider.LocalGovernmentGroupTypeName);

            case OrganisationGroupTypeIdentifier.LowerSuperOutputAreaCode:
                return(provider.LowerSuperOutputAreaName);

            case OrganisationGroupTypeIdentifier.WardCode:
                return(provider.WardName);

            case OrganisationGroupTypeIdentifier.RscRegionCode:
                return(provider.RscRegionName);

            case OrganisationGroupTypeIdentifier.CountryCode:
                return(provider.CountryName);

            case OrganisationGroupTypeIdentifier.LocalAuthorityClassificationTypeCode:
                return(provider.LocalGovernmentGroupTypeName);

            default:
                throw new Exception("Unable to resolve field to identifier value");
            }
        }
Пример #2
0
        private string GetOrganisationGroupIdentifier(Provider provider, OrganisationGroupTypeIdentifier identifierType)
        {
            switch (identifierType)
            {
            case OrganisationGroupTypeIdentifier.AcademyTrustCode:
                return(provider.TrustCode);

            case OrganisationGroupTypeIdentifier.UID:
            case OrganisationGroupTypeIdentifier.GroupId:
                return(string.Empty);

            default:
                return(identifierType.PropertyMapping(provider)?.ToString());
            }
        }
Пример #3
0
        public PublishedFundingVersionBuilder WithOrganisationGroupTypeIdentifier(OrganisationGroupTypeIdentifier organisationGroupTypeIdentifier)
        {
            _organisationGroupTypeIdentifier = organisationGroupTypeIdentifier;

            return(this);
        }
Пример #4
0
        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");
        }
Пример #5
0
        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");
        }
Пример #6
0
        public OrganisationGroupingConfigurationBuilder WithGroupTypeIdentifier(OrganisationGroupTypeIdentifier groupIdentifier)
        {
            _config.GroupTypeIdentifier = groupIdentifier;

            return(this);
        }
Пример #7
0
        public OrganisationGroupResultBuilder WithGroupTypeIdentifier(OrganisationGroupTypeIdentifier groupTypeIdentifier)
        {
            _groupTypeIdentifier = groupTypeIdentifier;

            return(this);
        }
Пример #8
0
 public OrganisationIdentifierBuilder WithType(OrganisationGroupTypeIdentifier type)
 {
     _type = type;
     return(this);
 }