private static Question makeMatchingQuestion(XmlNode question) { Question res = new QuestionAppariement(); 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("subquestion")) { res.addReponse(new ReponseMatching(reponse.FirstChild.InnerText, reponse["answer"].FirstChild.InnerText)); } res.addTitre(titreq); res.feedbackQ = feedbackq; return(res); }
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); }
private static string exportReponsesAppariement(QuestionAppariement qmt) { String res = "{\n"; foreach (Reponse r in qmt.getReponses()) { ReponseMatching rm = (ReponseMatching)r; res += "=" + rm.texte1 + " => " + rm.texte2; res += "\n"; } if (!qmt.feedbackQ.Equals("")) { res += "####" + qmt.feedbackQ + "\n"; } res += "}\n\n"; return(res); }