Example #1
0
        public ActionResult Index(Guid QuestionSurveyId, string Title)
        {
            service.GetQuestionSurveyId(QuestionSurveyId);

            QuestionnaireProblemCondition condition = new QuestionnaireProblemCondition()
            {
                QuestionSurveyId = QuestionSurveyId, Title = Title
            };
            var news   = service.SearchQuestionnaireProblem(condition);
            var models = new PagedList <QuestionnaireProblem>(news, news.Paging);

            ViewBag.QuestionSurveyId = QuestionSurveyId;
            ViewBag.QuestionTitle    = QuestionnaireService.GetById(QuestionSurveyId).Title;

            return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models));
        }
        public IPagedList <QuestionnaireProblem> SearchQuestionnaireProblem(QuestionnaireProblemCondition condition)
        {
            var query = repository.Table;

            if (!string.IsNullOrEmpty(condition.Title))
            {
                query = query.Where(t => t.Title.Contains(condition.Title));
            }
            if (condition.QuestionSurveyId != null)
            {
                query = query.Where(t => t.QuestionSurveyId == condition.QuestionSurveyId);
            }

            query = query.Where(t => t.IsDelete == false);
            query = query.OrderByDescending(t => t.CreateDate);

            return(new PagedList <QuestionnaireProblem>(query, condition.PageIndex, condition.PageSize));
        }
        public ActionResult QuestionInfo(Guid QuestionSurveyId)
        {
            ServiceQuestionnaireProblem          qis = new ServiceQuestionnaireProblem();
            ServiceQuestionnaireAnswer           qrs = new ServiceQuestionnaireAnswer();
            ServiceQuestionnair                  qss = new ServiceQuestionnair();
            List <QuestionnaireProblemCondition> QuestionInfoList = new List <QuestionnaireProblemCondition>();
            var list = qis.GetListByQuestionSurveyId(QuestionSurveyId);

            for (int i = 0; i < list.Count; i++)
            {
                var questionResultList             = qrs.GetListByQuestionInfoId(list[i].Id);
                QuestionnaireProblemCondition info = new QuestionnaireProblemCondition()
                {
                    Id = list[i].Id, Title = list[i].Title, QuestionSurveyId = list[i].QuestionSurveyId, QuestionType = list[i].QuestionType, IsRequired = list[i].IsRequired, QuestionResultList = questionResultList
                };
                QuestionInfoList.Add(info);
            }
            ViewBag.QuestionSurveyDesc  = qss.GetQuestionSurveyDesc(QuestionSurveyId);
            ViewBag.QuestionSurveyTitle = qss.GetQuestionSurveyTitle(QuestionSurveyId);
            ViewBag.QuestionInfoList    = QuestionInfoList;
            return(PartialView());
        }