public async Task Executar(FiltroRelatorioDto request)
        {
            var relatorioQuery = request.ObterObjetoFiltro <ObterRelatorioConselhoClasseAlunoQuery>();

            SentrySdk.CaptureMessage("4.09 Obtendo relatorio.. - RelatorioConselhoClasseAlunoUseCase");

            var relatorio = await mediator.Send(relatorioQuery);

            SentrySdk.CaptureMessage("5.1 Obtive relatorio.. - RelatorioConselhoClasseAlunoUseCase");

            var urlRelatorio = "";

            if (relatorio.Relatorio.FirstOrDefault().EhBimestreFinal)
            {
                urlRelatorio = "/sgp/RelatorioConselhoClasse/ConselhoClasseAbaFinal";
            }
            else
            {
                urlRelatorio = "/sgp/RelatorioConselhoClasse/ConselhoClasse";
            }

            var relatorioSerializado = JsonConvert.SerializeObject(relatorio);

            SentrySdk.CaptureMessage("5.2 Serializei relatório.. - RelatorioConselhoClasseAlunoUseCase");

            SentrySdk.AddBreadcrumb("5 - Obtive o relatorio serializado : " + relatorioSerializado, "5 - RelatorioConselhoClasseAlunoUseCase");
            await mediator.Send(new GerarRelatorioAssincronoCommand(urlRelatorio, relatorioSerializado, TipoFormatoRelatorio.Pdf, request.CodigoCorrelacao));

            SentrySdk.CaptureMessage("5 FINAL - RelatorioConselhoClasseAlunoUseCase");
        }
Ejemplo n.º 2
0
        private void ShowError(Exception e)
        {
            if (e is null)
            {
                SentrySdk.CaptureMessage("ShowError called but no Exception instance provided.", SentryLevel.Error);
            }

            if (e is AggregateException ae && ae.InnerExceptions.Count == 1)
            {
                e = ae.InnerExceptions[0];
            }

            var uploadButton = (Button)base.FindViewById(Resource.Id.btnUpload);
            var cancelButton = (Button)base.FindViewById(Resource.Id.btnCancel);

            var lastEvent = SentrySdk.LastEventId;
            // TODO: SentryId.Empty should operator overload ==
            var message = SentryId.Empty.ToString() == lastEvent.ToString()
                ? e?.ToString() ?? "Something didn't quite work."
                : $"Sentry id {lastEvent}:\n{e}";

            var builder = new AlertDialog.Builder(this);

            builder
            .SetTitle("Error")
            .SetMessage(message)
            .SetNeutralButton("Ironic eh?", (o, eventArgs) =>
            {
                uploadButton.Enabled = true;
                cancelButton.Enabled = false;
            })
            .Show();
        }
Ejemplo n.º 3
0
        public async Task <bool> Executar(MensagemRabbit mensagemRabbit)
        {
            var filtroDadosUsuario = mensagemRabbit.ObterObjetoMensagem <AtualizarDadosUsuarioDto>();

            if (filtroDadosUsuario == null)
            {
                SentrySdk.CaptureMessage($"Não foi possível realizar a atualização dos dados do responsável do aluno no eol", Sentry.Protocol.SentryLevel.Error);
                return(false);
            }

            var usuarioApp = await mediator.Send(new ObterUsuarioQuery(filtroDadosUsuario.Id));

            if (usuarioApp == null)
            {
                return(false);
            }

            var usuariosEol = await mediator.Send(new ObterDadosReponsavelPorCpfQuery(usuarioApp.Cpf));

            if (usuariosEol == null || !usuariosEol.Any())
            {
                return(false);
            }

            MapearAlteracoes(usuariosEol, filtroDadosUsuario);

            foreach (var usuarioEol in usuariosEol)
            {
                await mediator.Send(new AtualizarDadosResponsavelEolCommand(usuarioEol.CodigoAluno, long.Parse(usuarioEol.CPF), usuarioEol.Email, filtroDadosUsuario.DataNascimentoResponsavel, usuarioEol.NomeMae, usuarioEol.NumeroCelular, usuarioEol.DDDCelular));
            }

            return(true);
        }
