/** * <summary> * This method sorts out the games played by week * </summary> * @method csgoSort * @returns {VOID} * */ protected void csgoSort(object sender, EventArgs e) { //checks to see if the week field is empty if (weekNumberSort.Text == null) { Response.Redirect("~/Csgo.aspx"); } else { string week = weekNumberSort.Text; //store the input into a string 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 Csgo = (from allData in db.Csgoes where allData.weekOfGame == weekSort select allData); //bind results to the gridview CsgoGridView.DataSource = Csgo.ToList(); CsgoGridView.DataBind(); } } }
/** * * <summary> * This method gets the csgo data from the DB * </summary> * @method GetCsgoData * @returns {void} * */ protected void GetCsgoData() { //connect to EF using (GameTrackerConnection db = new GameTrackerConnection()) { //query the csgo table var Csgo = (from allData in db.Csgoes select allData); //bind results to the gridview CsgoGridView.DataSource = Csgo.ToList(); CsgoGridView.DataBind(); } }