using bdEmtusa.db; using bdEmtusa.dbcontext; using Microsoft.VisualBasic; using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; namespace bdEmtusa { public class Utilidades { public static string? VersionPrograma { get; set; } // public static double PorcentajeIva { get; set; } public static void GeneraNotificacion(tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum Tipo, string Titulo, string? Cuerpo=null, Exception? ex=null, byte[]? FicheroImagen = null, [CallerMemberName] string? Caller = null) { try { string sMensaje = ((VersionPrograma != null ? "Versión Programa: " + VersionPrograma : "") + (Caller != null ? " Rutina: " + Caller : "") + (Cuerpo != null ? Cuerpo : Titulo) ).Trim(); if (ex != null) { string sStackTrace = "Tipo excepción: " + ex.ToString() + Constants.vbCrLf; var exError = ex; do { sStackTrace += exError.StackTrace + Constants.vbCrLf; exError = exError.InnerException; } while (exError != null); if (!string.IsNullOrEmpty(sStackTrace)) sMensaje += Constants.vbCrLf + "StackTrace: " + sStackTrace; } if (FicheroImagen is null) { tsUtilidades.TsNotificacionesClient.RegistrarAsync(Titulo, sMensaje, Tipo); } else { tsUtilidades.TsNotificacionesClient.RegistrarAsync(Titulo, sMensaje, Tipo, FicheroImagen); } } catch (Exception ex2) { throw new Exception(ex2.Message, ex2); } } } }