Ejemplo n.º 4
0
        private void btnLive_Click(object sender, RoutedEventArgs e)
        {
            var LiveBtn_TextBlockText = txtBlock_BtnLive.Text.ToString();

            if (LiveBtn_TextBlockText == "Go Live")
            {
                if (ConnectionTest(false))
                {
                    IsLive = true;
                    txtBlock_BtnLive.Text = "Go Offline";
                    btnLive.Background    = Brushes.Red;
                    string text = "Live is Started ...! (" + DateTime.Now + ")";
                    txtLogs.Document.Blocks.Add(new Paragraph(new Run(text)));
                    InsertingLogTextToLogFile(text);
                }
                else
                {
                    string msg = "Database connection failed. Please make valid database configuration then Go Live.";
                    MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtLogs.Document.Blocks.Add(new Paragraph(new Run(msg + " (" + DateTime.Now.ToString() + ")")));
                    InsertingLogTextToLogFile(msg + " (" + DateTime.Now.ToString() + ")");
                    SentrySdk.CaptureMessage(msg);
                }
            }
            else
            {
                IsLive = false;
                txtBlock_BtnLive.Text = "Go Live";
                btnLive.Background    = Brushes.LimeGreen;
                string text = "Live is Stopped ...! (" + DateTime.Now + ")";
                txtLogs.Document.Blocks.Add(new Paragraph(new Run(text)));
                InsertingLogTextToLogFile(text);
            }
        }
        public async Task <bool> RelatoriosProcessando([FromQuery] FiltroRelatorioDto request, [FromServices] IMonitorarStatusRelatorioUseCase monitorarStatusRelatorioUseCase)
        {
            SentrySdk.CaptureMessage("7 - relatorios/processando");
            await monitorarStatusRelatorioUseCase.Executar(request);

            return(true);
        }
        public async Task RemoverConexoesIdle()
        {
            try
            {
                var conexao = new NpgsqlConnection(variaveisGlobaisOptions.AEConnection);

                await conexao.OpenAsync();

                var sqlQuery = new StringBuilder();
                sqlQuery.AppendLine("select pg_terminate_backend(pid)");
                sqlQuery.AppendLine("	from pg_stat_activity");
                sqlQuery.AppendLine("where datname = @databaseName and");
                sqlQuery.AppendLine(@"	  ""state"" = 'idle' and");
                sqlQuery.AppendLine("	  pid <> pg_backend_pid();");

                await conexao.ExecuteAsync(sqlQuery.ToString(), new { databaseName = conexao.Database });


                SentrySdk.CaptureMessage("Limpando pool de conexões idle do banco.");
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }
        }
        private async Task <List <Search> > SearchEpisodes(string searchTerm)
        {
            List <Search> searchResult = new List <Search>();

            try
            {
                var response =
                    await _httpClient.GetAsync(
                        $"{_httpClient.BaseAddress}search/episodes?q={searchTerm}&page=1&per_page=999");

                if (response.IsSuccessStatusCode)
                {
                    string json = response.Content.ReadAsStringAsync().Result;
                    SearchResult <Episode> ep = JsonSerializer.Deserialize <SearchResult <Episode> >(json);

                    foreach (Episode episode in ep.Hits)
                    {
                        searchResult.Add(new Search(episode));
                    }
                }

                if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    _toastService.ShowError("Error 404: Backend server is offline.");
                    SentrySdk.CaptureMessage("API: Error 404");
                }
            }
            catch (Exception e)
            {
                SentrySdk.CaptureException(e);
            }

            return(searchResult);
        }
Ejemplo n.º 8
0
 public void Registrar(string mensagem)
 {
     using (SentrySdk.Init(sentryDSN))
     {
         SentrySdk.CaptureMessage(mensagem);
     }
 }
