Beispiel #1
0
        public Scheduler()
        {
            this.serviceLog = new ServiceLog();
            InitializeComponent();
            int strTime = 1;

            getCallType = 1;

            if (getCallType == 1)
            {
                timer1 = new System.Timers.Timer();
                double inter = (double)GetNextInterval();
                timer1.Interval = inter;
                timer1.Elapsed += new ElapsedEventHandler(ServiceTimer_Tick);
            }
            else
            {
                timer1          = new System.Timers.Timer();
                timer1.Interval = strTime * 1000;
                timer1.Elapsed += new ElapsedEventHandler(ServiceTimer_Tick);
            }
        }
Beispiel #2
0
        public void LerRegistros()
        {
            try
            {
                ServiceLog.WriteErrorLog("Iniciou a Execução");
                DateTime agora  = DateTime.Now.AddMinutes(-1);
                ApiSap   apiSap = new ApiSap();

                apiSap.IniciarColeta();
                //TODO: Buscar relógios no MySQL
                //TODO: identificar qual o tipo de relógio
                //TODO: Chamar o relógio com os dados -IP, CPF, Login
                //TODO: Ler os registros do relógio
                //TODO: Inserir os registros no MySQL

                ServiceLog.WriteErrorLog("Concluiu a Execução com êxito");
            }
            catch (Exception ex)
            {
                ServiceLog.WriteErrorLog("Exception: " + ex);
                ServiceLog.WriteErrorLog("Concluiu a Execução com erro");
            }
        }
Beispiel #3
0
 protected override void OnStop()
 {
     timer1.AutoReset = false;
     timer1.Enabled   = false;
     ServiceLog.WriteErrorLog("Daily Reporting service stopped");
 }
Beispiel #4
0
 protected override void OnStart(string[] args)
 {
     timer1.AutoReset = true;
     timer1.Enabled   = true;
     ServiceLog.WriteErrorLog("Daily Reporting service started");
 }