示例#1
0
        /// <summary>
        /// Checks if specified BBAN entry is supported for given country code.
        /// </summary>
        /// <param name="alpha2Code">Alpha2 Country code</param>
        /// <param name="entryType">BBAN entry type</param>
        /// <returns>True if given country contains rule for specified entry</returns>
        public static bool IsBbanEntrySupported(string alpha2Code, BBanEntryType entryType)
        {
            BbanPrev      bban      = new BbanPrev();
            BBanStructure structure = GetStructureForCountry(alpha2Code);
            bool          result    = false;

            if (structure != null)
            {
                result = structure.Entries.Any(x => x.EntryType == entryType);
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// Search for BBAN structure of specified country
        /// </summary>
        /// <param name="alpha2Code">Alpha2 Country code</param>
        /// <returns>BBAN structure of defined country, or null if given country code is unsupported</returns>
        public static BBanStructure GetStructureForCountry(string alpha2Code)
        {
            BbanPrev      bban   = new BbanPrev();
            BBanStructure result = null;

            if (!string.IsNullOrEmpty(alpha2Code) && alpha2Code.Length == 2)
            {
                if (bban._bbanStructures != null)
                {
                    if (bban._bbanStructures.ContainsKey(alpha2Code.ToUpper()))
                    {
                        result = bban._bbanStructures[alpha2Code];
                    }
                }
            }

            return(result);
        }
示例#3
0
        /// <summary>
        /// Search for BBAN structure of specified country
        /// </summary>
        /// <param name="countryCode">Country code object</param>
        /// <returns>BBAN structure of defined country, or null if given country code is unsupported</returns>
        public static BBanStructure GetStructureForCountry(CountryCodeEntry countryCode)
        {
            BbanPrev      bban   = new BbanPrev();
            BBanStructure result = null;

            if (countryCode != null)
            {
                if (bban._bbanStructures != null)
                {
                    if (bban._bbanStructures.ContainsKey(countryCode.Alpha2))
                    {
                        result = bban._bbanStructures[countryCode.Alpha2];
                    }
                }
            }

            return(result);
        }