Ejemplo n.º 9
0
        public async Task SendEmail(QuieroProducto quiero)
        {
            try
            {
                EmailMessage message = new EmailMessage();
                message.Content  = $"Hola, soy {quiero.Nombre}, me interesa el modelo {quiero.Modelo} {quiero.Anio} con las medidas : {quiero.Talle} / {quiero.Taza}. Mi contacto es : {quiero.Email} / {quiero.Telefono}";
                message.Reciever = new MailboxAddress("Self", _notificationMetadata.Reciever);
                message.Sender   = new MailboxAddress("Self", _notificationMetadata.Sender);
                message.Subject  = $"Quiero el modelo {quiero.Modelo} {quiero.Anio}";

                var mimeMessage = CreateMimeMessageFromEmailMessage(message);

                using (SmtpClient smtpClient = new SmtpClient())
                {
                    SentrySdk.CaptureMessage(_notificationMetadata.SmtpServer);
                    SentrySdk.CaptureMessage(_notificationMetadata.Port.ToString());
                    SentrySdk.CaptureMessage(_notificationMetadata.UserName);
                    SentrySdk.CaptureMessage(_notificationMetadata.Password);
                    await smtpClient.ConnectAsync(_notificationMetadata.SmtpServer,
                                                  _notificationMetadata.Port, true);

                    await smtpClient.AuthenticateAsync(_notificationMetadata.UserName,
                                                       _notificationMetadata.Password);

                    await smtpClient.SendAsync(mimeMessage);

                    await smtpClient.DisconnectAsync(true);
                }
            }
            catch (Exception err)
            {
                SentrySdk.CaptureException(err);
            }
        }
Ejemplo n.º 10
0
        private async Task InicarCargaUsuariosDoCursoAsync(CursoGsaDto cursoGsaDto)
        {
            try
            {
                var filtroEstudantes  = new FiltroCargaCursoUsuariosGsaDto(cursoGsaDto, (short)UsuarioCursoGsaTipo.Estudante);
                var filtroProfessores = new FiltroCargaCursoUsuariosGsaDto(cursoGsaDto, (short)UsuarioCursoGsaTipo.Professor);

                var iniciarCargaEstudantes = await mediator.Send(new PublicaFilaRabbitCommand(RotasRabbit.FilaGsaCursoUsuarioCarregar, RotasRabbit.FilaGsaCursoUsuarioCarregar, filtroEstudantes));

                if (!iniciarCargaEstudantes)
                {
                    SentrySdk.CaptureMessage($"Não foi possível iniciar a carga de estudantes do curso {cursoGsaDto.Id}.");
                }

                var iniciarCargaProfessores = await mediator.Send(new PublicaFilaRabbitCommand(RotasRabbit.FilaGsaCursoUsuarioCarregar, RotasRabbit.FilaGsaCursoUsuarioCarregar, filtroProfessores));

                if (!iniciarCargaProfessores)
                {
                    SentrySdk.CaptureMessage($"Não foi possível iniciar a carga de professores do curso {cursoGsaDto.Id}.");
                }
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }
        }
Ejemplo n.º 11
0
        public async Task <bool> Executar(MensagemRabbit mensagemRabbit)
        {
            try
            {
                var filtro       = ObterFiltro(mensagemRabbit);
                var usuarioErros = await mediator.Send(new ObtemUsuariosErrosPorTipoQuery(UsuarioTipo.Aluno));

                if (!usuarioErros?.Any() ?? true)
                {
                    return(true);
                }

                foreach (var usuarioErro in usuarioErros)
                {
                    var filtroAluno         = new FiltroAlunoErroDto(usuarioErro, filtro.AnoLetivo, filtro.TiposUes, filtro.Ues, filtro.Turmas);
                    var publicarFuncionario = await mediator.Send(new PublicaFilaRabbitCommand(RotasRabbit.FilaAlunoErroTratar, RotasRabbit.FilaAlunoErroTratar, filtroAluno));

                    if (!publicarFuncionario)
                    {
                        SentrySdk.CaptureMessage($"Não foi possível inserir o tratamento de erro do aluno RA{usuarioErro.UsuarioId} na fila.");
                        continue;
                    }

                    await ExcluirUsuarioErroAsync(usuarioErro);
                }

                return(true);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }

            return(false);
        }
Ejemplo n.º 12
0
        public bool DeleteAmenity(int id)
        {
            try
            {
                using (var ctx = new ApplicationDbContext())
                {
                    var amenityEntity = ctx.Amenities.Where(a => a.Id == id)
                                        .FirstOrDefault();
                    if (amenityEntity == null)
                    {
                        return(false);
                    }

                    //check to make sure amenity is not linked to SpaceAmenities before deleting
                    if (amenityEntity.SpaceAmenities == null)
                    {
                        ctx.Amenities.Remove(amenityEntity);
                        return(ctx.SaveChanges() == 1);
                    }
                    else
                    {
                        SentrySdk.CaptureMessage($"Cannot delete Amenity with ID:{id} because it is in use");
                    }
                    return(false);
                }
            }
            catch (Exception e)
            {
                SentrySdk.CaptureException(e);
                return(false);
            }
        }
