Exemple #1
0
        public void CheckTotalParkingTime()
        {
            var currentBookingId   = mPlatformService.GetPreference <long>(AppConstants.CurrentBookingId);
            var bookingExpiredTime = mPlatformService.GetPreference <long>(AppConstants.BookingExpiredTime);

            if ((currentBookingId == null || currentBookingId == 0) || (currentBookingId != 0 && currentBookingId != long.Parse(SummaryVM.Reservation.BookingId)))
            {
                TotalParkingTime = (int)(long.Parse(SummaryVM.Reservation.EndTimestamp) - long.Parse(SummaryVM.Reservation.StartTimestamp));
                mPlatformService.SetPreference <long>(AppConstants.BookingExpiredTime, long.Parse(SummaryVM.Reservation.EndTimestamp));
                mPlatformService.SetPreference <long>(AppConstants.CurrentBookingId, long.Parse(SummaryVM.Reservation.BookingId));
            }
            else
            {
                var currentTimeStamp = DateTime.UtcNow.ToLocalTime().DateTimeToTimeStamp();
                if (currentTimeStamp <= bookingExpiredTime)
                {
                    TotalParkingTime = (int)(bookingExpiredTime - currentTimeStamp);
                }
                else
                {
                    mPlatformService.SetPreference <long>(AppConstants.BookingExpiredTime, 0);
                    mPlatformService.SetPreference <long>(AppConstants.CurrentBookingId, 0);
                }
            }
        }