Beispiel #1
0
        public List <Questions_Game> SelectQuestionsGame()
        {
            MySqlDataReader       reader            = null;
            Server                s                 = new Server();
            List <Questions_Game> _lstQuestionsGame = new List <Questions_Game>();

            try
            {
                s.connection.Open();
                MySqlCommand command = new MySqlCommand("SELECT * FROM question_jeu", s.connection);
                using (reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Questions_Game _question_Game = TransformToQuestion(Convert.ToInt32(reader["id"]), Convert.ToString(reader["question"]));
                        _lstQuestionsGame.Add(_question_Game);
                    }
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (s.connection != null)
                {
                    s.connection.Close();
                }
            }
            return(_lstQuestionsGame);
        }
Beispiel #2
0
        public Test_Game(Candidate c)
        {
            Questions_Game question_Game = new Questions_Game();

            Questions       = question_Game.SelectQuestionsGame();
            currentQuestion = Questions[0];
            Candidate       = c;
        }
Beispiel #3
0
        private Questions_Game TransformToQuestion(int id, string question)
        {
            Questions_Game questionGame = new Questions_Game(id, question);

            return(questionGame);
        }