Beispiel #1
0
 /// <summary>
 /// 创建输出结果
 /// </summary>
 private string CreateResult( string options = "",string @class = "") {
     if ( !options.IsEmpty() )
         options = " " + options;
     var result = new Str();
     result.Add( "<a href=\"javascript:void(0)\" class=\"easyui-linkbutton{0}\"{1}>a</a>", GetClass( @class ), options );
     return result.ToString();
 }
Beispiel #2
0
 public void TestButtons() {
     _button.Buttons( "a" );
     var result = new Str();
     result.Add( "title:'a'," );
     result.Add( "buttons:'a'" );
     Assert.AreEqual( CreateResult( result.ToString() ), _button.ToHtmlString() );
 }
Beispiel #3
0
 /// <summary>
 /// 渲染
 /// </summary>
 public string Render() {
     var result = new Str();
     result.Add( "[" );
     result.Add( _toolbar.GetItems().Splice() );
     result.Add( "]" );
     return result.ToString();
 }
Beispiel #4
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Введите 1ое слогаемое x:");
            int x = Convert.ToInt16(Console.ReadLine());
            Console.WriteLine("Введите ое слогаемое y:");
            int y = Convert.ToInt16(Console.ReadLine());
            Console.WriteLine("Введите множитель z:");
            int z = Convert.ToInt16(Console.ReadLine());

            var calc = new calc();
            Func<int, int, int, int> func = calc.fFunc;
            Console.WriteLine("Результат операции (x+y)*z: " + func(x, y, z));
            Console.ReadKey();

            Console.WriteLine("Введите первую половину слова");
            string s = Console.ReadLine();
            Console.WriteLine("Введите вторую половину слова");
            string s1 = Console.ReadLine();

            var Str = new Str();
            Console.WriteLine("Результатом сложения половины слов является:" + Str.SFunc(s, s1));
            Console.ReadKey();

            bool[] bo = new[] { true, false, false, false, false, false };
            bool[] boo = (bool[])Enumerable.Where(bo, a => a == false);
            int len = boo.Length;
            Console.WriteLine("Количество элементов массива со значением false =" + len);
        }
Beispiel #5
0
 public void TestGetSql_Pager() {
     _builder.From( "t" ).SetPager( new Pager( 1, 20, "a" ) );
     var result = new Str();
     result.Add( "Select * From t " );
     result.Add( "Order By a Offset 0 Rows Fetch Next 20 Rows Only" );
     Assert.AreEqual( result.ToString(), _builder.GetSql() );
 }
Beispiel #6
0
 public Util(Core RennderCore)
 {
     R = RennderCore;
     Str = new Str(R);
     Xml = new Xml();
     Serializer = new Serializer(R);
 }
Beispiel #7
0
 /// <summary>
 /// 获取结果
 /// </summary>
 private string GetResult( string options = "" ) {
     var result = new Str();
     result.Add( "<select class=\"easyui-combotree\"" );
     if ( !options.IsEmpty() )
         result.Add( " data-options=\"{0}\"", options );
     result.Add( "></select>" );
     return result.ToString();
 }
Beispiel #8
0
 /// <summary>
 /// 验证结果
 /// </summary>
 private void AssertResult( string options = "" ) {
     var result = new Str();
     result.Add( "<div class=\"easyui-pagination\"" );
     if( !options.IsEmpty() )
         result.Add( " data-options=\"{0}\"",options );
     result.Add( "></div>" );
     Assert.AreEqual( result.ToString(), _pagination.ToHtmlString() );
 }
Beispiel #9
0
 public void TestToObject() {
     Str result = new Str();
     result.Add( "{" );
     result.Add( "\"Name\":\"a\"" );
     result.Add( "}" );
     var customer = Json.ToObject<Customer>( result.ToString() );
     Assert.AreEqual( "a", customer.Name );
 }
Beispiel #10
0
 public void TestPanelHeight() {
     _combox.Add( "a" ).PanelHeight( "100" );
     var result = new Str();
     result.Add( "<select class=\"easyui-combobox\" data-options=\"editable:false,panelHeight:'100'\">" );
     result.Add( "<option>a</option>" );
     result.Add( "</select>" );
     Assert.AreEqual( result.ToString(), _combox.ToHtmlString() );
 }
Beispiel #11
0
 /// <summary>
 /// 验证结果
 /// </summary>
 private void AssertResult(string options = "",string html = "") {
     var result = new Str();
     result.Add( "<div class=\"web-uploader\" data-options=\"{0}\">", options );
     result.Add( html );
     result.Add( "</div>" );
     Assert.AreEqual( result.ToString(), _uploader.ToString() );
     
 }
