static public IVariantEditControl GetEditableControl(IQuestionAnswer answer)
 {
     if (answer is AccordanceQuestionAnswer)
     {
         return(new AccordanceVariantEditControl(answer as AccordanceQuestionAnswer));
     }
     else
     if (answer is AlternativeQuestionAnswer)
     {
         return(new AlternativeVariantEditControl(answer as AlternativeQuestionAnswer));
     }
     else
     if (answer is FreeStatementQuestionAnswer)
     {
         return(new FreeStatementVariantEditControl(answer as FreeStatementQuestionAnswer));
     }
     else
     if (answer is MultiQuestionAnswer)
     {
         return(new MultiVariantEditControl(answer as MultiQuestionAnswer));
     }
     else
     if (answer is SingleQuestionAnswer)
     {
         return(new SingleVariantEditControl(answer as SingleQuestionAnswer));
     }
     else
     if (answer is SequenceQuestionAnswer)
     {
         return(new SequenceVariantEditControl(answer as SequenceQuestionAnswer));
     }
     throw new ArgumentException("Для данного типа answer не найден соответствующий элемент управления");
 }
예제 #2
0
 public Question(string Name, IQuestionInfo QuestionInfo, IQuestionAnswer QuestionAnswer, string Section = null)
 {
     this.QuestionInfo   = QuestionInfo;
     this.QuestionAnswer = QuestionAnswer;
     this.Name           = Name;
     this.Section        = Section;
 }
예제 #3
0
 static public IVariantPassingControl GetPassingControl(IQuestionAnswer questionAnswer, bool isPreviewState)
 {
     if (questionAnswer is AccordanceQuestionAnswer)
     {
         return(new AccordanceVariantPassControl(questionAnswer as AccordanceQuestionAnswer, isPreviewState));
     }
     else
     if (questionAnswer is AlternativeQuestionAnswer)
     {
         return(new AlternativeVariantPassControl(questionAnswer as AlternativeQuestionAnswer, isPreviewState));
     }
     else
     if (questionAnswer is FreeStatementQuestionAnswer)
     {
         return(new FreeStatementPassControl(questionAnswer as FreeStatementQuestionAnswer, isPreviewState));
     }
     else
     if (questionAnswer is MultiQuestionAnswer)
     {
         return(new MultiVariantPassControl(questionAnswer as MultiQuestionAnswer, isPreviewState));
     }
     else
     if (questionAnswer is SingleQuestionAnswer)
     {
         return(new SingleVariantPassControl(questionAnswer as SingleQuestionAnswer, isPreviewState));
     }
     else
     if (questionAnswer is SequenceQuestionAnswer)
     {
         return(new SequenceVariantPassControl(questionAnswer as SequenceQuestionAnswer, isPreviewState));
     }
     throw new ArgumentException("Для данного типа questionAnswer не найден соответствующий элемент управления");
 }
예제 #4
0
 public Question(Question questionToClone)
 {
     //QuestionType = questionToClone.QuestionType;
     Section        = questionToClone.Section;
     Name           = questionToClone.Name;
     QuestionInfo   = questionToClone.QuestionInfo;
     QuestionAnswer = questionToClone.QuestionAnswer;
 }
예제 #5
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            var tmp_questionAnswer = (variants as IVariantEditControl).GetAnswer();

            if (tmp_questionAnswer.ValidateAnswer())
            {
                _questionAnswer = tmp_questionAnswer;
                DialogResult    = DialogResult.OK;
            }
        }
예제 #6
0
 private void buttonRedaktVariants_Click(object sender, EventArgs e)
 {
     using (var editVariantsForm = new EditAnswerVariants(_answer))
     {
         if (editVariantsForm.ShowDialog() == DialogResult.OK)
         {
             _answer = editVariantsForm.QuestionAnswer;
         }
     }
 }
예제 #7
0
        public CreateEditQuestion(Editor parent, List <string> sections)
        {
            InitializeComponent();
            this.parent = parent;

            comboBoxType.SelectedIndex = 0;
            _answer = new SingleQuestionAnswer();

            foreach (var section in sections)
            {
                comboBoxSection.Items.Add(section);
            }
            comboBoxSection.SelectedIndex = 0;
            infoEdit = new SimpleInfoEditControl();
            panelInfo.Controls.Add(infoEdit as UserControl);
        }
