/// <summary> /// Enter a bet by assigning a random score to the current user. /// </summary> /// <param name="amount"></param> /// <returns></returns> private int EnterBet(int amount) { if (dataGridSchedule.CurrentRow == null) { return(1); } HockeyPoolGame g = (HockeyPoolGame)dataGridSchedule.CurrentRow.DataBoundItem; BettingSquares squares; squares = DBUtilities.GetGameBets(g.GameID); if (squares.SquaresFull()) { MessageBox.Show("No more bets available for this game."); return(1); } int home, away; do { RandomScore(out home, out away); } while (!squares.IsSquareAvailable(home, away)); // we have a score and a bet, now record the bet int betResult = DBUtilities.EnterBet(currentUser.ID, 1, g.GameID, home, away); return(betResult); }
public EnterBet(int amount, HockeyPoolGame g, int user) { InitializeComponent(); lblBetAmount.Text = "$" + amount.ToString() + " bet"; betAmount = amount; cmdAwayTeam.Text = g.AwayTeam; cmdHomeTeam.Text = g.HomeTeam; currentGame = g; userID = user; }
/// <summary> /// Enter a bet for a specific winning team. /// </summary> /// <param name="amount"></param> private void EnterBetWinningTeam(int amount) { if (dataGridSchedule.CurrentRow == null) { return; } Form frmBet; HockeyPoolGame g = (HockeyPoolGame)dataGridSchedule.CurrentRow.DataBoundItem; frmBet = new EnterBet(amount, g, currentUser.ID); frmBet.Show(); }
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(); }