/**
         * Called When the MainTrainingPage is loaded.
         * Generate a question, either from the file system, or from the
         * database, and show that to the user. If a question is generated
         * it is also saved to the database.
         * */
        private void load()
        {
            // Set the welcome label
            lbl_welcome.Text = stateManager.getTrainingName() + " for " + stateManager.getUserName();

            // Load a question for the current training
            loadQuestion();
        }
示例#2
0
        /**
         * Sets the initial title of the page
         */
        private void setTitle()
        {
            string title = stateManager.getUserName() + "'s ";

            //Usernames [Admin] Dashboard.
            if (stateManager.isAdmin())
            {
                title += "[ADMIN] ";
            }

            title += " Dashboard ";

            this.Text = title;
        }
        public List <NameValueCollection> getWorstQuestions(StateManager stateManager, int numQuestions)
        {
            string userName     = stateManager.getUserName();
            string trainingName = stateManager.getTrainingName();

            string queryString = "select user.id AS userID, question.id AS questionID, (user_answers_question.numCorrect*1.0 / user_answers_question.numAttempt*1.0) AS pctCorrect, " +
                                 " numAttempt, numCorrect, numWrong, trainingName, userName, " +
                                 " question.question, correctAnswer, answer1, answer2, answer3, answer4, answer5, answer6, answer7, " +
                                 " answer8, answer9, answer10, answer11, answer12, answer13, answer14, answer15 " +
                                 "from user_answers_question, user, question " +
                                 "WHERE user_answers_question.userID = user.id " +
                                 " AND user_answers_question.questionID = question.id " +
                                 " AND pctCorrect NOT NULL " +
                                 " AND userName = '******' " +
                                 " AND trainingName = '" + trainingName + "' " +
                                 " ORDER BY pctCorrect " +
                                 " LIMIT " + numQuestions + "; ";

            return(query(queryString));
        }
示例#4
0
 /* Returns the name of the currently logged in user */
 private string getUser()
 {
     //TODO: Implement actual getUser
     return(stateManager.getUserName());
 }