Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var numericFilter = new NumericTinSanitizer();
            var tinValidator  = new TinValidator(numericFilter);

            Console.WriteLine(tinValidator.ValidateTin("12Ga-b342"));

            var alphabeticFilter = new AlphabeticalTinSanitizer();

            tinValidator = new TinValidator(alphabeticFilter);
            Console.WriteLine(tinValidator.ValidateTin("12Ga-b342"));

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        protected override void LoadErrors()
        {
            ValidateTaxPayerIdentificationNumber(Content.BulkRegistrationHeader.TIN);

            var bulkRegistrationNew = (BulkRegistrationNewType)Content.Item;

            TinValidator.ValidateTaxPayerName(bulkRegistrationNew.Item);

            if (string.IsNullOrWhiteSpace(bulkRegistrationNew.StateIncorporated))
            {
                Content.ErrorMessages.Add("The State Incorporated is mandatory.");
            }
            else
            {
                ValidateState(bulkRegistrationNew.StateIncorporated);
            }

            ValidateEmptyString(bulkRegistrationNew.NAICSCode, NAICS_CODE_ERROR_MSG);

            ValidateAddress((IAddressType)bulkRegistrationNew.PhysicalAddress?.Item);

            if (bulkRegistrationNew.MailingAddress != null)
            {
                ValidateAddress((IAddressType)bulkRegistrationNew.MailingAddress?.Item);
            }

            if (bulkRegistrationNew.SSTPContact == null)
            {
                Content.ErrorMessages.Add("The Contact Seller Info is mandatory.");
            }
            else
            {
                ValidateContact(bulkRegistrationNew.SSTPContact);
            }

            if (bulkRegistrationNew.TechnologyModel == null)
            {
                Content.ErrorMessages.Add("The Technology Model is mandatory.");
            }
            else
            {
                ValidateTechnologyModel(bulkRegistrationNew.TechnologyModel);
            }

            ValidateEmptyString(bulkRegistrationNew.SellerPhone, SELLER_PHONE_ERROR_MSG);
            ValidatePhone(bulkRegistrationNew.SellerPhone, "Taxpayer");

            if (!bulkRegistrationNew.StateRegistrationIndicator.Any())
            {
                Content.ErrorMessages.Add("The State Registration Indicator must have at least one item.");
            }

            var firstFilingPeriod = DateTime.ParseExact(bulkRegistrationNew.FirstFilingPeriod, "yyyy-MM", CultureInfo.InvariantCulture);

            foreach (var registrationIndicator in bulkRegistrationNew.StateRegistrationIndicator)
            {
                ValidateRegistrationIndicator(registrationIndicator, firstFilingPeriod);
            }

            //if (!Regex.IsMatch(bulkRegistrationNew.NewPass, @"^(?=.*[\d])(?=.*[\D])([\w]{8,10}\\+)$"))
            //{
            //    ErrorMessages.Add("The New Password must be a minimun of 8 characters, maximun of 10 characters and must contain at least 1 alphacharacter and at least 1 number.");
            //}
        }