예제 #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ListGames = Template.FindName("PART_ListGames", this) as GamesGridView;
            if (ListGames != null)
            {
                SetListGamesBinding();
                ListGames.AppSettings = mainModel.AppSettings;

                BindingTools.SetBinding(ListGames,
                                        GamesGridView.SelectedItemProperty,
                                        mainModel,
                                        nameof(DesktopAppViewModel.SelectedGame),
                                        BindingMode.TwoWay);
                BindingTools.SetBinding(ListGames,
                                        GamesGridView.SelectedItemsListProperty,
                                        mainModel,
                                        nameof(DesktopAppViewModel.SelectedGamesBinder),
                                        BindingMode.TwoWay);
            }

            ControlTemplateTools.InitializePluginControls(
                mainModel.Extensions,
                Template,
                this,
                SDK.ApplicationMode.Desktop,
                mainModel,
                $"{nameof(DesktopAppViewModel.SelectedGameDetails)}.{nameof(GameDetailsViewModel.Game)}.{nameof(GameDetailsViewModel.Game.Game)}");
        }
예제 #2
0
        /**
         * <summary>
         * This method pupulate the Gridview with games list
         * The method take a integer value
         * if its true-show the list in that date, which can be selected using calender
         * if its false-show the list in the  week,which can be selected using the dropdown
         * </summary>
         *
         * @method GetGames
         * @returns {void}
         */
        protected void GetGames(Boolean checker)
        {
            string sortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

            // connect to EF
            using (GameTrackerConnection db = new GameTrackerConnection())
            {
                //checks whether it list should list by date or week
                if (checker)//show by date
                {
                    // query the games Table using EF and LINQ
                    var Games = (from allGames in db.Games
                                 where allGames.EventDate == DateSelectorCalendar.SelectedDate
                                 select allGames);

                    // bind the result to the GridView
                    GamesGridView.DataSource = Games.AsQueryable().OrderBy(sortString).ToList();
                    GamesGridView.DataBind();
                }
                else //show by week number
                {
                    int weekNo = Convert.ToInt32(WeekNoDropDownList.SelectedValue);//converting the selected week number to the int

                    // query the games Table using EF and LINQ
                    var Games = (from allGames in db.Games
                                 where allGames.WeekNo == weekNo
                                 select allGames);

                    // bind the result to the GridView
                    GamesGridView.DataSource = Games.AsQueryable().OrderBy(sortString).ToList();
                    GamesGridView.DataBind();
                }
            }
        }
        /**
         * <summary>
         * This method gets the game data from the DB
         * </summary>
         *
         * @method GetGames
         * @param {int} week
         * @returns {void}
         */
        protected void GetGames(int week)
        {
            string sortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

            //connect to EF
            using (GTConnection db = new GTConnection())
            {
                //query the Games Table using EF and LINQ
                var Games = (from allGames in db.Games
                             join allTeams in db.Teams on allGames.WinningID equals allTeams.TeamID
                             where allGames.Week == week
                             select new
                {
                    allGames.GameID,
                    allGames.Week,
                    allGames.GameName,
                    allGames.GameDescription,
                    allGames.NumberOfSpectators,
                    TotalScore = allGames.Team1Score + allGames.Team2Score,
                    Winner = allTeams.TeamName
                });

                //bind the result to the GridView
                GamesGridView.DataSource = Games.AsQueryable().OrderBy(sortString).ToList();
                GamesGridView.DataBind();
            }
        }
        /**
         * @description retrieves the games from the database
         * @method GetGames
         * @return {void}
         */
        protected void GetGames()
        {
            // connect to the entity framework5

            using (TeamConnection db = new TeamConnection())
            {
                //query the Students table using EF and LINQ
                var games = (from g in db.Games
                             join t1 in db.Teams on g.HomeTeamId equals t1.TeamId
                             join t2 in db.Teams on g.AwayTeamId equals t2.TeamId
                             select new
                {
                    Home = t1.TeamName,
                    Away = t2.TeamName,
                    Points = g.AwayPoints + g.HomePoints,
                    Spectators = g.Spectators,
                    GameDate = g.GameDate,
                    GameId = g.GameId
                });

                //bind the result to the gridview
                GamesGridView.DataSource = games.ToList();
                GamesGridView.DataBind();
            }
        }
