protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var table = Engine.EngineHelper.GetTopGames(); GamesListView.DataSource = table; GamesListView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var db = new x360ceModelContainer(); var rows = db.Programs.OrderByDescending(x => x.InstanceCount).Where(x => x.FileProductName.Length > 0).Take(20).ToArray(); GamesListView.DataSource = rows; GamesListView.DataBind(); } }
/** * <summary> * This method retrieves the matches found for the specified week. * </summary> * @method GetMatches * @returns {void} */ private void GetMatches() { try { DateTime initialDate = GameCalendar.SelectedDate; //Grab Date from Calendar DateTime startDate = initialDate.AddDays(Convert.ToInt32(initialDate.DayOfWeek) * -1); //Set to the first day of the desired week DateTime endDate = startDate.AddDays(7); //Set to the last day of the current week CalendarValue.InnerText = "Week of: " + GameCalendar.SelectedDate.ToString("MM/dd/yyyy"); using (DefaultConnection db = new DefaultConnection()) { //query the Matches table using EF and Linq var matches = (from allMatches in db.Matches join homeTeam in db.Teams on allMatches.HomeTeamID equals homeTeam.TeamID join awayTeam in db.Teams on allMatches.AwayTeamID equals awayTeam.TeamID join sport in db.Sports on homeTeam.SportID equals sport.SportID where allMatches.DateTime >= startDate && allMatches.DateTime <= endDate select new { allMatches.MatchID, allMatches.SportID, allMatches.HomeTeamID, allMatches.AwayTeamID, allMatches.Winner, MatchName = allMatches.Name, SportName = sport.Name, allMatches.DateTime, allMatches.SpecCount, allMatches.HomeTeamScore, HomeTeamName = homeTeam.Name, HomeTeamLogo = homeTeam.Logo, allMatches.AwayTeamScore, AwayTeamName = awayTeam.Name, AwayTeamLogo = awayTeam.Logo }); //bind the result to the GamesListView GamesListView.DataSource = matches.ToList(); GamesListView.DataBind(); } } catch (Exception e) { //Invalid Date Selection //Or Temporary Failure with Connection (no idea why it sometimes does this. Only has happened twice.) } }