Пример #1
0
        private static int GetIndividualNumber(int year, GenderRequest gender)
        {
            int[] legalNumbers = IndividualNumberProvider.GetLegalNumbers(year, gender).ToArray();
            int   index        = Rand.Next(legalNumbers.Length);

            return(legalNumbers[index]);
        }
Пример #2
0
        protected int AssertYearAndIndividualNumberCombinationIsValid()
        {
            int twoDigitYear     = Int32.Parse(Number.Substring(4, 2));
            int individualNumber = Int32.Parse(Number.Substring(6, 3));
            int fourDigitYear    = IndividualNumberProvider.GetYearWithCentury(twoDigitYear, individualNumber);

            if (fourDigitYear > 0)
            {
                return(fourDigitYear);
            }

            string msg = String.Format("{0} '{1}' har ikke en gyldig kombinasjon av årstall og individnummer.", Name, Number);

            throw new NinException(Statuscode.BadYearAndIndividualNumberCombination, msg);
        }