CreateResponse() public method

Creates a new Response instance, to be persisted when SubmitChanges is called.
public CreateResponse ( int responseHeaderId, int userId ) : Response
responseHeaderId int The ID of the that the instance is connected to.
userId int The ID of the user creating the instance.
return Response
Ejemplo n.º 1
0
        /// <summary>
        /// Writes the response entry.
        /// </summary>
        /// <param name="responseHeaderId">The response header id.</param>
        /// <param name="section">The section.</param>
        /// <param name="question">The question.</param>
        /// <param name="answer">The answer.</param>
        /// <param name="responseText">The response text.</param>
        private void WriteResponseEntry(int responseHeaderId, ISection section, IQuestion question, IAnswer answer, string responseText)
        {
            var surveyRepository = new SurveyRepository();
            var response         = surveyRepository.CreateResponse(responseHeaderId, 1);

            response.SurveyId              = this.SurveyId;
            response.SurveyText            = this.Text;
            response.ShowSurveyText        = this.ShowText;
            response.TitleOption           = this.TitleOption;
            response.SectionText           = section.Text;
            response.SectionRelativeOrder  = section.RelativeOrder;
            response.ShowSectionText       = false;
            response.SectionId             = section.SectionId;
            response.SectionRelativeOrder  = section.RelativeOrder;
            response.SectionFormatOption   = this.SectionFormatOption;
            response.QuestionId            = question.QuestionId;
            response.QuestionText          = question.Text;
            response.QuestionRelativeOrder = question.RelativeOrder;
            response.QuestionFormatOption  = this.QuestionFormatOption;
            response.ControlType           = question.ControlType;
            if (answer != null)
            {
                response.AnswerId            = answer.AnswerId;
                response.AnswerText          = answer.Text;
                response.AnswerRelativeOrder = answer.RelativeOrder;
                response.AnswerIsCorrect     = answer.IsCorrect;
            }

            response.UserResponse = responseText;

            surveyRepository.SubmitChanges();

            Debug.WriteLine(response.ResponseId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Writes the response entry.
        /// </summary>
        /// <param name="responseHeaderId">The response header id.</param>
        /// <param name="section">The section.</param>
        /// <param name="question">The question.</param>
        /// <param name="answer">The answer.</param>
        /// <param name="responseText">The response text.</param>
        private void WriteResponseEntry(int responseHeaderId, ISection section, IQuestion question, IAnswer answer, string responseText)
        {
            var surveyRepository = new SurveyRepository();
            var response = surveyRepository.CreateResponse(responseHeaderId, 1);
            response.SurveyId = this.SurveyId;
            response.SurveyText = this.Text;
            response.ShowSurveyText = this.ShowText;
            response.TitleOption = this.TitleOption;
            response.SectionText = section.Text;
            response.SectionRelativeOrder = section.RelativeOrder;
            response.ShowSectionText = false;
            response.SectionId = section.SectionId;
            response.SectionRelativeOrder = section.RelativeOrder;
            response.SectionFormatOption = this.SectionFormatOption;
            response.QuestionId = question.QuestionId;
            response.QuestionText = question.Text;
            response.QuestionRelativeOrder = question.RelativeOrder;
            response.QuestionFormatOption = this.QuestionFormatOption;
            response.ControlType = question.ControlType;
            if (answer != null)
            {
                response.AnswerId = answer.AnswerId;
                response.AnswerText = answer.Text;
                response.AnswerRelativeOrder = answer.RelativeOrder;
                response.AnswerIsCorrect = answer.IsCorrect;
            }

            response.UserResponse = responseText;

            surveyRepository.SubmitChanges();

            Debug.WriteLine(response.ResponseId);
        }