示例#1
0
        /**
         * <summary>
         * This method handles the pre-edit of a Match: show edit form and populate with data.
         * </summary>
         * @method GamesListView_ItemEditing
         * @param {object} sender
         * @param {ListViewEditEventArgs} e
         * @returns {void}
         */
        protected void GamesListView_ItemEditing(object sender, ListViewEditEventArgs e)
        {
            try
            {
                //Reverse engineer to work with data before updating database
                List <Match> matches = (List <Match>)GamesListView.DataSource; //List of Matches
                Match        match   = matches[GamesListView.EditItem.DataItemIndex];

                GamesListView.EditItem.FindControl("HomeTeamNameTextBox"); //Null - need item[rowindex]
                GamesListView.FindControl("HomeTeamNameTextBox");          //Null - need item[rowindex]
            }
            catch (Exception)
            {
                //
            }



            //Populate Edit Form with values

            //Query the Sports table for Match Type Drop Down List

            //Populate Match Type Selection

            //Update the Item

            //Show the Edit Form
        }
 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();
     }
 }
示例#4
0
        /**
         * <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.)
            }
        }