/// <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(); }
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() ); }
/// <summary> /// 渲染 /// </summary> public string Render() { var result = new Str(); result.Add( "[" ); result.Add( _toolbar.GetItems().Splice() ); result.Add( "]" ); return result.ToString(); }
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); }
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() ); }
public Util(Core RennderCore) { R = RennderCore; Str = new Str(R); Xml = new Xml(); Serializer = new Serializer(R); }
/// <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(); }
/// <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() ); }
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 ); }
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() ); }
/// <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() ); }
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() ); }
/// <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(); }
/// <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(); }
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() ); }
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() ); }
/// <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(); }
/// <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(); }
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() ); }
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() ); }
/// <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(); }
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() ); }
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() ); }
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() ); }
/// <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(); }
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() ) ); }
/// <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(); }
/// <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(); }
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() ); }
/// <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(); }
public static byte[] GetBytes(this string s, bool bom = false) => Util.CombineByteArray(bom ? Str.GetBOM(Str.Utf8Encoding) : null, Str.Utf8Encoding.GetBytes(s));
public static byte[] NormalizeCrlfWindows(this byte[] s) => Str.NormalizeCrlfWindows(s);
public static void ParseUrl(this string url_string, out Uri uri, out NameValueCollection query_string) => Str.ParseUrl(url_string, out uri, out query_string);
public static string GetString_UTF8(this byte[] b) => Str.DecodeString(b, Str.Utf8Encoding, out _);
public static string GetString_UTF16LE(this byte[] b) => Str.DecodeString(b, Str.UniEncoding, out _);
public static string GetString_Ascii(this byte[] b) => Str.DecodeString(b, Str.AsciiEncoding, out _);
public static bool IsZenkaku(this char c) => Str.IsZenkaku(c);
public static bool IsEmpty(this string s) => Str.IsEmptyStr(s);
public static string GetString_ShiftJis(this byte[] b) => Str.DecodeString(b, Str.ShiftJisEncoding, out _);
public static byte[] GetHexBytes(this string s) => Str.HexToByte(s);
public static string GetHexString(this byte[] b, string padding = "") => Str.ByteToHex(b, padding);
public static string GetString(this byte[] b) => Str.DecodeStringAutoDetect(b, out _);
public static bool IsPrintableAndSafe(this char c, bool crlf_ok = true, bool html_tag_ng = false) => Str.IsPrintableAndSafe(c, crlf_ok, html_tag_ng);
public static string Combine(this string[] t, string sepstr) => Str.CombineStringArray(t, sepstr);
public static bool IsCharNumOrAlpha(this char c) => Str.IsCharNumOrAlpha(c);
public static string[] UniqueToken(this string[] t) => Str.UniqueToken(t);
public static bool IsFilled(this string s) => !Str.IsEmptyStr(s);
public static string GetString_Euc(this byte[] b) => Str.DecodeString(b, Str.EucJpEncoding, out _);
public static bool ToBool(this string s) => Str.StrToBool(s);
public static string ToStr3(this uint s) => Str.ToStr3(s);
public static string MakeCharArray(this char c, int len) => Str.MakeCharArray(c, len);
public static string ToStr3(this ulong s) => Str.ToStr3(s);
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);
public static string ObjectToXmlPublic(this object o, Type t = null) => Str.ObjectToXMLSimple(o, t ?? o.GetType());
public static string LinesToStr(this string[] lines) => Str.LinesToStr(lines);
public static byte[] NormalizeCrlfThisPlatform(this byte[] s) => Str.NormalizeCrlfThisPlatform(s);
public static string ReplaceStrWithReplaceClass(this string str, object replace_class, bool case_sensitive = false) => Str.ReplaceStrWithReplaceClass(str, replace_class, case_sensitive);
public static byte[] NormalizeCrlfUnix(this byte[] s) => Str.NormalizeCrlfUnix(s);
public static string GetString(this byte[] b, Encoding default_encoding) => Str.DecodeString(b, default_encoding, out _);
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);