コード例 #1
0
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;

                // if (!ValidationHelper.IsValid()) throw new Exception("Job inválido");

                if (!Ativo)
                {
                    throw new Exception("Job inativo");
                }

                EnviarListaBranca();

                Criar_Log("Processado com sucesso", true);
                response.TotalRegistros = 0;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }
コード例 #2
0
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;
                if (!Ativo)
                {
                    throw new Exception("Job inativo");
                }
                //if (!ValidationHelper.IsValid()) throw new Exception("Job inválido");

                var veiculos = ObterVeiculos();
                PreparaBase();
                PersistirDados(veiculos);
                Criar_Log($"{nameof(ObterVeiculosSascarJobService)} - Processado com sucesso", true);

                response.TotalRegistros = veiculos.Count;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }
コード例 #3
0
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;

                if (!Ativo)
                {
                    throw new Exception("Job inativo");
                }

                var posicoes = ObterPosicoes();

                PersistirDados(posicoes);

                Criar_Log($"Processado com sucesso", true);
                response.TotalRegistros = posicoes.Count;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }
コード例 #4
0
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;

                var posicoes = ObterPosicoes();

                PersistirDados(posicoes);

                //Criar_Log_($"{nameof(ObterPosicoesSascarJobService)} - Processado com sucesso", true);
                response.TotalRegistros = posicoes.Count;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log_Banco(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }
コード例 #5
0
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;

                // if (!ValidationHelper.IsValid()) throw new Exception("Job inválido");

                if (!Ativo)
                {
                    throw new Exception("Job inativo");
                }

                var veiculos = new List <VeiculoAutotrac>();

                ObterVeiculos(ref veiculos);

                if (veiculos.Count == 0)
                {
                    throw new Exception("Nenhum veiculo encontrado");
                }

                PersistirDados(veiculos);

                Criar_Log("Processado com sucesso", true);
                response.TotalRegistros = veiculos.Count;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }
        public ObterDadosResponse Executa()
        {
            var response = new ObterDadosResponse();

            try
            {
                response.DataInicial = DateTime.Now;

                if (memoriaVeiculos == null || memoriaVeiculos.dataAtu < DateTime.Now.AddMinutes(-5))
                {
                    memoriaVeiculos = ObterVeiculos();
                }

                var posicoes = ObterPosicoes();

                if (posicoes.posicoes != null && posicoes.posicoes.Count > 0)
                {
                    PersistirDados(posicoes);
                }

                Criar_Log($"{nameof(ObterPosicoesSitaComJobService)} - Processado com sucesso", true);
                response.TotalRegistros = posicoes.posicoes.Count;
                response.Mensagem       = "Processado com sucesso!";
            }
            catch (Exception erro)
            {
                Criar_Log(erro.Message, false);
                response.Mensagem = erro.Message;
            }
            finally
            {
                response.DataFinal = DateTime.Now;
            }

            return(response);
        }