private void AssignBirthDateAndSex(IndexedTokens tokens)
		{
			BirthDate = CalculateBirthdate(tokens);

			Year = new YearCode(BirthDate.Value).ToString();
			Month = new MonthCode(BirthDate.Value).ToString();
			Day = new DayCode(BirthDate.Value, Sex).ToString();
		}
Beispiel #2
0
        private void AssignBirthDateAndSex(IndexedTokens tokens)
        {
            BirthDate = CalculateBirthdate(tokens);

            Year  = new YearCode(BirthDate.Value).ToString();
            Month = new MonthCode(BirthDate.Value).ToString();
            Day   = new DayCode(BirthDate.Value, Sex).ToString();
        }
		private DateTime CalculateBirthdate(IndexedTokens tokens)
		{
			var year = int.Parse(tokens[FiscalCodeTokens.Year]);
			var month = MonthCode.ToNumber(tokens[FiscalCodeTokens.Month][0]);
			var day = int.Parse(tokens[FiscalCodeTokens.Day]);

			if (day < 40)
			{
				Sex = Sex.Male;
			}
			else
			{
				day -= 40;
				Sex = Sex.Female;
			}

			var dateTime = new DateTime(1900 + year, month, day);
			return dateTime;
		}
Beispiel #4
0
        private DateTime CalculateBirthdate(IndexedTokens tokens)
        {
            var year  = int.Parse(tokens[FiscalCodeTokens.Year]);
            var month = MonthCode.ToNumber(tokens[FiscalCodeTokens.Month][0]);
            var day   = int.Parse(tokens[FiscalCodeTokens.Day]);

            if (day < 40)
            {
                Sex = Sex.Male;
            }
            else
            {
                day -= 40;
                Sex  = Sex.Female;
            }

            var dateTime = new DateTime(1900 + year, month, day);

            return(dateTime);
        }