private void BindFocusNews() { string key = "Home_Room_ZCDC_FocusNews"; DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); if (cacheAsDataTable == null) { cacheAsDataTable = new Views.V_News().Open("top 5 ID,Title", "isShow = 1 and SiteID = " + base._Site.ID.ToString() + " and [TypeName] = '足彩资讯'", "isCommend,DateTime desc"); if (cacheAsDataTable == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } if (cacheAsDataTable.Rows.Count < 1) { try { Shove._Web.Cache.ClearCache(key); } catch { } return; } Shove._Web.Cache.SetCache(key, cacheAsDataTable); } this.rptNews.DataSource = cacheAsDataTable; this.rptNews.DataBind(); }
private void BindNews() { string key = "Home_Room_JoinAllBuy_BindNews"; DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); if (cacheAsDataTable == null) { cacheAsDataTable = new Views.V_News().Open("top 5 Title,Content", "isShow = 1 and [TypeName] = '热门人物追踪'", "isCommend,DateTime desc"); if ((cacheAsDataTable == null) || (cacheAsDataTable.Rows.Count == 0)) { return; } Shove._Web.Cache.SetCache(key, 0x1770); } StringBuilder builder = new StringBuilder(); foreach (DataRow row in cacheAsDataTable.Rows) { builder.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">").Append("<tr>").Append(" <td align=\"left\" class=\"hui12\" style=\"padding: 3px 0px 3px 0px;\">").Append("<a href='" + row["Content"].ToString() + "' target='_blank'>").Append(row["Title"].ToString()).Append("</a>").Append("</td>").Append("</tr>").Append("<tr>").Append("<td class=\"hui12\" height=\"15\">").Append("<div id=\"hr\">").Append("</div>").Append("</td>").Append("</tr>").Append("</table>"); } this.tdNews.InnerHtml = builder.ToString(); }
public static string GetLotteryNews(int LotteryID) { DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(LotteryNews + LotteryID.ToString()); StringBuilder builder = new StringBuilder(); if ((cacheAsDataTable == null) || (cacheAsDataTable.Rows.Count == 0)) { string str = ""; if (LotteryID == 0x1c) { str = "重庆时时彩资讯"; } if (LotteryID == 0x1d) { str = "时时乐资讯"; } if (LotteryID == 0x3e) { str = "十一运夺金资讯"; } if (LotteryID == 5) { str = "双色球资讯"; } if (LotteryID == 6) { str = "3D资讯"; } if (LotteryID == 0x27) { str = "超级大乐透资讯"; } if (LotteryID == 0x3d) { str = "时时彩咨询"; } if ((LotteryID == 0x3f) || (LotteryID == 0x40)) { str = "排列3/5资讯"; } if (((LotteryID == 1) || (LotteryID == 15)) || (LotteryID == 2)) { str = "足彩资讯"; } if (LotteryID == 70) { str = "11选5资讯"; } if (LotteryID == 0x29) { str = "浙江体彩6+1资讯"; } cacheAsDataTable = new Views.V_News().Open("top 8 Title,Content", "isShow = 1 and [TypeName] = '" + str + "'", "isCommend,DateTime desc"); if ((cacheAsDataTable != null) && (cacheAsDataTable.Rows.Count > 0)) { Cache.SetCache(LotteryNews + LotteryID.ToString(), cacheAsDataTable, 0xe10); } } string input = ""; foreach (DataRow row in cacheAsDataTable.Rows) { if ((row["Title"].ToString().IndexOf("</font>") > -1) && (row["Title"].ToString().IndexOf("</font>") > -1)) { input = row["Title"].ToString(); if (input.IndexOf("class=red12") > 0) { input = input.Substring(input.IndexOf(">") + 1, (input.IndexOf("</font>") - input.IndexOf(">")) - 1); builder.Append("<tr>").Append("<td width=\"5%\" height=\"24\" align=\"center\" class=\"hui14\">").Append("▪ ").Append("</td>").Append("<td width=\"95%\" height=\"22\" class=\"blue12\">").Append("<a href='").Append(row["Content"].ToString()).Append("' target='_blank'>").Append("<font class = 'red12'>").Append(_String.Cut(input, 15)).Append("</font>").Append("</a>").Append("</td>").Append("</tr>"); } else { input = input.Substring(input.IndexOf(">") + 1, (input.IndexOf("</font>") - input.IndexOf(">")) - 1); builder.Append("<tr>").Append("<td width=\"5%\" height=\"24\" align=\"center\" class=\"hui14\">").Append("▪ ").Append("</td>").Append("<td width=\"95%\" height=\"22\" class=\"blue12\">").Append("<a href='").Append(row["Content"].ToString()).Append("' target='_blank'>").Append("<font class = 'black12'>").Append(_String.Cut(input, 0x11)).Append("</font>").Append("</a>").Append("</td>").Append("</tr>"); } continue; } builder.Append("<tr>").Append("<td width=\"5%\" height=\"24\" align=\"center\" class=\"hui14\">").Append("▪ ").Append("</td>").Append("<td width=\"95%\" height=\"22\" class=\"blue12\">").Append("<a href='").Append(row["Content"].ToString()).Append("' target='_blank'>").Append(_String.Cut(row["Title"].ToString(), 15)).Append("</a>").Append("</td>").Append("</tr>"); } return(builder.ToString()); }