//1:安置;2:推荐 public static string Direct_Table_New(string bh, int qs, int isAnTj) { if (isAnTj == 1) { strAzTj = "az"; } else { strAzTj = "tj"; } SqlParameter[] spa = new SqlParameter[] { new SqlParameter("@number", bh), new SqlParameter("@ExpectNum", qs), new SqlParameter("@type", isAnTj) }; qs1 = qs.ToString(); DataTable dtNew = DAL.DBHelper.ExecuteDataTable("ShowNet", spa, CommandType.StoredProcedure); string toWidth = (JieGouNew2.GetFinalWidth(dtNew)).ToString(); return("<table align='center' width='" + toWidth + "' style='margin-left:20px;'><tr><td align='left'>" + JieGouNew2.GetAll(dtNew, bh, isAnTj) + "<td/><tr></table>"); }
public static string GetThree(DataTable dt, int isAnTj) { StringBuilder sb2 = new StringBuilder(); DataRow[] row3; row3 = dt.Select("cengshu=3", "Xuhao");//第三层 if (row3.Length == 0) { return(""); } DataRow[] row2; row2 = dt.Select("cengshu=2", "Xuhao"); //第二层 DataRow[] rowTeam; //第三层团队 int firstWidth = 0; int endWidth = 0; int w2 = 0; int firstPLeft = 0; int firstPLeft1 = 0; int toWidth = JieGouNew2.GetFinalWidth(dt); int midWidth = 0; int leftWidth = 0; int rightWidth = 0; int toWidth2 = 0; if (row2.Length > 0) { toWidth2 = Convert.ToInt32(row2[row2.Length - 1]["LeftDistance"].ToString()) + Convert.ToInt32(row2[row2.Length - 1]["Lenth"].ToString()); } //画横线 int toWidth3 = (Convert.ToInt32(row3[row3.Length - 1]["LeftDistance"].ToString()) + Convert.ToInt32(row3[row3.Length - 1]["Lenth"].ToString())); sb2.Append("<table width='" + toWidth3 + "' cellspacing='0' cellpadding='0'><tr>"); for (int i = 0; i < row2.Length; i++) { rowTeam = dt.Select("shangji='" + row2[i]["number"] + "'", "Xuhao"); w2 = 0; for (int k = 0; k < rowTeam.Length; k++) { firstPLeft = Convert.ToInt32(rowTeam[k]["Said"].ToString()); if (firstPLeft == 0) { firstPLeft = jianJu; } w2 += firstPLeft + Convert.ToInt32(rowTeam[k]["Lenth"].ToString()); if (k == 0) { firstWidth = Convert.ToInt32(rowTeam[k]["Lenth"].ToString()); firstPLeft1 = Convert.ToInt32(rowTeam[k]["Said"].ToString()); } if (k == rowTeam.Length - 1) { endWidth = Convert.ToInt32(rowTeam[k]["Lenth"].ToString()); } } leftWidth = firstPLeft1 + (firstWidth / 2) - 2; rightWidth = (endWidth / 2) - 2; midWidth = w2 - leftWidth - rightWidth - firstPLeft1 + 4; if (rowTeam.Length > 1) { sb2.Append("<td width='" + w2 + "'><table width='100%' cellspacing='0' cellpadding='0' border='0' ><tbody><tr><td width='" + leftWidth + "' height=\"2\"></td><td width='" + midWidth + "' background=\"images/images03_05.gif\" > </td><td width='" + rightWidth + "'></td></tr></tbody></table></td>"); } else { leftWidth = w2 / 3; midWidth = w2 / 3; rightWidth = w2 - leftWidth - midWidth; sb2.Append("<td width='" + w2 + "'><table width='100%' cellspacing='0' cellpadding='0' border='0' ><tbody><tr><td width='" + w2 + "' height=\"2\"></td><td width='" + midWidth + "' > </td><td width='" + rightWidth + "'></td></tr></tbody></table></td>"); } } sb2.Append("</tr></table>"); //画竖线和第三层总余新 sb2.Append("<table width='" + toWidth3 + "' cellspacing='0' cellpadding='0'><tr>"); int tw2 = 0; for (int i = 0; i < row2.Length; i++) { rowTeam = dt.Select("shangji='" + row2[i]["number"] + "'", "Xuhao"); w2 = 0; tw2 = Convert.ToInt32(row2[i]["Lenth"]); for (int k = 0; k < rowTeam.Length; k++) { firstWidth = Convert.ToInt32(rowTeam[k]["Lenth"].ToString()); firstPLeft = Convert.ToInt32(rowTeam[k]["Said"].ToString()); if (firstPLeft == 0) { firstPLeft = jianJu; } if (firstWidth % 2 == 1) { leftWidth = firstWidth / 2; rightWidth = firstWidth / 2 - 1; } else { leftWidth = firstWidth / 2 - 2; rightWidth = firstWidth / 2; } sb2.Append("<td width='" + (Convert.ToInt32(rowTeam[k]["Lenth"].ToString()) + Convert.ToInt32(rowTeam[k]["Said"].ToString())) + "' valign='top'>"); sb2.Append("<table width='100%' cellspacing='0' cellpadding='0' border='0' >"); sb2.Append("<tbody>"); sb2.Append("<tr><td width='" + firstPLeft + "'><table width='100%'><tbody><tr><td> </td></tr></tbody></table></td><td width='" + rowTeam[k]["Lenth"].ToString() + "'><table width='100%' cellspacing='0' cellpadding='0' border='0' ><tbody><tr><td width='" + leftWidth + "' height=\"18\"></td><td width=\"2\" background=\"images/images02_02.gif\" > </td><td width='" + rightWidth + "'></td></tr></tbody></table></td></tr>"); sb2.Append("<tr><td width='" + firstPLeft + "' ><table width='100%'><tbody><tr><td> </td></tr></tbody></table></td><td width='" + rowTeam[k]["Lenth"].ToString() + "'>" + GetOneTable(dt, rowTeam[k]["number"].ToString(), isAnTj) + "</td></tr>"); sb2.Append("</tbody></table></td>"); } } sb2.Append("</tr></table>"); return(sb2.ToString()); }