protected void BuildBody() { keys["KODEJABATAN"] = Request["key1"]; Data.JABATANAKTORController controller = new Data.JABATANAKTORController(); string text = controller.FetchFullText(keys, field); text = Control.HTMLEncodeSpecialChars(text); text = text.Replace("\n", "<BR>").Replace("\r", "<BR>"); output.Append(text); }
protected void Page_Load(object sender, EventArgs e) { CheckSecurity(); bool suggestAllContent = true; bool searchAll = false; if (Request["start"] == null || (string)Request["start"] == "0") { suggestAllContent = false; } string field = (string)Request["searchField"]; string value = (string)Request["searchFor"]; if (!string.IsNullOrEmpty(value)) { Builder bldr = Factory.CreateBuilder(); Smarty.Table tableInfo = bldr.Tables[strTableName]; if (string.IsNullOrEmpty(field)) { searchAll = true; } List <string> fields = new List <string>(); List <string> items = null; try { Data.JABATANAKTORController controller = new Data.JABATANAKTORController(); items = searchAll ? controller.FetchForSearchSuggestAll(fields, value, suggestAllContent, OwnerColumn, OwnerID) : controller.FetchForSearchSuggest(field, value, suggestAllContent, OwnerColumn, OwnerID); } catch { items = new List <string>(); items.Add(string.Empty); } foreach (string item in items) { //if (suggestAllContent) //{ string str = item.Substring(0, item.Length > 50 ? 50 : item.Length); int pos = my_stripos(str, value, 0); if (pos < 0) { output.Append(str); } else { output.Append(str.Substring(0, pos) + "<b>" + str.Substring(pos, value.Length) + "</b>" + str.Substring(pos + value.Length)); } output.Append("\n"); //} //else //{ // output.Append("<b>" + item.Substring(0,value.Length) + "</b>" + value.Substring(value.Length, (item.Length > 50 ? 50 : item.Length) - value.Length) + "\n"); //} } } this.Response.Write(output.ToString()); this.Response.End(); }