private void PopulateIdentifyingAreasLeaderboard()
        {
            LearningGames lg = new LearningGames();
            RegisterLogin rl = new RegisterLogin();

            mlb = lg.GetAllLeadBoardRecords(connectionString).OrderByDescending(a => a.IDENTIFYING_AREAS_PERSONAL_BEST).ToList();

            int i = 1;

            foreach (var item in mlb)
            {
                user = rl.GetUser(item.USER_LIBRARY_CARD_ID, connectionString);

                DataGridBind dgb = new DataGridBind
                {
                    POSITION = i.ToString(),
                    NAME     = user[0].USER_FNAME + " " + user[0].USER_LNAME,
                    SCORE    = item.IDENTIFYING_AREAS_PERSONAL_BEST.ToString()
                };


                dgIdentifyingAreas.Items.Add(dgb);
                i++;
            }
        }
        private void PopulateReplacingBooksLeaderboard()
        {
            LearningGames lg = new LearningGames();
            RegisterLogin rl = new RegisterLogin();

            mlb = lg.GetAllLeadBoardRecords(connectionString).OrderBy(a => a.REPLACING_BOOKS_PERSONAL_BEST).ToList();

            int i = 1;

            foreach (var item in mlb)
            {
                user = rl.GetUser(item.USER_LIBRARY_CARD_ID, connectionString);

                DataGridBind dgb = new DataGridBind
                {
                    POSITION = i.ToString(),
                    NAME     = user[0].USER_FNAME + " " + user[0].USER_LNAME,
                    SCORE    = item.REPLACING_BOOKS_PERSONAL_BEST
                };


                dgReplacingBooks.Items.Add(dgb);
                i++;
            }
        }
        private void MainMenu1_Loaded(object sender, RoutedEventArgs e)
        {
            RegisterLogin rl = new RegisterLogin();

            List <ModelRegisterLogin> getUserName = rl.GetUser(currentUser, connectionString);

            lbCurrentUser.Content = "Welcome " + getUserName[0].USER_FNAME + " !";
        }
        private void UpdateLeaderBoardPersonalBest()
        {
            try
            {
                LearningGames lg = new LearningGames();
                RegisterLogin rl = new RegisterLogin();

                ModelLeaderBoard mlb = new ModelLeaderBoard
                {
                    USER_LIBRARY_CARD_ID = currentUser
                };

                List <ModelLeaderBoard> getPersonalBest = lg.GetPersonalBestIdentifyingAreas(mlb, connectionString);


                tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();



                if (getPersonalBest.Count == 1)
                {
                    tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();
                }



                getAllRecords = lg.GetIdentifyingAreasChampion(connectionString);

                if (getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST == 0)
                {
                    tbChampionName.Text = "No Champion Yet !";
                }
                else
                {
                    tbChampScore.Text = getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();

                    List <ModelLeaderBoard> getBestUserId = lg.GetChampionNameIdentifyingAreas(getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(), connectionString);

                    int id = getBestUserId[0].USER_LIBRARY_CARD_ID;

                    if (id == currentUser)
                    {
                        isChamp = true;
                    }

                    List <ModelRegisterLogin> getBestUser = rl.GetUser(id, connectionString);
                    tbChampionName.Text = getBestUser[0].USER_FNAME + " " + getBestUser[0].USER_LNAME;
                }
            }
            catch (Exception)
            {
                tbChampionName.Text = "No Champion Yet !";
            }
        }
コード例 #5
0
        //Updates labels related to personal best score and champion
        private void UpdateLeaderBoardPersonalBest()
        {
            try
            {
                LearningGames lg = new LearningGames();
                RegisterLogin rl = new RegisterLogin();

                ModelLeaderBoard mlb = new ModelLeaderBoard
                {
                    USER_LIBRARY_CARD_ID = currentUser
                };

                List <ModelLeaderBoard> getPersonalBest = lg.GetPersonalBestReplacingBooks(mlb, connectionString);

                if (getPersonalBest.Count == 1)
                {
                    lbPersonalBest.Text = getPersonalBest[0].REPLACING_BOOKS_PERSONAL_BEST.ToString();
                    pb = getPersonalBest[0].REPLACING_BOOKS_PERSONAL_BEST.ToString();
                }

                getAllRecords = lg.GetAllLeadBoardRecords(connectionString);

                SelectionSortBestTime();

                lbChampTime.Text = getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST;

                List <ModelLeaderBoard> getBestUserId = lg.GetChampionNameReplacingBooks(getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST.ToString(), connectionString);

                int id = getBestUserId[0].USER_LIBRARY_CARD_ID;

                List <ModelRegisterLogin> getBestUser = rl.GetUser(id, connectionString);
                tbChampionName.Text = getBestUser[0].USER_FNAME + " " + getBestUser[0].USER_LNAME;
                ChampTime           = getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST;
            }
            catch (Exception)
            {
                tbChampionName.Text = "No Champion Yet !";
            }
        }