コード例 #1
0
        public static JsonQuestion getJsonQuestion(string questionContent)
        {
            JsonQuestion json = new JsonQuestion();

            json.question = questionContent;
            return(json);
        }
コード例 #2
0
        public static JsonQuestion getJsonQuestion(string questionContent, string choiceA, string choiceB, string choiceC, string choiceD)
        {
            JsonQuestion json = new JsonQuestion();

            json.question  = questionContent;
            json.choices.A = choiceA;
            json.choices.B = choiceB;
            json.choices.C = choiceC;
            json.choices.D = choiceD;
            return(json);
        }
コード例 #3
0
        public DAL_Question(Question question)
        {
            if (question is Multiple_Choice)
            {
                Multiple_Choice myMC = (Multiple_Choice)question;
                Type = "mc";
                JsonQuestion json = JsonQuestion.getJsonQuestion(myMC.QuestionContent, myMC.ChoiceA, myMC.ChoiceB, myMC.ChoiceC, myMC.ChoiceD);
                QuestionContent = Newtonsoft.Json.JsonConvert.SerializeObject(json);
            }
            else if (question is Compound)
            {
                Compound myCP = (Compound)question;
                Type = "cp";
                JsonQuestion json = JsonQuestion.getJsonQuestion(myCP.QuestionContent, myCP.ChoiceA, myCP.ChoiceB, myCP.ChoiceC, myCP.ChoiceD);
                QuestionContent = Newtonsoft.Json.JsonConvert.SerializeObject(json);
            }
            else if (question is Fill_In)
            {
                Fill_In myFi = (Fill_In)question;
                Type = "fi";
                JsonQuestion json = JsonQuestion.getJsonQuestion(myFi.QuestionContent);
                QuestionContent = JsonConvert.SerializeObject(json);
            }
            else if (question is Fast)
            {
                Fast myFa = (Fast)question;
                Type = "fs";
                JsonQuestion json = JsonQuestion.getJsonQuestion(myFa.QuestionContent);
                QuestionContent = JsonConvert.SerializeObject(json);
            }
            else if (question is True_False)
            {
                True_False myTf = (True_False)question;
                Type = "tf";
                JsonQuestion json = JsonQuestion.getJsonQuestion(myTf.QuestionContent);
                QuestionContent = JsonConvert.SerializeObject(json);
            }

            AnswerKey         = question.AnswerKey;
            ImageBase64String = question.Image64String;
        }