// GET: MerchCat/Delete/5 public ActionResult Delete(int id) { MerchCatBusinessLayer bl = new MerchCatBusinessLayer(); MerchCat o = bl.MerchCats.Where(p => p.MerchCatID == id).Single(); ViewBag.ID = id; return(View(o)); }
// GET: PreArticleSeasonal/Edit/5 public ActionResult Edit(string id) { #region StaticData SeasonBusinessLayer sbl = new SeasonBusinessLayer(); List <Season> ListOfSeasons = sbl.Seasons.Where(r => r.SeasonActive == 1).OrderBy(o => o.FirstLaunchDate).ToList(); VendorBusinessLayer vbl = new VendorBusinessLayer(); List <Vendor> ListOfVendors = vbl.Vendors.OrderBy(o => o.VendorID).ToList(); GradeBusinessLayer gbl = new GradeBusinessLayer(); List <Grade> ListOfGrades = gbl.Grades.Where(z => z.PreArticleGrade == 1).OrderBy(o => o.GradeOrder).ToList(); MerchCatBusinessLayer mbl = new MerchCatBusinessLayer(); List <MerchCat> ListOfMerchCats = mbl.MerchCats.OrderBy(o => o.MerchCatID).ToList(); SpaceUseBusinessLayer spbl = new SpaceUseBusinessLayer(); List <SpaceUse> ListOfSpaceUses = spbl.SpaceUses.ToList(); StatusBusinessLayer tbl = new StatusBusinessLayer(); List <Status> ListOfStatuses = tbl.Statuses.ToList(); #endregion PreArticleSeasonalBusinessLayer pbl = new PreArticleSeasonalBusinessLayer(); PreArticleSeasonal SomePreArticleSeasonal = pbl.PreArticleSeasonals.Where(i => i.ID == id).Single(); ViewData["ddSeason"] = ListOfSeasons.Select(m => new SelectListItem { Value = m.SeasonID.ToString(), Text = m.SeasonDesc + " (" + m.SeasonID.ToString() + ")", Selected = m.SeasonID == SomePreArticleSeasonal.SeasonID }); ViewData["ddGradeP"] = ListOfGrades.Select(m => new SelectListItem { Value = m.GradeID.ToString(), Text = m.GradeDescription, Selected = m.GradeID == SomePreArticleSeasonal.ProposedPreArticleGradeID }); ViewData["ddGradeC"] = ListOfGrades.Select(m => new SelectListItem { Value = m.GradeID.ToString(), Text = m.GradeDescription, Selected = m.GradeID == SomePreArticleSeasonal.ConfirmedPreArticleGradeID }); ViewData["ddMerchCat"] = ListOfMerchCats.Select(m => new SelectListItem { Value = m.MerchCatID.ToString(), Text = m.MerchCatDesc + " (" + m.MerchCatID.ToString() + ")", Selected = m.MerchCatID == SomePreArticleSeasonal.MerchCatID }); ViewData["ddVendor"] = ListOfVendors.Select(m => new SelectListItem { Value = m.VendorID, Text = m.VendorDesc + " (" + m.VendorID + ")", Selected = m.VendorID == SomePreArticleSeasonal.VendorID }); ViewData["ddSpaceUse"] = ListOfSpaceUses.Select(m => new SelectListItem { Value = m.SpaceUseID.ToString(), Text = m.SpaceUseDesc + " (" + m.SpaceUseID.ToString() + ")", Selected = m.SpaceUseID == SomePreArticleSeasonal.VendorID }); ViewData["ddContinue"] = ListOfStatuses.Where(i => i.StatusType == "C").Select(m => new SelectListItem { Value = m.StatusID.ToString(), Text = m.StatusDesc + " (" + m.StatusID.ToString() + ")", Selected = m.StatusID == SomePreArticleSeasonal.ConfirmedPreArticleGradeID }); ViewData["ddReplacement"] = ListOfStatuses.Where(i => i.StatusType == "R").Select(m => new SelectListItem { Value = m.StatusID.ToString(), Text = m.StatusDesc + " (" + m.StatusID.ToString() + ")", Selected = m.StatusID == SomePreArticleSeasonal.ReplacementStatusID }); ViewBag.SeasonID = SomePreArticleSeasonal.SeasonID; return(View(SomePreArticleSeasonal)); }
// GET: PreArticleSeasonal/Create public ActionResult Create(int SeasonID = 0) { SeasonBusinessLayer sbl = new SeasonBusinessLayer(); List <Season> ListOfSeasons = sbl.Seasons.Where(r => r.SeasonActive == 1).OrderBy(o => o.FirstLaunchDate).ToList(); VendorBusinessLayer vbl = new VendorBusinessLayer(); List <Vendor> ListOfVendors = vbl.Vendors.OrderBy(o => o.VendorID).ToList(); GradeBusinessLayer gbl = new GradeBusinessLayer(); List <Grade> ListOfGrades = gbl.Grades.Where(z => z.PreArticleGrade == 1).OrderBy(o => o.GradeOrder).ToList(); MerchCatBusinessLayer mbl = new MerchCatBusinessLayer(); List <MerchCat> ListOfMerchCats = mbl.MerchCats.OrderBy(o => o.MerchCatID).ToList(); SpaceUseBusinessLayer spbl = new SpaceUseBusinessLayer(); List <SpaceUse> ListOfSpaceUses = spbl.SpaceUses.ToList(); StatusBusinessLayer tbl = new StatusBusinessLayer(); List <Status> ListOfStatuses = tbl.Statuses.ToList(); ViewData["ddSeason"] = ListOfSeasons.Select(m => new SelectListItem { Value = m.SeasonID.ToString(), Text = m.SeasonDesc + " (" + m.SeasonID.ToString() + ")", Selected = m.SeasonID == SeasonID }); ViewData["ddSpaceUse"] = ListOfSpaceUses.Select(m => new SelectListItem { Value = m.SpaceUseID.ToString(), Text = m.SpaceUseDesc + " (" + m.SpaceUseID.ToString() + ")" }); ViewData["ddGradeP"] = ListOfGrades.Select(m => new SelectListItem { Value = m.GradeID.ToString(), Text = m.GradeDescription }); ViewData["ddGradeC"] = ListOfGrades.Select(m => new SelectListItem { Value = m.GradeID.ToString(), Text = m.GradeDescription }); ViewData["ddMerchCat"] = ListOfMerchCats.Select(m => new SelectListItem { Value = m.MerchCatID.ToString(), Text = m.MerchCatDesc + " (" + m.MerchCatID.ToString() + ")" }); ViewData["ddVendor"] = ListOfVendors.Select(m => new SelectListItem { Value = m.VendorID, Text = m.VendorDesc + " (" + m.VendorID + ")" }); ViewData["ddContinue"] = ListOfStatuses.Where(i => i.StatusType == "C").Select(m => new SelectListItem { Value = m.StatusID.ToString(), Text = m.StatusDesc + " (" + m.StatusID.ToString() + ")", Selected = m.Default == 1 }); ViewData["ddReplacement"] = ListOfStatuses.Where(i => i.StatusType == "R").Select(m => new SelectListItem { Value = m.StatusID.ToString(), Text = m.StatusDesc + " (" + m.StatusID.ToString() + ")", Selected = m.Default == 1 }); ViewBag.SeasonID = SeasonID; return(View()); }
public ActionResult Index(FormCollection collection) { AvailableSpaceBusinessLayer sbl = new AvailableSpaceBusinessLayer(); int SeasonID = Convert.ToInt32(collection["ddSeason"]); int GradeID = Convert.ToInt32(collection["ddGrade"]); int CatID = Convert.ToInt32(collection["ddCat"]); string DeptName; string CatName = ""; List <AvailableSpace> ListOfAvailableSpaces = sbl.AvailableSpaces.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.ToList(); CatBusinessLayer cbl = new CatBusinessLayer(); List <Cat> ListOfCats = cbl.Cats.Where(w => w.CatActive == 1).ToList(); int DeptID = ListOfMerchCats.Where(m => m.CatID == CatID).First().DeptID; DeptName = ListOfDepts.Where(q => q.DeptID == DeptID).Single().DeptName; if (ListOfCats.Count > 0) { CatName = ListOfCats.Where(c => c.CatID == CatID).Single().CatDesc; } #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"] = ListOfCats.Select(m => new SelectListItem { Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")", Selected = m.CatID == CatID }); ViewBag.DeptID = DeptID; ViewBag.DeptName = DeptName; ViewBag.CatID = CatID; ViewBag.CatName = CatName; ViewBag.GradeName = GradeName; ViewBag.SeasonID = SeasonID; ListOfAvailableSpaces = ListOfAvailableSpaces.Where(z => z.SpaceGradeID == GradeID && z.SeasonID == SeasonID && z.CatID == CatID).OrderBy(w => w.FixtureOrdinal).ToList(); #endregion return(View(ListOfAvailableSpaces)); }
// GET: AvailableSpace public ActionResult Index(int DeptID = 0, int SeasonID = 0, int GradeID = 0, int CatID = 0) { string DeptName = ""; string CatName = ""; string GradeName = ""; AvailableSpaceBusinessLayer sbl = new AvailableSpaceBusinessLayer(); List <AvailableSpace> ListOfAvailableSpaces = sbl.AvailableSpaces.ToList(); GradeBusinessLayer gbl = new GradeBusinessLayer(); List <Grade> ListOfGrades = gbl.Grades.ToList(); DeptBusinessLayer dbl = new DeptBusinessLayer(); List <Dept> ListOfDepts = dbl.Depts.ToList(); SeasonBusinessLayer ebl = new SeasonBusinessLayer(); List <Season> ListOfSeasons = ebl.Seasons.ToList(); //no parameters recieved, pick the first ones if (GradeID == 0) { GradeID = ListOfGrades.Where(q => q.PreArticleGrade == 1).First().GradeID; } GradeName = ListOfGrades.Where(q => q.GradeID == GradeID).Single().GradeDescription; if (DeptID == 0) { DeptID = ListOfDepts.Where(q => q.DeptActive == 1).First().DeptID; } DeptName = ListOfDepts.Where(q => q.DeptID == DeptID).Single().DeptName; if (SeasonID == 0) { SeasonID = ListOfSeasons.Where(q => q.SeasonActive == 1).First().SeasonID; } 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(); if (CatID == 0 && ListOfMerchCats.Any(q => q.MerchCatActive == 1)) { CatID = ListOfMerchCats.Where(q => q.MerchCatActive == 1).First().CatID; } ListOfCats = ListOfCats.Join(ListOfMerchCats, a => a.CatID, b => b.CatID, (a, b) => new { a, b }).Select(z => z.a).Distinct().ToList(); if (ListOfCats.Count > 0) { CatName = ListOfCats.Where(c => c.CatID == CatID).Single().CatDesc; } ListOfAvailableSpaces = ListOfAvailableSpaces.Where(z => z.SpaceGradeID == GradeID && z.SeasonID == SeasonID && z.CatID == CatID).ToList(); #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 }); //move department selection to department index //ViewData["ddDept"] = ListOfDepts.Select(m => new SelectListItem { Value = m.DeptID.ToString(), Text = m.DeptName + " (" + m.DeptID.ToString() + ")", Selected = m.DeptID == DeptID }); ViewData["ddCat"] = ListOfCats.Select(m => new SelectListItem { Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")", Selected = m.CatID == CatID }); ViewBag.DeptID = DeptID; ViewBag.DeptName = DeptName; ViewBag.CatID = CatID; ViewBag.CatName = CatName; ViewBag.GradeName = GradeName; ViewBag.SeasonID = SeasonID; #endregion return(View(ListOfAvailableSpaces)); }
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)); }
// GET: SpaceAllocation public ActionResult Index(int DeptID = 0, int SeasonID = 0, int GradeID = 0, int CatID = 0, int FO = 0) { string DeptName = ""; string CatName = ""; string GradeName = ""; SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer(); List <SpaceAllocation> ListOfSpaceAllocations = sbl.SpaceAllocations.ToList(); GradeBusinessLayer gbl = new GradeBusinessLayer(); List <Grade> ListOfGrades = gbl.Grades.ToList(); DeptBusinessLayer dbl = new DeptBusinessLayer(); List <Dept> ListOfDepts = dbl.Depts.ToList(); SeasonBusinessLayer ebl = new SeasonBusinessLayer(); List <Season> ListOfSeasons = ebl.Seasons.ToList(); //no parameters recieved, pick the first ones if (GradeID == 0) { GradeID = ListOfGrades.Where(q => q.PreArticleGrade == 1).First().GradeID; } GradeName = ListOfGrades.Where(q => q.GradeID == GradeID).Single().GradeDescription; if (DeptID == 0) { DeptID = ListOfDepts.Where(q => q.DeptActive == 1).First().DeptID; } DeptName = ListOfDepts.Where(q => q.DeptID == DeptID).Single().DeptName; if (SeasonID == 0) { SeasonID = ListOfSeasons.Where(q => q.SeasonActive == 1).First().SeasonID; } 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(); if (CatID == 0 && ListOfMerchCats.Any(q => q.MerchCatActive == 1)) { CatID = ListOfMerchCats.Where(q => q.MerchCatActive == 1).First().CatID; } ListOfCats = ListOfCats.Join(ListOfMerchCats, a => a.CatID, b => b.CatID, (a, b) => new { a, b }).Select(z => z.a).Distinct().ToList(); if (ListOfCats.Count > 0) { CatName = ListOfCats.Where(c => c.CatID == CatID).Single().CatDesc; } //ListOfSpaceAllocations = ListOfSpaceAllocations.Join(ListOfMerchCats, a => a.CatID, b => b.CatID, (a, b) => new { a, b }).Select(z => z.a).ToList(); ListOfSpaceAllocations = ListOfSpaceAllocations.Where(z => z.SpaceGradeID == GradeID && z.SeasonID == SeasonID && z.CatID == CatID).ToList(); 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(); if (FO == 0 && ListOfSpaceAllocations.Count > 0) { FO = ListOfSpaceAllocations.Min(a => a.FixtureOrdinal); } ListOfSpaceAllocations = ListOfSpaceAllocations.Where(z => z.FixtureOrdinal == FO).OrderBy(w => w.OrdinalSequence).ToList(); string FixtureName = ""; if (ListOfSpaceAllocations.Count > 0) { FixtureName = ListOfSpaceAllocations.First().FixtureName; } #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["ddDept"] = ListOfDepts.Select(m => new SelectListItem { Value = m.DeptID.ToString(), Text = m.DeptName + " (" + m.DeptID.ToString() + ")", Selected = m.DeptID == DeptID }); ViewData["ddCat"] = ListOfCats.Select(m => new SelectListItem { Value = m.CatID.ToString(), Text = m.CatDesc + " (" + m.CatID.ToString() + ")", Selected = m.CatID == CatID }); ViewData["ddFO"] = ListofSelects; ViewBag.DeptID = DeptID; ViewBag.DeptName = DeptName; ViewBag.CatID = CatID; ViewBag.CatName = CatName; ViewBag.GradeName = GradeName; ViewBag.FixtureName = FixtureName; #endregion return(View(ListOfSpaceAllocations)); }