Ejemplo n.º 13
0
 public override void _Notification(int what)
 {
     if (what == MainLoop.NotificationWmQuitRequest)
     {
         SentrySdk.CaptureMessage("App Quit!");
     }
 }
Ejemplo n.º 14
0
        public void logError(Object obj, String message)
        {
            String errorMessage = formatMessage(obj, message, "ERROR");

            _log.WriteEntry(errorMessage);
            SentrySdk.CaptureMessage(errorMessage);
        }
Ejemplo n.º 15
0
 private void btn_DbConfig_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string pathDir = AppDomain.CurrentDomain.BaseDirectory + "\\Credential\\appData.xml";
         if (File.Exists(pathDir))
         {
             System.Diagnostics.Process.Start("notepad.exe", pathDir);
         }
         else
         {
             string msg = "No Database Configuration file found.";
             MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             txtLogs.Document.Blocks.Add(new Paragraph(new Run(msg + " (" + DateTime.Now.ToString() + ")")));
             InsertingLogTextToLogFile(msg + " (" + DateTime.Now.ToString() + ")");
             SentrySdk.CaptureMessage(msg);
         }
     }
     catch (Exception ex)
     {
         txtLogs.Document.Blocks.Add(new Paragraph(new Run(ex.Message + " (" + DateTime.Now.ToString() + ")")));
         InsertingLogTextToLogFile(ex.Message + " (" + DateTime.Now.ToString() + ")");
         SentrySdk.CaptureException(ex);
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 16
0
        public async Task <RetornoUsuarioCoreSSO> ObterPorCPF(string cpf)
        {
            try
            {
                RetornoUsuarioCoreSSO usuarioCoreSSO;

                using var conn = new SqlConnection(variaveisGlobaisOptions.CoreSSOConnection);

                conn.Open();
                usuarioCoreSSO = await conn.QueryFirstOrDefaultAsync <RetornoUsuarioCoreSSO>(@"
                            SELECT u.usu_id usuId,u.usu_senha as senha, u.usu_situacao as status, u.usu_criptografia as TipoCriptografia, u.usu_login as Cpf
                            FROM sys_usuario u
                            WHERE u.usu_login = @cpf "
                                                                                             , new { cpf });

                conn.Close();


                return(usuarioCoreSSO);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureMessage(ex.Message, Sentry.Protocol.SentryLevel.Error);
                SentrySdk.CaptureException(ex);
                throw ex;
            }
        }
        public async Task <bool> Executar(MensagemRabbit mensagemRabbit)
        {
            try
            {
                var filtroCargaInicial = UtilsDto.ObterFiltroParametrosIniciais(mensagemRabbit);
                var usuarioErros       = await mediator.Send(new ObtemUsuariosErrosPorTipoQuery(UsuarioTipo.Funcionario));

                if (!usuarioErros?.Any() ?? true)
                {
                    return(true);
                }

                foreach (var usuarioErro in usuarioErros)
                {
                    var filtroFuncionarioErro = new FiltroUsuarioErroDto(usuarioErro, filtroCargaInicial);
                    var publicarFuncionario   = await mediator.Send(new PublicaFilaRabbitCommand(RotasRabbit.FilaFuncionarioErroTratar, RotasRabbit.FilaFuncionarioErroTratar, filtroFuncionarioErro));

                    if (!publicarFuncionario)
                    {
                        SentrySdk.CaptureMessage($"Não foi possível inserir o tratamento de erro do funcionário RF{usuarioErro.UsuarioId} na fila.");
                        continue;
                    }

                    await ExcluirUsuarioErroAsync(usuarioErro);
                }

                return(true);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }

            return(false);
        }
        public async Task Executar(FiltroRelatorioDto filtroRelatorioDto)
        {
            SentrySdk.AddBreadcrumb($"Obtendo dados do relatório", "8 - MonitorarStatusRelatorioUseCase");

            var dadosRelatorio = filtroRelatorioDto.ObterObjetoFiltro <DadosRelatorioDto>();

            var detalhesRelatorio = await mediator.Send(new ObterDetalhesRelatorioQuery(dadosRelatorio.RequisicaoId, dadosRelatorio.JSessionId));

            SentrySdk.AddBreadcrumb($"dados do relatório OK", "8 - MonitorarStatusRelatorioUseCase");


            if (detalhesRelatorio != null && detalhesRelatorio.Pronto)
            {
                SentrySdk.AddBreadcrumb($"Indo publicar na fila Prontos..", "8 - MonitorarStatusRelatorioUseCase");

                //TODO: Aplicar Polly ??
                if (await mediator.Send(new SalvarRelatorioJasperLocalCommand(dadosRelatorio.JSessionId, dadosRelatorio.RequisicaoId, dadosRelatorio.ExportacaoId, dadosRelatorio.CodigoCorrelacao)))
                {
                    servicoFila.PublicaFila(new PublicaFilaDto(dadosRelatorio, RotasRabbit.RotaRelatoriosProntosSgp, RotasRabbit.ExchangeSgp, filtroRelatorioDto.CodigoCorrelacao));
                    SentrySdk.CaptureMessage("8 - MonitorarStatusRelatorioUseCase - Publicado na fila PRONTO OK!");
                }
                else
                {
                    PublicarNovamenteNaFila(filtroRelatorioDto, dadosRelatorio);
                }
            }
            else
            {
                PublicarNovamenteNaFila(filtroRelatorioDto, dadosRelatorio);
            }
        }
 private async Task ExcluirUsuarioErroAsync(UsuarioErro usuarioErro)
 {
     if (!await mediator.Send(new ExcluirUsuarioErroCommand(usuarioErro.Id)))
     {
         SentrySdk.CaptureMessage($"Não foi possível excluir o erro Id {usuarioErro.Id} do funcionário RF{usuarioErro.UsuarioId}.");
     }
 }
Ejemplo n.º 20
0
        public async Task <bool> Handle(GerarRelatorioAtaFinalHtmlParaPdfCommand request, CancellationToken cancellationToken)
        {
            List <string> paginasEmHtml = new List <string>();

            foreach (var modelPagina in request.Paginas)
            {
                string html = string.Empty;

                html = GerarHtmlRazor(modelPagina, request.NomeTemplate);

                html = html.Replace("logo.png", SmeConstants.LogoSme);

                paginasEmHtml.Add(html);
            }

            //TODO: FILA PARA RELATORIO SEM DADOS?
            if (paginasEmHtml.Any())
            {
                PdfGenerator pdfGenerator = new PdfGenerator(converter);

                var directory = AppDomain.CurrentDomain.BaseDirectory;
                SentrySdk.AddBreadcrumb($"Gerando PDF", $"Caminho geração : {directory}");

                pdfGenerator.ConvertToPdf(paginasEmHtml, directory, request.CodigoCorrelacao.ToString());

                SentrySdk.AddBreadcrumb($"Indo publicar na fila Prontos..", "8 - MonitorarStatusRelatorioUseCase");
                servicoFila.PublicaFila(new PublicaFilaDto(new MensagemRelatorioProntoDto(request.MensagemUsuario, string.Empty), RotasRabbit.RotaRelatoriosProntosSgp, RotasRabbit.ExchangeSgp, request.CodigoCorrelacao));
                SentrySdk.CaptureMessage("8 - MonitorarStatusRelatorioUseCase - Publicado na fila PRONTO OK!");
            }

            return(true);
        }
Ejemplo n.º 21
0
        private string GetPasswordFromXML()
        {
            //string path = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
            //string path = System.IO.Path.Combine(Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName + "\\Credential", "LoginCredential.xml");
            //string fileName = System.IO.Path.Combine(path, "LoginCredential.xml");
            string path = AppDomain.CurrentDomain.BaseDirectory + "\\Credential\\LoginCredential.xml";

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(path);

                var dt = ds.Tables["LoginCredential"];
                if (dt != null)
                {
                    var getUserName_XML     = dt.Rows[0][0].ToString();
                    var getPass_XML         = dt.Rows[0][1].ToString();
                    var getUserName_Decrypt = Helper.Crypto.Decrypt(getUserName_XML);
                    var getPass_Decrypt     = Helper.Crypto.Decrypt(getPass_XML);

                    return(getPass_Decrypt);
                }
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureMessage(ex.Message);
                return(null);
            }
            return(null);
        }
