public ActionResult OpenEmployeeRoster(int ShiftID, int CrewID) { Expression <Func <VAT_RosterApplication, bool> > SpecificEntries1 = c => c.CriteriaData == CrewID; var rosterApps = VATRosterApplicationService.GetIndexSpecific(SpecificEntries1); Expression <Func <RosterApplication, bool> > SpecificEntries2 = c => c.CriteriaData == CrewID; var rosterApps2 = RosterApplicationService.GetIndexSpecific(SpecificEntries2); if (rosterApps.Count > 0) { VAT_RosterApplication rosterApp = rosterApps.First(); Expression <Func <RosterDetail, bool> > SpecificEntries = c => c.RosterAppID == rosterApp.RotaAppID; var rosterdetails = RosterDetailService.GetIndexSpecific(SpecificEntries); ViewBag.Header = "For Shift: " + rosterApp.ShiftName + ", Group: " + rosterApp.CrewName; return(View("RosterDetail", CalculateRosterDetails(rosterdetails, rosterApps2.First()).OrderByDescending(aa => aa.DutyDate))); } else { Shift obj = ShiftService.GetEdit((int)ShiftID); VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser; ViewBag.LocationID = new SelectList(DDService.GetLocation(LoggedInUser).ToList().OrderBy(aa => aa.LocationName).ToList(), "PLocationID", "LocationName", obj.LocationID); ViewBag.DayOff1 = new SelectList(DDService.GetDaysName().ToList().OrderBy(aa => aa.DayName).ToList(), "DaysNameID", "DayName", obj.DayOff1); ViewBag.DayOff2 = new SelectList(DDService.GetDaysName().ToList().OrderBy(aa => aa.DayName).ToList(), "DaysNameID", "DayName", obj.DayOff2); return(View("ShiftView", obj)); } }
public ActionResult RosterDetail(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //RosterDetailsCustom _RosterDetails = new RosterDetailsCustom(); //_RosterDetails.RosterDetails = db.RosterDetails.Where(aa => aa.RosterAppID == id).ToList(); //RosterApp _RosterApp = new RosterApp(); //_RosterApp = db.RosterApps.First(aa => aa.RotaApplD == id); ////_RosterDetails //int CrewID = Convert.ToInt32(Request.Form["CrewList"].ToString()); Expression <Func <RosterDetail, bool> > SpecificEntries = c => c.RosterAppID == id; var rosterdetails = RosterDetailService.GetIndexSpecific(SpecificEntries); RosterApplication rosterApp = RosterApplicationService.GetEdit((int)id); VAT_RosterApplication vATrosterApp = VATRosterApplicationService.GetEdit((int)id); ViewBag.Header = "For Shift: " + vATrosterApp.ShiftName + ", Group: " + vATrosterApp.CrewName; return(View(CalculateRosterDetails(rosterdetails, rosterApp).OrderByDescending(aa => aa.DutyDate))); }