예제 #8
0
        private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e)
        {
            //DONE: предупреждение
            if (comboBoxType.SelectedIndex == lastTypeSelectedIndex)
            {
                return;
            }
            if (lastTypeSelectedIndex != null)
            {
                if (MessageBox.Show("При смене типа вопроса текущие варианты ответа будут потеряны. Продолжить?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    comboBoxType.SelectedIndex = lastTypeSelectedIndex.Value;
                    return;
                }
            }
            lastTypeSelectedIndex = comboBoxSection.SelectedIndex;
            switch (comboBoxType.SelectedIndex)
            {
            case 0:
                _answer = new SingleQuestionAnswer();
                break;

            case 1:
                _answer = new AlternativeQuestionAnswer();
                break;

            case 2:
                _answer = new AccordanceQuestionAnswer();
                break;

            case 3:
                _answer = new SequenceQuestionAnswer();
                break;

            case 4:
                _answer = new FreeStatementQuestionAnswer();
                break;

            case 5:
                _answer = new MultiQuestionAnswer();
                break;

            default:
                throw new ArgumentException("Поле comboBoxType содержит недопустимое значение");
            }
        }
예제 #9
0
 public TestController(IQuestionAnswer iquestionAnswer)
 {
     _iquestionAnswer = iquestionAnswer;
 }
예제 #10
0
 public EditAnswerVariants(IQuestionAnswer questionAnswer) : this()
 {
     variants = EditableControlFactory.GetEditableControl(questionAnswer) as UserControl;
     panel.Controls.Add(variants);
     variants.Dock = DockStyle.Fill;
 }
예제 #11
0
        public CreateEditQuestion(Editor parent, List <string> sections, IQuestion questionToChange)
        {
            InitializeComponent();
            this.parent = parent;

            textBoxName.Enabled    = false;
            _isChangeQuestionState = true;

            textBoxName.Text = questionToChange.Name;
            infoEdit         = InfoEditableControlFactory.GetInfoEditableControl(questionToChange.QuestionInfo);
            panelInfo.Controls.Add(infoEdit as UserControl);

            if (questionToChange.QuestionAnswer is SingleQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 0;
                _answer = new SingleQuestionAnswer(questionToChange.QuestionAnswer as SingleQuestionAnswer);
            }
            else
            if (questionToChange.QuestionAnswer is AlternativeQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 1;
                _answer = new AlternativeQuestionAnswer(questionToChange.QuestionAnswer as AlternativeQuestionAnswer);
            }
            else
            if (questionToChange.QuestionAnswer is AccordanceQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 2;
                _answer = new AccordanceQuestionAnswer(questionToChange.QuestionAnswer as AccordanceQuestionAnswer);
            }
            else
            if (questionToChange.QuestionAnswer is SequenceQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 3;
                _answer = new SequenceQuestionAnswer(questionToChange.QuestionAnswer as SequenceQuestionAnswer);
            }
            else
            if (questionToChange.QuestionAnswer is FreeStatementQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 4;
                _answer = new FreeStatementQuestionAnswer(questionToChange.QuestionAnswer as FreeStatementQuestionAnswer);
            }
            else
            if (questionToChange.QuestionAnswer is MultiQuestionAnswer)
            {
                comboBoxType.SelectedIndex = 5;
                _answer = new MultiQuestionAnswer(questionToChange.QuestionAnswer as MultiQuestionAnswer);
            }
            else
            {
                throw new ArgumentException("Поле comboBoxType не содержит определения для данного типа QuestionAnswer");
            }

            foreach (var section in sections)
            {
                comboBoxSection.Items.Add(section);
            }
            if (questionToChange.Section == null)
            {
                comboBoxSection.SelectedIndex = 0;
            }
            else
            {
                comboBoxSection.SelectedIndex = comboBoxSection.Items.IndexOf(questionToChange.Section);
            }

            numericUpDownScore.Value = questionToChange.QuestionAnswer.QuestionScore < 1 ? 1 : questionToChange.QuestionAnswer.QuestionScore;
        }