Ejemplo n.º 1
0
        public ActionResult ViewQuestionGroup(int id)
        {
            Logger.Info(_logMsg.Clear().SetPrefixMsg("View Question Group").Add("QuestionGroupId", id).ToSuccessLogString());

            try
            {
                _questionGroupFacade = new QuestionGroupFacade();
                var questionGroup = _questionGroupFacade.GetQuestionGroupById(id);
                var questionList  = _questionGroupFacade.GetQuestionList(id);

                var model = new ViewQuestionGroupModel();
                model.Name        = questionGroup.QuestionGroupName;
                model.Description = questionGroup.Description;
                model.ProductName = questionGroup.ProductName;
                model.Status      = (questionGroup.Status ?? false) ? "Active" : "Inactive";
                model.CreateUser  = questionGroup.CreateUserName;
                model.UpdateUser  = questionGroup.UpdateUserName;
                model.CreateDate  = DateUtil.ToStringAsDateTime(questionGroup.CreateDate);
                model.UpdateDate  = DateUtil.ToStringAsDateTime(questionGroup.UpdateDate);

                model.QuestionList = questionList.Select(x => new ViewQuestionModel()
                {
                    SeqNo        = x.SeqNo,
                    QuestionName = x.QuestionName,
                }).ToList();

                return(View(model));
            }
            catch (Exception ex)
            {
                Logger.Info(_logMsg.Clear().SetPrefixMsg("View Question Group").ToFailLogString());
                return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                 this.ControllerContext.RouteData.Values["action"].ToString())));
            }
        }
Ejemplo n.º 2
0
        public ActionResult SearchQuestionList(QuestionSelectSearchFilter searchFilter)
        {
            Logger.Info(_logMsg.Clear().SetPrefixMsg("Search Question").ToInputLogString());

            try
            {
                if (ModelState.IsValid)
                {
                    _questionGroupFacade = new QuestionGroupFacade();
                    var model = new QuestionGroupEditViewModel();
                    model.SearchFilter = searchFilter;

                    model.QuestionList = _questionGroupFacade.GetQuestionList(model.SearchFilter);
                    ViewBag.PageSize   = model.SearchFilter.PageSize;

                    return(PartialView("~/Views/QuestionGroup/_QuestionList.cshtml", model));
                }

                return(Json(new
                {
                    Valid = false,
                    Error = string.Empty
                }));
            }
            catch (Exception ex)
            {
                Logger.Info(_logMsg.Clear().SetPrefixMsg("Search Question").ToFailLogString());
                return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                 this.ControllerContext.RouteData.Values["action"].ToString())));
            }
        }