/// <summary> /// 添加主数据 /// </summary> /// <returns></returns> protected string GetHtmlData() { StringBuilder condition = new StringBuilder(); if (!txtMark.Text.IsNullOrEmpty()) { condition.Append(" and d.name LIKE'%" + txtMark.Text.Trim() + "%' "); } if (TableDescription.Text.Trim() != "") { condition.Append(" AND cast(f.value AS VARCHAR) LIKE '%" + TableDescription.Text.Trim() + "%' "); } #region 拉列表 switch (tdyon.SelectedValue) { case "00": condition.Append(" and isnull(f.value, '')!=''"); break; case "11": condition.Append(" and ISNULL( f.[value], '')='' "); break; case "01": condition.Append(" "); break; default: condition.Append(" "); break; } switch (yesorno.SelectedValue) { case "00": condition.Append(" and isnull(g.value, '')!=' '"); break; case "11": condition.Append(" and ISNULL( g.[value], '')='' "); break; case "01": condition.Append(" "); break; default: condition.Append(" "); break; } #endregion if (Field.Text.Trim() != "") { condition.Append(" AND a.name LIKE '%" + Field.Text.Trim() + "%' "); } if (!FieldDescribe.Text.Trim().IsNullOrEmpty()) { condition.Append(" AND CAST(g.value AS VARCHAR) LIKE '" + FieldDescribe.Text.Trim() + "' "); } StringBuilder strHtmlData = new StringBuilder(); BLL_ListStructure bll = new BLL_ListStructure(); string databases = "[YXFW_DATA_0.9]"; //databases = "temp_yxfw_forZXDP"; DataSet ds = bll.GetListStructure(databases, condition.ToString(), PageIndex, PageSize, out rCount, out pCount); DataTable dt = ds.Tables[0]; int i = 0; strHtmlData.Append("<table class='table_list' cellpadding='0' cellspacing='0' >"); strHtmlData.Append("<tr class='tr_title'>"); strHtmlData.Append("<td style='width:15%'>表名</td>"); strHtmlData.Append("<td style='width:18%'>表说明</td>"); strHtmlData.Append("<td style='width:15%'>字段名</td>"); strHtmlData.Append("<td style='width:25%'>字段说明</td>"); strHtmlData.Append("<td style='width:8%'>字段类型</td>"); strHtmlData.Append("<td style='width:8%'>字段长度</td>"); strHtmlData.Append("</tr>"); for (int j = 0; j < dt.Rows.Count; j++) { string tablename = dt.Rows[j]["表名"].ToString(); string tableinfo = dt.Rows[j]["表说明"].ToString(); string tableColumn = dt.Rows[j]["字段名"].ToString(); string tablecolumninfo = dt.Rows[j]["字段说明"].ToString(); i++; string css = string.Empty; if (i % 2 == 0) { css = "tr_con_001"; } else { css = "tr_con_002"; } strHtmlData.Append("<tr class='" + css + "'>"); strHtmlData.Append("<td>" + tablename + "</td>"); strHtmlData.Append("<td>"); strHtmlData.Append("<input type='button' class='btn_modify'onclick=\"AddModule('" + databases + "','" + tablename + "','" + tableinfo + "');\"> "); strHtmlData.Append(tableinfo); strHtmlData.Append("</td>"); strHtmlData.Append("<td>" + tableColumn + "</td>"); strHtmlData.Append("<td>"); strHtmlData.Append("<input type='button' class='btn_modify'onclick=\"AddModuleColumns('" + databases + "','" + tablename + "','" + tableColumn + "','" + tablecolumninfo + "');\"> "); strHtmlData.Append(tablecolumninfo); strHtmlData.Append("</td>"); strHtmlData.Append("<td>" + dt.Rows[j]["类型"] + "</td>"); strHtmlData.Append("<td>" + dt.Rows[j]["长度"] + "</td>"); if (tableinfo.Equals(string.Empty)) { tableinfo = "000"; } if (tablecolumninfo.Equals(string.Empty)) { tablecolumninfo = "0000"; } //strHtmlData.Append("<td><a href='javascript:void(0)' onclick=\"AddModule('" + tablename + "','" + tableinfo + "','" + tableColumn + "','" + tablecolumninfo + "');\">修改</a></td>"); strHtmlData.Append("</tr>"); } return(strHtmlData.ToString()); }
/// <summary> /// 添加主数据 /// </summary> /// <returns></returns> protected string GetHtmlData() { StringBuilder condition = new StringBuilder(); if (!txtMark.Text.IsNullOrEmpty()) { condition.Append(" and d.name LIKE'%" + txtMark.Text.Trim() + "%' "); } if (TableDescription.Text.Trim() != "") { condition.Append(" AND cast(f.value AS VARCHAR) LIKE '%" + TableDescription.Text.Trim() + "%' "); } #region 拉列表 switch (tdyon.SelectedValue) { case "00": condition.Append(" and isnull(f.value, '')!=''"); break; case "11": condition.Append(" and ISNULL( f.[value], '')='' "); break; case "01": condition.Append(" "); break; default: condition.Append(" "); break; } switch (yesorno.SelectedValue) { case "00": condition.Append(" and isnull(g.value, '')!=' '"); break; case "11": condition.Append(" and ISNULL( g.[value], '')='' "); break; case "01": condition.Append(" "); break; default: condition.Append(" "); break; } #endregion if (Field.Text.Trim() != "") { condition.Append(" AND a.name LIKE '%" + Field.Text.Trim() + "%' "); } if (!FieldDescribe.Text.Trim().IsNullOrEmpty()) { condition.Append(" AND CAST(g.value AS VARCHAR) LIKE '" + FieldDescribe.Text.Trim() + "' "); } StringBuilder strHtmlData = new StringBuilder(); BLL_ListStructure bll = new BLL_ListStructure(); string databases = "[YXFW_DATA_0.9]"; //databases = "temp_yxfw_forZXDP"; DataSet ds = bll.GetListStructure(databases, condition.ToString(), PageIndex, PageSize, out rCount, out pCount); DataTable dt = ds.Tables[0]; int i = 0; strHtmlData.Append("<table class='table table-hover table-bordered'>"); strHtmlData.Append("<thead>"); strHtmlData.Append("<tr>"); strHtmlData.Append("<th>表名</th>"); strHtmlData.Append("<th>表说明</th>"); strHtmlData.Append("<th>字段名</th>"); strHtmlData.Append("<th>字段说明</th>"); strHtmlData.Append("<th>字段类型</th>"); strHtmlData.Append("<th>字段长度</th>"); strHtmlData.Append("</tr>"); strHtmlData.Append("</thead>"); strHtmlData.Append("<tbody>"); for (int j = 0; j < dt.Rows.Count; j++) { string tablename = dt.Rows[j]["表名"].ToString(); string tableinfo = dt.Rows[j]["表说明"].ToString(); string tableColumn = dt.Rows[j]["字段名"].ToString(); string tablecolumninfo = dt.Rows[j]["字段说明"].ToString(); i++; strHtmlData.Append("<tr>"); strHtmlData.Append("<td>" + tablename + "</td>"); strHtmlData.Append("<td>"); strHtmlData.Append(tableinfo); strHtmlData.Append((string.IsNullOrEmpty(tableinfo) ? "" : " ")); strHtmlData.Append("<a href='javascript:;' onclick=\"AddModule('" + databases + "','" + tablename + "','" + tableinfo + "');\"><i class='fa fa-edit'></i></a>"); strHtmlData.Append("</td>"); strHtmlData.Append("<td>" + tableColumn + "</td>"); strHtmlData.Append("<td>"); strHtmlData.Append(tablecolumninfo); strHtmlData.Append((string.IsNullOrEmpty(tablecolumninfo) ? "" : " ")); strHtmlData.Append("<a href='javascript:;' onclick=\"AddModuleColumns('" + databases + "','" + tablename + "','" + tableColumn + "','" + tablecolumninfo + "');\"><i class='fa fa-edit'></i></a>"); strHtmlData.Append("</td>"); strHtmlData.Append("<td>" + dt.Rows[j]["类型"] + "</td>"); strHtmlData.Append("<td>" + dt.Rows[j]["长度"] + "</td>"); if (tableinfo.Equals(string.Empty)) { tableinfo = "000"; } if (tablecolumninfo.Equals(string.Empty)) { tablecolumninfo = "0000"; } //strHtmlData.Append("<td><a href='javascript:void(0)' onclick=\"AddModule('" + tablename + "','" + tableinfo + "','" + tableColumn + "','" + tablecolumninfo + "');\">修改</a></td>"); strHtmlData.Append("</tr>"); } strHtmlData.Append("</tbody>"); strHtmlData.Append("</table>"); return(strHtmlData.ToString()); }