public ActionResult Delete(string id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Delete";

            try
            {
                AttributeValueBusinessLayer sbl = new AttributeValueBusinessLayer();
                AttributeValue a = sbl.AttributeValues.Where(i => i.ID == id).Single();

                //pull data from FormCollection-----------------------------------------------
                //a.AttributeValueEntry = (string)collection["AttributeValueEntry"];

                //--------------------------------------------------------------------------- -

                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", new { SeasonID = a.SeasonID, SFID = a.SFID }));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Delete";

            try
            {
                AttributeBusinessLayer         bl = new AttributeBusinessLayer();
                BusinessLayerLibrary.Attribute a  = bl.Attributes.Where(i => i.AttributeID == 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());
            }
        }
        public ActionResult Edit(FormCollection collection, string id = "")
        {
            bool   DidItWork  = false;
            string CrudAction = "Edit";

            try
            {
                UserBusinessLayer bl = new UserBusinessLayer();
                User a = bl.Users.Where(p => p.NetworkID == id).Single();

                #region Pull from Form Collection
                a.TeamID = Convert.ToInt32(collection["ddTeam"]);
                #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 #4
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Edit";

            try
            {
                SeasonBusinessLayer bl = new SeasonBusinessLayer();
                Season a = bl.Seasons.Where(p => p.SeasonID == id).Single();

                #region Pull from Form Collection
                a.SeasonDesc      = (string)collection["SeasonDesc"];
                a.SeasonActive    = Convert.ToInt32(collection["ddActive"]);
                a.FirstLaunchDate = Convert.ToDateTime(collection["FirstLaunchDate"]);
                a.VAT             = Convert.ToDecimal(collection["VAT"]);
                a.GBPUSD          = Convert.ToDecimal(collection["GBPUSD"]);
                a.GBPEUR          = Convert.ToDecimal(collection["GBPEUR"]);
                #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());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                Grade a = new Grade();

                #region Pull from Form Collection
                a.GradeDescription = (string)collection["GradeDescription"];
                a.GradeOrder       = Convert.ToInt32(collection["GradeOrder"]);
                a.PreArticleGrade  = Convert.ToInt32(collection["ddPAG"]);
                a.WholeGrade       = Convert.ToInt32(collection["ddWhole"]);
                a.SubCatGrade      = Convert.ToInt32(collection["ddSubCat"]);
                #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 #6
0
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                TeamAttributePermission a = new TeamAttributePermission();

                #region Pull from Form Collection
                a.TeamID            = Convert.ToInt32(collection["ddTeam"]);
                a.AttributeID       = Convert.ToInt32(collection["ddAttr"]);
                a.ReadPermission    = Convert.ToInt32(collection["ddRead"]);
                a.WritePermission   = Convert.ToInt32(collection["ddWrite"]);
                a.Notify            = Convert.ToInt32(collection["ddNotify"]);
                a.ViewChange        = Convert.ToInt32(collection["ddView"]);
                a.ParkForQuarantine = Convert.ToInt32(collection["ddPark"]);
                #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());
            }
        }
        public ActionResult Delete(int Autoid, FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer();
                SpaceAllocation sa = sbl.SpaceAllocations.Where(i => i.AutoID == Autoid).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(sa, "delete", User.Identity.Name);
                //DidItWork = sbl.ActionSpaceAllocation(sa, "delete", User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on deletion of space allocation. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", new { SeasonID = sa.SeasonID, GradeID = sa.SpaceGradeID, CatID = sa.CatID }));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(string id, FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                AttributeValueBusinessLayer sbl = new AttributeValueBusinessLayer();
                AttributeValue a = sbl.AttributeValues.Where(i => i.ID == id).Single();
                a.AttributeValueEntry = (string)collection["AttributeValueEntry"];

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, "Edit", User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on edit of attribute value. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", new { SeasonID = a.SeasonID, SFID = a.SFID }));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                int    SFID                = Convert.ToInt32(collection["SFID"]);
                int    SeasonID            = Convert.ToInt32(collection["ddSeason"]);
                int    AttributeID         = Convert.ToInt32(collection["ddAttribute"]);
                string AttributeValueEntry = (string)collection["AttributeValueEntry"];

                AttributeValue NewAV = new AttributeValue();
                NewAV.AttributeID         = AttributeID;
                NewAV.SFID                = SFID;
                NewAV.SeasonID            = SeasonID;
                NewAV.AttributeValueEntry = AttributeValueEntry;

                //AttributeValueBusinessLayer sbl = new AttributeValueBusinessLayer();
                //DidItWork = sbl.InsertAttributeValue(NewAV, User.Identity.Name);
                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(NewAV, "Create", User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on creation of Attribute Value. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", new { Sfid = SFID, SeasonID = SeasonID }));
                }
            }
            catch (Exception x)
            {
                return(Content("Error on creation of Attribute Value. Press back to return and try again"));
            }
        }
        public ActionResult Delete(string id, FormCollection collection)
        {
            string CrudAction = "Delete";
            bool   DidItWork  = false;

            try
            {
                PreArticleSeasonalBusinessLayer sbl = new PreArticleSeasonalBusinessLayer();
                PreArticleSeasonal r = sbl.PreArticleSeasonals.Where(q => q.ID == id).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(r, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on deletion of PreArticleSeasonal. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", "AttributeValuePivot", new { SeasonID = r.SeasonID }));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                TeamView a = new TeamView();

                #region Pull from Form Collection
                a.TeamID          = Convert.ToInt16(collection["ddTeam"]);
                a.ViewID          = Convert.ToInt16(collection["ddPivotView"]);
                a.ViewDescription = "";
                a.TeamDescription = "";
                #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 #12
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());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                Cat a = new Cat();

                #region Pull from Form Collection
                a.CatID     = Convert.ToInt32(collection["CatID"]);
                a.CatDesc   = (string)collection["CatDesc"];
                a.CatActive = Convert.ToInt32(collection["ddActive"]);
                a.CatOrder  = Convert.ToInt32(collection["CatOrder"]);
                a.Concept   = Convert.ToInt32(collection["ddConcept"]);
                a.ShortCode = (string)collection["ShortCode"];
                #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());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                MeType a = new MeType();

                #region Pull from Form Collection
                a.MeTypeID   = -1;
                a.MeTypeDesc = (string)collection["MeTypeDesc"];
                #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());
            }
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Edit";

            try
            {
                PivotViewBusinessLayer bl = new PivotViewBusinessLayer();
                PivotView a = bl.PivotViews(String.Empty).Where(p => p.ViewID == id).Single();

                #region Pull from Form Collection
                a.ViewDesc = (string)collection["ViewDesc"];
                #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 #16
0
        public ActionResult Delete(string id, FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                AvailableSpaceBusinessLayer sbl = new AvailableSpaceBusinessLayer();
                AvailableSpace sa = sbl.AvailableSpaces.Where(i => i.ID == id).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(sa, "Edit", User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on deletion of available space. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", new { SeasonID = sa.SeasonID, GradeID = sa.SpaceGradeID, CatID = sa.CatID }));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemple #17
0
        public ActionResult Create(FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                AvailableSpace a = new AvailableSpace();
                a.SeasonID     = Convert.ToInt32(collection["ddSeason"]);
                a.SpaceID      = Convert.ToInt32(collection["ddSpace"]);
                a.CatID        = Convert.ToInt32(collection["ddCat"]);
                a.SpaceGradeID = Convert.ToInt32(collection["ddGrade"]);
                //AvailableSpaceBusinessLayer bl = new AvailableSpaceBusinessLayer();
                //DidItWork = bl.ActionAvailableSpace(a, "Create", User.Identity.Name);
                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, "Create", User.Identity.Name);
                if (DidItWork == false)
                {
                    //something went wrong trying to action the PreArticalSeasonald procedure
                    //return View();
                    return(Content("Error on creation of Available Space. Press back to return and try again"));
                }
                else
                {
                    //return View();
                    return(RedirectToAction("Index", "AvailableSpace", new { SeasonID = a.SeasonID, CatID = a.CatID, SpaceID = a.SpaceID, GradeID = a.SpaceGradeID }));
                }
            }
            catch (Exception x)
            {
                return(View());
            }
        }
        public ActionResult AddNew(string id, FormCollection collection)
        {
            bool DidItWork = false;

            try
            {
                SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer();
                SpaceAllocation sa = sbl.SpaceAllocations.Where(i => i.ID == id).Single();
                //SpaceAllocation sa = new SpaceAllocation();


                sa.Fill            = Convert.ToInt32(collection["Fill"]);
                sa.DisplayQuantity = Convert.ToInt32(collection["DisplayQuantity"]);
                sa.SFID            = Convert.ToInt32(collection["ddPas"]);
                sa.MeTypeID        = Convert.ToInt32(collection["ddMeType"]);
                sa.OrdinalSequence = Convert.ToInt32(collection["OrdinalSequence"]);

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(sa, "insert", User.Identity.Name);
                //DidItWork = sbl.ActionSpaceAllocation(sa, "insert", User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content("Error on edit of space allocation. Press back to return and try again"));
                }
                else
                {
                    return(RedirectToAction("Index", new { SeasonID = sa.SeasonID, GradeID = sa.SpaceGradeID, CatID = sa.CatID, FO = sa.FixtureOrdinal }));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            string CrudAction = "Create";
            bool   DidItWork  = false;

            try
            {
                PreArticleSeasonal SomePreArticalSeasonal = new PreArticleSeasonal();
                SomePreArticalSeasonal.SFID                       = Convert.ToInt32(collection["SFID"]);
                SomePreArticalSeasonal.SunflowerDesc              = (string)collection["SunflowerDesc"];
                SomePreArticalSeasonal.PlmID                      = (string)collection["PlmID"];
                SomePreArticalSeasonal.PlmDescription             = (string)collection["PlmDescription"];
                SomePreArticalSeasonal.SapArticleID               = (string)collection["SapArticleID"];
                SomePreArticalSeasonal.SapDescription             = (string)collection["SapDescription"];
                SomePreArticalSeasonal.SeasonID                   = Convert.ToInt32(collection["ddSeason"]);
                SomePreArticalSeasonal.ProposedPreArticleGradeID  = Convert.ToInt32(collection["ddGradeP"]);
                SomePreArticalSeasonal.ConfirmedPreArticleGradeID = Convert.ToInt32(collection["ddGradeC"]);
                SomePreArticalSeasonal.MerchCatID                 = Convert.ToInt32(collection["ddMerchCat"]);
                SomePreArticalSeasonal.VendorID                   = (string)collection["ddVendor"];
                SomePreArticalSeasonal.ContinuationStatusID       = Convert.ToInt32(collection["ddContinue"]);
                SomePreArticalSeasonal.ReplacementStatusID        = Convert.ToInt32(collection["ddReplacement"]);
                SomePreArticalSeasonal.SpaceUseID                 = (string)collection["ddSpaceUse"];

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(SomePreArticalSeasonal, CrudAction, User.Identity.Name);

                if (DidItWork == false)
                {
                    //something went wrong trying to action the PreArticalSeasonald procedure
                    //return View();
                    return(Content("Error on creation of PreArticalSeasonal. Press back to return and try again"));
                }
                else
                {
                    //return View();
                    return(RedirectToAction("Index", "AttributeValuePivot", new { SeasonID = SomePreArticalSeasonal.SeasonID }));
                }
            }
            catch (Exception x)
            {
                return(View());
            }
        }
Exemple #20
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Edit";

            try
            {
                AttributeBusinessLayer         bl = new AttributeBusinessLayer();
                BusinessLayerLibrary.Attribute a  = bl.Attributes.Where(i => i.AttributeID == id).Single();

                #region Pull from Form Collection
                a.AttributeDesc       = (string)collection["AttributeDesc"];
                a.Seasonal            = Convert.ToInt32(collection["ddSeasonal"]);
                a.AttributeOrder      = Convert.ToInt32(collection["AttributeOrder"]);
                a.SapName             = (string)collection["SapName"];
                a.PlmName             = (string)collection["PlmName"];
                a.DataTypeID          = Convert.ToInt32(collection["ddDataType"]);
                a.FutureSeasonCascade = Convert.ToInt32(collection["ddCascade"]);
                a.Calculated          = Convert.ToInt32(collection["ddCalculated"]);
                #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());
            }
        }
        public ActionResult Index(FormCollection collection, string submitButton, IEnumerable <string> keys, IEnumerable <decimal> amounts)
        {
            SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer();

            if (submitButton == "Retazz LocationID" && keys != null)
            {
                //read the values for retazz and attempt to realign
                for (int i = 0; i < keys.Count(); i++)
                {
                    int NewOrder;
                    NewOrder = i + 1000 * Convert.ToInt32(amounts.ElementAt(i));
                    if (sbl.SpaceAllocations.Where(y => y.ID == keys.ElementAt(i) && y.AutoID != 0).Any())
                    {
                        SpaceAllocation LoopSA = sbl.SpaceAllocations.Where(y => y.ID == keys.ElementAt(i) && y.AutoID != 0).Single();
                        LoopSA.OrdinalSequence = NewOrder;
                        StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                        Boolean DidUpdateWork             = spbl.ExecuteStoredProcedure(LoopSA, "Edit", User.Identity.Name);
                        //Boolean DidUpdateWork = sbl.ActionSpaceAllocation(LoopSA, "Edit", User.Identity.Name);
                    }
                }
                Boolean DidRetazzWork = sbl.RetazzSpaceAllocation();
            }
            int DeptID   = Convert.ToInt32(collection["ddDept"]);
            int SeasonID = Convert.ToInt32(collection["ddSeason"]);
            int GradeID  = Convert.ToInt32(collection["ddGrade"]);
            int CatID    = Convert.ToInt32(collection["ddCat"]);
            int FO       = Convert.ToInt32(collection["ddFO"]);

            string DeptName;
            string CatName = "";


            List <SpaceAllocation> ListOfSpaceAllocations = sbl.SpaceAllocations.ToList();

            GradeBusinessLayer gbl          = new GradeBusinessLayer();
            List <Grade>       ListOfGrades = gbl.Grades.ToList();
            string             GradeName    = ListOfGrades.Where(q => q.GradeID == GradeID).Single().GradeDescription;

            DeptBusinessLayer dbl         = new DeptBusinessLayer();
            List <Dept>       ListOfDepts = dbl.Depts.ToList();

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

            MerchCatBusinessLayer mbl             = new MerchCatBusinessLayer();
            List <MerchCat>       ListOfMerchCats = mbl.MerchCats.Where(w => w.DeptID == DeptID).ToList();

            CatBusinessLayer cbl               = new CatBusinessLayer();
            List <Cat>       ListOfCats        = cbl.Cats.Where(w => w.CatActive == 1).ToList();
            List <Cat>       ListOfCatsForDept = ListOfCats.Join(ListOfMerchCats, a => a.CatID, b => b.CatID, (a, b) => new { a, b }).Select(z => z.a).Distinct().ToList();

            if (ListOfCatsForDept.Count == 0)
            {
                CatID = 0;
                FO    = 0;
            }
            else
            {
                if (ListOfCatsForDept.Any(c => c.CatID == CatID) == false)
                {
                    CatID   = ListOfCatsForDept.First().CatID;
                    CatName = ListOfCatsForDept.Where(c => c.CatID == CatID).Single().CatDesc;
                }
            }

            DeptName = ListOfDepts.Where(q => q.DeptID == DeptID).Single().DeptName;

            #region StaticData

            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, Selected = m.GradeID == GradeID
            });
            ViewData["ddCat"] = ListOfCatsForDept.Select(m => new SelectListItem {
                Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")", Selected = m.CatID == CatID
            });
            ViewData["ddDept"] = ListOfDepts.Select(m => new SelectListItem {
                Value = m.DeptID.ToString(), Text = m.DeptName + " (" + m.DeptID.ToString() + ")", Selected = m.DeptID == DeptID
            });

            ViewBag.DeptID   = DeptID;
            ViewBag.DeptName = DeptName;

            ViewBag.CatID   = CatID;
            ViewBag.CatName = CatName;

            ViewBag.GradeName = GradeName;

            ListOfSpaceAllocations = ListOfSpaceAllocations.Where(z => z.SpaceGradeID == GradeID && z.SeasonID == SeasonID && z.CatID == CatID).OrderBy(w => w.OrdinalSequence).ToList();

            if (FO == 0 && ListOfSpaceAllocations.Count > 0)
            {
                FO = ListOfSpaceAllocations.First().FixtureOrdinal;
            }

            List <SelectListItem> ListofSelects = new List <SelectListItem>();
            ListofSelects = ListOfSpaceAllocations.Select(m => new SelectListItem {
                Value = m.FixtureOrdinal.ToString(), Text = m.FixtureName + " (" + m.FixtureOrdinal.ToString() + ")", Selected = m.FixtureOrdinal == FO
            }).ToList();
            IEnumerable <SelectListItem> ListofSelects2 = ListofSelects;
            ListofSelects = ListofSelects.GroupBy(p => p.Value).Select(g => g.First()).ToList();

            #endregion

            ListOfSpaceAllocations = ListOfSpaceAllocations.Where(z => z.FixtureOrdinal == FO).ToList();
            string FixtureName = "";
            if (ListOfSpaceAllocations.Count > 0)
            {
                FixtureName = ListOfSpaceAllocations.First().FixtureName;
            }

            //fixture ordinals are slightly different to the other drop downs...they are made from the existing data
            ViewData["ddFO"]    = ListofSelects;
            ViewBag.FixtureName = FixtureName;

            return(View(ListOfSpaceAllocations));
        }