コード例 #1
0
ファイル: Questions_Game.cs プロジェクト: ti3059/Ways
        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);
        }
コード例 #2
0
        public Test_Game(Candidate c)
        {
            Questions_Game question_Game = new Questions_Game();

            Questions       = question_Game.SelectQuestionsGame();
            currentQuestion = Questions[0];
            Candidate       = c;
        }
コード例 #3
0
ファイル: Questions_Game.cs プロジェクト: ti3059/Ways
        private Questions_Game TransformToQuestion(int id, string question)
        {
            Questions_Game questionGame = new Questions_Game(id, question);

            return(questionGame);
        }