/// <summary> /// Processes Row information for answers that have two parameters to determine their value /// </summary> /// <param name="responseQuestion"></param> /// <param name="aInfo"></param> /// <returns></returns> private string ProcessRow(QuestionInfo responseQuestion, AnswerInfo aInfo) { AnswerInfo qRow = new AnswerInfo(); QuestionSubtypeEnum qaSubtype = responseQuestion.QuestionType.Subtype; // Demographic QuestionFamily types have extra spaces and newlines in front and back of their answer text if(qaSubtype == QuestionSubtypeEnum.International) { qRow = responseQuestion.QuestionAnswerList.Where(e => e.AnswerID == aInfo.Row).FirstOrDefault<AnswerInfo>(); return qRow.Text.Trim('\n').Trim(); } else qRow = responseQuestion.QuestionAnswerList.Where(e => e.AnswerID == aInfo.Row).FirstOrDefault<AnswerInfo>(); // for optional comments in Matrices if(qRow != null) return qRow.Text; else return responseQuestion.QuestionAnswerList[0].Text; }
/// <summary> /// Figures out how many times a particular respondent chose this QuestionAnswer /// </summary> /// <param name="qaf">The question answer to get counts for</param> /// <param name="qInfo">The information about how a respondent answered this question</param> /// <param name="SQCount">The number of times this answer appears in the respondent's QuestionInfo - but does not catch optional comments</param> /// <returns>The number of times this answer appears in the respondent's QuestionInfo - either 0 or 1 </returns> private int AddCount(QuestionAnswerFlat qaf, QuestionInfo qInfo, int SQCount) { // For counting optional comments if (SQCount == 0 && qaf.QuestionType == QuestionFamilyEnum.Matrix && qaf.AnswerType == AnswerTypeEnum.Other) { List<AnswerInfo> SQSelectOptional = qInfo.QuestionAnswerList.Where(e => e.Row == qaf.Column).ToList<AnswerInfo>(); return SQSelectOptional.Count; } return SQCount; }
/// <summary> /// Processes Answer information for answers that only have one parameter to determine their value /// </summary> /// <param name="responseQuestion"></param> /// <param name="aInfo"></param> /// <returns></returns> private string ProcessAnswer(QuestionInfo responseQuestion, AnswerInfo aInfo) { AnswerInfo qi = new AnswerInfo(); QuestionSubtypeEnum qaSubtype = responseQuestion.QuestionType.Subtype; if (qaSubtype == QuestionSubtypeEnum.Menu || qaSubtype == QuestionSubtypeEnum.Vertical || qaSubtype == QuestionSubtypeEnum.Horizontal) { qi = responseQuestion.QuestionAnswerList.Where(e => e.AnswerID == aInfo.Row).FirstOrDefault<AnswerInfo>(); } if (qaSubtype == QuestionSubtypeEnum.Ranking || qaSubtype == QuestionSubtypeEnum.Rating) { qi = responseQuestion.QuestionAnswerList.Where(e => e.AnswerID == aInfo.Column).FirstOrDefault<AnswerInfo>(); } // for optional comments in Matrices if(qi != null) return qi.Text; else return aInfo.Text; }