public ActionResult editRoaster(int profileID, int RoasterTypeID, int LocationID, DateTime cabDate, int AddressID, string ShiftStartTime, string ShiftEndTime) { CabModel mdl = new CabModel(); mdl.roaster = new Entities.CabBooking(); mdl.roaster.ProfileID = profileID; mdl.roaster.RoasterTypeID = RoasterTypeID; mdl.roaster.selectedDatesString = cabDate.ToString("MM/dd/yyyy"); mdl.roaster.ShiftStartTime = ShiftStartTime; mdl.roaster.ShiftEndTime = ShiftEndTime; mdl.selectedDates = new List <DateTime>(); List <KeyValuePair <string, string> > start = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("9:00 AM", "9:00 AM"), new KeyValuePair <string, string>("10:00 AM", "10:00 AM"), new KeyValuePair <string, string>("11:00 AM", "11:00 AM"), }; List <KeyValuePair <string, string> > end = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("5:00 PM", "5:00 PM"), new KeyValuePair <string, string>("6:00 PM", "6:00 PM"), new KeyValuePair <string, string>("7:00 PM", "7:00 PM"), }; mdl.startTimeList = start; mdl.endTimeList = end; return(View("editRoaster", mdl)); }
public ActionResult addRoaster(int profileID) { CabModel mdl = new CabModel(); mdl = CabHelper.addRoaster(profileID); return(View("addRoaster", mdl)); }
// GET: Cab public ActionResult viewRoaster(int profileID) { CabModel mdl = new CabModel(); mdl.currentRoasterList = CabHelper.getCurrentRoasterList(profileID); return(View("viewRoaster", mdl)); }
internal static CabModel getRoasterData(int profileID, int bookingID) { CabModel mdl = new CabModel(); mdl.roaster = repository.getRoasterData(bookingID); return(mdl); //mdl. }
internal static void saveRoaster(CabModel mdl) { CabBooking cabBooking = mdl.roaster; int addressID = repository.getDefaultAddressID(cabBooking.ProfileID); int locationID = 1; string[] selectedDates = cabBooking.selectedDatesString.Split(','); foreach (string date in selectedDates) { CabDate c = new CabDate(); c.cabDate = DateTime.ParseExact(date, "MM/dd/yyyy", CultureInfo.InvariantCulture); //DateTime.Parse(date); c.AddressID = addressID; c.ShiftStartTime = cabBooking.ShiftStartTime; c.ShiftEndTime = cabBooking.ShiftEndTime; c.RoasterTypeID = cabBooking.RoasterTypeID; c.LocationID = locationID; CabBooking existingRoaster = repository.getRoasterByMonthYear(cabBooking.ProfileID, c.cabDate.Month, c.cabDate.Year); if (existingRoaster != null && existingRoaster.BookingID > 0) { List <CabDate> existingCabDateList = new List <CabDate>(); existingCabDateList = Utility.Deserialize <List <CabDate> >(existingRoaster.cabDate); CabDate duplicate = new CabDate(); duplicate = existingCabDateList.FirstOrDefault(m => m.cabDate == c.cabDate); if (duplicate != null && duplicate.cabDate != DateTime.MinValue) { existingCabDateList.Remove(duplicate); } existingCabDateList.Add(c); existingRoaster.cabDate = Utility.Serialize <List <CabDate> >(existingCabDateList); repository.SaveRoaster(existingRoaster); } else { List <CabDate> cabDateList = new List <CabDate>(); cabDateList.Add(c); cabBooking.cabDate = Utility.Serialize <List <CabDate> >(cabDateList); cabBooking.MonthID = c.cabDate.Month; cabBooking.YearID = c.cabDate.Year; repository.SaveRoaster(cabBooking); } } }
internal static CabModel addRoaster(int profileID) { CabModel mdl = new CabModel(); mdl.roaster = new CabBooking(); mdl.roaster.ProfileID = profileID; mdl.selectedDates = new List <DateTime>(); List <KeyValuePair <string, string> > start = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("9:00 AM", "9:00 AM"), new KeyValuePair <string, string>("10:00 AM", "10:00 AM"), new KeyValuePair <string, string>("11:00 AM", "11:00 AM"), }; List <KeyValuePair <string, string> > end = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("5:00 PM", "5:00 PM"), new KeyValuePair <string, string>("6:00 PM", "6:00 PM"), new KeyValuePair <string, string>("7:00 PM", "7:00 PM"), }; mdl.startTimeList = start; mdl.endTimeList = end; return(mdl); }
public ActionResult saveRoaster(CabModel mdl) { CabHelper.saveRoaster(mdl); return(RedirectToAction("viewRoaster", new { profileID = mdl.roaster.ProfileID })); }