Exemplo n.º 1
0
        public static OrganizationNumber Create(string number)
        {
            OrganizationNumber result;

            try
            {
                result = new OrganizationNumber(number);
            }
            catch (NinException)
            {
                result = null;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static OrganizationNumber OneRandom(string pattern, int maxTryCount = DefaultRetryCount)
        {
            ValidatePattern(pattern, 9);
            char[]             resultChars = new char[9];
            OrganizationNumber result      = null;

            for (int tryCounter = 0; tryCounter < maxTryCount; ++tryCounter)
            {
                SetFirstDigit(resultChars, pattern);
                SetMiddleDigits(resultChars, pattern);
                SetCheckDigit(resultChars, pattern);
                result = Create(new string(resultChars));
                if (result != null)
                {
                    break;
                }
            }
            return(result);
        }