예제 #1
0
        public List <TSS_Question> GetQuestionsWithOptionsForDashboard(string Filter, int surveyId = 0, string value = null)
        {
            TSS_SurveyDocumentDL add = new TSS_SurveyDocumentDL();
            var dtsections           = add.GetDataTable("SURVEY_SECTIONS_BY_SITESURVEYID_For_Dashboard", Convert.ToString(surveyId), 0, 0);
            var result = new List <TSS_Question>();

            for (int i = 0; i < dtsections.Rows.Count; i++)
            {
                if (Convert.ToBoolean(dtsections.Rows[i]["IsRepeatable"]) == false)
                {
                    value = Convert.ToString(dtsections.Rows[i]["SectionId"]);

                    DataTable dt = qd.GetDataTable(Filter, value, surveyId);

                    var questionsWithOptions = dt.ToList <TSS_Question>();
                    foreach (var item in questionsWithOptions.Select(s => s.SiteQuestionId).Distinct().ToList())
                    {
                        var itemData = questionsWithOptions.FirstOrDefault(s => s.SiteQuestionId == item);
                        if (itemData == null)
                        {
                            continue;
                        }
                        result.Add(itemData);
                    }
                }
            }


            //foreach (var tssQuestion in result.Where(s => s.QuestionTypeId == 103300
            //                                          || s.QuestionTypeId == 93293
            //                                          || s.QuestionTypeId == 93294
            //                                          || s.QuestionTypeId == 103302
            //                                          || s.QuestionTypeId == 103303
            //                                          || s.QuestionTypeId == 103306).Distinct().ToList())
            //{
            //    tssQuestion.Responses.Add(new TSS_Response()
            //    {
            //        IsChecked = true,
            //        SiteQuestionId = tssQuestion.SiteQuestionId,
            //    });
            //}
            return(result);
        }
예제 #2
0
 public dynamic GetSurveyBySiteId(string Filter, long SiteId)
 {
     return(add.GetDataTable(Filter, SiteId.ToString()));
 }