Merge branch 'main' of https://gitea.tecnosis.net/ASEGASA/Asegasa.NET
This commit is contained in:
16
Asegasa.sln
16
Asegasa.sln
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 18
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 18.1.11312.151
|
VisualStudioVersion = 17.14.37301.10 d17.14
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -9,12 +9,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIFicheros", "APIFicheros\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GestionAsegasa", "GestionAsegasa\GestionAsegasa.vbproj", "{6995E4A5-BC07-42C2-8E8C-C09839886B7F}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GestionAsegasa", "GestionAsegasa\GestionAsegasa.vbproj", "{6995E4A5-BC07-42C2-8E8C-C09839886B7F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Servicio Gestion Asegasa", "Servicio Gestion Asegasa\Servicio Gestion Asegasa.csproj", "{B11D4268-5013-4084-ABF7-7E5D28AB7EB1}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itsm", "itsm\itsm.csproj", "{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itsm", "itsm\itsm.csproj", "{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasaVerifactu", "WSAsegasaVerifactu\WSAsegasaVerifactu.csproj", "{E92893A7-620D-563C-05D1-C2BFCEE5497C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasaVerifactu", "WSAsegasaVerifactu\WSAsegasaVerifactu.csproj", "{E92893A7-620D-563C-05D1-C2BFCEE5497C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicioGestionAsegasa", "ServicioGestionAsegasa\ServicioGestionAsegasa.csproj", "{1F76F4CF-4F19-4BA2-8159-5234ED0EF7BD}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -33,10 +33,6 @@ Global
|
|||||||
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B11D4268-5013-4084-ABF7-7E5D28AB7EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B11D4268-5013-4084-ABF7-7E5D28AB7EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B11D4268-5013-4084-ABF7-7E5D28AB7EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B11D4268-5013-4084-ABF7-7E5D28AB7EB1}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{09D06C54-3B7C-4A1D-8A1A-A1AEFAED2094}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -45,6 +41,10 @@ Global
|
|||||||
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E92893A7-620D-563C-05D1-C2BFCEE5497C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1F76F4CF-4F19-4BA2-8159-5234ED0EF7BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1F76F4CF-4F19-4BA2-8159-5234ED0EF7BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1F76F4CF-4F19-4BA2-8159-5234ED0EF7BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1F76F4CF-4F19-4BA2-8159-5234ED0EF7BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<PackageReference Include="System.ServiceModel.Federation" Version="10.0.652802" />
|
<PackageReference Include="System.ServiceModel.Federation" Version="10.0.652802" />
|
||||||
<PackageReference Include="TSpdf.commons" Version="1.0.1" />
|
<PackageReference Include="TSpdf.commons" Version="1.0.1" />
|
||||||
<PackageReference Include="TSpdfUtils" Version="1.0.15" />
|
<PackageReference Include="TSpdfUtils" Version="1.0.15" />
|
||||||
<PackageReference Include="tsWPFCore" Version="1.3.9" />
|
<PackageReference Include="tsWPFCore" Version="1.3.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using Servicio_Gestion_Asegasa;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
|
||||||
|
|
||||||
builder.Configuration
|
|
||||||
.SetBasePath(AppContext.BaseDirectory)
|
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
|
||||||
builder.Services.AddHostedService<Worker>();
|
|
||||||
|
|
||||||
builder.Services.Configure<Configuracion>(
|
|
||||||
builder.Configuration.GetSection("Configuracion"));
|
|
||||||
|
|
||||||
builder.Services.AddWindowsService(); // <-- NECESARIO EN .NET 8
|
|
||||||
|
|
||||||
var host = builder.Build();
|
|
||||||
host.Run();
|
|
||||||
@@ -47,27 +47,27 @@ namespace Servicio_Gestion_Asegasa
|
|||||||
switch (Tipo)
|
switch (Tipo)
|
||||||
{
|
{
|
||||||
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||||
Mensaje = "Error WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
Mensaje = "Error ServicioGestionAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||||
Log.Fatal(Mensaje);
|
Log.Fatal(Mensaje);
|
||||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Error en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Error en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
||||||
break;
|
break;
|
||||||
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
||||||
Mensaje = "Advertencia WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
Mensaje = "Advertencia ServicioGestionAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||||
Log.Warning(Mensaje);
|
Log.Warning(Mensaje);
|
||||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Advertencia en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ADVERTENCIA);
|
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Advertencia en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ADVERTENCIA);
|
||||||
break;
|
break;
|
||||||
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
||||||
Mensaje = "Inicio WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
Mensaje = "Inicio ServicioGestionAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||||
Log.Information(Mensaje);
|
Log.Information(Mensaje);
|
||||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Inicio Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Inicio Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||||
break;
|
break;
|
||||||
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
||||||
Mensaje = "Finalización WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
Mensaje = "Finalización ServicioGestionAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||||
Log.Information(Mensaje);
|
Log.Information(Mensaje);
|
||||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Finalización Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Finalización Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Mensaje = Tipo.ToString() + " WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
Mensaje = Tipo.ToString() + " ServicioGestionAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||||
Log.Information(Mensaje);
|
Log.Information(Mensaje);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
51
ServicioGestionAsegasa/Program.cs
Normal file
51
ServicioGestionAsegasa/Program.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Serilog;
|
||||||
|
using Servicio_Gestion_Asegasa;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Serilog.Debugging.SelfLog.Enable(msg => Console.Error.WriteLine(msg));
|
||||||
|
bdAsegasa.db.Utilidades.VersionPrograma = tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||||
|
// Configura Serilog antes de construir el host
|
||||||
|
string path = "";
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\ServicioGestionAsegasa\ServicioGestionAsegasa.log";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
path = @"/var/log/ServicioGestionAsegasa/ServicioGestionAsegasa.log";
|
||||||
|
}
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Information()
|
||||||
|
.WriteTo.File(path, rollingInterval: RollingInterval.Day)
|
||||||
|
.CreateLogger();
|
||||||
|
var host = CreateHostBuilder(args).Build();
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
|
Host.CreateDefaultBuilder(args)
|
||||||
|
.ConfigureServices((hostContext, services) =>
|
||||||
|
{
|
||||||
|
IConfiguration configuration = hostContext.Configuration;
|
||||||
|
Configuracion options = configuration.GetSection("Configuracion").Get<Configuracion>();
|
||||||
|
|
||||||
|
services.AddSingleton(options);
|
||||||
|
|
||||||
|
// Solo registrar WindowsService si estamos en Windows
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
services.AddWindowsService(config =>
|
||||||
|
{
|
||||||
|
config.ServiceName = "ServicioGestionAsegasa";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
services.AddHostedService<Worker>();
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
<PackageReference Include="Quartz" Version="3.15.0" />
|
<PackageReference Include="Quartz" Version="3.15.0" />
|
||||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
|
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
<PackageReference Include="tsCorreos" Version="1.0.6" />
|
<PackageReference Include="tsCorreos" Version="1.0.7" />
|
||||||
<PackageReference Include="tsUtilidades" Version="1.1.15" />
|
<PackageReference Include="tsUtilidades" Version="1.1.16" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WSAsegasa
|
namespace WSAsegasaVerifactu
|
||||||
{
|
{
|
||||||
public class Configuracion
|
public class Configuracion
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
//mmm
|
//mmm
|
||||||
namespace WSAsegasa
|
namespace WSAsegasaVerifactu
|
||||||
{
|
{
|
||||||
internal class Logs
|
internal class Logs
|
||||||
{
|
{
|
||||||
private static object oBloqueoLog;
|
private static object oBloqueoLog;
|
||||||
//private static EventLog el;
|
//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
|
// Descripción Sub: Gestión de logs de la aplicación
|
||||||
@@ -26,77 +26,77 @@ namespace WSAsegasa
|
|||||||
//
|
//
|
||||||
// Modificaciones:
|
// Modificaciones:
|
||||||
// ===============
|
// ===============
|
||||||
if (oBloqueoLog == null) oBloqueoLog = new object();
|
//if (oBloqueoLog == null) oBloqueoLog = new object();
|
||||||
lock (oBloqueoLog)
|
//lock (oBloqueoLog)
|
||||||
|
//{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
if (e != null)
|
||||||
{
|
{
|
||||||
if (e != null)
|
|
||||||
|
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
||||||
|
Exception exError = e;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
|
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
||||||
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
exError = exError.InnerException;
|
||||||
Exception exError = e;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
|
||||||
exError = exError.InnerException;
|
|
||||||
}
|
|
||||||
while (!Information.IsNothing(exError));
|
|
||||||
if (sStackTrace != "")
|
|
||||||
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
|
||||||
}
|
}
|
||||||
|
while (!Information.IsNothing(exError));
|
||||||
bdAsegasa.db.cuentascorreo? cta = null;
|
if (sStackTrace != "")
|
||||||
|
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
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)
|
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||||
Mensaje += " --- " + e.StackTrace;
|
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.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WSAsegasa;
|
using WSAsegasaVerifactu;
|
||||||
|
|
||||||
|
|
||||||
namespace WSAsegasa
|
namespace WSAsegasaVerifactu
|
||||||
{
|
{
|
||||||
public class Procesos
|
public class Procesos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ using static Quartz.Logging.OperationName;
|
|||||||
using static tsVeriFactu.Enums;
|
using static tsVeriFactu.Enums;
|
||||||
|
|
||||||
|
|
||||||
namespace WSAsegasa
|
namespace WSAsegasaVerifactu
|
||||||
{
|
{
|
||||||
public class ProcesosVeriFactuAsegasa : ItsVeriFactu
|
public class ProcesosVeriFactuAsegasa : ItsVeriFactu
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging.EventLog;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using WSAsegasa;
|
using WSAsegasaVerifactu;
|
||||||
|
|
||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
@@ -17,12 +17,12 @@ public class Program
|
|||||||
string path = "";
|
string path = "";
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\WSAsegasa\WSAsegasa.log";
|
path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\WSAsegasaVerifactu\WSAsegasaVerifactu.log";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
path = @"/var/log/WSAsegasa/WSAsegasa.log";
|
path = @"/var/log/WSAsegasaVerifactu/WSAsegasaVerifactu.log";
|
||||||
}
|
}
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.MinimumLevel.Information()
|
.MinimumLevel.Information()
|
||||||
@@ -46,7 +46,7 @@ public class Program
|
|||||||
{
|
{
|
||||||
services.AddWindowsService(config =>
|
services.AddWindowsService(config =>
|
||||||
{
|
{
|
||||||
config.ServiceName = "WSAsegasa";
|
config.ServiceName = "WSAsegasaVerifactu";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"WSAsegasa": {
|
"WSAsegasaVerifactu": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<UserSecretsId>dotnet-WSAsegasa-3170e77c-9190-48a1-9c66-26323b65ac5d</UserSecretsId>
|
<UserSecretsId>dotnet-WSAsegasa-3170e77c-9190-48a1-9c66-26323b65ac5d</UserSecretsId>
|
||||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||||
<Version>1.0.0.0</Version>
|
<Version>1.0.0.1</Version>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.0.1</AssemblyVersion>
|
||||||
<Authors>Manuel</Authors>
|
<Authors>Manuel</Authors>
|
||||||
<Company>Tecnosis S.A</Company>
|
<Company>Tecnosis S.A</Company>
|
||||||
<Description>Servicio de envío de facturas de asegasa al sistema Verifactu</Description>
|
<Description>Servicio de envío de facturas de asegasa al sistema Verifactu</Description>
|
||||||
<PackageReleaseNotes>
|
<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>
|
</PackageReleaseNotes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.1.2" />
|
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.1.2" />
|
||||||
<PackageReference Include="System.ServiceModel.Primitives" Version="8.1.2" />
|
<PackageReference Include="System.ServiceModel.Primitives" Version="8.1.2" />
|
||||||
<PackageReference Include="tsCorreos" Version="1.0.7" />
|
<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" />
|
<PackageReference Include="tsVeriFactu" Version="2.4.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using System.Reflection;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web.Services.Description;
|
using System.Web.Services.Description;
|
||||||
using tsUtilidades.SEPA_3414;
|
using tsUtilidades.SEPA_3414;
|
||||||
using WSAsegasa;
|
using WSAsegasaVerifactu;
|
||||||
|
|
||||||
namespace WSAsegasa
|
namespace WSAsegasaVerifactu
|
||||||
{
|
{
|
||||||
|
|
||||||
public class Worker : BackgroundService
|
public class Worker : BackgroundService
|
||||||
@@ -33,7 +33,7 @@ namespace WSAsegasa
|
|||||||
|
|
||||||
protected override async System.Threading.Tasks.Task ExecuteAsync(CancellationToken stoppingToken)
|
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
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ namespace WSAsegasa
|
|||||||
}
|
}
|
||||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
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);
|
Logs.A<EFBFBD>adeLog(tsUtilidades.Enumeraciones.TipoLog.FinServicio, "Finalizando " + Mensaje);
|
||||||
|
|
||||||
await base.StopAsync(cancellationToken);
|
await base.StopAsync(cancellationToken);
|
||||||
|
|||||||
@@ -4,5 +4,12 @@
|
|||||||
"SegundosMinimosEntreProcesos": "60",
|
"SegundosMinimosEntreProcesos": "60",
|
||||||
"HoraProcesosDiarios": "06:30",
|
"HoraProcesosDiarios": "06:30",
|
||||||
"NombreConexionBD": "Producción Remoto"
|
"NombreConexionBD": "Producción Remoto"
|
||||||
|
},
|
||||||
|
"TsNotificaciones": {
|
||||||
|
//"ApiUrl": "http://192.168.41.32:5000/", prod
|
||||||
|
"ApiUrl": "https://apinotificaciones.tecnosis.online",
|
||||||
|
"IdAplicacion": 20,
|
||||||
|
"Aplicacion": "WSAsegasaVerifactu",
|
||||||
|
"ApiKey": "96945a9b26c74fbb8b6c0e0bb6f24375"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||||
<PackageReference Include="tsEFCore8" Version="1.0.5" />
|
<PackageReference Include="tsEFCore8" Version="1.0.5" />
|
||||||
<PackageReference Include="tsUtilidades" Version="1.1.15" />
|
<PackageReference Include="tsUtilidades" Version="1.1.16" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace bdAsegasa.dbcontext
|
|||||||
// lc.Add(new Conexion() { Nombre = "Producción", Servidor = "192.168.61.201", Puerto = 30002, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
// lc.Add(new Conexion() { Nombre = "Producción", Servidor = "192.168.61.201", Puerto = 30002, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
||||||
lc.Add(new Conexion() { Nombre = "Producción", Servidor = "192.168.61.203", Puerto = 36200, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
lc.Add(new Conexion() { Nombre = "Producción", Servidor = "192.168.61.203", Puerto = 36200, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
||||||
lc.Add(new Conexion() { Nombre = "Desarrollo", Servidor = "192.168.41.26", Puerto = 3307, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
lc.Add(new Conexion() { Nombre = "Desarrollo", Servidor = "192.168.41.26", Puerto = 3307, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
||||||
lc.Add(new Conexion() { Nombre = "Producción Remoto", Servidor = "sevilla.asegasa.com", Puerto = 30002, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
lc.Add(new Conexion() { Nombre = "Producción Remoto", Servidor = "sevilla.asegasa.com", Puerto = 36200, Usuario = "asegasa", Contraseña = "tk-8Vb/#%+2ÄM", Database = "gestionasegasa" });
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ namespace bdAsegasa.dbcontext
|
|||||||
|
|
||||||
string servidor = "";
|
string servidor = "";
|
||||||
|
|
||||||
if (Directory.Exists("c:\\tecnosis.tfs")) {
|
if (Directory.("c:\\tecnosis.tfs")) {
|
||||||
servidor = "sevilla.asegasa.com";
|
servidor = "sevilla.asegasa.com";
|
||||||
}
|
}
|
||||||
//if (Environment.MachineName.ToUpper() == "VISDIG1")
|
//if (Environment.MachineName.ToUpper() == "VISDIG1")
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
<PackageReference Include="System.ServiceModel.Http" Version="8.*" />
|
<PackageReference Include="System.ServiceModel.Http" Version="8.*" />
|
||||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.*" />
|
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.*" />
|
||||||
<PackageReference Include="System.ServiceModel.Primitives" Version="8.*" />
|
<PackageReference Include="System.ServiceModel.Primitives" Version="8.*" />
|
||||||
<PackageReference Include="tsUtilidades" Version="1.1.15" />
|
<PackageReference Include="tsUtilidades" Version="1.1.16" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user