Example #1
0
        /// <summary>
        /// Determines whether a given strategy is applicable for a specific country.
        /// </summary>
        /// <param name="country">Country to check for.</param>
        /// <returns>true if the strategy is applicable for the specified country; false otherwise.</returns>
        public bool IsApplicableTo(IsoCountryCode country)
        {
            Region applicableRegions = GetApplicableRegions();

            Region targetRegion = Regions.GetRegionForCountry(country);

            return((applicableRegions & targetRegion) != 0);
        }
        public static Type UpiType(this IsoCountryCode country)
        {
            switch (country)
            {
            case IsoCountryCode.US: return(typeof(UnitedStatesUpi));

            default: return(null);
            }
        }
        public static string AsText(this IsoCountryCode country)
        {
            switch (country)
            {
            case IsoCountryCode.US: return("United States");

            default: return("");
            }
        }
Example #4
0
 public UniversalPropertyIdentifier(IsoCountryCode country, string subCountry, string property, SubPropertyTypeCode subPropertyType, string subProperty)
     : this(country, subCountry, property)
 {
     Country      = country;
     SubCountry   = subCountry;
     Property     = property;
     PropertyType = subPropertyType;
     SubProperty  = subProperty;
 }
        public static ICountryUpi ToCountryUpi(this List <string> segments)
        {
            if (segments.Any())
            {
                var countryId = segments[0];

                if (IsoCountryCode.TryParse(countryId, out IsoCountryCode isoCountry))
                {
                    var countryUpi = (ICountryUpi)Activator.CreateInstance(isoCountry.UpiType(), segments);
                    return(countryUpi);
                }
            }
            return(null);
        }
Example #6
0
        /// <summary>
        /// Gets the FIXatdl region for the supplied country.
        /// </summary>
        /// <param name="country">ISO country code to determine the region for.</param>
        /// <returns>Applicable region, or Region.None if none is applicable.</returns>
        public static Region GetRegionForCountry(IsoCountryCode country)
        {
            if (TheAmericasCountries.Contains(country))
            {
                return(Region.TheAmericas);
            }

            if (EuropeMiddleEastAfricaCountries.Contains(country))
            {
                return(Region.EuropeMiddleEastAfrica);
            }

            if (AsiaPacificJapanCountries.Contains(country))
            {
                return(Region.AsiaPacificJapan);
            }

            return(Region.None);
        }
Example #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Number.Length != 0)
            {
                hash ^= Number.GetHashCode();
            }
            if (IsoCountryCode.Length != 0)
            {
                hash ^= IsoCountryCode.GetHashCode();
            }
            if (CountryCallingCode.Length != 0)
            {
                hash ^= CountryCallingCode.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 protected CountryUpi(IsoCountryCode country)
 {
     Country = country;
 }
        public static ICountryUpi ToCountryUpi(this IsoCountryCode isoCountry)
        {
            var countryUpi = (ICountryUpi)Activator.CreateInstance(isoCountry.UpiType());

            return(countryUpi);
        }
Example #10
0
 public UniversalPropertyIdentifier(IsoCountryCode country, string subCountry, string property) : this(country)
 {
     SubCountry = subCountry;
     Property   = property;
 }
Example #11
0
 public UniversalPropertyIdentifier(IsoCountryCode country)
 {
     Country     = country;
     _countryUpi = country.ToCountryUpi();
 }