Engage.Survey.Entities.Survey.WriteResponseEntry C# (CSharp) Method

WriteResponseEntry() private method

Writes the response entry.
private WriteResponseEntry ( int responseHeaderId, ISection section, IQuestion question, IAnswer answer, string responseText ) : void
responseHeaderId int The response header id.
section ISection The section.
question IQuestion The question.
answer IAnswer The answer.
responseText string The response text.
return void
        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);
        }