public override DataSet Clone() { CSVExportData data = (CSVExportData)base.Clone(); data.InitVars(); return(data); }
public void RemoveVotersRow(CSVExportData.VotersRow row) { base.Rows.Remove(row); }
public void AddVotersRow(CSVExportData.VotersRow row) { base.Rows.Add(row); }
public VoterAnswersRowChangeEvent(CSVExportData.VoterAnswersRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveExportAnswersRow(CSVExportData.ExportAnswersRow row) { base.Rows.Remove(row); }
public void AddExportAnswersRow(CSVExportData.ExportAnswersRow row) { base.Rows.Add(row); }
/// <summary> /// Returns all data needed to create a CSV /// </summary> public CSVExportData GetForCSVExport(int surveyId, DateTime startDate, DateTime endDate) { CSVExportData dataSet = new CSVExportData(); //SqlParameter[] commandParameters = new SqlParameter[] //{ new SqlParameter("@SurveyID", surveyId), // new SqlParameter("@StartDate", startDate), // new SqlParameter("@EndDate", endDate) }; ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@SurveyId", surveyId).SqlValue); commandParameters.Add(new SqlParameter("@StartDate", startDate).SqlValue); commandParameters.Add(new SqlParameter("@EndDate", endDate).SqlValue); } DbConnection.db.LoadDataSet("vts_spVoterExportCSVData ", dataSet, new string[] { "ExportAnswers", "Voters", "VoterAnswers" }, commandParameters.ToArray()); return dataSet; }
/// <summary> /// Gets the highest section created by the voter /// </summary> private int GetVoterMaxSections(int voterId, CSVExportData csvExportData) { int sectionCount = 0; CSVExportData.VoterAnswersRow[] voterSectionCount = (CSVExportData.VoterAnswersRow[])csvExportData.VoterAnswers.Select("VoterID=" + voterId, "SectionNumber DESC"); if (voterSectionCount.Length > 0) { sectionCount = voterSectionCount[0].SectionNumber; } return sectionCount; }
public string GetDetail(CSVExportData.VoterAnswersRow detail, AnswerTypeEnum answerType) { switch (ddlAnswer.SelectedValue) { case "Answer": return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : (detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText); case "AnswerDisplayOrderNumber": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionOtherType ? (detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText) : detail.AnswerDisplayOrder.ToString(); case "AnswerID": if (isTextAnswer(detail.IsAnswerTypeIdNull()?0:detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerIdAliasNull() ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : detail.AnswerIdAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); case "AnswerAlias": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerAliasNull() ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : detail.AnswerAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); case "AnswerIdAlias": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerIdAliasNull() ? detail.AnswerAnswerText : detail.AnswerIdAlias) + " " + (detail.IsAnswerAliasNull() ? string.Empty : detail.AnswerAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); default: return "Invalid DDl Value"; } }
public string GetAnswerOnlyHeader(CSVExportData.ExportAnswersRow header) { switch (ddlAnswer.SelectedValue) { case "Answer": return header.IsAnswerTextNull() ? string.Empty : header.AnswerText; case "AnswerDisplayOrderNumber": if (!header.IsRowOrderNull()) return TrimSplit(header.AnswerDisplayOrder.ToString()); else return header.AnswerDisplayOrder.ToString(); case "AnswerID": return header.IsAnswerIdTextNull() ? (header.IsAnswerTextNull() ? string.Empty : header.AnswerText) : header.AnswerIdText; case "AnswerAlias": return header.IsAnswerAliasNull() ? (header.IsAnswerTextNull() ? string.Empty : header.AnswerText) : header.AnswerAlias; case "AnswerIdAlias": return (header.IsAnswerIdTextNull() ? (header.IsAnswerTextNull() ? string.Empty : header.AnswerText) : header.AnswerIdText) + " " + (header.IsAnswerAliasNull() ? (header.IsAnswerTextNull() ? string.Empty : header.AnswerText) : header.AnswerAlias); default: return "Invalid DDl Value"; } }
public string GetHeader(CSVExportData.ExportAnswersRow header) { string splitChar = "|"; switch (ddlHeader.SelectedValue) { case "Question": if (!header.IsRowOrderNull()) return TrimSplit((header.ParentQuestionText + splitChar + header.QuestionText + splitChar + header.AnswerText)); else return TrimSplit((header.QuestionText + splitChar + header.AnswerText)); case "QuestionDisplayOrderNumber": if (!header.IsRowOrderNull()) return TrimSplit(header.QuestionDisplayOrder.ToString() + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.QuestionDisplayOrder.ToString() + splitChar + header.AnswerDisplayOrder.ToString()); case "QuestionID": if (!header.IsRowOrderNull()) return TrimSplit((header.IsParentQuestionIdTextNull() ? string.Empty : header.ParentQuestionIdText) + splitChar + header.RowOrder.ToString() + splitChar + (header.IsAnswerTextNull() ? string.Empty : header.AnswerText)); else return TrimSplit((header.IsQuestionIdTextNull() ? header.QuestionText : header.QuestionIdText) + splitChar + (header.IsAnswerIdTextNull() ? string.Empty : header.AnswerIdText)); case "QuestionAlias": if (!header.IsRowOrderNull()) return TrimSplit(header.ParentQuestionAliasText.ToString() + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.IsQuestionAliasNull() ? header.QuestionText : header.QuestionAlias + splitChar + (header.IsAnswerAliasNull() ? header.IsAnswerTextNull() ? string.Empty : header.AnswerText : header.AnswerAlias)); case "QuestionIDAlias": if (!header.IsRowOrderNull()) return TrimSplit((header.IsParentQuestionIdTextNull() ? string.Empty : header.ParentQuestionIdText) + " " + (header.IsParentQuestionAliasTextNull() ? string.Empty : header.ParentQuestionAliasText) + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.IsQuestionIdTextNull() ? string.Empty : header.QuestionIdText + " " + (header.IsQuestionAliasNull() ? string.Empty : header.QuestionAlias) + "| " + (header.IsAnswerIdTextNull() ? string.Empty : header.AnswerIdText) + " " + (header.IsAnswerAliasNull() ? string.Empty : header.AnswerAlias)); default: return TrimSplit("Invalid DDl Value"); } }