Ejemplo n.º 22
0
        public bool Log(LogLevel logLevel, Func <string> messageFunc, Exception exception = null)
        {
            if ((messageFunc == null && logLevel <= LogLevel.Warn) || (logLevel >= LogLevel.Error && exception == null))
            {
                return(false);
            }

            switch (logLevel)
            {
            case LogLevel.Error:
            case LogLevel.Fatal:
                if (messageFunc != null)
                {
                    SentrySdk.CaptureException(new Exception(messageFunc(), exception));
                }
                else
                {
                    SentrySdk.CaptureException(exception);
                }
                break;

            case LogLevel.Warn:
                SentrySdk.CaptureMessage(messageFunc(), Sentry.Protocol.SentryLevel.Warning);
                break;

            default:
                SentrySdk.AddBreadcrumb(messageFunc(), $"Hangfire {logLevel.ToString()} event", "Logging");
                break;
            }
            return(true);
        }
Ejemplo n.º 23
0
 //install-package Sentry -v 1.0.1-beta
 public static void Log(string msg)
 {
     using (SentrySdk.Init("https://[email protected]/1316595"))
     {
         SentrySdk.CaptureMessage(msg);
     }
 }
        public async Task <bool> RelatorioConselhoClasseAluno([FromQuery] FiltroRelatorioDto request, IRelatorioConselhoClasseAlunoUseCase relatorioConselhoClasseAlunoUseCase)
        {
            SentrySdk.CaptureMessage("4 - relatorio/conselhoclassealuno");
            await relatorioConselhoClasseAlunoUseCase.Executar(request);

            return(true);
        }
