Exemple #1
0
        protected override void OnStart(string[] args)
        {
            LOGGER.Write(LOGGER.LOGGEREventID.INFORMATION, cMODULE_NAME, new string[] { cBASE_NAME, "Starting..." });
            double newFormsAlarmInterval  = 0;
            double lateFormsAlarmInterval = 0;

            System.Threading.Thread.Sleep(20000);

            try
            {
                newFormsAlarmInterval  = Properties.Settings.Default.NewFormsAlarmInterval;
                lateFormsAlarmInterval = Properties.Settings.Default.LateFormsAlarmInterval;

                Forms.ProcessUserProductionUnitsForms(Properties.Settings.Default.ReferenceStartDate);
                LateForms.ProcessLateSubmissions();
            }
            catch (Exception exp)
            {
                LOGGER.Write(LOGGER.LOGGEREventID.EXCEPTION, cMODULE_NAME, new string[] { cBASE_NAME, exp.Message });
            }

            NewFormsTimer.Elapsed += NewFormsTimer_Elapsed;
            NewFormsTimer.Enabled  = true;
            NewFormsTimer.Interval = newFormsAlarmInterval * 60 * 60 * 1000;
            NewFormsTimer.Start();

            LateFormsTimer.Elapsed += LateFormsTimer_Elapsed;
            LateFormsTimer.Enabled  = true;
            LateFormsTimer.Interval = lateFormsAlarmInterval * 60 * 60 * 1000;
            LateFormsTimer.Start();
        }
Exemple #2
0
        void LateFormsTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            LOGGER.Write(LOGGER.LOGGEREventID.INFORMATION, cMODULE_NAME, new string[] { cBASE_NAME, "Processing alerts notifications!" });
            LateFormsTimer.Stop();

            try
            {
                LateForms.ProcessLateSubmissions();
            }
            catch (Exception exp)
            {
                LOGGER.Write(LOGGER.LOGGEREventID.EXCEPTION, cMODULE_NAME, new string[] { cBASE_NAME, exp.Message });
            }
            finally
            {
                LateFormsTimer.Start();
            }
        }