Пример #1
0
        // This method will get the bets that the user has
        // just placed out of the database using the
        // betTime to tell the difference between new and
        // old bets
        public static List<Bet> GetBets(string betTime, string userName)
        {
            connection.Open();
            command.Connection = connection;
            command.Parameters.Clear();
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.AddWithValue("@UserName", userName);
            command.Parameters.AddWithValue("@BetTime", betTime);

            command.CommandText = "GetBets";

            var reader = command.ExecuteReader();

            while (reader.Read())
            {
                Bet newBets = new Bet()
                {
                    BetId = Convert.ToInt32(reader["BetId"]),
                    FixtureId = Convert.ToInt32(reader["FixtureId"]),
                    BetTime = reader["BetTime"].ToString(),
                    User = reader["UserName"].ToString(),
                    PlayerId = reader["PlayerId"].ToString()
                };
                bets.Add(newBets);
            }
            connection.Close();
            return bets;
        }
Пример #2
0
        protected void ddlPlayer6_SelectedIndexChanged(object sender, EventArgs e)
        {
            Bet bet = new Bet();
            {
                bet.FixtureId = Convert.ToInt16(ddlFixture6.SelectedValue);
                bet.BetTime = (string)(Session["BetTime"]);
                bet.User = (string)(Session["User"]);
                bet.PlayerId = ddlPlayer6.SelectedValue;

                bets.Add(bet);
            }
        }
Пример #3
0
        protected void ddlPlayer1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Bet bet = new Bet();
            {
                bet.FixtureId = Convert.ToInt16(ddlFixture1.SelectedValue);

                // This bet time is used to tell the difference between past and present bets
                // It is declared in the class above with the list items at the top of the page
                //bet.BetTime = betTime;
                bet.BetTime = (string)(Session["BetTime"]);
                bet.User = (string)(Session["User"]);
                bet.PlayerId = ddlPlayer1.SelectedValue;

                bets.Add(bet);
            }
        }