Beispiel #12
0
 public void TestUrl_Value() {
     _tree.Id( "id1" ).Url( "a", "b" );
     var result = new Str();
     result.Add( "<select class=\"easyui-combotree\" id=\"id1\" lazyValue=\"b\" data-options=\"onLoadSuccess:$.easyui.setComboTreeLazyValue_onLoadSuccess('id1'),url:'a'\">" );
     result.Add( "</select>" );
     Console.WriteLine( result );
     Assert.AreEqual( result.ToString(), _tree.ToHtmlString() );
 }
Beispiel #13
0
 /// <summary>
 /// 获取脚本
 /// </summary>
 public static string GetButtonScript_1_2() {
     Str result = new Str();
     result.Add( "var toolbar = new Ext.Toolbar({\"id\":\"toolbar\"});" );
     result.Add( "toolbar.add(" );
     result.Add( "{\"text\":\"新建\",\"iconCls\":\"a\",\"handler\":showBox}" );
     result.Add( ");" );
     return result.ToString();
 }
Beispiel #14
0
 /// <summary>
 /// 创建输出结果
 /// </summary>
 private string CreateReuslt( string name, string options = null ) {
     var result = new Str();
     result.Add( "<input class=\"easyui-textbox\" name=\"{0}\"", name );
     if ( options.IsEmpty() == false )
         result.Add( " data-options=\"{0}\"", options );
     result.Add( "/>" );
     return result.ToString();
 }
Beispiel #15
0
 public void TestBool_Nullable() {
     var combox = new EntityCombox<User, bool?>( t => t.NullableBoolValue );
     var result = new Str();
     result.Add( "<select class=\"easyui-combobox\" data-options=\"editable:false,panelHeight:'auto',width:50\" name=\"NullableBoolValue\">" );
     result.Add( "<option value=\"false\">否</option>" );
     result.Add( "<option value=\"true\">是</option>" );
     result.Add( "</select>" );
     Assert.AreEqual( result.ToString(), combox.ToHtmlString() );
 }
Beispiel #16
0
 public void TestEnum_Nullable() {
     var combox = new EntityCombox<User, TestEnum?>( t => t.NullableEnumValue );
     var result = new Str();
     result.Add( "<select class=\"easyui-combobox\" data-options=\"editable:false,panelHeight:'auto'\" name=\"NullableEnumValue\">" );
     result.Add( "<option value=\"1\">A1</option>" );
     result.Add( "<option value=\"2\">B1</option>" );
     result.Add( "</select>" );
     Assert.AreEqual( result.ToString(), combox.ToHtmlString() );
 }
Beispiel #17
0
 /// <summary>
 /// 获取脚本
 /// </summary>
 public static string GetButtonScript_2() {
     Str result = new Str();
     result.Add( "var toolbar = new Ext.Toolbar({\"id\":\"toolbar\"});" );
     result.Add( "toolbar.add(" );
     result.Add( "{\"text\":\"新建\",\"handler\":new}," );
     result.Add( "{\"text\":\"修改\",\"handler\":update}" );
     result.Add( ");" );
     return result.ToString();
 }
Beispiel #18
0
 /// <summary>
 /// 创建输出结果
 /// </summary>
 private string CreateResult( string html ) {
     var result = new Str();
     result.Add( "<a href=\"javascript:void(0)\" class=\"easyui-linkbutton\" " );
     result.Add( "onClick=\"$.easyui.dialog({" );
     result.Add( html );
     result.Add( "})\"" );
     result.Add( ">a</a>" );
     return result.ToString();
 }
Beispiel #19
0
 public void TestAdd() {
     _combox.Add( "a" ).Add( "b", 2 ).Value( "2" );
     var result = new Str();
     result.Add( "<select class=\"easyui-combobox\" data-options=\"editable:false,panelHeight:'auto'\">" );
     result.Add( "<option>a</option>" );
     result.Add( "<option value=\"2\" selected=\"selected\">b</option>" );
     result.Add( "</select>" );
     Assert.AreEqual( result.ToString(), _combox.ToHtmlString() );
 }
Beispiel #20
0
 public void TestBool() {
     _combox.Bool();
     var result = new Str();
     result.Add( "<select class=\"easyui-combobox\" data-options=\"editable:false,panelHeight:'auto',width:50\">" );
     result.Add( "<option value=\"false\">否</option>" );
     result.Add( "<option value=\"true\">是</option>" );
     result.Add( "</select>" );
     Assert.AreEqual( result.ToString(), _combox.ToHtmlString() );
 }
Beispiel #21
0
 /// <summary>
 /// 获取结果
 /// </summary>
 private string GetResult( string options = "" ) {
     var result = new Str();
     result.Add( "<ul class=\"easyui-tree\"" );
     if( !options.IsEmpty() )
         result.Add( " data-options=\"{0}\"",options );
     result.Add( "></ul>" );
     Console.Write( result.ToString() );
     return result.ToString();
 }
