Esempio n. 1
0
        public static void onExit(int userId)
        {
            var eventId = DatabaseHandler.GetMaxEventId(userId);

            DatabaseHandler.InsertIvent(userId, eventId + 1, true, DateTime.Now.AddMinutes(30));
            DatabaseHandler.UpdateMaxEventId(userId, eventId + 1);
            Console.WriteLine("Good bye)");
        }
Esempio n. 2
0
        public static void CountUserStatistic(int userId)
        {
            var max_val = DatabaseHandler.GetMaxEventId(userId);

            max_val = max_val % 2 == 0 ? max_val : max_val - 1;
            visitStatistics[userId] = new ArrayList();
            for (int j = 1; j < max_val; j += 2)
            {
                DateTime event1 = DatabaseHandler.GetTimeInGym(j);
                DateTime event2 = DatabaseHandler.GetTimeInGym(j + 1);
                visitStatistics[userId].Add(event1.Subtract(event2).TotalMinutes);
            }
        }
Esempio n. 3
0
        public static void OnEnter(int userId)
        {
            var dt = DatabaseHandler.GetExpireTime(userId);

            if (dt < DateTime.Now)
            {
                Console.WriteLine("Your pass has expired. Contact manager for further info");
                return;
            }

            Console.WriteLine("Access granted");
            var eventId = DatabaseHandler.GetMaxEventId(userId);

            DatabaseHandler.InsertIvent(userId, eventId + 1, true, DateTime.Now);
            DatabaseHandler.UpdateMaxEventId(userId, eventId + 1);
        }