agregado procesos y bd clases

This commit is contained in:
2026-04-28 11:52:16 +02:00
parent 59a774c397
commit cd2e8b8530
251 changed files with 56881 additions and 49 deletions

View File

@@ -0,0 +1,169 @@
using System;
using System.Linq;
using bdAsegasa.dbcontext;
using tsUtilidades;
using tsEFCore8;
namespace bdAsegasa.db
{
public partial class polizasagrario
{
public entidades Tomador
{
get
{
return this.idTomadorNavigation;
}
}
public entidades Asegurado
{
get
{
return this.idAseguradoNavigation;
}
}
public direcciones DireccionAsegurado
{
get
{
return this.idDomicilioAseguradoNavigation;
}
}
public string CodNomAgente
{
get
{
return this.idAgenteNavigation.Codigo + "-" + this.idAgenteNavigation.Nombre;
}
}
public string Fraccio
{
get
{
string Retorno = "NO";
if (this.fraccionada == true) Retorno = "SI";
return Retorno;
}
}
public int? idSubAgente_Especial
{
get
{
if (this.idSubagente.HasValue && this.idAgenteNavigation.Codigo == "000047002186")
{
using (var bd = tscgestionasegasa.NuevoContexto())
{
var Codigo = this.idSubagenteNavigation.Codigo.Substring(0, 2) + "00";
var subage = bd.subagentes.FirstOrDefault(x => x.idAgente == this.idAgente && x.Codigo == Codigo);
if (subage != null)
{
return subage.idSubagente;
}
else
{
return null;
}
}
}
return this.idSubagente;
}
}
public string ProvinciaAsegurado
{
get
{
if (this.idAseguradoNavigation != null && this.idAseguradoNavigation.idDireccionPrincipalNavigation != null && this.idAseguradoNavigation.idDireccionPrincipalNavigation.CodigoPostal != null && this.idAseguradoNavigation.idDireccionPrincipalNavigation.CodigoPostal.Length > 2)
{
return this.idAseguradoNavigation.idDireccionPrincipalNavigation.CodigoPostal.Substring(0, 2);
}
else
{
return "";
}
}
}
public ListadoGenericoPA AListadoGenericoPA()
{
return new ListadoGenericoPA(this);
}
}
public class ListadoGenericoPA
{
public ListadoGenericoPA(polizasagrario p)
{
NumeroPóliza = p.poliza;
if (p.fechaPoliza.HasValue)
{
FechaPóliza = new DateTime(p.fechaPoliza.Value.Year, p.fechaPoliza.Value.Month, p.fechaPoliza.Value.Day);
}
Línea = p.idPlanLineaNavigation?.descripcion;
Compañía = p.idCiaNavigation?.Nombre;
CIFAsegurado = p.Asegurado?.CIF;
Asegurado = p.Asegurado?.RazonSocial;
if (!string.IsNullOrEmpty(p.telefono1Asegurado))
{
Teléfono1 = p.telefono1Asegurado;
}
else
{
if (p.idAseguradoNavigation != null)
{
Teléfono1 = p.idAseguradoNavigation.Telefono1;
}
else
{
Teléfono1 = "";
}
}
if (!string.IsNullOrEmpty(p.telefono2Asegurado))
{
Teléfono2 = p.telefono2Asegurado;
}
else
{
if (p.idAseguradoNavigation != null)
{
Teléfono2 = p.idAseguradoNavigation.Telefono2;
}
else
{
Teléfono2 = "";
}
}
if (!string.IsNullOrEmpty(p.emailAsegurado))
{
Email = p.emailAsegurado;
}
else
{
if (p.idAseguradoNavigation != null)
{
Email = p.idAseguradoNavigation.Email;
}
else
{
Email = "";
}
}
}
public string NumeroPóliza { get; set; }
public DateTime? FechaPóliza { get; set; }
public string Compañía { get; set; }
public string Línea { get; set; }
public string CIFAsegurado { get; set; }
public string Asegurado { get; set; }
public string Teléfono1 { get; set; }
public string Teléfono2 { get; set; }
public string Email { get; set; }
}
}