Beispiel #1
0
        /**
         * <summary>
         * This method sorts out the games played by week
         * </summary>
         * @method dotaSort
         * @returns {VOID}
         * */


        protected void dotaSort(object sender, EventArgs e)
        {
            if (weekNumberSort.Text == null)
            {
                Response.Redirect("~/Dota.aspx");
            }
            else
            {
                //store the input into a string
                string   week      = weekNumberSort.Text;
                string[] weekArray = null;
                char[]   splitChar = { 'W' };      //split the input into 2 parts the year will be stored in weekArray[0] and the week number is stored in the second index of the array
                weekArray = week.Split(splitChar);
                string weekNum = weekArray[1];     // store just the week number into a string variable

                int weekSort = int.Parse(weekNum); // parse the number as an integer

                //connect to EF
                using (GameTrackerConnection db = new GameTrackerConnection())
                {
                    //query the csgo table
                    var Dota = (from allData in db.Dotas
                                where allData.weekOfGame == weekSort
                                select allData);

                    //bind results to the gridview
                    DotaGridView.DataSource = Dota.ToList();
                    DotaGridView.DataBind();
                }
            }
        }
Beispiel #2
0
        /**
         *
         * <summary>
         * This method gets the dota data from the DB
         * </summary>
         * @method GetDotaData
         * @returns {void}
         * */

        protected void GetDotaData()
        {
            //connect to EF
            using (GameTrackerConnection db = new GameTrackerConnection())
            {
                //query the csgo table
                var Dota = (from allData in db.Dotas
                            select allData);

                //bind results to the gridview
                DotaGridView.DataSource = Dota.ToList();
                DotaGridView.DataBind();
            }
        }