public NuGenDefaultValidation()
		{
			NuGenRule trim = new NuGenTrimLeadingWhitespace();
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "FT", trim));
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "ST", trim));
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TX", trim));
			
			NuGenRule size200 = new NuGenSizeRule(200);
			NuGenRule size32000 = new NuGenSizeRule(32000);
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "FT", size32000));
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "ID", size200));
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "IS", size200));
			
			NuGenRule nonNegativeInteger = new NuGenRegexPrimitiveRule("\\d*", "");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "SI", nonNegativeInteger));
			
			NuGenRule number = new NuGenRegexPrimitiveRule("(\\+|\\-)?\\d*\\.?\\d*", "");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "NM", number));
			
			NuGenRule telephoneNumber = new NuGenRegexPrimitiveRule("(\\d{1,2} )?(\\(\\d{3}\\))?\\d{3}-\\d{4}(X\\d{1,5})?(B\\d{1,5})?(C.*)?", "Version 2.4 Section 2.9.45");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TN", telephoneNumber));
			
			System.String datePattern = "(\\d{4}([01]\\d(\\d{2})?)?)?"; //YYYY[MM[DD]]
			NuGenRule date = new NuGenRegexPrimitiveRule(datePattern, "Version 2.5 Section 2.16.24");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "DT", date));
			
			System.String timePattern = "([012]\\d([0-5]\\d([0-5]\\d(\\.\\d(\\d(\\d(\\d)?)?)?)?)?)?)?([\\+\\-]\\d{4})?";
			NuGenRule time = new NuGenRegexPrimitiveRule(timePattern, "Version 2.5 Section 2.16.79");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TM", time));
			
			System.String datetimePattern = "(\\d{4}([01]\\d(\\d{2}([012]\\d([0-5]\\d([0-5]\\d(\\.\\d(\\d(\\d(\\d)?)?)?)?)?)?)?)?)?)?([\\+\\-]\\d{4})?";
			NuGenRule datetime = new NuGenRegexPrimitiveRule(datetimePattern, "Version 2.5 Section 2.16.25");
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TSComponentOne", datetime));
			PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "DTM", datetime));
		}
Ejemplo n.º 2
0
        public NuGenDefaultValidation()
        {
            NuGenRule trim = new NuGenTrimLeadingWhitespace();

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "FT", trim));
            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "ST", trim));
            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TX", trim));

            NuGenRule size200   = new NuGenSizeRule(200);
            NuGenRule size32000 = new NuGenSizeRule(32000);

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "FT", size32000));
            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "ID", size200));
            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "IS", size200));

            NuGenRule nonNegativeInteger = new NuGenRegexPrimitiveRule("\\d*", "");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "SI", nonNegativeInteger));

            NuGenRule number = new NuGenRegexPrimitiveRule("(\\+|\\-)?\\d*\\.?\\d*", "");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "NM", number));

            NuGenRule telephoneNumber = new NuGenRegexPrimitiveRule("(\\d{1,2} )?(\\(\\d{3}\\))?\\d{3}-\\d{4}(X\\d{1,5})?(B\\d{1,5})?(C.*)?", "Version 2.4 Section 2.9.45");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TN", telephoneNumber));

            System.String datePattern = "(\\d{4}([01]\\d(\\d{2})?)?)?";             //YYYY[MM[DD]]
            NuGenRule     date        = new NuGenRegexPrimitiveRule(datePattern, "Version 2.5 Section 2.16.24");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "DT", date));

            System.String timePattern = "([012]\\d([0-5]\\d([0-5]\\d(\\.\\d(\\d(\\d(\\d)?)?)?)?)?)?)?([\\+\\-]\\d{4})?";
            NuGenRule     time        = new NuGenRegexPrimitiveRule(timePattern, "Version 2.5 Section 2.16.79");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TM", time));

            System.String datetimePattern = "(\\d{4}([01]\\d(\\d{2}([012]\\d([0-5]\\d([0-5]\\d(\\.\\d(\\d(\\d(\\d)?)?)?)?)?)?)?)?)?)?([\\+\\-]\\d{4})?";
            NuGenRule     datetime        = new NuGenRegexPrimitiveRule(datetimePattern, "Version 2.5 Section 2.16.25");

            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "TSComponentOne", datetime));
            PrimitiveRuleBindings.Add(new NuGenRuleBinding("*", "DTM", datetime));
        }