Example #1
0
        public void IniciarServico()
        {
            //throw new NotImplementedException();

            Gradual.Utils.Logger.Initialize();

            Gradual.Utils.Logger.Log("Service", Gradual.Utils.LoggingLevel.Info, String.Format("{0}: {1}", Gradual.Utils.MethodHelper.GetCurrentMethod(), "Iniciando serviço"), new { User = Gradual.Utils.Settings.User, Environment = Gradual.Utils.Settings.Environment });

            _bKeepRunning = true;

            Gradual.Utils.Logger.Log("Service", Gradual.Utils.LoggingLevel.Info, String.Format("{0}: {1}",
                                                                                               Gradual.Utils.MethodHelper.GetCurrentMethod(),
                                                                                               "Criando thread do monitor"), new { User = Gradual.Utils.Settings.User, Environment = Gradual.Utils.Settings.Environment });

            thrMonitor = new System.Threading.Thread(new System.Threading.ThreadStart(Monitor));
            thrMonitor.Start();

            Gradual.Utils.Logger.Log("Service", Gradual.Utils.LoggingLevel.Info, String.Format("{0}: {1}",
                                                                                               Gradual.Utils.MethodHelper.GetCurrentMethod(),
                                                                                               "Iniciando Schenduler"), new { User = Gradual.Utils.Settings.User, Environment = Gradual.Utils.Settings.Environment });

            _cron = new Gradual.OMS.Library.CronStyleScheduler();
            _cron.Start();

            Gradual.Utils.Logger.Log("Service", Gradual.Utils.LoggingLevel.Info, String.Format("{0}: {1}",
                                                                                               Gradual.Utils.MethodHelper.GetCurrentMethod(),
                                                                                               "Serviço inicializado"), new { User = Gradual.Utils.Settings.User, Environment = Gradual.Utils.Settings.Environment });

            _status = Gradual.OMS.Library.Servicos.ServicoStatus.EmExecucao;
        }
Example #2
0
        public void PararServico()
        {
            //throw new NotImplementedException();
            _bKeepRunning = false;

            while (thrMonitor != null && thrMonitor.IsAlive)
            {
                System.Threading.Thread.Sleep(250);
            }

            _status = Gradual.OMS.Library.Servicos.ServicoStatus.Parado;

            Gradual.Utils.Logger.Log("Service", Gradual.Utils.LoggingLevel.Info, String.Format("{0}: {1}", Gradual.Utils.MethodHelper.GetCurrentMethod(), "Parando serviço"), new { User = Gradual.Utils.Settings.User, Environment = Gradual.Utils.Settings.Environment });
        }