| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using CB.Common;
- using CB.Data;
- using CB.Entity;
- using CB.Framework;
- namespace CB.Wap.column
- {
- public partial class tool_3dsjhcx : WebPage
- {
- protected string columnName = "", css = "", openDay = "", openInfo = "", columnAbout, SelectHtml, Qishu, Info = "", logo = "";
- protected string columnNav = "";
- protected StringBuilder sp = new StringBuilder();
- protected void Page_Load(object sender, EventArgs e)
- {
- InitData();
- }
- protected override void InitData()
- {
- var entity = CB.Data.Caches.GetColumnInfo("3dsjhcx");
- if (null == entity)
- {
- ShowError();
- return;
- }
- columnName = entity.Name;
- columnAbout = entity.About;
- logo = entity.Logo;
- pageTitle = entity.hTitle;
- pageKeyWords = entity.hKeywords;
- pageDescription = entity.hDescription;
- this.header1.ColumnName = entity.Name;
- int term = WRequest.GetQueryInt("term", 0);
- int year = WRequest.GetQueryInt("year", 0);
- int topsize = WRequest.GetQueryInt("topsize", 0);
- const int minYear = 2002;
- int nowYear = DateTime.Now.Year;
- SelectHtml = @"<select onchange='javascript:location.href=this.value;'><option>按年份</option>";
- for (int i = nowYear; i >= minYear; i--)
- {SelectHtml += "<option value='/zt/3dsjhcx-" + i.ToString() + ".htm' " + ((year > 0 && year == i) ? "selected='selected'" : "") + ">" + i.ToString() + "年</option>";}
- SelectHtml += "</select>";
- var qis = new List<int>() { 20, 50, 80, 120 };
- Qishu = @"<select onchange='javascript:location.href=this.value;'><option>最近期</option>";
- foreach (var qi in qis)
- {
- { Qishu += "<option value='/zt/3dsjhcx-" + qi.ToString() + ".htm' " + ((topsize > 0 && topsize == qi) ? "selected='selected'" : "") + ">近" + qi.ToString() + "期</option>"; }
- }
- Qishu += "</select>";
- //Qishu = "<a href='/zt/3dsjhcx-20.htm' " + (topsize == 20 ? style : "") + ">近20期</a>" +
- // "<a href='/zt/3dsjhcx-50.htm' " + (topsize == 50 ? style : "") + ">近50期</a>" +
- // "<a href='/zt/3dsjhcx-80.htm' " + (topsize == 80 ? style : "") + ">近80期</a>" +
- // "<a href='/zt/3dsjhcx-120.htm' " + (topsize == 120 ? style : "") + ">近120期</a>";
- List<FC3DInfo> list;
- if (minYear <= year && year <= nowYear)
- {
- list = Caches.GetFC3DList(0, 0, year);
- Info = year.ToString() + "年";
- }
- else if (topsize == 20 || topsize == 50 || topsize == 80 || topsize == 120)
- {
- list = Caches.GetFC3DList(topsize, 0, 0);
- Info = "近" + topsize.ToString() + "期";
- }
- else if (term > 0)
- {
- list = Caches.GetFC3DList(0, term, 0);
- Info = term.ToString() + "期";
- }
- else
- {
- list = Caches.GetFC3DList(10, 0, 0);
- Info = "近10期";
- }
- //var list = Caches.GetFC3DList(topsize, OpenCodeType.ShiJiHao);
- if (null != list && 0 < list.Count)
- {
- int i = 1;
- foreach (var item in list)
- {
- IList<int> d = item.ShiJiHao.ToIntArray(',');
- if (null == d)
- break;
- if (0 == i % 2)
- { sp.AppendLine(" <tr class=\"grey\">"); }
- else
- { sp.AppendLine(" <tr>"); }
- sp.AppendLine(" <td>" + item.Term.ToString() + "</td>");
- sp.AppendLine(" <td>" + item.OpenTime.ToString("yyyy.MM.dd") + "</td>");
- sp.AppendLine(" <td><span>" + item.ShiJiHao.Replace(",", ",") + "</span></td>");
- sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(d).ToString() + "</td>");
- if (0 <= item.OpenCode1)
- {
- sp.AppendLine(" <td>" + item.OpenCode1 + "," + item.OpenCode2 + "," + item.OpenCode3 + "</td>");
- sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(item.OpenCode).ToString() + "</td>");
- sp.AppendLine(" <td>" + GetContains(item.OpenCode, item.ShiJiHao) + "</td>");
- }
- else
- {
- sp.AppendLine(" <td>---</td>");
- sp.AppendLine(" <td>---</td>");
- sp.AppendLine(" <td>---</td>");
- }
- sp.AppendLine(" </tr>");
- i++;
- }
- }
- columnNav = GetColumnNavForWap(entity.Lottery);
- base.InitData();
- }
- private string GetContains(IList<int> list, string numbers)
- {
- if (null == list || 0 >= list.Count || string.IsNullOrEmpty(numbers))
- return "";
- IList<int> d = numbers.ToIntArray(',');
- if (null == d || 0 >= d.Count)
- return "";
- int i = 0;
- foreach (var item in d)
- {
- if (list.Contains(item))
- i++;
- }
- return 0 == i ? "" : i.ToString();
- }
- }
- }
|