コード例 #1
0
 public ActionResult Worksheets(int id)
 {
     Models.Worksheet w = new Models.Worksheet();
     w.GetWorksheet(id);
     ViewData.Model = w;
     return(View("Details", w));
 }
コード例 #2
0
        public ActionResult DetailsLoading(int id)
        {
            Models.Worksheet w = new Models.Worksheet();
            w.GetWorksheet(id);
            ViewData.Model = w;

            return(View());
        }
コード例 #3
0
        /// <summary>
        /// This returns the actual worksheet with cells
        /// Partial View for async wait message while loading
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Worksheet(int id)
        {
            Models.Worksheet w = new Models.Worksheet();
            w.GetWorksheet(id);
            int complete = w.Complete;
            int numTries = 0;

            while (complete == 0 && numTries < 20)
            {
                System.Threading.Thread.Sleep(500);
                w.GetWorksheet(id);
                complete = w.Complete;
                numTries++;
            }
            w.GetWorksheetCells(id);//Cells exist
            ViewData.Model = w;
            return(PartialView(w));
        }
コード例 #4
0
 public ActionResult DetailsDemo(int id)
 {
     Models.Worksheet w = new Models.Worksheet();
     w.GetWorksheet(id);
     if (w.Owner.ToUpper() != "DEMO")
     {
         return(RedirectToAction("Unauthorized"));
     }
     ViewData.Model = w;
     return(View());
 }
コード例 #5
0
        public ActionResult Delete(int id)
        {
            Models.Worksheet w = new Models.Worksheet();
            w.GetWorksheet(id);
            if (w.Owner.ToUpper() != User.Identity.Name.ToUpper())
            {
                return(RedirectToAction("Unauthorized"));
            }

            w.DeleteWorksheet(id);
            return(Redirect(Request.UrlReferrer.ToString()));//This should be User Page
        }
コード例 #6
0
        public ActionResult EditNew(int id)
        {
            Models.Worksheet w = new Models.Worksheet();
            w.GetWorksheet(id);

            if (w.Owner.ToUpper() != User.Identity.Name.ToUpper())
            {
                return(RedirectToAction("Unauthorized"));
            }

            ViewData.Model = w;
            return(View());
        }
コード例 #7
0
        public ActionResult Details(int id)
        {
            Models.Worksheet w = new Models.Worksheet();
            w.GetWorksheet(id);

            if (!w.Private || User.Identity.Name.ToUpper() == w.Owner.ToUpper()) //public or match
            {
                ViewData.Model = w;
                return(View());
            }
            else if (w.Private && !User.Identity.IsAuthenticated) //private, not logged in
            {
                return(RedirectToAction("LogOn", "Account", new { returnUrl = "/Worksheet/" + id }));
            }
            else //Logged on, wrong user
            {
                return(View("UnauthorizedDetail"));
            }
        }