You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using Common.Helper; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace JMEAgentSystem.Component.AutoComplete { public partial class SwiftTextBox : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) {
}
private string _url; public string URL { set { _url = value; } get { if (string.IsNullOrWhiteSpace(_url)) { return DefaultURL + GetSuffix(); }
return _url + GetSuffix(); } }
public string Width { set; get; } public string Value { set { aValue.Value = value; } get { return aValue.Value; } }
public string Text { set { aText.Text = value; } get { return aText.Text; } }
private string DefaultURL = GetStatic.GetUrlRoot().TrimEnd('/') + "/Component/AutoComplete/DataSource.asmx/GetList"; public string Category { set; get; } public string Param1 { set; get; } public string Param2 { set; get; } public string Param3 { set; get; } public string Param4 { set; get; }
protected String GetData() { var sb = new StringBuilder();
sb.Append("'category' : '" + Category.Replace("'", "").Replace(",", "") + "'");
if (!string.IsNullOrWhiteSpace(Param1)) { var data = ParseParam("param1", Param1); sb.Append("," + data);
} if (!string.IsNullOrWhiteSpace(Param2)) { var data = ParseParam("param2", Param2); sb.Append("," + data);
} if (!string.IsNullOrWhiteSpace(Param3)) { var data = ParseParam("param3", Param3); sb.Append("," + data);
}
if (!string.IsNullOrWhiteSpace(Param4)) { var data = ParseParam("param4", Param4); sb.Append("," + data);
}
return sb.ToString(); }
string ParseParam(string key, string data) { if (data.StartsWith("@")) { return @"'" + key + @"':'"" + " + data.Substring(1) + @" + ""'"; } else { return "'" + key + "':'" + data.Replace("'", "").Replace(",", "") + "'"; }
}
private string GetSuffix() { string suffix = "";
if (!string.IsNullOrWhiteSpace(Param1)) { suffix = "1"; } if (!string.IsNullOrWhiteSpace(Param2)) { suffix = "2"; } if (!string.IsNullOrWhiteSpace(Param3)) { suffix = "3"; } if (!string.IsNullOrWhiteSpace(Param4)) { suffix = "4"; } return suffix;
}
public string InitFunction() { var sb = new StringBuilder(); sb.Append("LoadAutoCompleteTextBox("); sb.Append(@"""" + URL + @""""); sb.Append(@",""#" + ClientID + @""""); sb.Append(@",""" + Width + @""""); sb.Append(@",""" + GetData() + @""");"); return sb.ToString(); } } }
|