Пример #1
0
 /// <summary>
 ///     多选题保存
 /// </summary>
 public int SubmitMultipeQuestion(int qID, tbQuestion question)
 {
     try
     {
         question.QuestionContent = Request.Form["hiddenQuestionContent"];
         string questionAnswer = Request.Form["hiddenQuestionAnswer"];
         if (questionAnswer != "")
         {
             int count = 1;
             foreach (
                 var qa in
                 questionAnswer.Split(new[] { "!!%!%!%!!" }, StringSplitOptions.RemoveEmptyEntries)
                 .Select(
                     quAnswer =>
                     quAnswer.Split(new[] { "***!!***" }, StringSplitOptions.RemoveEmptyEntries))
                 )
             {
                 question.QuestionAnswer.Add(new QuestionAnswer
                 {
                     Answer     = qa[0],
                     AnswerFlag = Convert.ToInt32(qa[1]),
                     AnswerType = 3,
                     Order      = count
                 });
                 count++;
             }
         }
         return(qID > 0 ? EQuestionBL.ModifyByID(question) : EQuestionBL.Insert(question));
     }
     catch
     {
         return(0);
     }
 }
Пример #2
0
 /// <summary>
 ///     填空题保存
 /// </summary>
 public int SubmitFillblankQuestion(int qID, tbQuestion question)
 {
     try
     {
         question.QuestionContent =
             Request.Form["hiddenQuestionContent"].Replace("(", "(")
             .Replace("(", "(")
             .Replace("(", "(")
             .Replace(")", ")")
             .Replace(")", ")")
             .Replace(")", ")");                                      //转换成英文括号,用于识别
         question.QuestionAnswer.Add(new QuestionAnswer
         {
             Answer     = Request.Form["txtQuestionAnswer"],
             AnswerFlag = 1,
             AnswerType = 1,
             Order      = 1
         });
         return(qID > 0 ? EQuestionBL.ModifyByID(question) : EQuestionBL.Insert(question));
     }
     catch
     {
         return(0);
     }
 }
Пример #3
0
 public int SubmitSubjectQuestion(int qID, tbQuestion question)
 {
     try
     {
         question.QuestionContent = Request.Form["hiddenQuestionContent"];
         question.QuestionAnswer.Add(new QuestionAnswer
         {
             Answer     = Request.Form["txtQuestionAnswer"],
             AnswerFlag = 1,
             AnswerType = 1,
             Order      = 1
         });
         return(qID > 0 ? EQuestionBL.ModifyByID(question) : EQuestionBL.Insert(question));
     }
     catch
     {
         return(0);
     }
 }