Beispiel #22
0
 public void TestGetResult() {
     var list = Test2.CreateList();
     var result = new DataGridResult( list, 2 );
     var expected = new Str();
     expected.Add( "{\"total\":2,\"rows\":[" );
     expected.Add( "{\"Id\":1,\"Name\":\"a\",\"Description\":\"a\"}," );
     expected.Add( "{\"Id\":2,\"Name\":\"b\",\"Description\":\"b\"}" );
     expected.Add( "]}" );
     Assert.AreEqual( expected.ToString(),result.ToString() );
 }
Beispiel #23
0
 public void Test_2Node_Children() {
     var node = new TreeNode { Id = "1", Text = "a",Level = 1};
     var node2 = new TreeNode { Id = "2", ParentId = "1", Text = "b", Level = 2 };
     _result = new TreeResult( new[] { node, node2 } );
     var expected = new Str();
     expected.Add( "[{\"id\":\"1\",\"text\":\"a\"," );
     expected.Add( "\"children\":[{\"id\":\"2\",\"ParentId\":\"1\",\"text\":\"b\"}]" );
     expected.Add( "}]" );
     Assert.AreEqual( expected.ToString(), _result.ToString() );
 }
Beispiel #24
0
 public void TestButton_Render() {
     _toolbar.RenderTo( "div1" );
     _toolbar.Button( "新建", "new" );
     Str result = new Str();
     result.Add( "var toolbar = new Ext.Toolbar({\"id\":\"toolbar\",\"renderTo\":\"div1\"});" );
     result.Add( "toolbar.add(" );
     result.Add( "{\"text\":\"新建\",\"handler\":new}" );
     result.Add( ");" );
     Assert.AreEqual( result.ToString(), _toolbar.ToHtmlString() );
 }
Beispiel #25
0
 /// <summary>
 /// 获取输出结果
 /// </summary>
 protected string GetResult( string options = "",string text= "" ) {
     var result = new Str();
     result.Add( "<div " );
     if ( !options.IsEmpty() ) {
         result.Add( "data-options=\"{0}\"", options );
     }
     result.Add( ">{0}",text );
     result.Add( "</div>" );
     return result.ToString();
 }
Beispiel #26
0
 public void ToJsonWithoutBrackets() {
     var result = new Str();
     result.Add( "\"Name\":\"a\"," );
     result.Add( "\"nickname\":\"b\"," );
     result.Add( "\"func\":c," );
     result.Add( "\"Value\":null," );
     result.Add( "\"Date\":\"2012/1/1 0:00:00\"," );
     result.Add( "\"Age\":1," );
     result.Add( "\"isShow\":true" );
     Assert.AreEqual( result.ToString(), Json.ToJsonWithoutBrackets( Customer.Create() ) );
 }
Beispiel #27
0
 /// <summary>
 /// 获取结果
 /// </summary>
 public static string GetResult( string option = "",string text = "" ) {
     var result = new Str();
     result.Add( "<th " );
     if( !option.IsEmpty() )
         result.Add( "data-options=\"{0}\"",option );
     result.Add( ">" );
     if( !text.IsEmpty() )
         result.Add( text );
     result.Add( "</th>" );
     return result.ToString();
 }
Beispiel #28
0
 /// <summary>
 /// 获取输出结果
 /// </summary>
 protected string GetResult( string options = "",string items = "" ) {
     var result = new Str();
     result.Add( "<div id=\"a\" class=\"easyui-menu\"" );
     if ( !options.IsEmpty() )
         result.Add( " data-options=\"{0}\"", options );
     result.Add( ">" );
     if ( !items.IsEmpty() )
         result.Add( items );
     result.Add( "</div>" );
     return result.ToString();
 }
Beispiel #29
0
 public void Test_3Node_Children() {
     var node = new TreeNode { Id = "1" };
     var node2 = new TreeNode { Id = "2", ParentId = "1" };
     var node3 = new TreeNode { Id = "3", ParentId = "2" };
     _result = new TreeResult( new[] { node2, node3, node } );
     var expected = new Str();
     expected.Add( "[{\"id\":\"1\",\"children\":[" );
     expected.Add( "{\"id\":\"2\",\"ParentId\":\"1\",\"children\":[" );
     expected.Add( "{\"id\":\"3\",\"ParentId\":\"2\"}]" );
     expected.Add( "}]}]" );
     Assert.AreEqual( expected.ToString(), _result.ToString() );
 }
