当前位置: 首页>>代码示例>>C#>>正文


C# Validator.GetSqlSmallDateTimeFromParts方法代码示例

本文整理汇总了C#中Validator.GetSqlSmallDateTimeFromParts方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.GetSqlSmallDateTimeFromParts方法的具体用法?C# Validator.GetSqlSmallDateTimeFromParts怎么用?C# Validator.GetSqlSmallDateTimeFromParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validator的用法示例。


在下文中一共展示了Validator.GetSqlSmallDateTimeFromParts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main


//.........这里部分代码省略.........
            var list = new List<string>( mySet );
            foreach( var item in mySet )
                list.Add( item );

            //	mySet = new Set( list );

            var ls = new ListSet<string> { "one", "two", "one", "two" };
            foreach( var item in ls )
                Console.WriteLine( item );

            var validator = new Validator();
            var vp = new ValidationErrorHandler( errorWriter );

            Console.WriteLine( validator.GetUrl( vp, "hTTp://RedStapler.biZ/fRed", false ) );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
            Console.WriteLine( validator.GetUrl( vp, "fred", true ) );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
            Console.Write( validator.GetNullableSqlSmallDateTimeExact( vp, "fred", "MM/dd/yyy", false ) );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
            Console.WriteLine( validator.GetInt( vp, "fred" ) );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "myGoodInt" );
            Console.WriteLine( validator.GetInt( vp, "-342" ) );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "myBadDate" );
            Console.WriteLine( validator.GetSqlSmallDateTimeFromParts( vp, "3", "", "" ) );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "myBadDate" );
            Console.WriteLine( validator.GetSqlSmallDateTimeFromParts( vp, "", "", "" ) );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "zip" );
            Console.WriteLine( validator.GetZipCode( vp, "14580", true ).FullZipCode );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "zip" );
            Console.WriteLine( validator.GetZipCode( vp, "14580-1234", true ).FullZipCode );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter ); // "badZip" );
            Console.WriteLine( validator.GetZipCode( vp, "123", false ).FullZipCode );
            Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );

            Console.WriteLine( "---------------------------------\nPhone Numbers:\n------------------------------------\n" );
            vp = new ValidationErrorHandler( errorWriter );
            Console.WriteLine( validator.GetPhoneNumber( vp, "5854556476", true, true, false ) );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
            Console.WriteLine( validator.GetPhoneNumber( vp, "585 4556476", true, true, false ) );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
            Console.WriteLine( validator.GetPhoneNumber( vp, "( 585 )455-6476", true, true, false ) );
            Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );

            vp = new ValidationErrorHandler( errorWriter );
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:67,代码来源:RsLibraryTester.cs


注:本文中的Validator.GetSqlSmallDateTimeFromParts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。