private void BindNewsDetail() { long id = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("ID"), -1); if (id < 0) { PF.GoError(ErrorNumber.Unknow, "您访问的数据不存在,可能是参数错误或内容已经被删除!", this.GetType().BaseType.FullName); return; } DataTable dt = new DAL.Views.V_News().Open("Title,DateTime,Content, TypeName", "ID=" + id + "", ""); if (dt == null) { PF.GoError(ErrorNumber.Unknow, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (dt.Rows.Count == 0) { PF.GoError(ErrorNumber.Unknow, "您访问的数据不存在,可能是参数错误或内容已经被删除!", this.GetType().BaseType.FullName); return; } DataRow dr = dt.Rows[0]; lbDate.Text = Shove._Convert.StrToDateTime(dr["DateTime"].ToString(), DateTime.Now.ToString()).ToString("yyyy-MM-dd"); lbTitle.Text = dr["Title"].ToString(); lbDetail.Text = dr["Content"].ToString(); lblType.Text = dr["TypeName"].ToString(); }
private void BindNews(string TypeName) { string CacheKey = "CPS_News_BindNews"; DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(CacheKey); if (dt == null) { dt = new DAL.Views.V_News().Open("ID,Title,Content,TypeName", "isShow=1 and (TypeName='CPS新闻公告' or TypeName = 'CPS推广指南')", ""); if (dt == null) { return; } Shove._Web.Cache.SetCache(CacheKey, dt, 1200); } DataTable dtData = dt.Clone(); DataRow[] drs = dt.Select("TypeName='"+TypeName+"'","ID desc"); foreach (DataRow dr in drs) { dtData.Rows.Add(dr.ItemArray); } sdlNewsList.DataSource = dtData.DefaultView; sdlNewsList.DataBind(); }
private void BindNews(string TypeName) { string CacheKey = "CPS_News_BindNews"; DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(CacheKey); if (dt == null) { dt = new DAL.Views.V_News().Open("ID,Title,Content,TypeName", "isShow=1 and (TypeName='CPS新闻公告' or TypeName = 'CPS推广指南')", ""); if (dt == null) { return; } Shove._Web.Cache.SetCache(CacheKey, dt, 1200); } DataTable dtData = dt.Clone(); DataRow[] drs = dt.Select("TypeName='" + TypeName + "'", "ID desc"); foreach (DataRow dr in drs) { dtData.Rows.Add(dr.ItemArray); } sdlNewsList.DataSource = dtData.DefaultView; sdlNewsList.DataBind(); }
private string BindNewsForLottery(string TypeName) { string lotteryName = this.LotteryName; if (lotteryName == "福彩3D") { lotteryName = "3D"; } string key = "Home_Room_Buy_BindNewsForLottery" + this.LotteryID.ToString(); DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); if (cacheAsDataTable == null) { cacheAsDataTable = new Views.V_News().Open("Title,Content,DateTime,TypeName", "IsShow=1 and TypeName like '" + lotteryName + "%'", ""); if ((cacheAsDataTable == null) || (cacheAsDataTable.Rows.Count == 0)) { return ""; } Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0x1770); } DataRow[] rowArray = cacheAsDataTable.Select("TypeName='" + TypeName + "'", "DateTime desc"); StringBuilder builder = new StringBuilder(); builder.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); string input = ""; string str4 = ""; int num = 0; foreach (DataRow row in rowArray) { num++; if ((num % 6) == 0) { builder.Append("<tr><td colspan='2'><div id='hr' style=\"margin-top: 5px;margin-bottom: 5px;\" ></div> </td></tr>"); } input = row["Title"].ToString().Trim(); if ((input.IndexOf("<font class=red12>") > -1) || (input.IndexOf("<font class=black12>") > -1)) { if (input.Contains("<font class=red12>")) { str4 = "red12"; } if (input.Contains("<font class=black12>")) { str4 = "black12"; } input = input.Replace("<font class=red12>", "").Replace("<font class=black12>", "").Replace("</font>", ""); builder.Append("<tr>").Append("<td width=\"5%\" height=\"22\" align=\"center\" class=\"hui14\">").Append("<img src=\"../Home/Room/Images/jiantou_3.gif\" width=\"4\" height=\"8\" />").Append("</td>").Append("<td width=\"95%\" height=\"22\" class=\"hui12\">").Append("<a href='" + row["Content"].ToString() + "' target='_blank'>").Append("<font class = '" + str4 + "'>").Append(_String.Cut(input, 20)).Append("</font>").Append("</a></td></tr>"); } else { builder.Append("<tr>").Append("<td width=\"5%\" height=\"22\" align=\"center\" class=\"hui14\">").Append("<img src=\"../Home/Room/Images/jiantou_3.gif\" width=\"4\" height=\"8\" />").Append("</td>").Append("<td width=\"95%\" height=\"22\" class=\"hui12\">").Append("<a href='" + row["Content"].ToString() + "' target='_blank'>").Append(_String.Cut(input, 20)).Append("</a></td></tr>"); } } builder.Append("</table>"); return builder.ToString(); }
/// <summary> /// 高频新闻(数据变化时,已清掉缓存) /// </summary> /// <param name="LotteryID"></param> /// <returns></returns> public static string GetLotteryNews(int LotteryID) { DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(LotteryNews + LotteryID.ToString()); StringBuilder sb = new StringBuilder(); if (dt == null || dt.Rows.Count == 0) { string NewsType = ""; if (LotteryID == 28) { NewsType = "重庆时时彩资讯"; } if (LotteryID == 29) { NewsType = "时时乐资讯"; } if (LotteryID == 62) { NewsType = "十一运夺金资讯"; } if (LotteryID == 5) { NewsType = "双色球资讯"; } if (LotteryID == 6) { NewsType = "3D资讯"; } if (LotteryID == 39) { NewsType = "超级大乐透资讯"; } if (LotteryID == 61) { NewsType = "时时彩咨询"; } if (LotteryID == 63 || LotteryID == 64) { NewsType = "排列3/5资讯"; } if (LotteryID == 1 || LotteryID == 15 || LotteryID == 2 || LotteryID == 74 || LotteryID == 75) { NewsType = "足彩资讯"; } if (LotteryID == 70) { NewsType = "11选5资讯"; } if (LotteryID == 77) { NewsType = "河南11选5资讯"; } if (LotteryID == 68) { NewsType = "快赢481资讯"; } if (LotteryID == 41) { NewsType = "浙江体彩6+1资讯"; } dt = new DAL.Views.V_News().Open("top 8 ID, Title,Content", "isShow = 1 and [TypeName] = '" + NewsType + "'", "isCommend,DateTime desc"); if (dt != null && dt.Rows.Count > 0) { Shove._Web.Cache.SetCache(LotteryNews + LotteryID.ToString(), dt, 120); } } string Title = ""; foreach (DataRow dr in dt.Rows) { if (dr["Title"].ToString().IndexOf("</font>") > -1 && dr["Title"].ToString().IndexOf("</font>") > -1) { Title = dr["Title"].ToString(); if (Title.IndexOf("class=red12") > 0) { Title = (Title.Substring(Title.IndexOf(">") + 1, Title.IndexOf("</font>") - Title.IndexOf(">") - 1)); sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append("<font class = 'red12'>") .Append(Shove._String.Cut(Title, 15)) .Append("</font>") .Append("</a>") .Append("</td>") .Append("</tr>"); } else { Title = (Title.Substring(Title.IndexOf(">") + 1, Title.IndexOf("</font>") - Title.IndexOf(">") - 1)); sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append("<font class = 'black12'>") .Append(Shove._String.Cut(Title, 17)) .Append("</font>") .Append("</a>") .Append("</td>") .Append("</tr>"); } //Append(Shove._String.Cut(dr["Title"].ToString(), 17)) } else { sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append(Shove._String.Cut(dr["Title"].ToString(), 15)) .Append("</a>") .Append("</td>") .Append("</tr>"); } } return sb.ToString(); }
/// <summary> /// 高频新闻(数据变化时,已清掉缓存) /// </summary> /// <param name="LotteryID"></param> /// <returns></returns> public static string GetLotteryNews(int LotteryID) { DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(LotteryNews + LotteryID.ToString()); StringBuilder sb = new StringBuilder(); if (dt == null || dt.Rows.Count == 0) { string NewsType = ""; if (LotteryID == 28) { NewsType = "重庆时时彩资讯"; } if (LotteryID == 29) { NewsType = "时时乐资讯"; } if (LotteryID == 62) { NewsType = "十一运夺金资讯"; } if (LotteryID == 5) { NewsType = "双色球资讯"; } if (LotteryID == 6) { NewsType = "3D资讯"; } if (LotteryID == 39) { NewsType = "超级大乐透资讯"; } if (LotteryID == 61) { NewsType = "时时彩咨询"; } if (LotteryID == 63 || LotteryID == 64) { NewsType = "排列3/5资讯"; } if (LotteryID == 1 || LotteryID == 15 || LotteryID == 2 || LotteryID == 74 || LotteryID == 75) { NewsType = "足彩资讯"; } if (LotteryID == 70) { NewsType = "11选5资讯"; } if (LotteryID == 41) { NewsType = "浙江体彩6+1资讯"; } dt = new DAL.Views.V_News().Open("top 8 ID, Title,Content", "isShow = 1 and [TypeName] = '" + NewsType + "'", "isCommend,DateTime desc"); if (dt != null && dt.Rows.Count > 0) { Shove._Web.Cache.SetCache(LotteryNews + LotteryID.ToString(), dt, 600); } } string Title = ""; foreach (DataRow dr in dt.Rows) { if (dr["Title"].ToString().IndexOf("</font>") > -1 && dr["Title"].ToString().IndexOf("</font>") > -1) { Title = dr["Title"].ToString(); if (Title.IndexOf("class=red12") > 0) { Title = (Title.Substring(Title.IndexOf(">") + 1, Title.IndexOf("</font>") - Title.IndexOf(">") - 1)); sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append("<font class = 'red12'>") .Append(Shove._String.Cut(Title, 15)) .Append("</font>") .Append("</a>") .Append("</td>") .Append("</tr>"); } else { Title = (Title.Substring(Title.IndexOf(">") + 1, Title.IndexOf("</font>") - Title.IndexOf(">") - 1)); sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append("<font class = 'black12'>") .Append(Shove._String.Cut(Title, 17)) .Append("</font>") .Append("</a>") .Append("</td>") .Append("</tr>"); } } else { sb.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='"); Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match m = regex.Match(dr["Content"].ToString()); if (m.Success) { sb.Append(dr["Content"].ToString()); } else { string URL = Shove._Web.Utility.GetUrl(); sb.Append(URL + "/Home/Web/ShowNews.aspx?ID=" + dr["ID"].ToString()); } sb.Append("' target='_blank'>") .Append(Shove._String.Cut(dr["Title"].ToString(), 15)) .Append("</a>") .Append("</td>") .Append("</tr>"); } } return(sb.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(); }
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(); }