proceso ficheros vencidos
This commit is contained in:
25
Servicio Gestion Asegasa/Clases/PolizaPagoUnicoExcel.cs
Normal file
25
Servicio Gestion Asegasa/Clases/PolizaPagoUnicoExcel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Servicio_Gestion_Asegasa.Clases
|
||||
{
|
||||
public class PolizaPagoUnicoExcel
|
||||
{
|
||||
public string NumeroPoliza { get; set; }
|
||||
|
||||
public string RazonSocial { get; set; }
|
||||
|
||||
public DateOnly FechaEfecto { get; set; }
|
||||
|
||||
public DateOnly FechaVencimiento { get; set; }
|
||||
|
||||
public string Descripcion { get; set; }
|
||||
|
||||
public string NombreAgente { get; set; }
|
||||
|
||||
public string CiaNumeroPolizaSuplemento { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,86 @@
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using System.Data;
|
||||
//using tsUtilidades.Extensiones;
|
||||
//using bdAsegasa.dbcontext;
|
||||
//using bdAsegasa.db;
|
||||
//using bdAsegasa;
|
||||
//using tsUtilidades;
|
||||
using bdAsegasa;
|
||||
using bdAsegasa.db;
|
||||
using bdAsegasa.dbcontext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Servicio_Gestion_Asegasa.Clases;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using tsUtilidades;
|
||||
using tsUtilidades.Extensiones;
|
||||
|
||||
namespace Servicio_Gestion_Asegasa.Procesos
|
||||
{
|
||||
public class ProcesosPolizas
|
||||
{
|
||||
|
||||
public static async Task ComprobarPolizasPagoUnico()
|
||||
{
|
||||
var bd = tscgestionasegasa.NuevoContexto();
|
||||
|
||||
try
|
||||
{
|
||||
DateOnly hoy = DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
List<polizassg> listadoPolizasVencidas = bd.polizassg.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).ToList();
|
||||
|
||||
var lr = bd.polizassg.Include(x => x.entidadespolizas).ThenInclude(x => x.idEntidadNavigation).Include(x => x.idRamoNavigation).Include(x => x.idAgenteNavigation).ToList()
|
||||
.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).Select(x => new PolizaPagoUnicoExcel{
|
||||
NumeroPoliza = x.NumeroPoliza ?? "",
|
||||
|
||||
RazonSocial = x.Tomador?.RazonSocial ?? "",
|
||||
|
||||
FechaEfecto = x.FechaEfecto,
|
||||
|
||||
FechaVencimiento = x.FechaVencimiento,
|
||||
|
||||
Descripcion = x.idRamoNavigation?.Descripcion ?? "",
|
||||
|
||||
NombreAgente = x.idAgenteNavigation?.Nombre ?? "",
|
||||
|
||||
CiaNumeroPolizaSuplemento = x.CiaNumeroPolizaSuplemento
|
||||
}).ToList();
|
||||
|
||||
byte[] f = tsUtilidades.Excel.IEnumerableAExcel(lr);
|
||||
|
||||
string sFichero = @"C:\temp\listadoPolizas.xlsx";
|
||||
File.WriteAllBytes(sFichero, f);
|
||||
|
||||
|
||||
//await bd.polizassg.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).ExecuteUpdateAsync(setters => setters
|
||||
// .SetProperty(x => x.FechaBaja, x => x.FechaVencimiento)
|
||||
// .SetProperty(x => x.idCausaBaja, 784));
|
||||
|
||||
|
||||
string sDireccionesEnvio = "davidperea@tecnosis.net";
|
||||
string sServidorSMTP = "mail.tecnosis.net";
|
||||
string sRemitente = "logs@tecnosis.es";
|
||||
string Asunto = "Ficheros vencidos";
|
||||
string Cuerpo = "Excel de ficheros cobro único vencidos.";
|
||||
|
||||
List<tsUtilidades.Correo.FicheroAdjunto> listadoFicheros = new List<tsUtilidades.Correo.FicheroAdjunto>();
|
||||
listadoFicheros.Add(new tsUtilidades.Correo.FicheroAdjunto
|
||||
{
|
||||
NombreFichero = "FicherosVencidos.xlsx",
|
||||
Fichero = f
|
||||
});
|
||||
|
||||
tsUtilidades.Correo.Funciones.EnviaCorreoVariosAdjuntos(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Cuerpo, listadoFicheros);
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace Servicio_Gestion_Asegasa.Procesos
|
||||
//{
|
||||
// public class ProcesosPolizas
|
||||
// {
|
||||
// public static async Task EnvioDocumentosSegurosAsync()
|
||||
// {
|
||||
// try
|
||||
@@ -663,5 +731,5 @@
|
||||
// await tsUtilidades.TsNotificacionesClient.RegistrarAsync("En GeneraEmailsMandatosSinRecibir.", "Rutina: GeneraEmailsMandatosSinRecibir-2. " + ex.Message, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using Quartz.Impl;
|
||||
using Servicio_Gestion_Asegasa.Procesos;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
using static Servicio_Gestion_Asegasa.Procesos.ProcesosPolizas;
|
||||
namespace Servicio_Gestion_Asegasa
|
||||
{
|
||||
public class Worker : BackgroundService
|
||||
@@ -27,8 +27,10 @@ namespace Servicio_Gestion_Asegasa
|
||||
{
|
||||
|
||||
string Mensaje = "Servicio Gestion Asegasa. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
|
||||
try
|
||||
{
|
||||
await ComprobarPolizasPagoUnico();
|
||||
|
||||
if (ProcesosConf.Conf.HoraProcesosDiarios != null)
|
||||
{
|
||||
|
||||
@@ -41,8 +41,12 @@ namespace bdAsegasa.db
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
|
||||
private bool _CodigoPostalTmpEsNulo = true;
|
||||
private string _CodigoPostalTmp;
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPostalTmp
|
||||
{
|
||||
get
|
||||
@@ -78,6 +82,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private bool _DomicilioTmpEsNulo = true;
|
||||
private string _DomicilioTmp;
|
||||
[NotMapped]
|
||||
|
||||
public string DomicilioTmp
|
||||
{
|
||||
get
|
||||
@@ -112,8 +118,11 @@ namespace bdAsegasa.db
|
||||
}
|
||||
|
||||
private bool _CodigoPoblacionTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
private string _CodigoPoblacionTmp;
|
||||
public string CodigoPoblacionTmp
|
||||
[NotMapped]
|
||||
public virtual string CodigoPoblacionTmp
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -176,6 +185,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _PoblacionTmp;
|
||||
private bool _PoblacionTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string PoblacionTmp
|
||||
{
|
||||
get
|
||||
@@ -192,6 +203,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _ProvinciaTmp;
|
||||
private bool _ProvinciaTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string ProvinciaTmp
|
||||
{
|
||||
get
|
||||
@@ -205,6 +218,7 @@ namespace bdAsegasa.db
|
||||
_ProvinciaTmpEsNulo = false;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
|
||||
public string OficinaAgente
|
||||
{
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using bdAsegasa.dbcontext;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using bdAsegasa.dbcontext;
|
||||
|
||||
namespace bdAsegasa.db
|
||||
{
|
||||
@@ -11,6 +12,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _codigoPostalTmp;
|
||||
private bool _codigoPostalTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPostalTmp
|
||||
{
|
||||
get
|
||||
@@ -32,6 +35,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _domicilioTmp;
|
||||
private bool _domicilioTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string DomicilioTmp
|
||||
{
|
||||
get
|
||||
@@ -53,6 +58,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _codigoPoblacionTmp;
|
||||
private bool _codigoPoblacionTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPoblacionTmp
|
||||
{
|
||||
get
|
||||
@@ -92,8 +99,11 @@ namespace bdAsegasa.db
|
||||
if (Direccion != null) Direccion.CodigoMunicipio = value;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
|
||||
public string DescripcionFormaLiquidacion => ((FormaLiquidacionEnum)(this.FormaLiquidacion)).ToString();
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoNombre => $"{this.Codigo} {this.Nombre}";
|
||||
|
||||
public enum FormaLiquidacionEnum
|
||||
|
||||
@@ -10,6 +10,16 @@ namespace bdAsegasa.db
|
||||
{
|
||||
public partial class entidades : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
public string ApellidosNombre
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Apellidos + " " + this.Nombre;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
@@ -53,6 +63,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _codigoPostalTmp;
|
||||
private bool _codigoPostalTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPostalTmp
|
||||
{
|
||||
get
|
||||
@@ -75,6 +87,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _domicilioTmp;
|
||||
private bool _domicilioTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string DomicilioTmp
|
||||
{
|
||||
get
|
||||
@@ -97,6 +111,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _codigoPoblacionTmp;
|
||||
private bool _codigoPoblacionTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPoblacionTmp
|
||||
{
|
||||
get
|
||||
@@ -161,6 +177,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _poblacionTmp;
|
||||
private bool _poblacionTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string PoblacionTmp
|
||||
{
|
||||
get
|
||||
@@ -184,6 +202,8 @@ namespace bdAsegasa.db
|
||||
|
||||
private string _provinciaTmp;
|
||||
private bool _provinciaTmpEsNulo = true;
|
||||
[NotMapped]
|
||||
|
||||
public string ProvinciaTmp
|
||||
{
|
||||
get
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace bdAsegasa.db
|
||||
{
|
||||
public partial class entidadespolizas
|
||||
{
|
||||
[NotMapped]
|
||||
public bool AEliminar_tmp { get; set; }
|
||||
|
||||
public string Domicilio
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace bdAsegasa.db
|
||||
public partial class polizassg
|
||||
{
|
||||
#region CamposTemporales
|
||||
[NotMapped]
|
||||
public string FechasInexistentes { get; set; }
|
||||
#endregion
|
||||
|
||||
@@ -142,7 +143,7 @@ namespace bdAsegasa.db
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string OficinaAgente
|
||||
{
|
||||
get
|
||||
@@ -159,6 +160,7 @@ namespace bdAsegasa.db
|
||||
}
|
||||
|
||||
private bool _idPoliza_EsNula;
|
||||
[NotMapped]
|
||||
public int? idPoliza_Nulable
|
||||
{
|
||||
get
|
||||
@@ -177,7 +179,7 @@ namespace bdAsegasa.db
|
||||
_idPoliza_EsNula = value == null;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int? idCompania_Nulable
|
||||
{
|
||||
get
|
||||
@@ -190,7 +192,7 @@ namespace bdAsegasa.db
|
||||
if (value.HasValue) this.idCompania = value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int? idAgente_Nulable
|
||||
{
|
||||
get
|
||||
@@ -203,7 +205,7 @@ namespace bdAsegasa.db
|
||||
if (value.HasValue) this.idAgente = value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int? idRamo_Nulable
|
||||
{
|
||||
get
|
||||
@@ -678,6 +680,7 @@ namespace bdAsegasa.db
|
||||
}
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string Telefono1Tomador
|
||||
{
|
||||
get
|
||||
@@ -696,6 +699,8 @@ namespace bdAsegasa.db
|
||||
if (EntidadPolizaTomador != null) EntidadPolizaTomador.Telefono1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string Telefono2Tomador
|
||||
{
|
||||
get
|
||||
@@ -714,6 +719,7 @@ namespace bdAsegasa.db
|
||||
if (EntidadPolizaTomador != null) EntidadPolizaTomador.Telefono2 = value;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string EmailTomador
|
||||
{
|
||||
get
|
||||
@@ -1075,22 +1081,45 @@ namespace bdAsegasa.db
|
||||
#endregion
|
||||
|
||||
#region Tomador_Tmp (WPF Bindings)
|
||||
[NotMapped]
|
||||
public string CifTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
public string RazonSocialTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPostalTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string DomicilioTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string CodigoPoblacionTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string PoblacionTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string ProvinciaTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
public string TelefonoTomador1Tmp { get; set; }
|
||||
[NotMapped]
|
||||
public string TelefonoTomador2Tmp { get; set; }
|
||||
[NotMapped]
|
||||
public string EmailTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
public bool? TomadorEsConductorHabitualTmp { get; set; }
|
||||
[NotMapped]
|
||||
public bool? TomadorEsPagadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
public bool? TomadorEsConductorOcasionalTmp { get; set; }
|
||||
[NotMapped]
|
||||
public bool? TomadorEsPropietarioTmp { get; set; }
|
||||
[NotMapped]
|
||||
public int? idSexoTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
public DateTime? FechaNacimientoTomadorTmp { get; set; }
|
||||
[NotMapped]
|
||||
public DateTime? FechaCarnetTomadorTmp { get; set; }
|
||||
|
||||
public void RellenaDatosTmpTomador(entidades entidad)
|
||||
|
||||
Reference in New Issue
Block a user