예제 #1
0
        private async void ResolveBets()
        {
            // get unresolved bets
            DataTable bets;

            int homeScore, awayScore;

            bets = tblBetsTableAdapter.GetDataByUnresolved();

            foreach (DataRow r in bets.Rows)
            {
                p = await hapi.GetGameResult(r["gameID"].ToString());

                homeScore = p.teams.home.teamStats.teamSkaterStats.goals;
                awayScore = p.teams.away.teamStats.teamSkaterStats.goals;

                // first check if there is any score, if not, the game has not been played yet
                if (homeScore == 0 && awayScore == 0)
                {
                    continue;
                }


                DBUtilities.ResolveBet((int)r["ID"], homeScore, awayScore);
            }


            this.tblUsersTableAdapter.Fill(this.hockeyPoolDataSet.tblUsers);
        }
예제 #2
0
        private async void LoadGames(string d)
        {
            p = await GetSchedule(d);

            todayGames.Clear();
            dataGridSchedule.DataSource = null;
            if (p == null)
            {
                MessageBox.Show("Could not get info.");

                return;
            }
            if (p.totalGames == 0)
            {
                //MessageBox.Show("No games scheduled for " + d);

                return;
            }

            HockeyPoolGame g;

            for (int i = 0; i < p.dates[0].games.Count; i++)
            {
                g = new HockeyPoolGame
                {
                    GameID     = p.dates[0].games[i].gamePk,
                    GameDate   = p.dates[0].games[i].gameDate,
                    HomeTeam   = p.dates[0].games[i].teams.home.team.name,
                    HomeTeamID = p.dates[0].games[i].teams.home.team.id,
                    AwayTeam   = p.dates[0].games[i].teams.away.team.name,
                    AwayTeamID = p.dates[0].games[i].teams.away.team.id
                };
                todayGames.Add(g);
            }

            dataGridSchedule.DataSource = todayGames;

            LoadBets();
        }
예제 #3
0
        public async Task <NHLAPI> GetSchedule(string d)
        {
            NHLAPI product = null;

            try
            {
                HttpResponseMessage response = await client.GetAsync("schedule?date=" + d).ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    product = await response.Content.ReadAsAsync <NHLAPI>();
                }

                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(product);
        }
예제 #4
0
        public async Task <NHLAPI> GetGameResult(string gameID)
        {
            NHLAPI product = null;

            try
            {
                HttpResponseMessage response = await client.GetAsync("game/" + gameID + "/boxscore").ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    product = await response.Content.ReadAsAsync <NHLAPI>();
                }

                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(product);
        }
예제 #5
0
        private async Task <NHLAPI> GetSchedule(string d)
        {
            p = await hapi.GetSchedule(d);

            return(p);
        }
예제 #6
0
        private async Task <NHLAPI> GetSchedule()
        {
            p = await hapi.GetSchedule();

            return(p);
        }
예제 #7
0
        private async Task <NHLAPI> LoadTeams()
        {
            p = await hapi.GetTeams();

            return(p);
        }