public ActionResult Table(FormCollection collection) { string text = base.Request.QueryString["connid"]; List <Tuple <string, int> > list = new List <Tuple <string, int> >(); RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); string empty = string.Empty; string empty2 = string.Empty; List <string> systemDataTables = RoadFlow.Utility.Config.get_SystemDataTables(); if (!MyExtensions.IsGuid(text)) { base.Response.Write("数据连接ID错误"); base.Response.End(); return(null); } RoadFlow.Data.Model.DBConnection dBConnection2 = dBConnection.Get(MyExtensions.ToGuid(text)); if (dBConnection2 == null) { base.Response.Write("未找到数据连接"); base.Response.End(); return(null); } empty2 = dBConnection2.Type; foreach (string table2 in dBConnection.GetTables(dBConnection2.ID, 1)) { list.Add(new Tuple <string, int>(table2, 0)); } foreach (string table3 in dBConnection.GetTables(dBConnection2.ID, 2)) { list.Add(new Tuple <string, int>(table3, 1)); } JsonData jsonData = new JsonData(); foreach (Tuple <string, int> item in list) { bool flag = systemDataTables.Find((string p) => p.Equals(item.Item1, StringComparison.CurrentCultureIgnoreCase)) != null; StringBuilder stringBuilder = new StringBuilder("<a class=\"viewlink\" href=\"javascript:void(0);\" onclick=\"queryTable('" + text + "','" + item.Item1 + "');\">查询</a>"); JsonData jsonData2 = new JsonData(); jsonData2["Name"] = item.Item1; jsonData2["Type"] = ((item.Item2 == 0) ? (flag ? "系统表" : "表") : "视图"); jsonData2["Opation"] = stringBuilder.ToString(); jsonData.Add(jsonData2); } empty = "&connid=" + text + "&appid=" + base.Request.QueryString["appid"] + "&tabid=" + base.Request.QueryString["tabid"]; base.ViewBag.Query = empty; base.ViewBag.dbconnID = text; base.ViewBag.DBType = empty2; base.ViewBag.list = jsonData.ToJson(); return(View()); }
/// <summary> /// 连接下所有表下拉框 /// </summary> /// <param name="connid"></param> /// <param name="table"></param> /// <returns></returns> public string getTableOps(Guid connid, string table) { var options = ""; var tableds = conn.GetTables(connid); foreach (var value in tableds) { options += "<option value='" + value + "' " + (value == table ? "selected='selected'" : "") + ">" + value + "</option>"; } return(options); }