/// <summary> /// Registers a save of the current answer group. Depending on the edit /// mode of the grouped area, this may add a new answer group to the /// area, or save the existing answer group. /// </summary> /// <returns></returns> public override bool RegisterSave() { Record record = _view.ActiveRecord; if (_mode == RecordEditModes.Add) { foreach (Question question in Questions) { question.RegisterSave(); record.AddAnswer(question.Answer); } _view.Records.Add(record); } else { foreach (Question question in Questions) { question.RegisterSave(); } } LoadEditMode(RecordEditModes.View); return(true); }
/// <summary> /// Adds a Text answer to the group represented by the GroupID /// </summary> /// <param name="GroupID"></param> /// <param name="iQuestionID"></param> /// <param name="AnswerText"></param> /// <returns></returns> public bool AddAnswerToRecord(long recordID, long questionID, string answerText) { Record record = RecordFromID(recordID); Answer newAnswer = new TextAnswer(); newAnswer.RecordID = recordID; newAnswer.QuestionID = questionID; ((TextAnswer)newAnswer).Text = answerText; record.AddAnswer(newAnswer); return(true); }