arreglado errores mensajes
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Servicio_Gestion_Asegasa
|
|||||||
|
|
||||||
public static DateTime? HoraUtcUltimaEjecucionProcesos = null;
|
public static DateTime? HoraUtcUltimaEjecucionProcesos = null;
|
||||||
private static bool Procesando;
|
private static bool Procesando;
|
||||||
|
private static DateTime? FechaUltimaEjecucionTareasHorarias;
|
||||||
|
|
||||||
public static async Task ProcesarAsync()
|
public static async Task ProcesarAsync()
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,16 @@ namespace Servicio_Gestion_Asegasa
|
|||||||
{
|
{
|
||||||
await ProcesosMensajes.EnviaSMSAsync();
|
await ProcesosMensajes.EnviaSMSAsync();
|
||||||
|
|
||||||
|
if (!FechaUltimaEjecucionTareasHorarias.HasValue || (DateTime.Now.Subtract(FechaUltimaEjecucionTareasHorarias.Value).TotalMinutes > 120 &&
|
||||||
|
DateTime.Now.Hour > 6 &&
|
||||||
|
DateTime.Now.Hour < 20 &&
|
||||||
|
DateTime.Now.DayOfWeek != DayOfWeek.Sunday) )
|
||||||
|
{
|
||||||
|
FechaUltimaEjecucionTareasHorarias = DateTime.Now;
|
||||||
|
|
||||||
|
|
||||||
|
ProcesosMensajes.CompruebaSMSNoEnviados();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ using Servicio_Gestion_Asegasa;
|
|||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
builder.Services.AddHostedService<Worker>();
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
builder.Services.Configure<Configuracion>(
|
||||||
|
builder.Configuration.GetSection("Configuracion"));
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
host.Run();
|
host.Run();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using bdAsegasa;
|
|||||||
using bdAsegasa.db;
|
using bdAsegasa.db;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using Quartz.Impl;
|
using Quartz.Impl;
|
||||||
using Servicio_Gestion_Asegasa.Procesos;
|
using Servicio_Gestion_Asegasa.Procesos;
|
||||||
@@ -14,10 +15,10 @@ namespace Servicio_Gestion_Asegasa
|
|||||||
{
|
{
|
||||||
private readonly ILogger<Worker> _logger;
|
private readonly ILogger<Worker> _logger;
|
||||||
|
|
||||||
public Worker(ILogger<Worker> logger, Configuracion Conf)
|
public Worker(ILogger<Worker> logger, IOptions<Configuracion> options)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
ProcesosConf.Conf = Conf;
|
ProcesosConf.Conf = options.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user