Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        private void LoadBets()
        {
            List <BettingSquares> squares = new List <BettingSquares>();

            foreach (HockeyPoolGame g in todayGames)
            {
                BettingSquares bs = DBUtilities.GetGameBets(g.GameID);

                squares.Add(bs);
            }
            BindingSource binder = new BindingSource(squares, "");

            navBets.BindingSource = binder;
            navBets.BindingSource.PositionChanged += navBetsBindingSource_PositionChanged;
        }