Exemple #1
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Edit";

            try
            {
                SpaceBusinessLayer bl = new SpaceBusinessLayer();
                Space a = bl.Spaces.Where(p => p.SpaceID == id).Single();

                #region Pull from Form Collection
                a.SpaceOrder = Convert.ToInt32(collection["SpaceOrder"]);
                a.SpaceDesc  = (string)collection["SpaceDesc"];
                #endregion

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        // GET: Space
        public ActionResult Index()
        {
            SpaceBusinessLayer bl           = new SpaceBusinessLayer();
            List <Space>       ListOfSpaces = bl.Spaces.OrderBy(o => o.SpaceOrder).ToList();

            return(View(ListOfSpaces));
        }
Exemple #3
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Delete";

            try
            {
                SpaceBusinessLayer bl = new SpaceBusinessLayer();
                Space a = bl.Spaces.Where(p => p.SpaceID == id).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemple #4
0
        // GET: AvailableSpace/Edit/5
        public ActionResult Edit(string id)
        {
            AvailableSpaceBusinessLayer sbl = new AvailableSpaceBusinessLayer();
            AvailableSpace sa = sbl.AvailableSpaces.Where(i => i.ID == id).Single();

            GradeBusinessLayer gbl          = new GradeBusinessLayer();
            List <Grade>       ListOfGrades = gbl.Grades.ToList();

            SeasonBusinessLayer ebl           = new SeasonBusinessLayer();
            List <Season>       ListOfSeasons = ebl.Seasons.ToList();

            SpaceBusinessLayer spbl         = new SpaceBusinessLayer();
            List <Space>       ListOfSpaces = spbl.Spaces.ToList();

            CatBusinessLayer cbl        = new CatBusinessLayer();
            List <Cat>       ListOfCats = cbl.Cats.Where(w => w.CatActive == 1).ToList();

            ViewData["ddSeason"] = ListOfSeasons.Select(m => new SelectListItem {
                Value = m.SeasonID.ToString(), Text = m.SeasonDesc + " (" + m.SeasonID.ToString() + ")", Selected = m.SeasonID == sa.SeasonID
            });
            ViewData["ddGrade"] = ListOfGrades.Select(m => new SelectListItem {
                Value = m.GradeID.ToString(), Text = m.GradeDescription, Selected = m.GradeID == sa.SpaceGradeID
            });
            ViewData["ddCat"] = ListOfCats.Select(m => new SelectListItem {
                Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")", Selected = m.CatID == sa.CatID
            });
            ViewData["ddSpace"] = ListOfSpaces.Select(m => new SelectListItem {
                Value = m.SpaceID.ToString(), Text = m.SpaceDesc + " (" + m.SpaceID.ToString() + ")", Selected = m.SpaceID == sa.SpaceID
            });

            return(View(sa));
        }
Exemple #5
0
        // GET: AvailableSpace/Create
        public ActionResult Create(int SeasonID)
        {
            GradeBusinessLayer gbl          = new GradeBusinessLayer();
            List <Grade>       ListOfGrades = gbl.Grades.ToList();

            SeasonBusinessLayer ebl           = new SeasonBusinessLayer();
            List <Season>       ListOfSeasons = ebl.Seasons.ToList();

            SpaceBusinessLayer sbl          = new SpaceBusinessLayer();
            List <Space>       ListOfSpaces = sbl.Spaces.ToList();

            CatBusinessLayer cbl        = new CatBusinessLayer();
            List <Cat>       ListOfCats = cbl.Cats.Where(w => w.CatActive == 1).ToList();

            ViewData["ddSeason"] = ListOfSeasons.Select(m => new SelectListItem {
                Value = m.SeasonID.ToString(), Text = m.SeasonDesc + " (" + m.SeasonID.ToString() + ")", Selected = m.SeasonID == SeasonID
            });
            ViewData["ddGrade"] = ListOfGrades.Select(m => new SelectListItem {
                Value = m.GradeID.ToString(), Text = m.GradeDescription
            });
            ViewData["ddCat"] = ListOfCats.Select(m => new SelectListItem {
                Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")"
            });
            ViewData["ddSpace"] = ListOfSpaces.Select(m => new SelectListItem {
                Value = m.SpaceID.ToString(), Text = m.SpaceDesc + " (" + m.SpaceID.ToString() + ")", Selected = m.SpaceID == 1
            });

            return(View());
        }
Exemple #6
0
        // GET: Space/Edit/5
        public ActionResult Edit(int id)
        {
            SpaceBusinessLayer bl = new SpaceBusinessLayer();
            Space o = bl.Spaces.Where(p => p.SpaceID == id).Single();

            ViewBag.ID = id;
            return(View(o));
        }