Пример #1
0
        public ActionResult StatisticalReport()
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_ADMINISTRATOR)
            {
                return RedirectToAction("Invalid", "Home");
            }
            TwoQuestionModels twoModels = new TwoQuestionModels();

            twoModels.data1 = new questionModel().displayQuestionsAnswer();
            twoModels.data2 = new questionModel().displayQuestionsAnswer();

            return View(twoModels);
        }
Пример #2
0
        public ActionResult DemographicComparison(String demographic, String graphType, String includeOrExclude)
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_ADMINISTRATOR)
            {
                return RedirectToAction("Invalid", "Home");
            }
            TwoQuestionModels twoModels = new TwoQuestionModels();

            Session["graphType"] = graphType;

            if (includeOrExclude == "Include")
            {
                List<questionModel> result = new questionModel().includeDemographicQuestions(demographic);
                if (!result.Equals(null))
                {

                    twoModels.data1 = new questionModel().includeDemographicQuestions(demographic);
                    twoModels.data2 = new questionModel().includeDemographicQuestions(demographic);

                    if (twoModels.data1.Count() == 0)
                    {
                        ViewData["error"] = "Your search returns no result. Please try again.";
                    }
                    else
                    {
                        ViewData["error"] = "";
                    }

                    return View(twoModels);
                }

                else
                {
                    return View();
                }
            }

            //then it's exclude
            else
            {
                List<questionModel> result = new questionModel().excludeDemographicQuestions(demographic);
                if (!result.Equals(null))
                {
                    twoModels.data1 = new questionModel().excludeDemographicQuestions(demographic);
                    twoModels.data2 = new questionModel().excludeDemographicQuestions(demographic);

                    if (twoModels.data1.Count() == 0)
                    {
                        ViewData["error"] = "Your search returns no result. Please try again.";
                    }

                    else
                    {
                        ViewData["error"] = "";
                    }

                    return View(twoModels);
                }

                else
                {
                    return View();
                }
            }
        }