Ejemplo n.º 25
0
        private void SendMessageEvent(object sender, EventArgs e)
        {
            var message = "Hello Xamarin.Forms";

            _ = SentrySdk.CaptureMessage(message);
            _ = DisplayAlert("Message captured", message, "Ok");
        }
Ejemplo n.º 26
0
        public bool DeleteCategory(int id)
        {
            try
            {
                using (var ctx = new ApplicationDbContext())
                {
                    var categoryEntity = ctx.Categories.Where(c => c.Id == id)
                                         .FirstOrDefault();
                    if (categoryEntity == null)
                    {
                        return(false);
                    }

                    // make sure this category is not linked to any space before deleting
                    if (categoryEntity.Spaces == null)
                    {
                        ctx.Categories.Remove(categoryEntity);
                        return(ctx.SaveChanges() == 1);
                    }
                    else
                    {
                        SentrySdk.CaptureMessage($"Cannot delete Category with ID:{id} because it is in use");
                    }

                    return(false);
                }
            }
            catch (Exception e)
            {
                SentrySdk.CaptureException(e);
                return(false);
            }
        }
Ejemplo n.º 27
0
        public async Task <bool> Handle(EnviarAtualizacaoCadastralProdamCommand request, CancellationToken cancellationToken)
        {
            var httpClient = httpClientFactory.CreateClient("servicoAtualizacaoCadastralProdam");

            var body     = JsonConvert.SerializeObject(request.ResponsavelDto, UtilJson.ObterConfigConverterNulosEmVazio());
            var resposta = await httpClient.PostAsync($"AtualizarResponsavelAluno", new StringContent(body, Encoding.UTF8, "application/json"));

            Console.WriteLine(body);
            if (resposta.IsSuccessStatusCode && resposta.StatusCode != HttpStatusCode.NoContent)
            {
                var json = await resposta.Content.ReadAsStringAsync();

                Console.WriteLine(body);
                Console.WriteLine(json);
                SentrySdk.CaptureMessage(json);

                if (json.ToLower().Contains("false"))
                {
                    throw new Exception($"Não foi possível atualizar os dados cadastrais do cpf {request.ResponsavelDto.CPF}. Retorno: {json}");
                }

                return(true);
            }
            else
            {
                throw new Exception($"Não foi possível atualizar os dados cadastrais do cpf {request.ResponsavelDto.CPF}.");
            }
        }
        public async Task <bool> Handle(GerarRelatorioAssincronoCommand request, CancellationToken cancellationToken)
        {
            try
            {
                ParametrosRelatorioDto parametrosDoDto = ObterParametrosRelatorio(request.Dados);

                var post = new ExecucaoRelatorioRequisicaoDto()
                {
                    UnidadeRelatorioUri = request.CaminhoRelatorio,
                    Async            = false,
                    SalvarSnapshot   = false,
                    FormatoSaida     = request.Formato.Name(),
                    Interativo       = false,
                    IgnorarPaginacao = false,
                    Paginas          = null,
                    Parametros       = parametrosDoDto
                };


                SentrySdk.CaptureMessage("6.1 - Obtendo jSessionId...");

                var jsessionId = await loginService.ObterTokenAutenticacao(configuration.GetSection("ConfiguracaoJasper:Username").Value, configuration.GetSection("ConfiguracaoJasper:Password").Value);

                SentrySdk.CaptureMessage($"6.2 - jSessionId = {jsessionId}");


                SentrySdk.CaptureMessage("6.3 - Solicitando relatório...");


                var retorno = await execucaoRelatorioService.SolicitarRelatorio(post, jsessionId);

                var exportacaoId = retorno?.Exports?.FirstOrDefault()?.Id;

                SentrySdk.CaptureMessage($"6.4 - Exportação Id = {exportacaoId}");

                if (exportacaoId != null)
                {
                    var dadosRelatorio = new DadosRelatorioDto(retorno.RequestId, exportacaoId.Value, request.CodigoCorrelacao, jsessionId);
                    var publicacaoFila = new PublicaFilaDto(dadosRelatorio, RotasRabbit.RotaRelatoriosProcessando, null, request.CodigoCorrelacao);

                    servicoFila.PublicaFila(publicacaoFila);

                    var jsonPublicaFila = UtilJson.ConverterApenasCamposNaoNulos(publicacaoFila);
                    Console.WriteLine(jsonPublicaFila);

                    SentrySdk.CaptureMessage("6.5 - Sucesso na publicação da fila: " + publicacaoFila.Rota);
                    return(true);
                }

                SentrySdk.CaptureMessage("6.6 - Erro na geração");

                return(false);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
                throw ex;
            }
        }