Beispiel #30
0
 /// <summary>
 /// 获取消息框输出结果,设置标题为A,设置内容为B
 /// </summary>
 public static string GetResult_TitleA_ContentB() {
     Str result = new Str();
     result.Add( "Ext.Msg.show({" );
     result.Add( "\"title\":\"a\"," );
     result.Add( "\"msg\":\"b\"," );
     result.Add( "\"buttons\":Ext.MessageBox.OK," );
     result.Add( "\"closable\":true," );
     result.Add( "\"modal\":true," );
     result.Add( "\"icon\":Ext.MessageBox.INFO" );
     result.Add( "});" );
     return result.ToString();
 }
Beispiel #31
0
 public static byte[] GetBytes(this string s, bool bom = false) => Util.CombineByteArray(bom ? Str.GetBOM(Str.Utf8Encoding) : null, Str.Utf8Encoding.GetBytes(s));
Beispiel #32
0
 public static byte[] NormalizeCrlfWindows(this byte[] s) => Str.NormalizeCrlfWindows(s);
Beispiel #33
0
 public static void ParseUrl(this string url_string, out Uri uri, out NameValueCollection query_string) => Str.ParseUrl(url_string, out uri, out query_string);
Beispiel #34
0
 public static string GetString_UTF8(this byte[] b) => Str.DecodeString(b, Str.Utf8Encoding, out _);
Beispiel #35
0
 public static string GetString_UTF16LE(this byte[] b) => Str.DecodeString(b, Str.UniEncoding, out _);
Beispiel #36
0
 public static string GetString_Ascii(this byte[] b) => Str.DecodeString(b, Str.AsciiEncoding, out _);
Beispiel #37
0
 public static bool IsZenkaku(this char c) => Str.IsZenkaku(c);
Beispiel #38
0
 public static bool IsEmpty(this string s) => Str.IsEmptyStr(s);
Beispiel #39
0
 public static string GetString_ShiftJis(this byte[] b) => Str.DecodeString(b, Str.ShiftJisEncoding, out _);
Beispiel #40
0
 public static byte[] GetHexBytes(this string s) => Str.HexToByte(s);
Beispiel #41
0
 public static string GetHexString(this byte[] b, string padding = "") => Str.ByteToHex(b, padding);
Beispiel #42
0
 public static string GetString(this byte[] b) => Str.DecodeStringAutoDetect(b, out _);
Beispiel #43
0
 public static bool IsPrintableAndSafe(this char c, bool crlf_ok = true, bool html_tag_ng = false) => Str.IsPrintableAndSafe(c, crlf_ok, html_tag_ng);
Beispiel #44
0
 public static string Combine(this string[] t, string sepstr) => Str.CombineStringArray(t, sepstr);
Beispiel #45
0
 public static bool IsCharNumOrAlpha(this char c) => Str.IsCharNumOrAlpha(c);
Beispiel #46
0
 public static string[] UniqueToken(this string[] t) => Str.UniqueToken(t);
Beispiel #47
0
 public static bool IsFilled(this string s) => !Str.IsEmptyStr(s);
Beispiel #48
0
 public static string GetString_Euc(this byte[] b) => Str.DecodeString(b, Str.EucJpEncoding, out _);
Beispiel #49
0
 public static bool ToBool(this string s) => Str.StrToBool(s);
Beispiel #50
0
 public static string ToStr3(this uint s) => Str.ToStr3(s);
Beispiel #51
0
 public static string MakeCharArray(this char c, int len) => Str.MakeCharArray(c, len);
Beispiel #52
0
 public static string ToStr3(this ulong s) => Str.ToStr3(s);
Beispiel #53
0
 public static List <string> ToList(this string[] t, bool remove_empty = false, bool distinct = false, bool distinct_case_sensitive = false) => Str.StrArrayToList(t, remove_empty, distinct, distinct_case_sensitive);
Beispiel #54
0
 public static string ObjectToXmlPublic(this object o, Type t = null) => Str.ObjectToXMLSimple(o, t ?? o.GetType());
Beispiel #55
0
 public static string LinesToStr(this string[] lines) => Str.LinesToStr(lines);
Beispiel #56
0
 public static byte[] NormalizeCrlfThisPlatform(this byte[] s) => Str.NormalizeCrlfThisPlatform(s);
Beispiel #57
0
 public static string ReplaceStrWithReplaceClass(this string str, object replace_class, bool case_sensitive = false) => Str.ReplaceStrWithReplaceClass(str, replace_class, case_sensitive);
Beispiel #58
0
 public static byte[] NormalizeCrlfUnix(this byte[] s) => Str.NormalizeCrlfUnix(s);
Beispiel #59
0
 public static string GetString(this byte[] b, Encoding default_encoding) => Str.DecodeString(b, default_encoding, out _);
Beispiel #60
0
 public static string ToDtStr(this DateTimeOffset dt, bool with_msecs = false, DtstrOption option = DtstrOption.All, bool with_nanosecs = false) => Str.DateTimeToDtstr(dt, with_msecs, option, with_nanosecs);