Exemple #1
0
 public void FctGerarPreficificacaoFornecedor()
 {
     try
     {
         eventLog1.WriteEntry($"Gerando Precificação Cotação Fornecedores.", EventLogEntryType.Information, 1);
         var service = new PrecoCotacaoFornecedorService();
         service.PrecificarCotacaoFornecedor();
     }
     catch (Exception ex)
     {
         eventLog1.WriteEntry($"Erro ao Gerar Mensalidades.\n\n{ex}", EventLogEntryType.Error, 1);
     }
 }
        private void PrecificarCotacoesFornecedor()
        {
            try
            {
                Connection = new HubConnection(Url);
                Proxy      = Connection.CreateHubProxy("Notificacoes");
                Connection.Start();

                PrecoCotacaoFornecedorService service = new PrecoCotacaoFornecedorService();
                eventLog2.WriteEntry($"Precificando Cotação Fornecedor.", EventLogEntryType.Information, 1);
                var resultado = service.PrecificarCotacaoFornecedor();

                resultado.ForEach(x => {
                    Proxy.Invoke("CotacaoNovoPreco", x.TokenUsuario, x.CotacaoId, x.DataFechamentoCotacao, x.CotacaoGrupo, DateTime.Now);
                });

                eventLog2.WriteEntry($"Precificação de Cotações para Fornecedores executada com sucesso!", EventLogEntryType.Information, 1);
            }
            catch (Exception ex)
            {
                eventLog2.WriteEntry($"Erro ao Precificar Cotações para Fornecedores.\n\n{ex}", EventLogEntryType.Error, 1);
            }
        }