예제 #1
0
 /// <summary>
 /// Raises event 'ProgressDetail'
 /// </summary>
 protected virtual void OnProgressDetail()
 {
     if (ProgressDetail != null)
     {
         ProgressDetail.Invoke(this, System.EventArgs.Empty);
     }
 }
예제 #2
0
        public ActionResult UpdateEventProgress(ProgressDetail details)
        {
            var track = new EventTracking {
                CustomerId = User.Identity.GetUserId(), EventId = details.Id, EventStatus = details.EventStatus, Date = DateTime.Now
            };

            db.EventTrackings.Add(track);
            db.SaveChanges();
            return(View(GetProgressDetail(details.Id)));
        }
예제 #3
0
        private ProgressDetail GetProgressDetail(int id)
        {
            //Get the tracking record
            var eventTracking = db.EventTrackings.AsEnumerable().LastOrDefault(et => et.EventId == id);
            var evnt          = db.Events.FirstOrDefault(e => e.Id == id);
            var detail        = new ProgressDetail();

            detail.Id          = id;
            detail.EventName   = evnt.EventName;
            detail.EventStatus = (byte)EventStatus.Create;

            //Get the actual saved event status and fill it in the model to return to view
            if (eventTracking != null)
            {
                detail.EventStatus = eventTracking.EventStatus;
            }
            return(detail);
        }
예제 #4
0
        public ActionResult UpdateEventProgress(ProgressDetail details)
        {
            var currentTrack = db.EventTrackings.Where(e => e.BookingId == details.BookingId).OrderByDescending(e => e.Id).FirstOrDefault();

            if (currentTrack != null && currentTrack.EventStatus == details.EventStatus)
            {
                return(View(GetProgressDetail(details.BookingId)));
            }
            var track = new EventTracking {
                CustomerId = User.Identity.GetUserId(), BookingId = details.BookingId, EventId = details.EventId, EventStatus = details.EventStatus, Date = DateTime.Now
            };

            db.EventTrackings.Add(track);

            var booking = db.Bookings.Where(b => b.Id == details.BookingId).FirstOrDefault();

            if (booking != null)
            {
                booking.BookingStatus = ((EventStatus)details.EventStatus).ToString();
            }
            db.SaveChanges();
            ViewBag.Updated = true;
            return(View(GetProgressDetail(details.BookingId)));
        }