Пример #1
0
        private static bool ReConstructQuestion(Question sq, Question oq)
        {
            bool result;

            if (sq.QID == oq.QID)
            {
                sq.CourseId  = oq.CourseId;
                sq.Text      = oq.Text;
                sq.ImageData = oq.ImageData;
                sq.ImageSize = oq.ImageSize;
                bool flag = false;
                if (sq.QType == QuestionType.FILL_BLANK_ALL)
                {
                    flag = true;
                }
                if (sq.QType == QuestionType.FILL_BLANK_GROUP)
                {
                    flag = true;
                }
                if (sq.QType == QuestionType.FILL_BLANK_EMPTY)
                {
                    flag = true;
                }
                foreach (object obj in sq.QuestionAnswers)
                {
                    QuestionAnswer questionAnswer = (QuestionAnswer)obj;
                    foreach (object obj2 in oq.QuestionAnswers)
                    {
                        QuestionAnswer questionAnswer2 = (QuestionAnswer)obj2;
                        if (questionAnswer.QAID == questionAnswer2.QAID)
                        {
                            if (flag)
                            {
                                string text  = QuestionHelper.RemoveSpaces(questionAnswer.Text).Trim().ToLower();
                                string value = QuestionHelper.RemoveSpaces(questionAnswer2.Text).Trim().ToLower();
                                if (text.Equals(value))
                                {
                                    questionAnswer.Chosen   = true;
                                    questionAnswer.Selected = true;
                                }
                            }
                            else
                            {
                                questionAnswer.Text   = questionAnswer2.Text;
                                questionAnswer.Chosen = questionAnswer2.Chosen;
                            }
                            break;
                        }
                    }
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Пример #2
0
 private static string RemoveNewLine(string s)
 {
     s = s.Replace(Environment.NewLine, "");
     s = QuestionHelper.RemoveSpaces(s);
     return(s);
 }