public ReponseQuizz RechercheReponseQuizz(string reponse)
        {
            ReponseQuizz reponseQuestion = new ReponseQuizz();


            var requeteReponseQuizz = from ReponseQuizz in InitListeReponseQuizz()
                                      where ReponseQuizz.reponseQuizz1 == reponse
                                      select ReponseQuizz;


            reponseQuestion = requeteReponseQuizz.Single();
            return(reponseQuestion);
        }
        public ReponseQuizz RechercheReponseTrueQuizz(string question)
        {
            ReponseQuizz reponseQuizz = new ReponseQuizz();

            var requeteReponseQuizz = from ReponseQuizz in InitListeReponseQuizz()
                                      where ReponseQuizz.isTrue == "TRUE "
                                      where ReponseQuizz.QuestionQuizz1.questionQuizz1 == question
                                      select ReponseQuizz;


            reponseQuizz = requeteReponseQuizz.Single();
            return(reponseQuizz);
        }
        /// <summary>
        /// Permet de verifier si le quizz est correct ou non
        /// </summary>
        /// <param name="reponseQuizzJoueur">reponse donne au quizz par le joueur</param>
        /// <param name="quizz">Objet quizz</param>
        /// <param name="reponseQuizz">reponse du quizz recherche en base et compare a la reponse du joueur</param>
        /// <returns></returns>
        public Boolean QuizzCorrect(String reponseQuizzJoueur, Quizz quizz, ReponseQuizz reponseQuizz)
        {
            Boolean repQuizz;

            repQuizz = false;


            //String reponseChoisie = ;

            //A MODIFIER
            if (reponseQuizzJoueur.Equals(reponseQuizz.reponseQuizz1))
            {
                repQuizz = true;
            }
            else
            {
                repQuizz = false;
            }
            return(repQuizz);
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            QuestionQuizz questionQuizz = service1.RechercheQuestionQuizz(label2.Text);
            ReponseQuizz  reponsejuste  = service1.RechercheReponseTrueQuizz(label2.Text);

            groupBox1.Controls.Add(radioButton1);
            groupBox1.Controls.Add(radioButton2);
            groupBox1.Controls.Add(radioButton3);


            foreach (RadioButton RB in groupBox1.Controls)
            {
                if (RB.Checked == true)
                {
                    reponse = RB.Text;
                    MessageBox.Show("Vous avez choisi la réponse suivante : " + reponse);
                }
            }
            ReponseQuizz reponseselectionne = service1.RechercheReponseQuizz(reponse);

            if (reponseselectionne.isTrue == "TRUE ")
            {
                MessageBox.Show("Bien joué +3 points");
                int score             = (int)joueur1.scoreJoueur;
                int nouveauscore      = score + 3;
                int confirmationscore = service1.modificationScore(joueur1, nouveauscore);
                MessageBox.Show("Votre score est maintenant de" + confirmationscore);
                this.Refresh();
            }
            else
            {
                MessageBox.Show("Dommage, retentez votre chance ! " +
                                "La réponse était" + reponsejuste.reponseQuizz1);
                this.Refresh();
            }

            List <String> questionQuizzs = service1.QuestionQuizzpartheme(themesouhaite);
            int           nb             = questionQuizzs.Count();

            if (i < nb)
            {
                label2.Text = questionQuizzs.ElementAt(i).ToString();

                List <String> reponsequestion = service1.ReponseQuizzparQuestion(label2.Text);
                int           nbreponse       = reponsequestion.Count();
                if (nbreponse == 3)
                {
                    radioButton1.Text = reponsequestion.ElementAt(0).ToString();
                    radioButton2.Text = reponsequestion.ElementAt(1).ToString();
                    radioButton3.Text = reponsequestion.ElementAt(2).ToString();
                }
                else
                {
                    MessageBox.Show("Le nombre de réponse n'est pas suffisante");
                }
                i++;
            }
            else
            {
                int score = (int)joueur1.scoreJoueur;
                MessageBox.Show("Vous avez fini le quizz ! Félicitation, votre score est désormais de" + score);
                this.Close();
            }
        }