Inheritance: System.Web.UI.Page
Exemple #1
0
        public ActionResult Create(int obtype, String attribute, int questionid)
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_CREATOR)
            {
                return RedirectToAction("Invalid", "Home");
            }

            ViewData["questionid"] = questionid;

            questionObjectModel ob = new questionObjectModel();
            int a = ob.getObject(obtype, questionid).obid;
            if (ob.getObject(obtype, questionid).obid != -1)
            {
                ViewData["created"] = "This object already exists.";
                return View();
            }

            try
            {
                switch (obtype)
                {
                    case 1:
                        ViewData["created"] = "Added a Countdown Timer";
                        break;
                    case 2:
                        ViewData["created"] = "Added a Response Counter";
                        break;
                    case 3:
                        ViewData["created"] = "Added a Correct Answer Indicator";
                        break;
                    default:
                        break;
                }
                new questionObjectModel().createObject(obtype, attribute, questionid);
                return View();
            }
            catch(Exception e)
            {
                ViewData["error1"] = "!ERROR: " + e.Message;
                return View();
            }
        }
Exemple #2
0
        public void createDefaultObjects(int pollid, int questionid)
        {
            pollObjectModel po = new pollObjectModel();
            questionObjectModel qo = new questionObjectModel();
            List<pollObjectModel> list = po.indexObjects(pollid);

            foreach (pollObjectModel p in list) {
                qo.createObject(p.obid, p.attribute, questionid);
            }
        }
Exemple #3
0
        //
        // GET: /Object/
        public ActionResult Index(int questionid)
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_MASTER)
            {
                return RedirectToAction("Invalid", "Home");
            }

            questionObjectModel qo = new questionObjectModel();
            List<questionObjectModel> list = qo.indexObjects(questionid);

            ViewData["message"] = "This question does not have any objects.";
            ViewData["questionid"] = questionid;
            return View(list);
        }
Exemple #4
0
        public ActionResult Delete(int objectid, int questionid)
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_CREATOR)
            {
                return RedirectToAction("Invalid", "Home");
            }
            questionObjectModel ob = new questionObjectModel(objectid);
            ob.deleteObject();

            return RedirectToAction("Index", "Object", new { questionid = questionid});
        }