Ejemplo n.º 1
0
        private void CheckDayGender()
        {
            FiscalCodeValidationResult result = null;

            if (_generator.MainFiscalCode.DayGenderRepresentation == _fiscalCodeToValidate.DayGenderRepresentation)
            {
                result = _localizationProvider.GetLocalizedMessage("msg_day_gender_main_ok");
            }
            else if (_generator.FiscalCodes.Any(fc =>
                                                fc.DayGenderRepresentation == _fiscalCodeToValidate.DayGenderRepresentation))
            {
                result = _localizationProvider.GetLocalizedMessage("msg_day_gender_omocode_ok");
            }
            else
            {
                result = _localizationProvider.GetFormattedLocalizedMessage("msg_day_gender_wrong",
                                                                            new[]
                {
                    _generator.MainFiscalCode.DayGenderRepresentation,
                    _fiscalCodeToValidate.DayGenderRepresentation
                });
            }

            ValidationResults.Add(result);
        }
Ejemplo n.º 2
0
        private void CheckMonthRepresentation()
        {
            FiscalCodeValidationResult result = null;

            if (_fiscalCodeToValidate.MonthRepresentation == _generator.MainFiscalCode.MonthRepresentation)
            {
                result = _localizationProvider.GetLocalizedMessage("msg_month_ok");
            }
            else
            {
                result = _localizationProvider.GetFormattedLocalizedMessage("msg_month_wrong",
                                                                            new[] { _generator.MainFiscalCode.MonthRepresentation, _fiscalCodeToValidate.MonthRepresentation });
            }

            ValidationResults.Add(result);
        }
Ejemplo n.º 3
0
        private void CheckNameTriplet()
        {
            FiscalCodeValidationResult result = null;

            if (_fiscalCodeToValidate.NameTriplet == _generator.FiscalCodes[0].NameTriplet)
            {
                result = _localizationProvider.GetLocalizedMessage("msg_name_triplet_ok");
            }
            else
            {
                result = _localizationProvider.GetFormattedLocalizedMessage("msg_name_triplet_wrong",
                                                                            new[] { _generator.FiscalCodes[0].NameTriplet, _fiscalCodeToValidate.NameTriplet });
            }

            ValidationResults.Add(result);
        }
Ejemplo n.º 4
0
        private void CheckCheckDigit()
        {
            FiscalCodeValidationResult result = null;

            char expectedCheckDigit = _fiscalCodeToValidate.CalculateCheckDigit();

            if (expectedCheckDigit == _fiscalCodeToValidate.CheckDigit)
            {
                result = _localizationProvider.GetLocalizedMessage("msg_checkdigit_ok");
            }
            else
            {
                result = _localizationProvider.GetFormattedLocalizedMessage("msg_checkdigit_wrong",
                                                                            new[] { (object)expectedCheckDigit, _fiscalCodeToValidate.CheckDigit });
            }

            ValidationResults.Add(result);
        }
Ejemplo n.º 5
0
        private void CheckPlaceOfBirth()
        {
            FiscalCodeValidationResult result = null;

            if (_generator.MainFiscalCode.Code == _fiscalCodeToValidate.Code)
            {
                result = _localizationProvider.GetLocalizedMessage("msg_place_code_main_ok");
            }
            else if (_generator.FiscalCodes.Any(fc => fc.Code == _fiscalCodeToValidate.Code))
            {
                result = _localizationProvider.GetLocalizedMessage("msg_place_code_omocode_ok");
            }
            else
            {
                result = _localizationProvider.GetFormattedLocalizedMessage("msg_place_code_wrong",
                                                                            new[] { _generator.MainFiscalCode.Code, _fiscalCodeToValidate.Code });
            }

            ValidationResults.Add(result);
        }