private string HelpDB2JSON(int FormID) { StringBuilder sb = new StringBuilder(); if (FormID > 0) { DataSet ds = EvoDB.GetData("EXEC EvoDico_Form_GetHelp " + FormID.ToString() + ",1", _SqlConnection, ref ErrorMsg); sb.Append("[ "); if (ds != null) { DataTable t = ds.Tables[0]; int MaxLoop1 = t.Rows.Count; if (MaxLoop1 > 0) { for (int i = 0; i < MaxLoop1; i++) { if (t.Rows[i][1] != null) { sb.Append("{").AppendFormat("id:'{0}',", EscapedJSON1(t.Rows[i][0].ToString())); sb.AppendFormat("help:'{0}'", EscapedJSON2(t.Rows[i][1].ToString())).Append("},"); } } sb.Remove(sb.Length - 1, 1); } } sb.Append("]"); if (ds != null) { ds.Dispose(); } } return(sb.ToString()); }
//### LOV ############################################################################################ #region "LOV" private string getLOV(HttpContext context) { string fm = "", fs = "", cid = "0", sqlw = ""; if (context.Request["fs"] != null) { fs = TrimEvolu(context.Request["fs"].ToString()); if (context.Request["fm"] != null) { fm = TrimEvolu(context.Request["fm"].ToString()); } if (context.Request["id"] != null) { cid = context.Request["id"].ToString(); } } string sql = ""; if (fm == "FORMID" && fs == "PANELID") { sqlw = String.Format("t.formID={0}", cid); sql = EvoDB.BuildSQL(string.Format(EvoDB.SQL_SELECT_LOV, "label"), "EvoDico_Panel t", sqlw, "", 300); } else if (fm == "COUNTRYID" && fs == "CITYID") { sqlw = String.Format("t.{1}={0}", cid, fm); sql = EvoDB.BuildSQL(string.Format(EvoDB.SQL_SELECT_LOV, "name"), "dep_City t", sqlw, "", 300); } StringBuilder sb = new StringBuilder(); if (!String.IsNullOrEmpty(sql)) { DataSet ds = EvoDB.GetData(sql, _SqlConnection, ref ErrorMsg); if (ds != null) { DataTable t = ds.Tables[0]; int MaxLoop1 = t.Rows.Count; if (MaxLoop1 > 0) { sb.Append("[{id:'0',v:' - '},"); for (int i = 0; i < MaxLoop1; i++) { sb.Append("{").AppendFormat("id:'{0}',", t.Rows[i][0].ToString()); if (t.Rows[i][1] != null) { sb.AppendFormat("v:'{0}'", t.Rows[i][1].ToString().Replace("\n\r", "\\n").Replace("\n", "\\n").Replace("\r", "").Replace("'", "\\'")); } else { sb.Append("v:''"); } sb.Append("},"); } sb.Remove(sb.Length - 1, 1); sb.Append("]"); } else { sb.Append("[]"); } } if (ds != null) { ds.Dispose(); } } return(sb.ToString()); }