コード例 #1
0
        /// <summary>
        /// This method gets battlefield data from the database
        /// </summary>

        protected void getCricket()
        {
            using (TeamContext db = new TeamContext())
            {
                var TeamData = (from allTeams in db.Teams
                                select allTeams);

                //
                CricketGridView.DataSource = TeamData.ToList();
                CricketGridView.DataBind();
            }
        }
コード例 #2
0
        /**
         *
         *<summary>
         * This method connects to db and displays cricket data.
         * </summary>
         *
         * @method GetCricketData
         * @returns {void}
         */
        protected void GetCricketData()
        {
            //connect to EF
            using (GameConnection db = new GameConnection())
            {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

                var cricketQuery = (from gc in db.GAMES
                                    where gc.GAME_TYPE == "cricket"
                                    select gc);

                CricketGridView.DataSource = cricketQuery.AsQueryable().OrderBy(SortString).ToList();
                CricketGridView.DataBind();
            }
        }