/// <summary> /// Replace the pipe token with the answer text entered by /// the user /// </summary> protected virtual string PipeAnswerText(int answerId, VoterAnswersData.VotersAnswersDataTable surveyAnswers) { VoterAnswersData.VotersAnswersRow[] rowArray = (VoterAnswersData.VotersAnswersRow[]) surveyAnswers.Select("AnswerId=" + answerId); if (rowArray.Length > 0) { return rowArray[0].AnswerText; } return string.Empty; }
/// <summary> /// Replace the pipe token with the question answers /// </summary> protected virtual string PipeQuestionAnswers(int questionId, VoterAnswersData.VotersAnswersDataTable surveyAnswers, string languageCode) { StringBuilder builder = new StringBuilder(); VoterAnswersData.VotersAnswersRow[] rowArray = (VoterAnswersData.VotersAnswersRow[]) surveyAnswers.Select("QuestionId=" + questionId); int index = 0; while (index < rowArray.Length) { PipeData.AnswersRow[] rowArray2 = (PipeData.AnswersRow[]) this._pipeData.Answers.Select("AnswerId=" + rowArray[index].AnswerId); if (rowArray2.Length > 0) { builder.Append(rowArray2[0].AnswerText); } index++; if ((index + 1) == rowArray.Length) { builder.Append(ResourceManager.GetString("PipeValuesSeparator", languageCode)); } else if (index < rowArray.Length) { builder.Append(", "); } } return builder.ToString(); }
/// <summary> /// Returns if answer has been selected by the user /// </summary> /// <param name="answer"></param> /// <param name="voterAnswersState"></param> /// <returns></returns> private static bool IsUserSelected(int answerId, int sectionNumber, VoterAnswersData.VotersAnswersDataTable voterAnswersState) { bool flag = false; if ((voterAnswersState != null) && (voterAnswersState.Rows.Count > 0)) { VoterAnswersData.VotersAnswersRow[] rowArray = (VoterAnswersData.VotersAnswersRow[]) voterAnswersState.Select(string.Concat(new object[] { "AnswerId = ", answerId, " AND SectionNumber=", sectionNumber })); if (rowArray.Length > 0) { flag = true; } } return flag; }
/// <summary> /// Returns, if any, the text entered by the user /// </summary> /// <param name="answer"></param> /// <param name="voterAnswersState"></param> /// <returns></returns> private static string GetUserText(int answerId, int sectionNumber, VoterAnswersData.VotersAnswersDataTable voterAnswersState) { string answerText = null; if ((voterAnswersState != null) && (voterAnswersState.Rows.Count > 0)) { VoterAnswersData.VotersAnswersRow[] rowArray = (VoterAnswersData.VotersAnswersRow[]) voterAnswersState.Select(string.Concat(new object[] { "AnswerId = ", answerId, " AND SectionNumber=", sectionNumber })); if (rowArray.Length > 0) { answerText = rowArray[0].AnswerText; } } return answerText; }