Esempio n. 1
0
        /// <summary>
        /// Update weekly stats
        /// </summary>
        public static void UpdateStatsWeek(IServiceLayer DBServiceLayer, bool updateInOuts = false)
        {
            WeeklyStats stats = DBServiceLayer.GetCurrentWeekStats();

            stats.WeekNumber     = DBServiceLayer.GetCurrentWeekNumber();
            stats.ScannedIn      = stats.ScannedIn + ModuleScanning.getScannedIn();
            stats.ScannedOut     = stats.ScannedOut + ModuleScanning.getScannedOut();
            stats.TotalListeners = DBServiceLayer.GetCurrentListenerCount();
            stats.PausedCount    = DBServiceLayer.GetListenersByStatus(ListenerStates.PAUSED).Count;

            // Just update it if it already exists
            if (DBServiceLayer.WeeklyStatExistsForWeek(stats.WeekNumber))
            {
                DBServiceLayer.UpdateWeeklyStats(stats);
            }
            else
            {
                DBServiceLayer.SaveWeekStats(stats);
            }

            // Update the in/outs if required
            if (updateInOuts)
            {
                // Update in/out stats.
                DBServiceLayer.UpdateListenerInOuts();
            }
        }
Esempio n. 2
0
        // On load.
        private void formFinished_Load(object sender, EventArgs e)
        {
            ModuleGeneric.saveEndTime();

            // Setup labels.
            int weeknumb = serviceLayer.GetCurrentWeekNumber();

            lblStartTime.Text   = ModuleGeneric.getStartTimeString();
            lblFinishTime.Text  = ModuleGeneric.getEndTimeString();
            lblElapsedTime.Text = ModuleGeneric.getElapsedTimeString();
            lblScannedIn.Text   = ModuleScanning.getScannedIn().ToString();
            lblScannedOut.Text  = ModuleScanning.getScannedOut().ToString();

            // Update the stats week
            ModuleGeneric.UpdateStatsWeek(serviceLayer, false);

            readyToExit = true;
        }