Imports tsl5 Imports bdGestionAsegasa Imports tsl5.Extensiones Imports DevExpress.CodeParser Partial Public Class polizasagrario #Region "Tomador" Public ReadOnly Property Tomador As entidades Get Return Me.entidades End Get End Property #End Region #Region "Asegurado" Public ReadOnly Property Asegurado As entidades Get Return Me.entidades1 End Get End Property Public ReadOnly Property DireccionAsegurado As direcciones Get Return Me.direcciones End Get End Property #End Region Public ReadOnly Property CodNomAgente As String Get Return Me.agentes.Codigo & "-" & Me.agentes.Nombre End Get End Property Public ReadOnly Property Fraccio As String Get Dim Retorno = "NO" If Me.fraccionada = True Then Retorno = "SI" Return Retorno End Get End Property Public ReadOnly Property idSubAgente_Especial As Integer? Get If Me.idSubagente.HasValue AndAlso Me.agentes.Codigo = "000047002186" Then Dim bd As gestionasegasaEntities = Me.ObtieneContexto Dim Codigo = Me.subagentes.Codigo.Substring(0, 2) & "00" Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo) If subage IsNot Nothing Then Return subage.idSubagente Else Return Nothing End If Else Return idSubagente End If End Get End Property Public ReadOnly Property ProvinciaAsegurado As String Get If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.direcciones1 IsNot Nothing AndAlso Me.entidades1.direcciones1.CodigoPostal IsNot Nothing AndAlso Me.entidades1.direcciones1.CodigoPostal.Length > 2 Then Return Me.entidades1.direcciones1.CodigoPostal.Substring(0, 2) Else Return "" End If End Get End Property #Region "Conversiones" Public Function AListadoGenericoPA() As ListadoGenericoPA Return New ListadoGenericoPA(Me) End Function #End Region End Class #Region "Exportaciones" Public Class ListadoGenericoPA Public Sub New(Poliza As polizasagrario) NumeroPóliza = Poliza.poliza FechaPóliza = Poliza.fechaPoliza Línea = Poliza.planeslineas.descripcion Compañía = Poliza.companias.Nombre CIFAsegurado = Poliza.entidades1.CIF Asegurado = Poliza.entidades1.RazonSocial Teléfono1 = If(Poliza.telefono1Asegurado.NothingAVacio <> "", Poliza.telefono1Asegurado, Poliza.entidades1.Telefono1.NothingAVacio) Teléfono2 = If(Poliza.telefono2Asegurado.NothingAVacio <> "", Poliza.telefono2Asegurado, Poliza.entidades1.Telefono2.NothingAVacio) Email = If(Poliza.emailAsegurado.NothingAVacio <> "", Poliza.emailAsegurado, Poliza.entidades1.Email.NothingAVacio) End Sub Property NumeroPóliza As String Property FechaPóliza As Date? Property Compañía As String Property Línea As String Property CIFAsegurado As String Property Asegurado As String Property Teléfono1 As String Property Teléfono2 As String Property Email As String End Class #End Region