public override Response CreateDefaultResponse() { ChoiceResponse r = new ChoiceResponse(this); for (int i = 0; i < this.MinNumberOfSelection; ++i) { r.SelectedChoices.Add(new ResponseChoice(r, this.Choices[i])); } return(r); }
/// <summary> /// /// </summary> /// <param name="responses">int[]</param> /// <returns></returns> public override Response CreateResponse(params object[] responses) { int numChoice = responses.Length; if (this.MinNumberOfSelection > numChoice || numChoice > this.MaxNumberOfSelection) { throw new Exception(String.Format("The number of selected choices {0} is not within range of [{1}, {2}].", numChoice, this.MinNumberOfSelection, this.MaxNumberOfSelection)); } ChoiceResponse r = new ChoiceResponse(this); int numAvailableChoices = this.Choices.Count; foreach (object c in (int[])responses[0]) { r.SelectedChoices.Add(new ResponseChoice(r, this.Choices[(int)c])); } return(r); }
public ResponseChoice(ChoiceResponse r, Survey.Choice choice) { this.r = r; this.Choice = choice; }