protected virtual int addLeague(string league) { return(AddLeague.DoIt(dbStuff, league)); }
public void AddTodaysMatches(int sleepTime, DriverWrapper driver) { var foundMatches = new List <aMatch>(); driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; driver.ForceSleep(sleepTime); driver.GetElementAndClick("splashSection", "MATCH MARKETS"); driver.ForceSleep(sleepTime); driver.GetElementAndClick("splashSection", "Main"); driver.ForceSleep(sleepTime); driver.GetElementAndClick("genericRow", "Full Time Result"); driver.ForceSleep(sleepTime); // it takes time for genericRow to expand GetPreMatchData(driver, foundMatches); ///////////////////// int longestTeam1 = foundMatches.Select(x => x.team1).Max(x => x.Length); int longestTeam2 = foundMatches.Select(x => x.team2).Max(x => x.Length); int longestLeague = foundMatches.Select(x => x.league).Max(x => x.Length); foreach (aMatch m in foundMatches) { Console.WriteLine(m.team1.PadRight(longestTeam1 + 1) + " " + m.team2.PadRight(longestTeam2 + 1) + " at " + m.koDateTime.TimeOfDay + " in " + m.league); int leagueId = AddLeague.DoIt(m_dbStuff, m.league); int hTeamId = AddTeam.DoIt(m_dbStuff, m.team1); int aTeamId = AddTeam.DoIt(m_dbStuff, m.team2); int gameId = AddGame.DoIt(m_dbStuff, hTeamId, aTeamId, leagueId, m.koDateTime); m.id = gameId; } ///////////////////// driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; driver.ForceSleep(sleepTime); driver.GetElementAndClick("splashSection", "CORNERS"); driver.ForceSleep(sleepTime); //driver.GetElementAndClick("genericRow", "Race To 3 Corners"); //driver.ForceSleep(sleepTime); //GetRaceToCornerData(driver, foundMatches, 3); /////////////////////// //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; //driver.ForceSleep(sleepTime); //driver.GetElementAndClick("genericRow", "Race To 5 Corners"); //driver.ForceSleep(sleepTime); //GetRaceToCornerData(driver, foundMatches, 5); /////////////////////// //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; //driver.ForceSleep(sleepTime); //driver.GetElementAndClick("genericRow", "Race To 7 Corners"); //driver.ForceSleep(sleepTime); //GetRaceToCornerData(driver, foundMatches, 7); /////////////////////// //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; //driver.ForceSleep(sleepTime); //driver.GetElementAndClick("genericRow", "Race To 9 Corners"); //driver.ForceSleep(sleepTime); //GetRaceToCornerData(driver, foundMatches, 9); ///////////////////// //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1"; //driver.ForceSleep(sleepTime); driver.GetElementAndClick("genericRow", "Asian Total Corners"); System.Threading.Thread.Sleep(sleepTime); driver.ForceSleep(sleepTime); GetAsianCornerData(driver, foundMatches); ///////////////////// foreach (aMatch m in foundMatches) { Console.WriteLine(m.team1.PadRight(longestTeam1 + 1) + " " + m.team2.PadRight(longestTeam2 + 1) + " corner line: " + m.cornerLine + " " + m.homeAsianCornerPrice + "//" + m.awayAsianCornerPrice); if (String.IsNullOrEmpty(m.cornerLine) == false) { AddCornerData.DoIt(m_dbStuff, m.id, m.cornerLine, m.homeAsianCornerPrice, m.awayAsianCornerPrice); } if (String.IsNullOrEmpty(m.homeRaceTo3CornersPrice) == false && String.IsNullOrEmpty(m.awayRaceTo3CornersPrice) == false && String.IsNullOrEmpty(m.neitherRaceTo3CornersPrice) == false) { AddRaceToCornerData.DoIt(m_dbStuff, m.id, 3, m.homeRaceTo3CornersPrice, m.awayRaceTo3CornersPrice, m.neitherRaceTo3CornersPrice); } if (String.IsNullOrEmpty(m.homeRaceTo5CornersPrice) == false && String.IsNullOrEmpty(m.awayRaceTo5CornersPrice) == false && String.IsNullOrEmpty(m.neitherRaceTo5CornersPrice) == false) { AddRaceToCornerData.DoIt(m_dbStuff, m.id, 5, m.homeRaceTo5CornersPrice, m.awayRaceTo5CornersPrice, m.neitherRaceTo5CornersPrice); } if (String.IsNullOrEmpty(m.homeRaceTo7CornersPrice) == false && String.IsNullOrEmpty(m.awayRaceTo7CornersPrice) == false && String.IsNullOrEmpty(m.neitherRaceTo7CornersPrice) == false) { AddRaceToCornerData.DoIt(m_dbStuff, m.id, 7, m.homeRaceTo7CornersPrice, m.awayRaceTo7CornersPrice, m.neitherRaceTo7CornersPrice); } if (String.IsNullOrEmpty(m.homeRaceTo9CornersPrice) == false && String.IsNullOrEmpty(m.awayRaceTo9CornersPrice) == false && String.IsNullOrEmpty(m.neitherRaceTo9CornersPrice) == false) { AddRaceToCornerData.DoIt(m_dbStuff, m.id, 9, m.homeRaceTo9CornersPrice, m.awayRaceTo9CornersPrice, m.neitherRaceTo9CornersPrice); } if (String.IsNullOrEmpty(m.homeWinPrice) == false && String.IsNullOrEmpty(m.drawPrice) == false && String.IsNullOrEmpty(m.awayWinPrice) == false) { AddFinalResultPrices.DoIt(m_dbStuff, m.id, m.homeWinPrice, m.drawPrice, m.awayWinPrice); } } /////////////////////// Console.WriteLine("Finished"); }