예제 #5
0
        protected void GetGames()
        {
            using (GameConnection db = new GameConnection())
            {
                var Games = (from allGames in db.games
                             select allGames);

                //Bind the result
                GamesGridView.DataSource = Games.ToList();
                GamesGridView.DataBind();
            }
        }
예제 #6
0
        /**
         * <summary>
         * This method gets the Game data from the DB
         * </summary>
         *
         * @method GetGames
         * @returns {void}
         */
        protected void GetGames()
        {
            // connect to EF
            using (DefaultConnection db = new DefaultConnection())
            {
                // query the Students Table using EF and LINQ
                var Games = (from allGames in db.Games
                             select allGames);

                // bind the result to the GridView
                GamesGridView.DataSource = Games.ToList();
                GamesGridView.DataBind();
            }
        }
예제 #7
0
        /**
         * <summary>
         * This method gets the student data from the DB
         * </summary>
         *
         * @method GetGames
         * @returns {void}
         */
        protected void GetGames()
        {
            // connect to EF
            using (GameTrackerConn db = new GameTrackerConn()) {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

                // query the Gridview_template_item_view1 Table using EF and LINQ
                var GamesList = (from allGames in db.Games
                                 select allGames);

                // bind the result to the GridView
                GamesGridView.DataSource = GamesList.AsQueryable().OrderBy(SortString).ToList();
                GamesGridView.DataBind();
            }
        }
예제 #8
0
        /**
         *
         * <summary>
         * This method gets the game data from the database
         * </summary>
         *
         * @method GetGames
         * @returns {void}
         *
         */
        protected void GetGames()
        {
            //Connect to Entity Framework
            using (DefaultContext db = new DefaultContext())
            {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();
                //Query the Games Table using Entity Framework and LINQ
                var Games = (from allGames in db.GameInfoes
                             select allGames);

                //Bind the result to the GridView
                GamesGridView.DataSource = Games.AsQueryable().OrderBy(SortString).ToList();
                GamesGridView.DataBind(); //Creates 1-way Data Binding
            }
        }
        /// <summary>
        /// This method gets the game data from the DB
        /// </summary>
        private void GetGames()
        {
            // connect to EF DB
            using (CricketInfo db = new CricketInfo())
            {
                string SortString = Session["SortColumn"].ToString() + " " +
                                    Session["SortDirection"].ToString();

                // query the CricketInfo Table using EF and LINQ
                var Games = (from allGames in db.CricketInfoMains
                             select allGames);

                // bind the result to the Students GridView
                GamesGridView.DataSource = Games.AsQueryable().OrderBy(SortString).ToList();
                GamesGridView.DataBind();
            }
        }
예제 #10
0
        private async void GamesGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var gameDefinition = ((GameDefinition)e.ClickedItem);

            triggered = true;

            await Task.WhenAll(new []
            {
                AnimationTrigger.AnimateClose(),
                Boxtana.Do(BoxtanaAction.Exit),
                GamesGridView.AnimateItems(
                    new BounceOutDownAnimation(), 0.05,
                    gameDefinition,
                    new ExpandAnimation {
                    Duration = 0.8, FinalScale = 1.1
                })
            });

            Frame.Navigate(typeof(GamePage), gameDefinition.UniqueId);
        }
예제 #11
0
        /**
         * <summary>
         * This method gets the games from the database and puts them into the gridview based on the date specified in the dropdown menu
         * </summary>
         * @method GetGames
         * @return {void}
         * */
        protected void GetGames()
        {
            //connect to EF
            using (GameTrackerConnection db = new GameTrackerConnection())
            {
                DateTime date1 = new DateTime();
                DateTime date2 = new DateTime();
                date1 = Convert.ToDateTime(TrackingWeekDropDown.SelectedValue);
                date2 = Convert.ToDateTime(TrackingWeekDropDown.Items[TrackingWeekDropDown.SelectedIndex + 1].Value);

                //query the Games table using EF and LINQ
                var Games = (from allGames in db.Games
                             where allGames.Created >= date1.Date &&
                             allGames.Created < date2.Date
                             select allGames);

                //bind results to gridview
                GamesGridView.DataSource = Games.AsQueryable().ToList();
                GamesGridView.DataBind();
                TrackingDateLabel.Text = date1.ToString("MMMM dd, yyyy") + " To " + date2.ToString("MMMM dd, yyyy");
            }
        }
