Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public ActionResult addRoaster(int profileID)
        {
            CabModel mdl = new CabModel();

            mdl = CabHelper.addRoaster(profileID);
            return(View("addRoaster", mdl));
        }
Ejemplo n.º 3
0
        // GET: Cab
        public ActionResult viewRoaster(int profileID)
        {
            CabModel mdl = new CabModel();

            mdl.currentRoasterList = CabHelper.getCurrentRoasterList(profileID);
            return(View("viewRoaster", mdl));
        }
Ejemplo n.º 4
0
        internal static CabModel getRoasterData(int profileID, int bookingID)
        {
            CabModel mdl = new CabModel();

            mdl.roaster = repository.getRoasterData(bookingID);
            return(mdl);
            //mdl.
        }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public ActionResult saveRoaster(CabModel mdl)
 {
     CabHelper.saveRoaster(mdl);
     return(RedirectToAction("viewRoaster", new { profileID = mdl.roaster.ProfileID }));
 }