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 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 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");
            }
        }