예제 #12
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ListGames = Template.FindName("PART_ListGames", this) as GamesGridView;
            if (ListGames != null)
            {
                SetListGamesBinding();
                ListGames.AppSettings = mainModel.AppSettings;

                BindingTools.SetBinding(ListGames,
                                        GamesGridView.SelectedItemProperty,
                                        mainModel,
                                        nameof(DesktopAppViewModel.SelectedGame),
                                        BindingMode.TwoWay);
                BindingTools.SetBinding(ListGames,
                                        GamesGridView.SelectedItemsListProperty,
                                        mainModel,
                                        nameof(DesktopAppViewModel.SelectedGamesBinder),
                                        BindingMode.TwoWay);
            }
        }
        /**
         * <summary>
         * This function will get the games from the database and bind them to the gridview
         * </summary>
         *
         * @method GetGames
         * @returns {void}
         */
        protected void GetGames()
        {
            //Opens the DB and gets all the data from the games table for that week.
            //It also includes a column TotalPoints as the sum of the points entered for teams one and two.
            SqlCommand getGames = new SqlCommand("SELECT *, (TeamOnePoints+TeamTwoPoints) AS TotalPoints FROM GamesTable WHERE Week = @Week", db);

            getGames.Parameters.AddWithValue("@Week", weekNum);
            db.Open();
            reader = getGames.ExecuteReader();
            gamesData.Load(reader);
            db.Close();

            gamesData.Columns.Add(new DataColumn("TeamOne", typeof(string)));
            gamesData.Columns.Add(new DataColumn("TeamTwo", typeof(string)));
            gamesData.Columns.Add(new DataColumn("GameWinner", typeof(string)));
            gamesData.Columns.Add(new DataColumn("GameNum", typeof(string)));

            int gameNum = 1;

            foreach (DataRow row in gamesData.Rows)
            {
                row["GameNum"] = "Game #" + gameNum;
                gameNum++;

                //This set of if/else statements will print a blank if there is no team (e.g. new game),
                //or will get the team name from the teams table using the team id (e.g. game that has been edited to include data).
                if (Int32.Parse(row["TeamOneID"].ToString()) == 0)
                {
                    row["TeamOne"] = "";
                }
                else
                {
                    SqlCommand getTeamNames = new SqlCommand("SELECT TeamName FROM TeamTable WHERE TeamID = @ID", db);
                    getTeamNames.Parameters.AddWithValue("@ID", row["TeamOneID"].ToString());
                    db.Open();
                    reader = getTeamNames.ExecuteReader();
                    while (reader.Read())
                    {
                        row["TeamOne"] = (String)reader["TeamName"];
                    }
                    db.Close();
                }

                if (Int32.Parse(row["TeamTwoID"].ToString()) == 0)
                {
                    row["TeamTwo"] = "";
                }
                else
                {
                    SqlCommand getTeamNames = new SqlCommand("SELECT TeamName FROM TeamTable WHERE TeamID = @ID", db);
                    getTeamNames.Parameters.AddWithValue("@ID", row["TeamTwoID"].ToString());
                    db.Open();
                    reader = getTeamNames.ExecuteReader();
                    while (reader.Read())
                    {
                        row["TeamTwo"] = (String)reader["TeamName"];
                    }
                    db.Close();
                }

                //This if/elseif/else statment will print a blank for new/empty games,
                //the winning team for wins, or "tie" where a game was tied
                if (Int32.Parse(row["Winner"].ToString()) == 0)
                {
                    row["GameWinner"] = "";
                }
                else if (Int32.Parse(row["Winner"].ToString()) == 5)
                {
                    row["GameWinner"] = "Tie";
                }
                else
                {
                    SqlCommand getWinner = new SqlCommand("SELECT TeamName FROM TeamTable WHERE TeamID = @winID", db);
                    getWinner.Parameters.AddWithValue("@winID", row["Winner"].ToString());
                    db.Open();
                    reader = getWinner.ExecuteReader();
                    while (reader.Read())
                    {
                        row["GameWinner"] = (String)reader["TeamName"];
                    }
                    db.Close();
                }
            }


            GamesGridView.DataSource = gamesData.DefaultView;
            GamesGridView.DataBind();
        }
예제 #14
0
 private void BindGameGrid()
 {
     GamesGridView.DataSource = ThePresenter.PassedGames;
     GamesGridView.DataBind();
 }