/Sqlite.Net/Soccer Score Forecast/OldClass/UpdateSqldata.cs

http://htmlconvertsql.googlecode.com/ · C# · 158 lines · 0 code · 10 blank · 148 comment · 0 complexity · de363a059c7e85eb6ed09630061f7bb4 MD5 · raw file

  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.Data;
  4. //using System.Drawing;
  5. //using System.IO;
  6. //using System.Text;
  7. //using System.Threading;
  8. //using System.Windows.Forms;
  9. //using MathWorks.MATLAB.NET.Arrays;
  10. //using System.Runtime.InteropServices;
  11. //using System.Text.RegularExpressions;
  12. //using mshtml;
  13. //using System.Net;
  14. //using System.Data.Linq;
  15. //using System.Data.Linq.Mapping;
  16. //using System.Reflection;
  17. //using System.Linq.Expressions;
  18. //using System.ComponentModel;
  19. //using HtmlAgilityPack;
  20. //using Soccer_Score_Forecast.LinqSql;
  21. //using System.Linq;
  22. //using System.Collections;
  23. //namespace Soccer_Score_Forecast
  24. //{
  25. // class OldUpdateSqldata
  26. // {
  27. // public static void UpdateTodayMatch()
  28. // {
  29. // DataClassesMatchDataContext matches = new DataClassesMatchDataContext();
  30. // var lt = matches.live_Table.OrderBy(o => o.s_date).ThenBy(p => p.s_time);//?lambda?????
  31. // foreach (var m in lt)
  32. // {
  33. // if (m.home_team_big != null)
  34. // {
  35. // //??????
  36. // live_Table_lib ltl = new live_Table_lib();
  37. // ltl.html_position = Int32.Parse(m.html_position);
  38. // ltl.home_team_big = Int32.Parse(TableHtmlAgilityPack.GetNumber(m.home_team_big));
  39. // ltl.away_team_big = Int32.Parse(TableHtmlAgilityPack.GetNumber(m.away_team_big));
  40. // ltl.match_type = m.match_type.Trim();
  41. // ltl.match_time = DateTime.Parse(m.s_date.Substring(0, 10) + " " + m.s_time);
  42. // ltl.status = m.full_time_score.Replace(" ", "").Trim();
  43. // ltl.home_team = m.home_team.Trim();
  44. // ltl.away_team = m.away_team.Trim();
  45. // ltl.home_red_card = TableHtmlAgilityPack.StringCount(m.home_team, " ", 0);
  46. // ltl.away_red_card = TableHtmlAgilityPack.StringCount(m.away_team, " ", 0);
  47. // ltl.full_home_goals = null;
  48. // ltl.full_away_goals = null;
  49. // if (m.half_time_score.IndexOf("-") > 0)
  50. // {
  51. // ltl.half_home_goals = Int32.Parse(m.half_time_score.Substring(0, m.half_time_score.IndexOf("-")));
  52. // ltl.half_away_goals = Int32.Parse(m.half_time_score.Substring(m.half_time_score.IndexOf("-") + 1, m.half_time_score.Length - m.half_time_score.IndexOf("-") - 1));
  53. // }
  54. // var rtExist =matches.live_Table_lib.Where (p=> p.home_team_big == ltl.home_team_big&& p.away_team_big == ltl.away_team_big);
  55. // //let????????
  56. // var rtUpdateExist = from p in rtExist
  57. // let timeDiff = ltl.match_time.Value - p.match_time.Value
  58. // where timeDiff.Days <= 1
  59. // where timeDiff.Days >= -1
  60. // select p;
  61. // //???????????????????????????1?
  62. // if (rtUpdateExist.Any())
  63. // {
  64. // var rtUpate = rtUpdateExist.First();
  65. // rtUpate.status = ltl.status;
  66. // rtUpate.home_team = ltl.home_team;
  67. // rtUpate.away_team = ltl.away_team;
  68. // rtUpate.home_red_card = ltl.home_red_card;
  69. // rtUpate.away_red_card = ltl.away_red_card;
  70. // rtUpate.half_home_goals = ltl.half_home_goals;
  71. // rtUpate.half_away_goals = ltl.half_away_goals;
  72. // matches.SubmitChanges();
  73. // }
  74. // //???????????
  75. // else
  76. // {
  77. // matches.live_Table_lib.InsertOnSubmit(ltl);
  78. // matches.SubmitChanges();
  79. // }
  80. // }
  81. // }
  82. // matches.live_Table.DeleteAllOnSubmit(lt);//?????
  83. // matches.SubmitChanges();
  84. // MessageBox.Show("OK");
  85. // //dataGridView1.DataSource = matches.live_Table_lib;
  86. // }
  87. // public static void UpdateLastMatch()
  88. // {
  89. // int i = 0;
  90. // DataClassesMatchDataContext matches = new DataClassesMatchDataContext();
  91. // var rt = matches.result_tb.OrderBy(o => o.s_date).ThenBy(p => p.s_time);//?lambda?????
  92. // //???????
  93. // DateTime lib_max_match_time = matches.result_tb_lib.Select(p => p.match_time).Max().Value.AddDays(-2);
  94. // foreach (var m in rt)
  95. // {
  96. // i++;
  97. // ProgressBarDelegate.DoSendPMessage(i);
  98. // Application.DoEvents();
  99. // if (m.home_team_big != null)
  100. // {
  101. // result_tb_lib rtl = new result_tb_lib();
  102. // rtl.html_position = Int32.Parse(m.html_position);
  103. // rtl.home_team_big = Int32.Parse(TableHtmlAgilityPack.GetNumber(m.home_team_big));
  104. // rtl.away_team_big = Int32.Parse(TableHtmlAgilityPack.GetNumber(m.away_team_big));
  105. // rtl.match_type = m.match_type.Trim();
  106. // rtl.match_time = DateTime.Parse(m.s_date.Substring(0, 10) + " " + m.s_time);
  107. // rtl.odds = m.odds.Trim();
  108. // rtl.win_loss_big = m.win_loss_big.Trim();
  109. // rtl.home_team = m.home_team.Trim();
  110. // rtl.away_team = m.away_team.Trim();
  111. // rtl.home_red_card = TableHtmlAgilityPack.StringCount(m.home_team, "&nbsp;", 0);
  112. // rtl.away_red_card = TableHtmlAgilityPack.StringCount(m.away_team, "&nbsp;", 0);
  113. // string bf = m.full_time_score.Replace("&nbsp;", "").Replace("&nbsp;", "");
  114. // if (m.full_time_score.IndexOf("-") > 0)
  115. // {
  116. // rtl.full_home_goals = Int32.Parse(bf.Substring(0, bf.IndexOf("-")));
  117. // rtl.full_away_goals = Int32.Parse(bf.Substring(bf.IndexOf("-") + 1, bf.Length - bf.IndexOf("-") - 1));
  118. // }
  119. // if (m.half_time_score.IndexOf("-") > 0)
  120. // {
  121. // rtl.half_home_goals = Int32.Parse(m.half_time_score.Substring(0, m.half_time_score.IndexOf("-")));
  122. // rtl.half_away_goals = Int32.Parse(m.half_time_score.Substring(m.half_time_score.IndexOf("-") + 1, m.half_time_score.Length - m.half_time_score.IndexOf("-") - 1));
  123. // }
  124. // //????????????????
  125. // if (rtl.match_time > lib_max_match_time)
  126. // {
  127. // //??????????
  128. // var rtExist = from p in matches.result_tb_lib
  129. // where p.match_time == rtl.match_time
  130. // where p.home_team_big == rtl.home_team_big
  131. // where p.away_team_big == rtl.away_team_big
  132. // select p;
  133. // //??????????
  134. // if (!rtExist.Any())
  135. // {
  136. // matches.result_tb_lib.InsertOnSubmit(rtl);
  137. // }
  138. // }
  139. // //?????
  140. // matches.result_tb.DeleteOnSubmit(m);
  141. // matches.SubmitChanges();
  142. // }
  143. // }
  144. // MessageBox.Show("OK");
  145. // //dataGridView1.DataSource = matches.result_tb_lib;
  146. // }
  147. // }
  148. //}