Inheritance: System.Web.UI.Page
Exemplo n.º 1
0
        public ActionResult Create(int obtype, String attribute, int pollid)
        {
            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["pollid"] = pollid;

            pollObjectModel ob = new pollObjectModel();

            if (ob.getObject(obtype, pollid).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;
                }
                pollObjectModel po = new pollObjectModel();
                po.createObject(obtype, attribute, pollid);

                //return RedirectToAction("Index", new { pollid = pollid });
                return View();
            }
            catch (Exception e)
            {
                ViewData["error1"] = "!ERROR: " + e.Message;
                return View();
            }
        }
Exemplo n.º 2
0
        public ActionResult Delete(int objectid, int pollid)
        {
            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");
            }

            pollObjectModel ob = new pollObjectModel(objectid);
            ob.deleteObject();

            return RedirectToAction("Index", "PollObject", new { pollid = pollid, pollname = ViewData["pollname"] });
        }
Exemplo n.º 3
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);
            }
        }