예제 #1
0
        private void PopulateBookings(DateTime dt)
        {
            long today    = FSManager.GetSecondsDayOnly(dt);
            long tomorrow = FSManager.AdjustDay(today, 1);

            bookings      = db.PullAllBookingsByDate(today, tomorrow);
            bookingPanels = new List <int>();
            foreach (Booking b in bookings.Values)
            {
                GenerateBookingSlot(b);
            }
        }
예제 #2
0
        private void CheckForBookingStart(long curTime)
        {
            bool check = false;

            if (!slotSynced)
            {
                long diff = curTime % bookingCycle;
                if (diff == 0)
                {
                    slotSynced       = true;
                    lastBookingCheck = curTime;
                    check            = true;
                }
            }
            else if (curTime >= (lastBookingCheck + bookingCycle))
            {
                lastBookingCheck = curTime;
                check            = true;
            }

            if (check)
            {
                // Check for bookings to start
                long lowEnd  = lastBookingCheck - 300;
                long highEnd = lastBookingCheck + 300;
                Dictionary <int, Booking> bookings = db.PullAllBookingsByDate(lowEnd, highEnd);
                foreach (Booking b in bookings.Values)
                {
                    if (sims.ContainsKey(b.SimMacAddress))
                    {
                        string startTime = b.GetCompiledStartTime();
                        bool   countUp   = false; // Made via booking, which is a set time/duration
                        StartNewSession(sims[b.SimMacAddress], startTime, countUp);
                    }
                }
            }
        }