コード例 #1
0
        private static Question makeQuestion(string reponses, string titreq)
        {
            Question res           = null;
            String   titrequestion = getTitreQuestion(titreq);
            String   nomquestion   = getNomQuestion(titreq);
            String   typequestion  = getTypeQuestion(reponses);

            titrequestion = titrequestion.Replace("\n", "");
            nomquestion   = nomquestion.Replace("\n", "");

            List <Reponse> reps = getReponses(reponses);

            switch (typequestion)
            {
            case "TRUEFALSE":
                res = new QuestionVF();
                break;

            case "ESSAY":
                res = new QuestionEssay();
                break;

            case "NUMERICAL":
                res = new QuestionNumerical();
                break;

            case "SIMPLE":
                res = new QuestionSimple();
                break;

            case "MULTIPLE":
                res = new QuestionMultiple();
                break;

            case "SHORTANSWER":
                res = new QuestionShort();
                break;

            case "APPARIEMENT":
                res = new QuestionAppariement();
                break;
            }
            foreach (Reponse r in reps)
            {
                cleanReponse(r);
                res.addReponse(r);
            }
            res.addTitre(titrequestion);
            res.nomq = nomquestion;
            return(res);
        }
コード例 #2
0
        private static Question makeEssayQuestion(XmlNode question)
        {
            Question res       = new QuestionEssay();
            String   titreq    = "";
            String   feedbackq = "";
            String   nom       = "";

            if (question.SelectSingleNode("name") != null)
            {
                nom = question["name"].FirstChild.InnerText;
            }
            res.nomq = nom;
            if (question.SelectSingleNode("questiontext") != null)
            {
                titreq = question["questiontext"].FirstChild.InnerText;
            }
            if (question.SelectSingleNode("generalfeedback") != null)
            {
                feedbackq = question["generalfeedback"].FirstChild.InnerText;
            }
            foreach (XmlNode reponse in question.SelectNodes("answer"))
            {
                String  feedbackr = "";
                Boolean vrai      = false;
                if (reponse.SelectSingleNode("feedback") != null)
                {
                    feedbackr = reponse["feedback"].FirstChild.InnerText;
                }
                if (double.Parse(reponse.Attributes[0].InnerText.Replace(".", ",")) > 0)
                {
                    vrai = true;
                }
                res.addReponse(new ReponseSimple(feedbackr, reponse["text"].InnerText, vrai));
            }
            res.addTitre(titreq);
            res.feedbackQ = feedbackq;
            return(res);
        }