Пример #1
0
        public virtual void attachChoice(QuestionDef q)
        {
            if (q.DynamicChoices != null)
            {
                //can't attach dynamic choices because they aren't guaranteed to exist yet
                return;
            }

            SelectChoice choice = null;

            if (index != -1 && index < q.NumChoices)
            {
                choice = q.getChoice(index);
            }
            else if (xmlValue != null && xmlValue.Length > 0)
            {
                choice = q.getChoiceForValue(xmlValue);
            }

            if (choice != null)
            {
                attachChoice(choice);
            }
            else
            {
                throw new XPathTypeMismatchException("value " + xmlValue + " could not be loaded into question " + q.TextID + ".  Check to see if value " + xmlValue + " is a valid option for question " + q.TextID + ".");
            }
        }
Пример #2
0
        private static Selection getSelection(System.String choiceValue, QuestionDef q)
        {
            Selection s;

            if (q == null || q.DynamicChoices != null)
            {
                s = new Selection(choiceValue);
            }
            else
            {
                SelectChoice choice = q.getChoiceForValue(choiceValue);
                s = (choice != null?choice.selection():null);
            }

            return(s);
        }
Пример #3
0
 public virtual void attachChoice(SelectChoice choice)
 {
     this.choice   = choice;
     this.xmlValue = choice.Value;
     this.index    = choice.Index;
 }
Пример #4
0
 public Selection(SelectChoice choice)
 {
     attachChoice(choice);
 }
Пример #5
0
 public virtual System.String getSpecialFormSelectChoiceText(SelectChoice sel, System.String form)
 {
     return(getSpecialFormSelectItemText(sel.selection(), form));
 }
Пример #6
0
 /// <seealso cref="getSelectItemText(Selection sel)">
 /// </seealso>
 public virtual System.String getSelectChoiceText(SelectChoice selection)
 {
     return(getSelectItemText(selection.selection()));
 }