Ejemplo 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();
            }
        }
Ejemplo n.º 2
0
        private void btnScanIn_Click(object sender, EventArgs e)
        {
            // Check if alterations have been completed.
            DialogResult result = MessageBox.Show("Have you completed all the alterations and additions from the pending tray?" + Environment.NewLine + Environment.NewLine + "If you still have alterations or additions press Cancel and scan in after.", ModuleGeneric.getAppShortName(), MessageBoxButtons.OKCancel);

            if (result == DialogResult.OK)
            {
                // Is it not a new stats week?
                if (!(serviceLayer.IsNewStatsWeek()) &&
                    serviceLayer.GetCurrentWeekStats().hasScanningResults())
                {
                    // Check before we create a new stats bit then!
                    DialogResult newWeekCheck = MessageBox.Show("Scanning has already been done this week. Are you sure you want to continue, a new stats week will be created.", ModuleGeneric.getAppShortName());
                    if (result == DialogResult.OK)
                    {
                        My.MyProject.Forms.formScanIn.Show();
                    }
                }
                else
                {
                    My.MyProject.Forms.formScanIn.Show();
                }
            }
        }