//专题 public string CreateZhuantiIndex() { string ErrorMessage = ""; bool isError = false; int Count = 0; string str = ""; string Title = ""; string Url = ""; string Img = ""; StreamReader sr = null; StreamWriter sw = null; Encoding code = Encoding.GetEncoding("gb2312"); try { string Path = Server.MapPath("../Video/index.html"); sr = new StreamReader(Path, code); str = sr.ReadToEnd(); if (str.Length > 0) { DataTable Hot = bll.GetHotVideo(8, 1); //热门专题 Count = Hot.Rows.Count; if (Count > 0) { StringBuilder Hot1 = new StringBuilder(); StringBuilder Hot2 = new StringBuilder(); Hot1.Append("<ul class=\"ul_pic\">"); Hot2.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Hot.Rows[i]["Title"].ToString(); Url = Hot.Rows[i]["VideoUrl"].ToString(); Img = Hot.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Hot1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Hot1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Hot1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Hot2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Hot2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Hot2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Hot1.Append("</ul>"); Hot2.Append("</ul>"); str = str.Replace("$Hot1$", Hot1.ToString()); str = str.Replace("$Hot2$", Hot2.ToString()); } //政府招商 DataTable Zs = bll.GetZsVideo(12, 1); Count = Zs.Rows.Count; if (Count > 0) { StringBuilder Zs1 = new StringBuilder(); StringBuilder Zs2 = new StringBuilder(); StringBuilder Zs3 = new StringBuilder(); Zs1.Append("<ul class=\"ul_pic\">"); Zs2.Append("<ul class=\"ul_pic\">"); Zs3.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Zs.Rows[i]["Title"].ToString(); Url = Zs.Rows[i]["VideoUrl"].ToString(); Img = Zs.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Zs1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zs1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zs1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else if (i >= 4 && i < 8) { Zs2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zs2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zs2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Zs3.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zs3.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zs3.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Zs1.Append("</ul>"); Zs2.Append("</ul>"); Zs3.Append("</ul>"); str = str.Replace("$Zs1$", Zs1.ToString()); str = str.Replace("$Zs2$", Zs2.ToString()); str = str.Replace("$Zs3$", Zs3.ToString()); } //融资 DataTable Rz = bll.GetRzVideo(12, 1); Count = Rz.Rows.Count; if (Count > 0) { StringBuilder Rz1 = new StringBuilder(); StringBuilder Rz2 = new StringBuilder(); StringBuilder Rz3 = new StringBuilder(); Rz1.Append("<ul class=\"ul_pic\">"); Rz2.Append("<ul class=\"ul_pic\">"); Rz3.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Rz.Rows[i]["Title"].ToString(); Url = Rz.Rows[i]["VideoUrl"].ToString(); Img = Rz.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Rz1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Rz1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Rz1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else if (i >= 4 && i < 8) { Rz2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Rz2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Rz2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Rz3.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Rz3.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Rz3.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Rz1.Append("</ul>"); Rz2.Append("</ul>"); Rz3.Append("</ul>"); str = str.Replace("$Rz1$", Rz1.ToString()); str = str.Replace("$Rz2$", Rz2.ToString()); str = str.Replace("$Rz3$", Rz3.ToString()); } //投资 DataTable Tz = bll.GetTzVideo(8, 1); Count = Tz.Rows.Count; if (Count > 0) { StringBuilder Tz1 = new StringBuilder(); StringBuilder Tz2 = new StringBuilder(); Tz1.Append("<ul class=\"ul_pic\">"); Tz2.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Tz.Rows[i]["Title"].ToString(); Url = Tz.Rows[i]["VideoUrl"].ToString(); Img = Tz.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Tz1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Tz1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Tz1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Tz2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Tz2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Tz2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Tz1.Append("</ul>"); Tz2.Append("</ul>"); str = str.Replace("$Tz1$", Tz1.ToString()); str = str.Replace("$Tz2$", Tz2.ToString()); } //展会 DataTable Zh = bll.GetZhVideo(12, 1); Count = Zh.Rows.Count; if (Count > 0) { StringBuilder Zh1 = new StringBuilder(); StringBuilder Zh2 = new StringBuilder(); StringBuilder Zh3 = new StringBuilder(); Zh1.Append("<ul class=\"ul_pic\">"); Zh2.Append("<ul class=\"ul_pic\">"); Zh3.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Zh.Rows[i]["Title"].ToString(); Url = Zh.Rows[i]["VideoUrl"].ToString(); Img = Zh.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Zh1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zh1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zh1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else if (i >= 4 && i < 8) { Zh2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zh2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zh2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Zh3.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zh3.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zh3.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Zh1.Append("</ul>"); Zh2.Append("</ul>"); Zh3.Append("</ul>"); str = str.Replace("$Zh1$", Zh1.ToString()); str = str.Replace("$Zh2$", Zh2.ToString()); str = str.Replace("$Zh3$", Zh3.ToString()); } //资金贷款 DataTable Zjdk = bll.GetZjdkVideo(8, 1); Count = Zjdk.Rows.Count; if (Count > 0) { StringBuilder Zjdk1 = new StringBuilder(); StringBuilder Zjdk2 = new StringBuilder(); Zjdk1.Append("<ul class=\"ul_pic\">"); Zjdk2.Append("<ul class=\"ul_pic\">"); for (int i = 0; i < Count; i++) { Title = Zjdk.Rows[i]["Title"].ToString(); Url = Zjdk.Rows[i]["VideoUrl"].ToString(); Img = Zjdk.Rows[i]["ImgUrl"].ToString(); if (i < 4) { Zjdk1.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zjdk1.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zjdk1.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } else { Zjdk2.Append("<li><i class=\"iPic\"><a href=\"" + Url + "\" target=\"_blank\">"); Zjdk2.Append("<img alt=\"" + Title + "\" src=\"" + Img + "\" width=\"135\" height=\"100\" /></a></i>"); Zjdk2.Append("<i class=\"iTit\"><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></i></li>"); } } Zjdk1.Append("</ul>"); Zjdk2.Append("</ul>"); str = str.Replace("$Zjdk1$", Zjdk1.ToString()); str = str.Replace("$Zjdk2$", Zjdk2.ToString()); } //热门专题列表 DataTable HotList = bll.GetHotVideoList(18, 1); Count = HotList.Rows.Count; if (Count > 0) { StringBuilder HotStr = new StringBuilder(); HotStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = HotList.Rows[i]["Title"].ToString(); Url = HotList.Rows[i]["VideoUrl"].ToString(); HotStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } HotStr.Append("</ul>"); str = str.Replace("$HotList$", HotStr.ToString()); } //招商专题列表 DataTable ZsList = bll.GetZsVideoList(18, 1); Count = ZsList.Rows.Count; if (Count > 0) { StringBuilder ZsStr = new StringBuilder(); ZsStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = ZsList.Rows[i]["Title"].ToString(); Url = ZsList.Rows[i]["VideoUrl"].ToString(); ZsStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } ZsStr.Append("</ul>"); str = str.Replace("$ZsList$", ZsStr.ToString()); } //资金贷款专题列表 DataTable ZjdkList = bll.GetZjdkVideoList(18, 1); Count = ZjdkList.Rows.Count; if (Count > 0) { StringBuilder ZjdkStr = new StringBuilder(); ZjdkStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = ZjdkList.Rows[i]["Title"].ToString(); Url = ZjdkList.Rows[i]["VideoUrl"].ToString(); ZjdkStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } ZjdkStr.Append("</ul>"); str = str.Replace("$ZjdkList$", ZjdkStr.ToString()); } //融资专题列表 DataTable RzList = bll.GetRzVideoList(18, 1); Count = RzList.Rows.Count; if (Count > 0) { StringBuilder RzStr = new StringBuilder(); RzStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = RzList.Rows[i]["Title"].ToString(); Url = RzList.Rows[i]["VideoUrl"].ToString(); RzStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } RzStr.Append("</ul>"); str = str.Replace("$RzList$", RzStr.ToString()); } //投资专题列表 DataTable TzList = bll.GetTzVideoList(18, 1); Count = TzList.Rows.Count; if (Count > 0) { StringBuilder TzStr = new StringBuilder(); TzStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = TzList.Rows[i]["Title"].ToString(); Url = TzList.Rows[i]["VideoUrl"].ToString(); TzStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } TzStr.Append("</ul>"); str = str.Replace("$TzList$", TzStr.ToString()); } //展会专题列表 DataTable ZhList = bll.GetZhVideoList(18, 1); Count = ZhList.Rows.Count; if (Count > 0) { StringBuilder ZhStr = new StringBuilder(); ZhStr.Append("<ul class=\"ul_text\">"); for (int i = 0; i < Count; i++) { Title = ZhList.Rows[i]["Title"].ToString(); Url = ZhList.Rows[i]["VideoUrl"].ToString(); ZhStr.Append("<li><a href=\"" + Url + "\" target=\"_blank\">" + Title + "</a></li>"); } ZhStr.Append("</ul>"); str = str.Replace("$ZhList$", ZhStr.ToString()); } sw = new StreamWriter(@"J:zt/index.html", false, code); sw.Write(str); } } catch (Exception ex) { ErrorMessage = ex.Message; isError = true; } finally { if (sr != null) { sr.Close(); } if (sw != null) { sw.Close(); } } return(ErrorMessage); }