Migración a percona
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WSAsegasa
|
||||
namespace WSAsegasaVerifactu
|
||||
{
|
||||
public class Configuracion
|
||||
{
|
||||
|
||||
@@ -10,13 +10,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
//mmm
|
||||
namespace WSAsegasa
|
||||
namespace WSAsegasaVerifactu
|
||||
{
|
||||
internal class Logs
|
||||
{
|
||||
private static object oBloqueoLog;
|
||||
//private static EventLog el;
|
||||
public static void AñadeLog(tsUtilidades.Enumeraciones.TipoLog Tipo, string Mensaje, Exception e = null)
|
||||
public static async void AñadeLog(tsUtilidades.Enumeraciones.TipoLog Tipo, string Mensaje, Exception e = null)
|
||||
{
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// Descripción Sub: Gestión de logs de la aplicación
|
||||
@@ -26,77 +26,77 @@ namespace WSAsegasa
|
||||
//
|
||||
// Modificaciones:
|
||||
// ===============
|
||||
if (oBloqueoLog == null) oBloqueoLog = new object();
|
||||
lock (oBloqueoLog)
|
||||
//if (oBloqueoLog == null) oBloqueoLog = new object();
|
||||
//lock (oBloqueoLog)
|
||||
//{
|
||||
try
|
||||
{
|
||||
try
|
||||
if (e != null)
|
||||
{
|
||||
if (e != null)
|
||||
|
||||
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
||||
Exception exError = e;
|
||||
do
|
||||
{
|
||||
|
||||
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
||||
Exception exError = e;
|
||||
do
|
||||
{
|
||||
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
||||
exError = exError.InnerException;
|
||||
}
|
||||
while (!Information.IsNothing(exError));
|
||||
if (sStackTrace != "")
|
||||
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
||||
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
||||
exError = exError.InnerException;
|
||||
}
|
||||
|
||||
bdAsegasa.db.cuentascorreo? cta = null;
|
||||
|
||||
try
|
||||
{
|
||||
var bd = tscgestionasegasa.NuevoContexto(Procesos.Conf.NombreConexionBD, true, false, true, "WSAsegasa");
|
||||
cta = bd.cuentascorreo.First(x => x.Codigo == "DEFECTO");
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
switch (Tipo)
|
||||
{
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||
Mensaje = "Error WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Fatal(Mensaje);
|
||||
if (cta != null) tsCorreos.Funciones.EnviaCorreo(cta.ServidorSMTP, cta.Remitente, "sevilla@tecnosis.net", "Error en WSAsegasa", Mensaje, null, null, "", "", cta.CuentaCorreo, cta.Password, cta.Puerto.Value, true);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
||||
Mensaje = "Advertencia WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Warning(Mensaje);
|
||||
if (cta != null) tsCorreos.Funciones.EnviaCorreo(cta.ServidorSMTP, cta.Remitente, "sevilla@tecnosis.net", "Advertencia en WSAsegasa", Mensaje, null, null, "", "", cta.CuentaCorreo, cta.Password, cta.Puerto.Value, true);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
||||
Mensaje = "Inicio WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
if (cta != null) tsCorreos.Funciones.EnviaCorreo(cta.ServidorSMTP, cta.Remitente, "sevilla@tecnosis.net", "Inicio WSAsegasa", Mensaje, null, null, "", "", cta.CuentaCorreo, cta.Password, cta.Puerto.Value, true);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
||||
Mensaje = "Finalización WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
if (cta != null) tsCorreos.Funciones.EnviaCorreo(cta.ServidorSMTP, cta.Remitente, "sevilla@tecnosis.net", "Finalización WSAsegasa", Mensaje, null, null, "", "", cta.CuentaCorreo, cta.Password, cta.Puerto.Value, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
Mensaje = Tipo.ToString() + " WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
while (!Information.IsNothing(exError));
|
||||
if (sStackTrace != "")
|
||||
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
bdAsegasa.db.cuentascorreo? cta = null;
|
||||
|
||||
//try
|
||||
//{
|
||||
// var bd = tscgestionasegasa.NuevoContexto(Procesos.Conf.NombreConexionBD, true, false, true, "WSAsegasaVerifactu");
|
||||
// cta = bd.cuentascorreo.First(x => x.Codigo == "DEFECTO");
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
//}
|
||||
|
||||
switch (Tipo)
|
||||
{
|
||||
if (e != null)
|
||||
Mensaje += " --- " + e.StackTrace;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||
Mensaje = "Error WSAsegasaVerifactu. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Fatal(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Error en WSAsegasaVerifactu", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
||||
Mensaje = "Advertencia WSAsegasaVerifactu. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Warning(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Adverntencia en WSAsegasaVerifactu", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ADVERTENCIA);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
||||
Mensaje = "Inicio WSAsegasaVerifactu. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Inicio Servicio WSAsegasaVerifactu", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
||||
Mensaje = "Finalización WSAsegasaVerifactu. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Fin Servicio WSAsegasaVerifactu", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
|
||||
Log.Fatal(Mensaje + " ---" + ex.Message + " --- " + ex.StackTrace);
|
||||
default:
|
||||
Mensaje = Tipo.ToString() + " WSAsegasaVerifactu. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (e != null)
|
||||
Mensaje += " --- " + e.StackTrace;
|
||||
|
||||
Log.Fatal(Mensaje + " ---" + ex.Message + " --- " + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WSAsegasa;
|
||||
using WSAsegasaVerifactu;
|
||||
|
||||
|
||||
namespace WSAsegasa
|
||||
namespace WSAsegasaVerifactu
|
||||
{
|
||||
public class Procesos
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ using static Quartz.Logging.OperationName;
|
||||
using static tsVeriFactu.Enums;
|
||||
|
||||
|
||||
namespace WSAsegasa
|
||||
namespace WSAsegasaVerifactu
|
||||
{
|
||||
public class ProcesosVeriFactuAsegasa : ItsVeriFactu
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging.EventLog;
|
||||
using Serilog;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using WSAsegasa;
|
||||
using WSAsegasaVerifactu;
|
||||
|
||||
|
||||
public class Program
|
||||
@@ -17,12 +17,12 @@ public class Program
|
||||
string path = "";
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\WSAsegasa\WSAsegasa.log";
|
||||
path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\WSAsegasaVerifactu\WSAsegasaVerifactu.log";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
path = @"/var/log/WSAsegasa/WSAsegasa.log";
|
||||
path = @"/var/log/WSAsegasaVerifactu/WSAsegasaVerifactu.log";
|
||||
}
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
@@ -46,7 +46,7 @@ public class Program
|
||||
{
|
||||
services.AddWindowsService(config =>
|
||||
{
|
||||
config.ServiceName = "WSAsegasa";
|
||||
config.ServiceName = "WSAsegasaVerifactu";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"WSAsegasa": {
|
||||
"WSAsegasaVerifactu": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"environmentVariables": {
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>dotnet-WSAsegasa-3170e77c-9190-48a1-9c66-26323b65ac5d</UserSecretsId>
|
||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||
<Version>1.0.0.0</Version>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<Version>1.0.0.1</Version>
|
||||
<AssemblyVersion>1.0.0.1</AssemblyVersion>
|
||||
<Authors>Manuel</Authors>
|
||||
<Company>Tecnosis S.A</Company>
|
||||
<Description>Servicio de envío de facturas de asegasa al sistema Verifactu</Description>
|
||||
<PackageReleaseNotes>
|
||||
- 2026-05-19 V1.0.0.0 Versión renombrada de wsasegasa a wsasegasaverifactu
|
||||
- 2026-05-19 V 1.0.0.1 Se cambian los logs de correo a tsnotificaciones.
|
||||
- 2026-05-19 V 1.0.0.0 Versión renombrada de wsasegasa a wsasegasaverifactu.
|
||||
</PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.1.2" />
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="8.1.2" />
|
||||
<PackageReference Include="tsCorreos" Version="1.0.7" />
|
||||
<PackageReference Include="tsUtilidades" Version="1.1.15" />
|
||||
<PackageReference Include="tsUtilidades" Version="1.1.16" />
|
||||
<PackageReference Include="tsVeriFactu" Version="2.4.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Services.Description;
|
||||
using tsUtilidades.SEPA_3414;
|
||||
using WSAsegasa;
|
||||
using WSAsegasaVerifactu;
|
||||
|
||||
namespace WSAsegasa
|
||||
namespace WSAsegasaVerifactu
|
||||
{
|
||||
|
||||
public class Worker : BackgroundService
|
||||
@@ -33,7 +33,7 @@ namespace WSAsegasa
|
||||
|
||||
protected override async System.Threading.Tasks.Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
string Mensaje = "WSAsegasa. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
string Mensaje = "WSAsegasaVerifactu. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
try
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace WSAsegasa
|
||||
}
|
||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
string Mensaje = "WSAsegasa. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
string Mensaje = "WSAsegasaVerifactu. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
Logs.A<EFBFBD>adeLog(tsUtilidades.Enumeraciones.TipoLog.FinServicio, "Finalizando " + Mensaje);
|
||||
|
||||
await base.StopAsync(cancellationToken);
|
||||
|
||||
@@ -4,5 +4,12 @@
|
||||
"SegundosMinimosEntreProcesos": "60",
|
||||
"HoraProcesosDiarios": "06:30",
|
||||
"NombreConexionBD": "Producción Remoto"
|
||||
},
|
||||
"TsNotificaciones": {
|
||||
//"ApiUrl": "http://192.168.41.32:5000/", prod
|
||||
"ApiUrl": "https://apinotificaciones.tecnosis.online",
|
||||
"IdAplicacion": 20,
|
||||
"Aplicacion": "WSAsegasaVerifactu",
|
||||
"ApiKey": "96945a9b26c74fbb8b6c0e0bb6f24375"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user