Exemple #1
0
        /// <summary>
        /// Runs all the operations of this monitor
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        public static bool Run(StreamWriter writer)
        {
            if (IsRunning)
            {
                return(false);
            }

            IsRunning = true;


            // 1. Excute CheckClientContracts
            Info(writer, ":: ClientMonitor :: CheckClientContracts() :: Executed");

            CheckClientContracts(writer);

            // 2. ....

            IsRunning = false;

            #region Update Last Run

            using (SystemConfigService service = new SystemConfigService())
            {
                SystemConfig rules = service.GetById(ConfigSettings.SystemRules.Id);

                if (rules != null)
                {
                    rules.LastClientMonitorRun   = DateTime.Now;
                    rules.LastClientMonitorCount = ClientMonitorCount;

                    service.Update(rules);
                }
            }

            #endregion

            return(true);
        }