Ejemplo n.º 29
0
    public static void SmokeTest()
    {
        t.name = "SMOKE";
        try
        {
            Debug.Log("SMOKE TEST: Start");
            int crashed = _crashedLastRun();
            t.Expect($"options.CrashedLastRun ({crashed}) == false (0)", crashed == 0);

            var currentMessage = 0;
            t.ExpectMessage(currentMessage, "'type':'session'");

            var guid = Guid.NewGuid().ToString();
            Debug.LogError(guid);

            // Skip the session init requests (there may be multiple of othem). We can't skip them by a "positive"
            // because they're also repeated with standard events (in an envelope).
            Debug.Log("Skipping all non-event requests");
            for (; currentMessage < 10; currentMessage++)
            {
                if (t.CheckMessage(currentMessage, "'type':'event'"))
                {
                    break;
                }
            }
            Debug.Log($"Done skipping non-event requests. Last one was: #{currentMessage}");

            t.ExpectMessage(currentMessage, "'type':'event'");
            t.ExpectMessage(currentMessage, guid);

            SentrySdk.CaptureMessage(guid);
            t.ExpectMessage(++currentMessage, "'type':'event'");
            t.ExpectMessage(currentMessage, guid);

            var ex = new Exception("Exception & context test");
            AddContext();
            SentrySdk.CaptureException(ex);
            t.ExpectMessage(++currentMessage, "'type':'event'");
            t.ExpectMessage(currentMessage, "'message':'crumb','type':'error','data':{'foo':'bar'},'category':'bread','level':'critical'}");
            t.ExpectMessage(currentMessage, "'message':'scope-crumb'}");
            t.ExpectMessage(currentMessage, "'extra':{'extra-key':42}");
            t.ExpectMessage(currentMessage, "'tags':{'tag-key':'tag-value'");
            t.ExpectMessage(currentMessage, "'user':{'email':'*****@*****.**','id':'user-id','ip_address':'::1','username':'******','other':{'role':'admin'}}");

            t.Pass();
        }
        catch (Exception ex)
        {
            if (t.exitCode == 0)
            {
                Debug.Log($"SMOKE TEST: FAILED with exception {ex}");
                t.Exit(-1);
            }
            else
            {
                Debug.Log("SMOKE TEST: FAILED");
            }
        }
    }
Ejemplo n.º 30
0
 public void TrackFeatureUsage(string featureName, params string[] tags)
 {
     if (TestingUtility.IsRunningFromUnitTest || Debugger.IsAttached)
     {
         return;
     }
     SentrySdk.CaptureMessage($"[CLI] {featureName}", SentryLevel.Debug);
 }