tool_3dsjhcx.aspx.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using CB.Common;
  9. using CB.Data;
  10. using CB.Entity;
  11. using CB.Framework;
  12. namespace CB.Wap.column
  13. {
  14. public partial class tool_3dsjhcx : WebPage
  15. {
  16. protected string columnName = "", css = "", openDay = "", openInfo = "", columnAbout, SelectHtml, Qishu, Info = "", logo = "";
  17. protected string columnNav = "";
  18. protected StringBuilder sp = new StringBuilder();
  19. protected void Page_Load(object sender, EventArgs e)
  20. {
  21. InitData();
  22. }
  23. protected override void InitData()
  24. {
  25. var entity = CB.Data.Caches.GetColumnInfo("3dsjhcx");
  26. if (null == entity)
  27. {
  28. ShowError();
  29. return;
  30. }
  31. columnName = entity.Name;
  32. columnAbout = entity.About;
  33. logo = entity.Logo;
  34. pageTitle = entity.hTitle;
  35. pageKeyWords = entity.hKeywords;
  36. pageDescription = entity.hDescription;
  37. this.header1.ColumnName = entity.Name;
  38. int term = WRequest.GetQueryInt("term", 0);
  39. int year = WRequest.GetQueryInt("year", 0);
  40. int topsize = WRequest.GetQueryInt("topsize", 0);
  41. const int minYear = 2002;
  42. int nowYear = DateTime.Now.Year;
  43. SelectHtml = @"<select onchange='javascript:location.href=this.value;'><option>按年份</option>";
  44. for (int i = nowYear; i >= minYear; i--)
  45. {SelectHtml += "<option value='/zt/3dsjhcx-" + i.ToString() + ".htm' " + ((year > 0 && year == i) ? "selected='selected'" : "") + ">" + i.ToString() + "年</option>";}
  46. SelectHtml += "</select>";
  47. var qis = new List<int>() { 20, 50, 80, 120 };
  48. Qishu = @"<select onchange='javascript:location.href=this.value;'><option>最近期</option>";
  49. foreach (var qi in qis)
  50. {
  51. { Qishu += "<option value='/zt/3dsjhcx-" + qi.ToString() + ".htm' " + ((topsize > 0 && topsize == qi) ? "selected='selected'" : "") + ">近" + qi.ToString() + "期</option>"; }
  52. }
  53. Qishu += "</select>";
  54. //Qishu = "<a href='/zt/3dsjhcx-20.htm' " + (topsize == 20 ? style : "") + ">近20期</a>" +
  55. // "<a href='/zt/3dsjhcx-50.htm' " + (topsize == 50 ? style : "") + ">近50期</a>" +
  56. // "<a href='/zt/3dsjhcx-80.htm' " + (topsize == 80 ? style : "") + ">近80期</a>" +
  57. // "<a href='/zt/3dsjhcx-120.htm' " + (topsize == 120 ? style : "") + ">近120期</a>";
  58. List<FC3DInfo> list;
  59. if (minYear <= year && year <= nowYear)
  60. {
  61. list = Caches.GetFC3DList(0, 0, year);
  62. Info = year.ToString() + "年";
  63. }
  64. else if (topsize == 20 || topsize == 50 || topsize == 80 || topsize == 120)
  65. {
  66. list = Caches.GetFC3DList(topsize, 0, 0);
  67. Info = "近" + topsize.ToString() + "期";
  68. }
  69. else if (term > 0)
  70. {
  71. list = Caches.GetFC3DList(0, term, 0);
  72. Info = term.ToString() + "期";
  73. }
  74. else
  75. {
  76. list = Caches.GetFC3DList(10, 0, 0);
  77. Info = "近10期";
  78. }
  79. //var list = Caches.GetFC3DList(topsize, OpenCodeType.ShiJiHao);
  80. if (null != list && 0 < list.Count)
  81. {
  82. int i = 1;
  83. foreach (var item in list)
  84. {
  85. IList<int> d = item.ShiJiHao.ToIntArray(',');
  86. if (null == d)
  87. break;
  88. if (0 == i % 2)
  89. { sp.AppendLine(" <tr class=\"grey\">"); }
  90. else
  91. { sp.AppendLine(" <tr>"); }
  92. sp.AppendLine(" <td>" + item.Term.ToString() + "</td>");
  93. sp.AppendLine(" <td>" + item.OpenTime.ToString("yyyy.MM.dd") + "</td>");
  94. sp.AppendLine(" <td><span>" + item.ShiJiHao.Replace(",", ",") + "</span></td>");
  95. sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(d).ToString() + "</td>");
  96. if (0 <= item.OpenCode1)
  97. {
  98. sp.AppendLine(" <td>" + item.OpenCode1 + "," + item.OpenCode2 + "," + item.OpenCode3 + "</td>");
  99. sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(item.OpenCode).ToString() + "</td>");
  100. sp.AppendLine(" <td>" + GetContains(item.OpenCode, item.ShiJiHao) + "</td>");
  101. }
  102. else
  103. {
  104. sp.AppendLine(" <td>---</td>");
  105. sp.AppendLine(" <td>---</td>");
  106. sp.AppendLine(" <td>---</td>");
  107. }
  108. sp.AppendLine(" </tr>");
  109. i++;
  110. }
  111. }
  112. columnNav = GetColumnNavForWap(entity.Lottery);
  113. base.InitData();
  114. }
  115. private string GetContains(IList<int> list, string numbers)
  116. {
  117. if (null == list || 0 >= list.Count || string.IsNullOrEmpty(numbers))
  118. return "";
  119. IList<int> d = numbers.ToIntArray(',');
  120. if (null == d || 0 >= d.Count)
  121. return "";
  122. int i = 0;
  123. foreach (var item in d)
  124. {
  125. if (list.Contains(item))
  126. i++;
  127. }
  128. return 0 == i ? "" : i.ToString();
  129. }
  130. }
  131. }