Beispiel #1
0
        private void Upload(string league, DateTime koDate, string homeTeam, string awayTeam, IEnumerable <XElement> snaps)
        {
            int leagueId = addLeague(league);

            int hTeamId = AddTeam.DoIt(dbStuff, homeTeam);
            int aTeamId = AddTeam.DoIt(dbStuff, awayTeam);
            int gameId  = AddGame.DoIt(dbStuff, hTeamId, aTeamId, leagueId, koDate);

            log.Debug("Adding " + homeTeam + " [" + hTeamId + "] v " + awayTeam + " [" + aTeamId + "] in league [" + leagueId + "] with game id: " + gameId);
            SendStats(snaps, gameId);
        }
Beispiel #2
0
        protected void SendToWeb(string league, DateTime koDate, string homeTeam, string awayTeam, Dictionary <string, int> hstats, Dictionary <string, int> astats, string time)
        {
            int leagueId = addLeague(league);
            int hTeamId  = AddTeam.DoIt(dbStuff, homeTeam);
            int aTeamId  = AddTeam.DoIt(dbStuff, awayTeam);
            int gameId   = AddGame.DoIt(dbStuff, hTeamId, aTeamId, leagueId, koDate);

            List <int> allStats = new List <int>();

            allStats.AddRange(hstats.Values);
            allStats.AddRange(astats.Values);

            int retries = 0;

            log.Debug("Adding " + homeTeam + " [" + hTeamId + "] v " + awayTeam + " [" + aTeamId + "] in league [" + leagueId + "] with game id: " + gameId + " at time: " + time);

            log.Debug("Goals Corners");

            var line1 = hstats[statType[1]].ToString().PadRight(6) + hstats[statType[6]].ToString();
            var line2 = astats[statType[1]].ToString().PadRight(6) + astats[statType[6]].ToString();

            log.Debug(line1);
            log.Debug(line2);

            while (retries < keyClashRetries)
            {
                try
                {
                    AddStatistics.DoIt(dbStuff, isBet365(), allStats, gameId, time, "", koDate);
                }
                catch (DbException)
                {
                    log.Warn("Retrying....");
                    retries += 1;
                }
                break;
            }
        }
Beispiel #3
0
        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");
        }