p3.aspx.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.Web.Kjh.History
  13. {
  14. public partial class p3 : WebPage
  15. {
  16. protected string Html = "", SelectHtml = "", Qishu = "", LastTerm = "", PageTitle = "";
  17. private int year = 0, topsize = 0, newterm = 0;
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. InitData();
  21. }
  22. protected override void InitData()
  23. {
  24. TCP3Info entity = Caches.GetTCP3Info(0, OpenCodeType.KaiJiangHao);
  25. if (entity == null) { ShowError(); return; }
  26. kjsj = entity.OpenTime.ToString("yyyy年MM月dd日");
  27. djsj = entity.OpenTime.AddDays(60).ToString("yyyy年MM月dd日");
  28. LastTerm = entity.Term.ToString();
  29. year = WRequest.GetQueryInt("year", 0);
  30. topsize = WRequest.GetQueryInt("topsize", 0);
  31. newterm = WRequest.GetQueryInt("newterm", 0);
  32. List<TCP3Info> lists = new List<TCP3Info>();
  33. if (year > 0)
  34. { lists = Caches.GetTCP3List(0, 0, year); PageTitle = year.ToString() + "年"; }
  35. else if (topsize == 50 || topsize == 80 || topsize == 120)
  36. { lists = Caches.GetTCP3List(topsize, 0, 0); PageTitle = "近" + topsize.ToString() + "期"; }
  37. else if (newterm > 0)
  38. { lists = Caches.GetTCP3List(0, newterm, 0); }
  39. else
  40. { lists = Caches.GetTCP3List(15, 0, 0); PageTitle = "近15期"; }
  41. Html = GetKjhHistotry(lists);
  42. lotMuen = GetLotMunes();
  43. InitSelectYear();
  44. base.InitData();
  45. }
  46. /// <summary>
  47. /// 初始化下拉年份
  48. /// </summary>
  49. private void InitSelectYear()
  50. {
  51. int minYear = 2004;
  52. int nowYear = DateTime.Now.Year;
  53. SelectHtml = @"<select name='selectyear' onchange='javascript:location.href=this.value;'><option>按年份</option>";
  54. for (int i = nowYear; i >= minYear; i--)
  55. SelectHtml += "<option value='/p3-history-" + i.ToString() + ".htm' " + ((year > 0 && year == i) ? "selected='selected'" : "") + ">" + i.ToString() + "年</option>";
  56. SelectHtml += "</select>";
  57. string style = "class='redQishu'";
  58. Qishu =
  59. "<a href='/p3-history-50.htm' " + (topsize == 50 ? style : "") + ">近50期</a>" +
  60. "<a href='/p3-history-80.htm' " + (topsize == 80 ? style : "") + ">近80期</a>" +
  61. "<a href='/p3-history-120.htm' " + (topsize == 120 ? style : "") + ">近120期</a>";
  62. }
  63. private string GetKjhHistotry(List<TCP3Info> lists)
  64. {
  65. StringBuilder sb = new StringBuilder();
  66. for (int i = 0; i < lists.Count; i++)
  67. {
  68. //291740962,42 5356078^一等奖|7|7072680,二等奖|183|99103,三等奖|1465|3000,四等奖|64270|200,五等奖|1089509|10,六等奖|8453034|5
  69. List<string> money = lists[i].Detail.Split('^').ToList()[0].Split(',').ToList();
  70. List<string> bonus = lists[i].Detail.Split('^').ToList()[1].Split(',').ToList();
  71. //if (money[1].Length == 8) money[1] = "0" + money[1];
  72. //string jiangci = (money[1].Length > 8 ? money[1].Substring(0, money[1].Length - 7) : "");
  73. //if (jiangci.Length > 0)
  74. // jiangci = jiangci.Substring(0, jiangci.Length - 1) + "." + jiangci.Substring(jiangci.Length - 1, 1);
  75. string trclass = "";
  76. if (i % 2 == 0) trclass = "bg_grey";
  77. sb.Append(@"<tr class='" + trclass + @"'>
  78. <td>" + lists[i].Term + @"</td>
  79. <td>" + lists[i].OpenTime.ToString("yyyy.MM.dd") + @"</td>
  80. <td>
  81. <ul class='ballbox middle'>
  82. <li class='ball wred-24'>" + lists[i].OpenCode1 + @"</li>
  83. <li class='ball wred-24'>" + lists[i].OpenCode2 + @"</li>
  84. <li class='ball wred-24'>" + lists[i].OpenCode3 + @"</li>
  85. </ul>
  86. </td>
  87. <td>" + money[0] + @"</td>
  88. <td>" + bonus[0].Split('|')[1] + @"注<i>" + bonus[0].Split('|')[2] + @"元</i></td>
  89. <td>" + bonus[1].Split('|')[1] + @"注<i>" + bonus[1].Split('|')[2] + @"元</i></td>
  90. <td>" + bonus[2].Split('|')[1] + @"注<i>" + bonus[2].Split('|')[2] + @"元</i></td>
  91. <td><a href='/p3-kjjg-" + lists[i].Term + @".htm'>详情</a><a href='http://www.55128.cn/zs/2_14.htm' target='_blank'>走势</a></td>
  92. </tr>");
  93. }
  94. return sb.ToString();
  95. }
  96. }
  97. }