2049 lines
91 KiB
VB.net
2049 lines
91 KiB
VB.net
Imports tsl5
|
|
Imports bdGestionAsegasa
|
|
Imports tsl5.Extensiones
|
|
Imports System.Data.Objects
|
|
Imports System.Text.RegularExpressions
|
|
Imports tsl5.Enumeraciones
|
|
Imports DevExpress.Mvvm.Native
|
|
Imports System.Security
|
|
Imports AccesoWSZurichDocumentos
|
|
|
|
|
|
Partial Public Class polizassg
|
|
|
|
#Region "CamposTemporales"
|
|
Public Property FechasInexistentes As String
|
|
|
|
#End Region
|
|
|
|
#Region "Listados"
|
|
Public Shared Function ListadoPolizasCIAsFechasInexistentes(bd As bdGestionAsegasa.gestionasegasaEntities) As List(Of polizassg)
|
|
' SELECT * FROM gestionasegasa.recibos WHERE idPoliza IN (SELECT idPoliza FROM gestionasegasa.polizassg WHERE idTipoPago = 279 AND FechaBaja IS NOT NULL) ORDER BY idPoliza, FechaEfecto ASC;
|
|
Dim consultaIdsPolizasCobroCiaNoBaja = (From x In bd.polizassg Where x.idTipoPago = 279 And x.FechaBaja IsNot Nothing Select x.idPoliza).ToList()
|
|
'Dim consultaIdsPolizasCobroCiaNoBaja = (From x In bd.polizassg Where x.idTipoPago = 279 And x.FechaBaja IsNot Nothing Select x.idPoliza).Take(30).ToList()
|
|
Dim consultaIdsRecibosQueSeAnalizaran = (From x In bd.recibos.OrderBy(Function(y) y.FechaVencimiento) Where consultaIdsPolizasCobroCiaNoBaja.Contains(x.idPoliza) Select x.idRecibo, x.idPoliza).ToList()
|
|
|
|
Debug.WriteLine("consultaIdsRecibosQueSeAnalizaran.Count() = " & consultaIdsRecibosQueSeAnalizaran.Count())
|
|
|
|
Dim fechaEfectoA As New Date
|
|
Dim fechaEfectoB As New Date
|
|
Dim fechaVencimientoA As New Date
|
|
Dim fechaVencimientoB As New Date
|
|
Dim rupturaContinuidad As Boolean = False
|
|
Dim lp As New List(Of polizassg)
|
|
For Each idP In consultaIdsPolizasCobroCiaNoBaja
|
|
Debug.WriteLine("Siguiente póliza")
|
|
|
|
Dim consultaIdsRecibos = consultaIdsRecibosQueSeAnalizaran.Where(Function(x) x.idPoliza = idP).Select(Function(x) x.idRecibo).ToList()
|
|
If consultaIdsRecibos.Count > 1 Then
|
|
Dim consultaRecibos = (From x In bd.recibos Where consultaIdsRecibos.Contains(x.idRecibo) Select x Order By x.FechaVencimiento Ascending).ToList()
|
|
'Dim consultaRecibos = (From x In bd.recibos Where consultaIdsRecibos.Contains(x.idRecibo) Select x).ToList()
|
|
'consultaRecibos = consultaRecibos.OrderBy(Function(x) x.idRecibo).ToList
|
|
|
|
Debug.WriteLine("consultaIdsRecibos.Count() = " & consultaIdsRecibos.Count())
|
|
Debug.WriteLine("consultaRecibos.Count() = " & consultaRecibos.Count())
|
|
|
|
fechaEfectoA = New Date
|
|
fechaEfectoB = New Date
|
|
fechaVencimientoA = New Date
|
|
fechaVencimientoB = New Date
|
|
rupturaContinuidad = False
|
|
|
|
Dim sbFechas As New System.Text.StringBuilder
|
|
|
|
For Each recibo In consultaRecibos
|
|
Debug.WriteLine("Siguiente recibo")
|
|
|
|
If fechaEfectoA.Year = 1 Then 'Estamos en el primer recibo de la lista
|
|
fechaEfectoA = recibo.FechaEfecto
|
|
fechaVencimientoA = recibo.FechaVencimiento
|
|
Else 'Estamos en un recibo que no es el primero de la lista, podemos empezar a comparar fechas
|
|
fechaEfectoB = recibo.FechaEfecto
|
|
fechaVencimientoB = recibo.FechaVencimiento
|
|
|
|
If fechaVencimientoA.Date.AddDays(1) < fechaEfectoB.Date Then 'En este caso no hay continuidad en las fechas entre este recibo y el anterior.
|
|
rupturaContinuidad = True
|
|
Debug.WriteLine("rupturaContinuidad = True")
|
|
' El carácter que se usa para los rangos de fechas no es un guión normal, sino el carácter "em dash" que puedes copiar y pegar de aquí: —
|
|
' Ese carácter es el que aparece justo en la línea siguiente de código para separar las fechas, entre {0} y {1}.
|
|
sbFechas.AppendFormat("{0}—{1}, ", fechaVencimientoA.ToString("yyyy-MM-dd"), fechaEfectoB.ToString("yyyy-MM-dd"))
|
|
End If
|
|
|
|
' Esto sirve de preparación para la siguiente comparación de parejas de recibos.
|
|
fechaEfectoA = fechaEfectoB
|
|
fechaVencimientoA = fechaVencimientoB
|
|
End If
|
|
Next
|
|
|
|
' Si hay ruptura de continuidad, entonces recopilo los datos que necesito y los añado al datatable de resultados.
|
|
If rupturaContinuidad Then
|
|
Dim poliza = bd.polizassg.Where(Function(x) x.idPoliza = idP).FirstOrDefault
|
|
Dim sNumPoliza As String = poliza.NumeroPoliza
|
|
Dim sIdTomador As String = poliza.Tomador.idEntidad
|
|
Dim sRazonSocialTomador As String = poliza.Tomador.RazonSocial
|
|
Dim sFechasInexistentes As String = sbFechas.ToString
|
|
sFechasInexistentes = sFechasInexistentes.Substring(0, sFechasInexistentes.Length - 2)
|
|
poliza.FechasInexistentes = sFechasInexistentes
|
|
lp.Add(poliza)
|
|
End If
|
|
End If
|
|
Next
|
|
Return lp
|
|
End Function
|
|
|
|
Public Shared Function GeneraEmailsMandatosSinRecibir(idUsuario As Integer) As String
|
|
Try
|
|
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
|
|
Dim fi As Date = Now.Date.AddDays(-23)
|
|
Dim idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "DOCRAM.MDTO").idEnumeracion
|
|
'Dim pols = bd.polizassg.Where(Function(x) x.FechaBaja.HasValue = False AndAlso x.documentospolizassg.Any(Function(y) y.documentosasolicitar.idTipo = idTipo And y.idFichero.HasValue = False)).GroupBy(Function(x) x.idAgente).ToList
|
|
Dim pls = bd.documentospolizassg.Where(Function(x) x.documentosasolicitar.idTipo = idTipo And x.idFichero.HasValue = False And x.polizassg.FechaBaja.HasValue = False).Select(Function(x) x.polizassg).ToList
|
|
Dim polsa = pls.GroupBy(Function(x) x.idAgente).ToList
|
|
|
|
Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "SEG.GENERALES")
|
|
Dim iNumCorreos As Integer
|
|
' Dim sDestinatariosBCC = bd.enumeraciones.First(Function(X) X.Codigo = "CONF.EMAILCOPIAS").ValorAlfabeticoLargo
|
|
Dim sDestinatariosBCC = bd.usuarios.First(Function(x) x.idUsuario = idUsuario).email
|
|
For Each grag In polsa
|
|
Dim la = grag.Select(Function(x) x.AListadoGenerico).ToList
|
|
Dim ba() As Byte = tsWPF.Utilidades.Varias.IEnumerableAExcel(la)
|
|
Dim Agente As String
|
|
Dim idAgente = grag.First.idAgente
|
|
Dim Ag = bd.agentes.First(Function(x) x.idAgente = idAgente)
|
|
Dim sDestinatario As String = Ag.Email.NothingAVacio
|
|
Agente = Ag.Codigo
|
|
Dim sAsunto = "Listado de pólizas sin mandato SEPA " & Now.Date.ToString("dd-MM-yyyy") & ") Agente: " & Agente
|
|
Dim sCuerpo = "Distinguidos Sres., les recordamos que es de obligado cumplimiento el tener el mandato sepa debidamente rellenado y firmado para poder enviar los recibos al cobro, por lo que necesitamos que suban los mandatos a la aplicación, a la mayor brevedad posible. Remitimos un archivo excel detallando las pólizas sin mandato sepa." & vbCrLf & "Muchas gracias y reciba un cordial saludo. "
|
|
If sDestinatario.EsListaEmailsValida = False Then
|
|
sDestinatario = sDestinatariosBCC
|
|
sDestinatariosBCC = ""
|
|
sAsunto &= " (Agente " & Agente & " sin correo)"
|
|
End If
|
|
bdGestionAsegasa.correos.GeneraRegistroCorreoConAdjunto(bd, sAsunto, sCuerpo, cta, ba, "ReclamacionMandatos-" & Now.ToString("yyyy-MM-dd") & ".xlsx", sAsunto, sDestinatario,, sDestinatariosBCC)
|
|
iNumCorreos += 1
|
|
Dim grsa = grag.GroupBy(Function(x) x.idSubAgente_Especial).ToList
|
|
For Each g In grsa
|
|
Try
|
|
Dim idSubAgente = g.First.idSubAgente_Especial
|
|
If idSubAgente.HasValue Then
|
|
Dim l = g.Select(Function(x) x.AListadoGenerico).ToList
|
|
Dim b() As Byte = tsWPF.Utilidades.Varias.IEnumerableAExcel(l)
|
|
Agente = Ag.Codigo
|
|
Dim sa As bdGestionAsegasa.subagentes
|
|
sa = bd.subagentes.First(Function(x) x.idSubagente = idSubAgente)
|
|
Agente &= "-" & sa.Codigo
|
|
If sa.Email.NothingAVacio <> "" Then sDestinatario = sa.Email
|
|
sAsunto = "Listado de pólizas sin mandato SEPA " & Now.Date.ToString("dd-MM-yyyy") & ") Agente: " & Agente
|
|
sCuerpo = "Distinguidos Sres., les recordamos que es de obligado cumplimiento el tener el mandato sepa debidamente rellenado y firmado para poder enviar los recibos al cobro, por lo que necesitamos que suban los mandatos a la aplicación, a la mayor brevedad posible. Remitimos un archivo excel detallando las pólizas sin mandato sepa." & vbCrLf & "Muchas gracias y reciba un cordial saludo. "
|
|
If sDestinatario.EsListaEmailsValida = False Then
|
|
sDestinatario = sDestinatariosBCC
|
|
sDestinatariosBCC = ""
|
|
sAsunto &= " (Agente/Subagente " & Agente & " sin correo)"
|
|
End If
|
|
iNumCorreos += 1
|
|
bdGestionAsegasa.correos.GeneraRegistroCorreoConAdjunto(bd, sAsunto, sCuerpo, cta, b, "ReclamacionMandatos-" & Now.ToString("yyyy-MM-dd") & ".xlsx", sAsunto, sDestinatario,, sDestinatariosBCC)
|
|
End If
|
|
Catch ex As Exception
|
|
Call Utilidades.AñadeLog(TipoLog.Fallo, "En GeneraEmailsMandatosSinRecibir.", "Rutina: GeneraEmailsMandatosSinRecibir. " & ex.Message, ex)
|
|
End Try
|
|
Next
|
|
Next
|
|
Return "Se han generado " & iNumCorreos.ToString & " correos de " & pls.Count.ToString & " pólizas."
|
|
Catch ex As Exception
|
|
Call Utilidades.AñadeLog(TipoLog.Fallo, "En GeneraEmailsMandatosSinRecibir.", "Rutina: GeneraEmailsMandatosSinRecibir-2. " & ex.Message, ex)
|
|
End Try
|
|
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
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 AvisosEntidades As String
|
|
Get
|
|
Try
|
|
Dim lent = Me.entidadespolizas.ToList.Where(Function(x) x.entidades.Avisos.NothingAVacio <> "").Select(Function(x) New With {.Aviso = x.entidades.Avisos, .CIF = x.entidades.CIF}).ToList
|
|
Dim la = lent.Select(Function(x) x.Aviso).ToList
|
|
If CifTomadorTmp.NothingAVacio <> "" AndAlso lent.Any(Function(x) x.CIF = CifTomadorTmp) = False Then
|
|
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
|
|
Dim ent = bd.entidades.FirstOrDefault(Function(x) x.CIF = CifTomadorTmp)
|
|
If ent IsNot Nothing AndAlso ent.Avisos.NothingAVacio <> "" Then la.Add(ent.Avisos)
|
|
End If
|
|
If la.Count = 0 Then
|
|
Return ""
|
|
Else
|
|
Return String.Join(" ", la)
|
|
End If
|
|
Catch ex As Exception
|
|
Return ""
|
|
End Try
|
|
End Get
|
|
End Property
|
|
|
|
Private _idPoliza_EsNula As Boolean
|
|
|
|
Public ReadOnly Property OficinaAgente As String
|
|
Get
|
|
If Me.agentes IsNot Nothing Then
|
|
Return Me.agentes.OficinaAgente
|
|
Else
|
|
Return "Sevilla"
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public Property idPoliza_Nulable As Integer?
|
|
Get
|
|
If Me.idPoliza = 0 Or _idPoliza_EsNula Then
|
|
Return Nothing
|
|
Else
|
|
Return Me.idPoliza
|
|
End If
|
|
End Get
|
|
Set(value As Integer?)
|
|
_idPoliza_EsNula = value Is Nothing
|
|
OnPropertyChanged("idPoliza_Nulable")
|
|
End Set
|
|
End Property
|
|
Public Property idCompania_Nulable As Integer?
|
|
Get
|
|
If Me.idCompania = 0 Then
|
|
Return Nothing
|
|
Else
|
|
Return Me.idCompania
|
|
End If
|
|
End Get
|
|
Set(value As Integer?)
|
|
If value.HasValue Then Me.idCompania = value.Value
|
|
OnPropertyChanged("idCompania_Nulable")
|
|
End Set
|
|
End Property
|
|
Public Property idAgente_Nulable As Integer?
|
|
Get
|
|
If Me.idAgente = 0 Then
|
|
Return Nothing
|
|
Else
|
|
Return Me.idAgente
|
|
End If
|
|
End Get
|
|
Set(value As Integer?)
|
|
If value.HasValue Then Me.idAgente = value.Value
|
|
OnPropertyChanged("idAgente_Nulable")
|
|
End Set
|
|
End Property
|
|
Public Property idRamo_Nulable As Integer?
|
|
Get
|
|
If Me.idRamo = 0 Then
|
|
Return Nothing
|
|
Else
|
|
Return Me.idRamo
|
|
End If
|
|
End Get
|
|
Set(value As Integer?)
|
|
If value.HasValue Then Me.idRamo = value.Value
|
|
OnPropertyChanged("idRamo_Nulable")
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property AgenteSubagente As String
|
|
Get
|
|
If Me.agentes Is Nothing Then
|
|
Return ""
|
|
Else
|
|
If Me.subagentes IsNot Nothing Then
|
|
Return Me.agentes.Nombre & " / " & subagentes.ListaSubAgentes.First(Function(x) x.idSubagente = Me.idSubAgente).Nombre
|
|
Else
|
|
Return Me.agentes.Nombre
|
|
End If
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property NombreSubAgente As String
|
|
Get
|
|
If Me.idSubAgente.HasValue Then
|
|
Return subagentes.ListaSubAgentes.First(Function(x) x.idSubagente = Me.idSubAgente).Nombre
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public Sub RefrescaNombreSubAgente()
|
|
Me.OnPropertyChanged("NombreSubAgente")
|
|
End Sub
|
|
|
|
Public ReadOnly Property EntidadPolizaTomador As entidadespolizas
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsTomador) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsTomador)
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EntidadPolizaPropietario As entidadespolizas
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPropietario)
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property EntidadPolizaConductor As entidadespolizas
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorHabitual)
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EntidadPolizaPagador As entidadespolizas
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPagador)
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EntidadPolizaConductorOcasional As entidadespolizas
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorOcasional)
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
|
|
Public ReadOnly Property CausaBaja As String
|
|
Get
|
|
If Me.enumeraciones IsNot Nothing Then
|
|
Return Me.enumeraciones.Descripcion
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property NumeroSuplemento_String As String
|
|
Get
|
|
If Me.NumeroSuplemento = 0 Then
|
|
Return ""
|
|
Else
|
|
Return NumeroSuplemento.ToString
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property NumeroPolizaSuplementoLargo As String
|
|
Get
|
|
If Me.NumeroSuplemento = 0 Then
|
|
Return Me.NumeroPoliza
|
|
Else
|
|
Return Me.NumeroPoliza & " (" & Me.NumeroSuplemento.ToString & ")"
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
|
|
|
|
Public ReadOnly Property NumeroPolizaSuplemento As String
|
|
Get
|
|
If Me.NumeroSuplemento = 0 Then
|
|
Return Me.NumeroPoliza
|
|
Else
|
|
Return Me.NumeroPoliza & "#" & Me.NumeroSuplemento.ToString
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property UltimoRecibo As recibos
|
|
Get
|
|
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
|
|
If bd.recibos.Any(Function(x) x.idPoliza = Me.idPoliza) Then
|
|
Return bd.recibos.Where(Function(x) x.idPoliza = Me.idPoliza).OrderByDescending(Function(x) x.FechaEfecto).First
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CiaNumeroPolizaSuplemento As String
|
|
Get
|
|
If Me.NumeroSuplemento = 0 Then
|
|
Return Me.companias.Codigo & "-" & Me.NumeroPoliza
|
|
Else
|
|
Return Me.companias.Codigo & "-" & Me.NumeroPoliza & "#" & Me.NumeroSuplemento.ToString
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
|
|
Public ReadOnly Property TieneSuplementoPosterior As Boolean
|
|
Get
|
|
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
|
|
Return bd.polizassg.Any(Function(x) x.NumeroPoliza = Me.NumeroPoliza And x.idCompania = Me.idCompania And x.NumeroSuplemento > Me.NumeroSuplemento)
|
|
End Get
|
|
End Property
|
|
|
|
Private _RCSociosCaser As RCSociosCaser
|
|
Public Property RcSociosCaser As RCSociosCaser
|
|
Get
|
|
If _RCSociosCaser Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCSOCIOSCASER AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As RCSociosCaser = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCSociosCaser))
|
|
_RCSociosCaser = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _RCSociosCaser
|
|
End If
|
|
End Get
|
|
Set(value As RCSociosCaser)
|
|
_RCSociosCaser = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRcSociosCaser(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As RCSociosCaser)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "rcsocioscaser.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _rcMaquinariaAgricola As RCMaquinariaAgricola
|
|
Public Property RCMaquinariaAgricola As RCMaquinariaAgricola
|
|
Get
|
|
If _rcMaquinariaAgricola Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCMAQUINARIAAGRICOLA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As RCMaquinariaAgricola = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCMaquinariaAgricola))
|
|
_rcMaquinariaAgricola = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _rcMaquinariaAgricola
|
|
End If
|
|
End Get
|
|
Set(value As RCMaquinariaAgricola)
|
|
_rcMaquinariaAgricola = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRcMaquinariaAgricola(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As RCMaquinariaAgricola)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "rcmaquinariaagricola.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _rcTarificadorMaquinariaPlusUltra As TarificadorMaquinariaPlusUltra
|
|
Public Property TarificadorMaquinariaPlusUltra As TarificadorMaquinariaPlusUltra
|
|
Get
|
|
If _rcTarificadorMaquinariaPlusUltra Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.MAQUINARIAPLUSULTRA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As TarificadorMaquinariaPlusUltra = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(TarificadorMaquinariaPlusUltra))
|
|
_rcTarificadorMaquinariaPlusUltra = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _rcTarificadorMaquinariaPlusUltra
|
|
End If
|
|
End Get
|
|
Set(value As TarificadorMaquinariaPlusUltra)
|
|
_rcTarificadorMaquinariaPlusUltra = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaTarificadorMaquinariaPlusUltra(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As TarificadorMaquinariaPlusUltra)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "TarificadorMaquinariaPlusUltra.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _rcTarificadorGenerico As TarificadorGenerico
|
|
Public Property TarificadorGenerico As TarificadorGenerico
|
|
Get
|
|
If _rcTarificadorGenerico Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.TARIFICADORGENERICO AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As TarificadorGenerico = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(TarificadorGenerico))
|
|
_rcTarificadorGenerico = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _rcTarificadorGenerico
|
|
End If
|
|
End Get
|
|
Set(value As TarificadorGenerico)
|
|
_rcTarificadorGenerico = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaTarificadorGenerico(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As TarificadorGenerico)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "TarificadorGenerico.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _Tractores As Tractores
|
|
Public Property Tractores As Tractores
|
|
Get
|
|
If _Tractores Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.TRACTORES AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As Tractores = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(Tractores))
|
|
_Tractores = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _Tractores
|
|
End If
|
|
End Get
|
|
Set(value As Tractores)
|
|
_Tractores = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub GuardaTractores(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, tractor As Tractores)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "tractores.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(tractor))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(tractor))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _rcSociosZurich As RCSociosZurich
|
|
Public Property RCSociosZurich() As RCSociosZurich
|
|
Get
|
|
If _rcSociosZurich Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCSOCIOSZURICH AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As RCSociosZurich = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCSociosZurich))
|
|
_rcSociosZurich = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _rcSociosZurich
|
|
End If
|
|
End Get
|
|
Set(ByVal value As RCSociosZurich)
|
|
_rcSociosZurich = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRCSociosZurich(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As RCSociosZurich)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "RCSociosZurich.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _RCCotosCazaCaser As RCCotosCazaCaser
|
|
Public Property RCCotosCazaCaser As RCCotosCazaCaser
|
|
Get
|
|
If _RCCotosCazaCaser Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCCOTOSCAZACASER AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As RCCotosCazaCaser = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCCotosCazaCaser))
|
|
_RCCotosCazaCaser = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _RCCotosCazaCaser
|
|
End If
|
|
End Get
|
|
Set(value As RCCotosCazaCaser)
|
|
_RCCotosCazaCaser = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRCCotosCazaCaser(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As RCCotosCazaCaser)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "rccotoscazacaser.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _TarificadorMaquinaria As TarificadorMaquinaria
|
|
Public Property TarificadorMaquinaria As TarificadorMaquinaria
|
|
Get
|
|
If _TarificadorMaquinaria Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.TARIFICADORMAQUINARIA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As TarificadorMaquinaria = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(TarificadorMaquinaria))
|
|
_TarificadorMaquinaria = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _TarificadorMaquinaria
|
|
End If
|
|
End Get
|
|
Set(value As TarificadorMaquinaria)
|
|
_TarificadorMaquinaria = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaTarificadorMaquinaria(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcsc As TarificadorMaquinaria)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "tarificadormaquinaria.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcsc))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _RCPerros As RCPerros
|
|
Public Property RCPerros As RCPerros
|
|
Get
|
|
If _RCPerros Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCPERROS AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcp As RCPerros = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCPerros))
|
|
_RCPerros = rcp
|
|
Return rcp
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _RCPerros
|
|
End If
|
|
End Get
|
|
Set(value As RCPerros)
|
|
_RCPerros = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRCPerros(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As RCPerros)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "rcperros.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
Private _RCCaballos As RCCaballos
|
|
Public Property RCCaballos As RCCaballos
|
|
Get
|
|
If _RCCaballos Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.RCCABALLOS AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcp As RCCaballos = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(RCCaballos))
|
|
_RCCaballos = rcp
|
|
Return rcp
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _RCCaballos
|
|
End If
|
|
End Get
|
|
Set(value As RCCaballos)
|
|
_RCCaballos = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaRCCaballos(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As RCCaballos)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "rccaballos.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _TransportesAXA As TransportexAXA
|
|
Public Property TransportesAXA As TransportexAXA
|
|
Get
|
|
If _TransportesAXA Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.TRANSPORTESAXA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim traxa As TransportexAXA = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(TransportexAXA))
|
|
_TransportesAXA = traxa
|
|
Return traxa
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _TransportesAXA
|
|
End If
|
|
End Get
|
|
Set(value As TransportexAXA)
|
|
_TransportesAXA = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaTransportesAXA(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As TransportexAXA)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "transportesAXA.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _AccidentesIndividualesAXA As AccidentesIndividualesAXA
|
|
Public Property AccidentesIndividualesAXA As AccidentesIndividualesAXA
|
|
Get
|
|
If _AccidentesIndividualesAXA Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.ACCIDENTESINDIVIDUALESAXA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim accInd As AccidentesIndividualesAXA = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(AccidentesIndividualesAXA))
|
|
_AccidentesIndividualesAXA = accInd
|
|
Return accInd
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _AccidentesIndividualesAXA
|
|
End If
|
|
End Get
|
|
Set(value As AccidentesIndividualesAXA)
|
|
_AccidentesIndividualesAXA = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaAccidentesIndividualesAXA(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As AccidentesIndividualesAXA)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "accidentesIndividualesAXA.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _SaludMapfre As SaludMapfre
|
|
Public Property SaludMapfre As SaludMapfre
|
|
Get
|
|
If _SaludMapfre Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.SALUDMAPFRE AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim accInd As SaludMapfre = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(SaludMapfre))
|
|
_SaludMapfre = accInd
|
|
Return accInd
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _SaludMapfre
|
|
End If
|
|
End Get
|
|
Set(value As SaludMapfre)
|
|
_SaludMapfre = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaSaludMapfre(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As SaludMapfre)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "SaludMapfre.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _CasetasRiegoAXA As CasetasRiegoAxa
|
|
Public Property CasetasRiegoAXA As CasetasRiegoAxa
|
|
Get
|
|
If _CasetasRiegoAXA Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.CASETASRIEGOAXA AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim casRieg As CasetasRiegoAxa = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(CasetasRiegoAxa))
|
|
_CasetasRiegoAXA = casRieg
|
|
Return casRieg
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _CasetasRiegoAXA
|
|
End If
|
|
End Get
|
|
Set(value As CasetasRiegoAxa)
|
|
_CasetasRiegoAXA = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaCasetasRiegoAxa(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As CasetasRiegoAxa)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "CasetasRiegoAxa.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _TractoresEuropAssistance As TractoresEuropAssistance
|
|
Public Property TractoresEuropAssistance As TractoresEuropAssistance
|
|
Get
|
|
If _TractoresEuropAssistance Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.TRACTORESEUROPASSISTANCE AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim tracEurop As TractoresEuropAssistance = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(TractoresEuropAssistance))
|
|
_TractoresEuropAssistance = tracEurop
|
|
Return tracEurop
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _TractoresEuropAssistance
|
|
End If
|
|
End Get
|
|
Set(value As TractoresEuropAssistance)
|
|
_TractoresEuropAssistance = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaTractoresEuropAssistance(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As TractoresEuropAssistance)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "TractoresEuropAssistance.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
|
|
Private _DatosCodeoscopic As CodeoscopicV5
|
|
Public Property DatosCodeoscopic As CodeoscopicV5
|
|
Get
|
|
Try
|
|
If _DatosCodeoscopic Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.AVANT2 AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim rcsc As CodeoscopicV5 = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(CodeoscopicV5))
|
|
_DatosCodeoscopic = rcsc
|
|
Return rcsc
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _DatosCodeoscopic
|
|
End If
|
|
Catch ex As Exception
|
|
Return Nothing
|
|
End Try
|
|
End Get
|
|
Set(value As CodeoscopicV5)
|
|
_DatosCodeoscopic = value
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Patinetes"
|
|
|
|
Private _patinetes As Patinetes
|
|
Public Property Patinetes As Patinetes
|
|
Get
|
|
If _patinetes Is Nothing Then
|
|
If Me.idOrigenPresupuesto = TiposPresupuestos.PATINETES AndAlso Me.idFicheroPresupuesto.HasValue Then
|
|
Dim pat As Patinetes = tsl5.Utilidades.Deserializa(Me.ficheros.Fichero, GetType(Patinetes))
|
|
_patinetes = pat
|
|
Return pat
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
Else
|
|
Return _patinetes
|
|
End If
|
|
End Get
|
|
Set(value As Patinetes)
|
|
_patinetes = value
|
|
End Set
|
|
End Property
|
|
Public Sub GuardaPatinetes(bd As bdGestionAsegasa.gestionasegasaEntities, poliza As polizassg, rcp As Patinetes)
|
|
If Me.idFicheroPresupuesto.HasValue = False Then
|
|
Dim fi = New ficheros
|
|
fi.idTipo = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
|
|
fi.NombreFichero = "patinetes.xml"
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
fi.Descripcion = "Documento XML de Presupuesto"
|
|
poliza.ficheros = fi
|
|
Else
|
|
Dim fi = poliza.ficheros
|
|
fi.Fichero = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(rcp))
|
|
poliza.ficheros = fi
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
#Region "GeneracionFicheros"
|
|
Public Function GeneraFicheroMandatoSEPA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
If bd.plantillas.Any(Function(x) x.Codigo = "SEPA." & Me.companias.Codigo) Then
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "SEPA." & Me.companias.Codigo)
|
|
Else
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "SEPA.ASEGASA")
|
|
End If
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPolizasG(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
|
|
Public Function GeneraFicheroPresupuestoRCSociosCASER(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCSOCIOSCASER")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCSociosCaser(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRCMaquinariaAgricola(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCMAQUINARIAAGRICOLA")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCMaquinariaAgricola(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroAgroCASER(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RESPCIVILAGROCASER")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCCotosCazaCaser(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoTractoresAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.TRACTORES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCCertificadoTractores(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoTractoresAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.PRETRACTORES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPresupuestoTractores(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRemolquesAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.PREREMOLQUES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPresupuestoTractores(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRCCotosCazaCaser(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCCOTOSCAZACASER")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCCotosCazaCaser(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRCSociosZurich(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCSOCIOSZURICH")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPresupuestoRCSociosZurich(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoRemolquesAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.REMOLQUES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCCertificadoRemolques(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoPatinetesZurich(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.CERTPATINETES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPatinetes(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoTarificadorMaquinaria(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.TARIFICADORMAQUINARIA")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCTarificadorMaquinaria(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRCCaballos(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCCABALLOS")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCCaballos(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoRCCaballos(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.CERTRCCABALLOS")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCCaballos(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoRCPerros(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.RCPERROS")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCPerros(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoRCPerros(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.CERTRCPERROS")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCRCPerros(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoTransportesAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.TRANSPORTESAXA")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCTransportesAXA(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoAccidentesIndividualesAXA(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.ACCIDENTESINDAXA")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCAccidentesIndividualesAXA(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoSaludMapfre(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.SALUDMAPFRE")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCSaludMapfre(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoPatinetes(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.PATINETES")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCPatinetes(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoCasetasRiegoAxa(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.CASETASRIEGAXA")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCCasetasRiegoAxa(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroPresupuestoTractoresEuropAssistance(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.TRACTORESEUROP")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCTractoresEuropAssistance(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
Public Function GeneraFicheroCertificadoTractoresEuropAssistance(bd As bdGestionAsegasa.gestionasegasaEntities) As Byte()
|
|
Dim Plantilla As plantillas
|
|
Plantilla = bd.plantillas.First(Function(x) x.Codigo = "PR.CERTTRACTORESEUROP")
|
|
Dim lp As New List(Of polizassg)
|
|
lp.Add(Me)
|
|
Dim cc = CombinacionCorrespondencia.Utilidades.ObtieneCCTractoresEuropAssistance(lp)
|
|
Return CombinacionCorrespondencia.Utilidades.FusionaPlantillaENPDF(Plantilla.Plantilla, cc)
|
|
End Function
|
|
#End Region
|
|
Public Enum TiposPresupuestos
|
|
RCSOCIOSCASER = 1
|
|
TRACTORES = 2
|
|
RCCOTOSCAZACASER = 3
|
|
TARIFICADORMAQUINARIA = 4
|
|
AVANT2 = 5
|
|
RCMAQUINARIAAGRICOLA = 6
|
|
RCPERROS = 7
|
|
PATINETES = 8
|
|
RCCABALLOS = 9
|
|
TRANSPORTESAXA = 10
|
|
ACCIDENTESINDIVIDUALESAXA = 11
|
|
SALUDMAPFRE = 12
|
|
CASETASRIEGOAXA = 13
|
|
RCSOCIOSZURICH = 14
|
|
MAQUINARIAPLUSULTRA = 15
|
|
TARIFICADORGENERICO = 16
|
|
TRACTORESEUROPASSISTANCE = 17
|
|
IMPORTACION_CSV_ALLIANZ_202111 = 100
|
|
FICHERO_EIAC = 101
|
|
End Enum
|
|
|
|
#Region "Tomador"
|
|
|
|
Public Property Tomador As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsTomador) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsTomador).entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
Set(value As entidades)
|
|
If Not Me.entidadespolizas.Any(Function(x) x.EsTomador) Then
|
|
Me.entidadespolizas.Add(New entidadespolizas With {.EsTomador = True, .entidades = value})
|
|
Else
|
|
Me.entidadespolizas.First(Function(x) x.EsTomador).entidades = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property DireccionTomador As direcciones
|
|
Get
|
|
If EntidadPolizaTomador IsNot Nothing Then
|
|
Return EntidadPolizaTomador.direcciones
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public Property Telefono1Tomador As String
|
|
Get
|
|
If EntidadPolizaTomador IsNot Nothing Then
|
|
Return EntidadPolizaTomador.Telefono1
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
If EntidadPolizaTomador IsNot Nothing Then EntidadPolizaTomador.Telefono1 = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Telefono2Tomador As String
|
|
Get
|
|
If EntidadPolizaTomador IsNot Nothing Then
|
|
Return EntidadPolizaTomador.Telefono2
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
If EntidadPolizaTomador IsNot Nothing Then EntidadPolizaTomador.Telefono2 = value
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property EmailTomador As String
|
|
Get
|
|
If EntidadPolizaTomador IsNot Nothing Then
|
|
Return EntidadPolizaTomador.Email.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "Tomador_Tmp"
|
|
Private _CifTomadorTmp As String
|
|
Public Property CifTomadorTmp As String
|
|
Get
|
|
Return _CifTomadorTmp
|
|
End Get
|
|
Set(value As String)
|
|
_CifTomadorTmp = value
|
|
Me.OnPropertyChanged("CifTomadorTmp")
|
|
End Set
|
|
End Property
|
|
Public Property RazonSocialTomadorTmp As String
|
|
Public Property CodigoPostalTomadorTmp As String
|
|
Public Property DomicilioTomadorTmp As String
|
|
|
|
|
|
Public Property CodigoPoblacionTomadorTmp As String
|
|
|
|
Public Property PoblacionTomadorTmp As String
|
|
|
|
Public Property ProvinciaTomadorTmp As String
|
|
Public Property TelefonoTomador1Tmp As String
|
|
Public Property TelefonoTomador2Tmp As String
|
|
|
|
Public Property EmailTomadorTmp As String
|
|
Public Property TomadorEsConductorHabitualTmp As Boolean?
|
|
Public Property TomadorEsPagadorTmp As Boolean?
|
|
Public Property TomadorEsConductorOcasionalTmp As Boolean?
|
|
|
|
Public Property TomadorEsPropietarioTmp As Boolean?
|
|
|
|
Public Property idSexoTomadorTmp As Integer?
|
|
Public Property FechaNacimientoTomadorTmp As Date?
|
|
Public Property FechaCarnetTomadorTmp As Date?
|
|
|
|
|
|
Public Sub RellenaDatosTmpTomador(Entidad As entidades)
|
|
CifTomadorTmp = Entidad.CIF
|
|
RazonSocialTomadorTmp = Entidad.RazonSocial
|
|
If Entidad.direcciones1 IsNot Nothing Then
|
|
CodigoPostalTomadorTmp = Entidad.direcciones1.CodigoPostal
|
|
DomicilioTomadorTmp = Entidad.direcciones1.Direccion
|
|
CodigoPoblacionTomadorTmp = Entidad.direcciones1.CodigoMunicipio
|
|
If Entidad.direcciones1.municipios IsNot Nothing Then
|
|
PoblacionTomadorTmp = Entidad.direcciones1.municipios.Nombre
|
|
|
|
If Entidad.direcciones1.municipios.provincias IsNot Nothing Then
|
|
ProvinciaTomadorTmp = Entidad.direcciones1.municipios.provincias.Nombre
|
|
End If
|
|
End If
|
|
End If
|
|
TelefonoTomador1Tmp = Entidad.Telefono1
|
|
TelefonoTomador2Tmp = Entidad.Telefono2
|
|
|
|
EmailTomadorTmp = Entidad.Email
|
|
TomadorEsConductorHabitualTmp = False
|
|
TomadorEsPagadorTmp = False
|
|
TomadorEsConductorOcasionalTmp = False
|
|
|
|
TomadorEsPropietarioTmp = False
|
|
|
|
idSexoTomadorTmp = Entidad.idSexo
|
|
FechaNacimientoTomadorTmp = Entidad.FechaNacimiento
|
|
FechaCarnetTomadorTmp = Entidad.FechaExpedicionCarnet
|
|
RefrescaDatosTomadorTMP()
|
|
|
|
End Sub
|
|
|
|
|
|
Public Sub RellenaDatosTmpTomador(ep As entidadespolizas)
|
|
Dim entidad = ep.entidades
|
|
If ep.entidades IsNot Nothing Then
|
|
CifTomadorTmp = entidad.CIF
|
|
RazonSocialTomadorTmp = entidad.RazonSocial
|
|
If ep.direcciones IsNot Nothing Then
|
|
CodigoPostalTomadorTmp = ep.direcciones.CodigoPostal
|
|
DomicilioTomadorTmp = ep.direcciones.Direccion
|
|
CodigoPoblacionTomadorTmp = ep.direcciones.CodigoMunicipio
|
|
If ep.direcciones.municipios IsNot Nothing Then
|
|
PoblacionTomadorTmp = ep.direcciones.municipios.Nombre
|
|
If ep.direcciones.municipios.provincias IsNot Nothing Then
|
|
ProvinciaTomadorTmp = ep.direcciones.municipios.provincias.Nombre
|
|
End If
|
|
End If
|
|
End If
|
|
TelefonoTomador1Tmp = ep.Telefono1
|
|
TelefonoTomador2Tmp = ep.Telefono2
|
|
EmailTomadorTmp = ep.Email
|
|
|
|
TomadorEsConductorHabitualTmp = ep.EsConductorHabitual
|
|
TomadorEsPagadorTmp = ep.EsPagador
|
|
TomadorEsConductorOcasionalTmp = ep.EsConductorOcasional
|
|
TomadorEsPropietarioTmp = ep.EsPropietario
|
|
|
|
idSexoTomadorTmp = entidad.idSexo
|
|
FechaNacimientoTomadorTmp = entidad.FechaNacimiento
|
|
FechaCarnetTomadorTmp = entidad.FechaExpedicionCarnet
|
|
RefrescaDatosTomadorTMP()
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub VaciaDatosTmpTomador()
|
|
RazonSocialTomadorTmp = ""
|
|
CodigoPostalTomadorTmp = ""
|
|
DomicilioTomadorTmp = ""
|
|
CodigoPoblacionTomadorTmp = ""
|
|
PoblacionTomadorTmp = ""
|
|
ProvinciaTomadorTmp = ""
|
|
TelefonoTomador1Tmp = ""
|
|
TelefonoTomador2Tmp = ""
|
|
|
|
EmailTomadorTmp = ""
|
|
TomadorEsConductorHabitualTmp = False
|
|
TomadorEsPagadorTmp = False
|
|
TomadorEsConductorOcasionalTmp = False
|
|
|
|
TomadorEsPropietarioTmp = False
|
|
|
|
idSexoTomadorTmp = Nothing
|
|
FechaNacimientoTomadorTmp = Nothing
|
|
FechaCarnetTomadorTmp = Nothing
|
|
RefrescaDatosTomadorTMP()
|
|
End Sub
|
|
|
|
|
|
Public Sub RefrescaDatosTomadorTMP()
|
|
Me.OnPropertyChanged("CifTomadorTmp")
|
|
Me.OnPropertyChanged("RazonSocialTomadorTmp")
|
|
Me.OnPropertyChanged("CodigoPostalTomadorTmp")
|
|
Me.OnPropertyChanged("DomicilioTomadorTmp")
|
|
Me.OnPropertyChanged("CodigoPoblacionTomadorTmp")
|
|
Me.OnPropertyChanged("PoblacionTomadorTmp")
|
|
Me.OnPropertyChanged("ProvinciaTomadorTmp")
|
|
Me.OnPropertyChanged("TelefonoTomador1Tmp")
|
|
Me.OnPropertyChanged("TelefonoTomador2Tmp")
|
|
Me.OnPropertyChanged("EmailTomadorTmp")
|
|
Me.OnPropertyChanged("TomadorEsConductorHabitualTmp")
|
|
Me.OnPropertyChanged("TomadorEsPagadorTmp")
|
|
Me.OnPropertyChanged("TomadorEsConductorOcasionalTmp")
|
|
Me.OnPropertyChanged("TomadorEsPropietarioTmp")
|
|
Me.OnPropertyChanged("idSexoTomadorTmp")
|
|
Me.OnPropertyChanged("FechaNacimientoTomadorTmp")
|
|
Me.OnPropertyChanged("FechaCarnetTomadorTmp")
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "Propietario"
|
|
Public ReadOnly Property Propietario As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPropietario).entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DireccionPropietario As direcciones
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPropietario).direcciones
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Telefono1Propietario As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPropietario)
|
|
Return ep.Telefono1.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Telefono2Propietario As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPropietario)
|
|
Return ep.Telefono2.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property EmailPropietario As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPropietario) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPropietario)
|
|
Return ep.Email.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
#End Region
|
|
|
|
#Region "Conductor"
|
|
Public ReadOnly Property Conductor As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorHabitual).entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DireccionConductor As direcciones
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorHabitual).direcciones
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Telefono1Conductor As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorHabitual)
|
|
Return ep.Telefono1.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Telefono2Conductor As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorHabitual)
|
|
Return ep.Telefono2.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property EmailConductor As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorHabitual) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorHabitual)
|
|
Return ep.Email.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
#End Region
|
|
|
|
#Region "Asegurados"
|
|
Public ReadOnly Property Asegurado1 As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.Observaciones = "Asegurado1") Then
|
|
Return Me.entidadespolizas.First(Function(x) x.Observaciones = "Asegurado1").entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Asegurado2 As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.Observaciones = "Asegurado2") Then
|
|
Return Me.entidadespolizas.First(Function(x) x.Observaciones = "Asegurado2").entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Asegurado3 As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.Observaciones = "Asegurado3") Then
|
|
Return Me.entidadespolizas.First(Function(x) x.Observaciones = "Asegurado3").entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Asegurado4 As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.Observaciones = "Asegurado4") Then
|
|
Return Me.entidadespolizas.First(Function(x) x.Observaciones = "Asegurado4").entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
#End Region
|
|
|
|
#Region "Pagador"
|
|
Public ReadOnly Property Pagador As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPagador).entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DireccionPagador As direcciones
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsPagador).direcciones
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Telefono1Pagador As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPagador)
|
|
Return ep.Telefono1.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Telefono2Pagador As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPagador)
|
|
Return ep.Telefono2.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property EmailPagador As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsPagador) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsPagador)
|
|
Return ep.Email.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
#End Region
|
|
|
|
#Region "ConductorOcasional"
|
|
|
|
|
|
Public ReadOnly Property ConductorOcasional As entidades
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorOcasional).entidades
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DireccionConductorOcasional As direcciones
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Return Me.entidadespolizas.First(Function(x) x.EsConductorOcasional).direcciones
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property Telefono1ConductorOcasional As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorOcasional)
|
|
Return ep.Telefono1.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Telefono2ConductorOcasional As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorOcasional)
|
|
Return ep.Telefono2.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property EmailConductorOcasional As String
|
|
Get
|
|
If Me.entidadespolizas.Any(Function(x) x.EsConductorOcasional) Then
|
|
Dim ep = Me.entidadespolizas.First(Function(x) x.EsConductorOcasional)
|
|
Return ep.Email.NothingAVacio
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
Public ReadOnly Property TipoCobro As String
|
|
Get
|
|
If Me.idTipoCobro.HasValue Then
|
|
Return Me.enumeraciones1.Descripcion
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TipoPago As String
|
|
Get
|
|
If Me.idTipoPago.HasValue Then
|
|
Return Me.enumeraciones2.Descripcion
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property FicheroFSS As ficheros
|
|
Get
|
|
If Me.documentospolizassg.ToList.Any(Function(x) x.documentosasolicitar.enumeraciones.Codigo = "DOCRAM.FSS" And x.idFichero.HasValue) Then
|
|
Return Me.documentospolizassg.ToList.Where(Function(x) x.documentosasolicitar.enumeraciones.Codigo = "DOCRAM.FSS" And x.idFichero.HasValue).OrderByDescending(Function(x) x.idDocumento).First.ficheros
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DocumentosPendientesRecibir As List(Of documentospolizassg)
|
|
Get
|
|
Return Me.documentospolizassg.Where(Function(x) x.FechaComprobacion Is Nothing And x.Obligatorio And x.idFichero Is Nothing).ToList
|
|
End Get
|
|
End Property
|
|
|
|
Public Shared Function TransformaNumeroPolizaAFormatoAsegasa(NumeroPolizaAvant As String, CodigoCompañia As String, CodigoRamo As String) As String
|
|
Dim NumeroPoliza As String = NumeroPolizaAvant
|
|
Select Case CodigoCompañia
|
|
Case "0013", "2913"
|
|
If NumeroPolizaAvant.Length > 11 Then NumeroPoliza = NumeroPoliza.Substring(NumeroPoliza.Length - 11, 11)
|
|
If NumeroPolizaAvant.Length < 11 Then NumeroPoliza = NumeroPoliza.PadLeft(11, "0")
|
|
Case "0008"
|
|
If NumeroPolizaAvant.Contains("-") Then NumeroPoliza = NumeroPoliza.Replace("-", "")
|
|
Case "0021"
|
|
If CodigoRamo = "1" Or CodigoRamo = "1-2" And NumeroPoliza.Substring(0, 1) <> "0" Then NumeroPoliza = "0" & NumeroPoliza
|
|
End Select
|
|
Return NumeroPoliza
|
|
End Function
|
|
|
|
Friend Shared Sub GuardandoCambios(bd As bdGestionAsegasa.gestionasegasaEntities, Aplicacion As String)
|
|
Dim pols As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
Dim ents As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
Dim eps As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
Dim dirs As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
Dim docsp As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
Dim gests As IEnumerable(Of ObjectStateEntry) = Nothing
|
|
pols = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "polizassg")
|
|
eps = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "entidadespolizas")
|
|
ents = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "entidades")
|
|
dirs = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "direcciones")
|
|
docsp = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "documentospolizassg")
|
|
gests = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "gestionespolizassg")
|
|
|
|
Try
|
|
Dim polsn = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Where(Function(x) x.EntitySet.Name.ToLower = "polizassg")
|
|
Dim docsn = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Where(Function(x) x.EntitySet.Name.ToLower = "documentospolizassg")
|
|
For Each m In pols
|
|
Dim ra = DirectCast(m.Entity, polizassg)
|
|
ra.Matricula = Regex.Replace(ra.Matricula.NothingAVacio, "[^a-zA-Z0-9]", "").ToUpper
|
|
Next
|
|
Catch ex As Exception
|
|
Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En GuardandoCambios Nueva Póliza", ex.Message, ex)
|
|
End Try
|
|
|
|
Try
|
|
|
|
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
|
|
Dim su = If(bd.Aplicacion IsNot Nothing, bd.Aplicacion.ModoSuperUsuario, False)
|
|
For Each m In pols
|
|
Dim ra = DirectCast(m.Entity, polizassg)
|
|
ra.Matricula = Regex.Replace(ra.Matricula.NothingAVacio, "[^a-zA-Z0-9]", "").ToUpper
|
|
Dim reant = bdtmp.polizassg.First(Function(x) x.idPoliza = ra.idPoliza)
|
|
Dim lr = bdGestionAsegasa.logs.GeneraLog(bdtmp, "POLIZASSG", reant.idPoliza, Nothing, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant), su, Aplicacion)
|
|
Dim lep = reant.entidadespolizas.ToList
|
|
bdGestionAsegasa.logs.GeneraLog(bdtmp, "ENTIDADESPOLIZAS", reant.idPoliza, lr, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(lep), su, Aplicacion)
|
|
For Each ent In lep
|
|
Dim lrent = bdGestionAsegasa.logs.GeneraLog(bdtmp, "ENTIDADES", ent.idEntidad, lr, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(ent.entidades), su, Aplicacion)
|
|
If ent.entidades.direcciones1 IsNot Nothing Then bdGestionAsegasa.logs.GeneraLog(bdtmp, "DIRECCIONES", ent.entidades.direcciones1.idDireccion, lrent, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(ent.entidades.direcciones1), su, Aplicacion)
|
|
Next
|
|
Dim docs = reant.documentospolizassg.ToList
|
|
bdGestionAsegasa.logs.GeneraLog(bdtmp, "DOCUMENTOSPOLIZASSG", reant.idPoliza, lr, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(docs), su, Aplicacion)
|
|
Dim ges = reant.gestionespolizassg.ToList
|
|
bdGestionAsegasa.logs.GeneraLog(bdtmp, "GESTIONESPOLIZASSG", reant.idPoliza, lr, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(ges), su, Aplicacion)
|
|
Next
|
|
Catch ex As Exception
|
|
Dim sListaCambios As String = ""
|
|
If pols IsNot Nothing Then
|
|
For Each m In pols
|
|
Dim ra = DirectCast(m.Entity, polizassg)
|
|
sListaCambios &= "polizassg idPoliza:" & ra.idPoliza & "; "
|
|
Next
|
|
End If
|
|
sListaCambios = sListaCambios.Trim.TrimEnd(";") & vbCrLf
|
|
If ents IsNot Nothing Then
|
|
For Each m In ents
|
|
Dim ra = DirectCast(m.Entity, entidades)
|
|
sListaCambios &= "entidades idEntidad:" & ra.idEntidad & "; "
|
|
Next
|
|
End If
|
|
sListaCambios = sListaCambios.Trim.TrimEnd(";") & vbCrLf
|
|
If eps IsNot Nothing Then
|
|
For Each m In eps
|
|
Dim ra = DirectCast(m.Entity, entidadespolizas)
|
|
sListaCambios &= "entidadespoliza idEntidadPoliza:" & ra.idEntidadPoliza & "; "
|
|
Next
|
|
End If
|
|
sListaCambios = sListaCambios.Trim.TrimEnd(";") & vbCrLf
|
|
If dirs IsNot Nothing Then
|
|
For Each m In dirs
|
|
Dim ra = DirectCast(m.Entity, direcciones)
|
|
sListaCambios &= "direcciones idDireccion:" & ra.idDireccion & "; "
|
|
Next
|
|
End If
|
|
If docsp IsNot Nothing Then
|
|
For Each m In docsp
|
|
Dim ra = DirectCast(m.Entity, documentospolizassg)
|
|
sListaCambios &= "documentos idDocumento:" & ra.idDocumento & "; "
|
|
Next
|
|
End If
|
|
If gests IsNot Nothing Then
|
|
For Each m In gests
|
|
Dim ra = DirectCast(m.Entity, gestionespolizassg)
|
|
sListaCambios &= "direcciones idGestionPoliza:" & ra.idGestionPoliza & "; "
|
|
Next
|
|
End If
|
|
Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En GuardandoCambios", ex.Message & vbCrLf & sListaCambios, ex)
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
#Region "Conversiones"
|
|
Public Function AListadoPropuestas() As ListadoPropuestasRealizadas
|
|
Return New ListadoPropuestasRealizadas(Me)
|
|
End Function
|
|
Public Function AListadoGenerico() As ListadoGenerico
|
|
Return New ListadoGenerico(Me)
|
|
End Function
|
|
#End Region
|
|
|
|
#Region "CreacionRecibos"
|
|
|
|
Public Sub GeneraReciboPolizaColectivo(bd As bdGestionAsegasa.gestionasegasaEntities, PolizaColectivo As String)
|
|
If Not Me.recibos.Any(Function(x) x.FechaVencimiento >= Today) Then
|
|
If Me.FechaAceptacionPresupuesto.HasValue = False Then Throw New Exception("La póliza no está aceptada")
|
|
'If Me.recibos.Any(Function(x) x.FechaVencimiento >= Today) Then Throw New Exception("La póliza tiene recibos en vigor")
|
|
Dim pc = bd.enumeraciones.First(Function(x) x.Codigo = PolizaColectivo)
|
|
Dim PrimaNeta = pc.ValorNumerico1.Value
|
|
Dim PorcentajeImpuestos = pc.ValorNumerico2.Value
|
|
Dim Impuestos = Math.Round(PrimaNeta * PorcentajeImpuestos / 100, 2)
|
|
Me.GeneraReciboPolizaColectivo(bd, PrimaNeta, Impuestos, 0)
|
|
End If
|
|
End Sub
|
|
Public Sub GeneraReciboPolizaColectivo(bd As bdGestionAsegasa.gestionasegasaEntities, PrimaNeta As Double, Impuestos As Double, Consorcio As Double)
|
|
Dim nr As New recibos
|
|
'nr.polizassg = Me
|
|
Dim ur = Me.recibos.OrderByDescending(Function(X) X.FechaVencimiento).FirstOrDefault
|
|
' Dim FechaEfecto As Date = If(ur Is Nothing, Me.FechaEfecto, ur.FechaVencimiento.AddDays(1))
|
|
Dim sr As Integer = (If(ur Is Nothing, 1, CInt(ur.NumeroRecibo.Split("-")(2)) + 1))
|
|
nr.NumeroRecibo = Me.NumeroPoliza & "-" & sr.ToString
|
|
nr.CodigoRecibo = Me.companias.Codigo & "/" & nr.NumeroRecibo
|
|
nr.PrimaNeta = PrimaNeta
|
|
nr.BonificacionORecargo = 0
|
|
nr.Consorcio = Consorcio
|
|
nr.Impuesto = Impuestos
|
|
nr.RecargoExterno = 0
|
|
nr.TotalRecibo = 0
|
|
nr.ComisionReciboPrimaNeta = 0
|
|
nr.PorcentajeReciboPrimaNeta = 0
|
|
nr.TotalComision = 0
|
|
nr.PorcentajeComisionAgente = 0
|
|
nr.ComisionAgente = 0
|
|
nr.ComisionAsegasaPrimaNeta = 0
|
|
nr.AsegasaRecargoExterno = 0
|
|
nr.AsegasaComisionConsorcio = 0
|
|
nr.AsegasaComisionTotal = 0
|
|
nr.FechaEfecto = If(ur Is Nothing, Me.FechaEfecto, ur.FechaVencimiento.AddDays(1))
|
|
nr.FechaVencimiento = nr.FechaEfecto.AddYears(1).AddDays(-1)
|
|
nr.FechaExpedicion = Today
|
|
nr.FechaRecepcionCia = Today
|
|
nr.idDuracion = bd.enumeraciones.First(Function(x) x.Codigo = "DUR.A").idEnumeracion
|
|
nr.idPoliza = Me.idPoliza
|
|
nr.idAgente = Me.idAgente
|
|
nr.idSubagente = Me.idSubAgente
|
|
nr.IBAN = Me.IBAN
|
|
nr.idTipoPago = Me.idTipoPago
|
|
nr.idTipo = If(ur Is Nothing, bd.enumeraciones.First(Function(x) x.Codigo = "TRC.E").idEnumeracion, bd.enumeraciones.First(Function(x) x.Codigo = "TRC.C").idEnumeracion)
|
|
nr.polizassg = Me
|
|
If nr.polizassg.FechaReciboCompania.HasValue = False Then nr.polizassg.FechaReciboCompania = Now
|
|
bdGestionAsegasa.recibos.RecalculaDatosEconomicos(bd, nr, True)
|
|
bd.SaveChanges()
|
|
End Sub
|
|
|
|
'Public Shared Sub ObtieneDocumentosPolizas(bd As bdGestionAsegasa.gestionasegasaEntities, Cia As String)
|
|
' Dim idCia = bd.companias.First(Function(X) X.idCompania = Cia).idCompania
|
|
' Dim idTS = bd.enumeraciones.First(Function(X) X.Codigo = "TGP.SOLDOCFIS").idEnumeracion
|
|
' Dim idDP = bd.enumeraciones.First(Function(X) X.Codigo = "TIPFIC.DOCPOL").idEnumeracion
|
|
' Dim pols = bd.polizassg.Where(Function(x) x.FechaBaja Is Nothing AndAlso x.idCompania = idCia AndAlso x.gestionespolizassg.Any(Function(y) y.idTipo = idTS) = False).Take(10)
|
|
' For Each p In pols
|
|
' Dim tg As New bdGestionAsegasa.gestionespolizassg
|
|
' With tg
|
|
' .idPoliza = p.idPoliza
|
|
' .idTipo = idTS
|
|
' .GestionesRealizadas = "Descarga Documento Físico Póliza"
|
|
' .Fecha = Now
|
|
' .Observaciones = ""
|
|
' End With
|
|
' bd.gestionespolizassg.AddObject(tg)
|
|
' bd.SaveChanges()
|
|
' Try
|
|
' Dim b As Byte() = ObtieneDocumento(p.NumeroPoliza)
|
|
|
|
' Dim dp = New documentospolizassg
|
|
' p.documentospolizassg.Add(dp)
|
|
' dp.Descripcion = "PÓLIZA"
|
|
' dp.idDocumentoASolicitar = Nothing
|
|
' dp.Obligatorio = False
|
|
' dp.Fecha = Date.Now
|
|
' Dim f As New ficheros
|
|
' With f
|
|
' .Descripcion = "Póliza " & p.NumeroPoliza
|
|
' .Fichero = b
|
|
' .Fecha = Now
|
|
' .NombreFichero = p.idPoliza.ToString & ".pdf"
|
|
' .idAplicacion = p.idPoliza
|
|
' .idTipo = idDP
|
|
' End With
|
|
' dp.ficheros = f
|
|
' bd.SaveChanges()
|
|
' Catch ex As Exception
|
|
' Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosPolizas", ex.Message, ex)
|
|
' tg.Observaciones = ex.Message.Acortar(500)
|
|
' tg.ContieneErrores = True
|
|
' bd.SaveChanges()
|
|
' End Try
|
|
' Next
|
|
|
|
|
|
|
|
|
|
|
|
'End Sub
|
|
|
|
|
|
Public Shared Sub ObtieneDocumentosPolizasZurich()
|
|
'Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
|
|
'Dim idCia = bd.companias.First(Function(X) X.Codigo = "0013").idCompania
|
|
'Dim idTS = bd.enumeraciones.First(Function(X) X.Codigo = "TGP.SOLDOCFIS").idEnumeracion
|
|
'Dim idDP = bd.enumeraciones.First(Function(X) X.Codigo = "TIPFIC.DOCPOL").idEnumeracion
|
|
'Dim pols = bd.polizassg.Where(Function(x) x.FechaBaja Is Nothing AndAlso x.idCompania = idCia AndAlso x.gestionespolizassg.Any(Function(y) y.idTipo = idTS) = False).Take(10).ToList
|
|
'' Dim pols = bd.polizassg.Where(Function(x) x.NumeroPoliza = "00099094658").Take(10).ToList
|
|
'For Each p In pols
|
|
' Dim tg As New bdGestionAsegasa.gestionespolizassg
|
|
' With tg
|
|
' .idPoliza = p.idPoliza
|
|
' .idTipo = idTS
|
|
' .GestionesRealizadas = "Descarga Documentos Físicos Póliza"
|
|
' .Fecha = Now
|
|
' .Observaciones = ""
|
|
' End With
|
|
' bd.gestionespolizassg.AddObject(tg)
|
|
' bd.SaveChanges()
|
|
' Try
|
|
' Dim np = p.NumeroPoliza.PadLeft(14, "0")
|
|
' Dim ListaDocs = ObtieneDocumentos.ObtenerListaDocumentos(np)
|
|
' 'aqui Dim ld = ListaDocs.Document.Where(Function(x) x.documentCode IsNot Nothing AndAlso x.documentCode <> "").ToList
|
|
' For Each d In ListaDocs.Document
|
|
' Try
|
|
' Dim b As Byte() = ObtieneDocumentos.ObtenerDocumento(np, d.documentCode)
|
|
' Dim dp = New documentospolizassg
|
|
' p.documentospolizassg.Add(dp)
|
|
' dp.Descripcion = d.documentTypeDesc & " (" & d.typeCode & ")"
|
|
' dp.idDocumentoASolicitar = Nothing
|
|
' dp.Obligatorio = False
|
|
' dp.Fecha = Date.Now
|
|
' Dim f As New ficheros
|
|
' With f
|
|
' .Descripcion = d.documentTypeDesc & p.NumeroPoliza
|
|
' .Fichero = b
|
|
' .Fecha = Now
|
|
' .NombreFichero = p.idPoliza.ToString & ".pdf"
|
|
' .idAplicacion = p.idPoliza
|
|
' .idTipo = idDP
|
|
' End With
|
|
' dp.ficheros = f
|
|
' Catch ex As Exception
|
|
' Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosPolizas", ex.Message, ex)
|
|
' tg.Observaciones = ex.Message.Acortar(500)
|
|
' tg.ContieneErrores = True
|
|
' End Try
|
|
' Next
|
|
' bd.SaveChanges()
|
|
' Catch ex As Exception
|
|
' Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosPolizas", ex.Message, ex)
|
|
' tg.Observaciones = ex.Message.Acortar(500)
|
|
' tg.ContieneErrores = True
|
|
' bd.SaveChanges()
|
|
' End Try
|
|
'Next
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
End Class
|
|
#Region "Exportaciones"
|
|
Public Class ListadoPropuestasRealizadas
|
|
Public Sub New(Poliza As polizassg)
|
|
NumeroPropuesta = Poliza.idPoliza
|
|
FechaPropuesta = Poliza.FechaAlta
|
|
NumeroPolizaSuplemento = Poliza.NumeroPolizaSuplementoLargo
|
|
FechaPoliza = Poliza.FechaReciboCompania
|
|
Compañia = Poliza.companias.Nombre
|
|
Tomador = If(Poliza.Tomador Is Nothing, "* DESCONOCIDO *", Poliza.Tomador.RazonSocial)
|
|
Teléfono = If(Poliza.Tomador Is Nothing, "", Poliza.Tomador.Telefono1.NothingAVacio)
|
|
If Poliza.FechaReciboCompania.HasValue = False Then
|
|
Estado = "PENDIENTE EMITIR CIA."
|
|
Else
|
|
Estado = "EMITIDA"
|
|
End If
|
|
End Sub
|
|
|
|
Property NumeroPropuesta As Integer
|
|
Property FechaPropuesta As Date
|
|
Property NumeroPolizaSuplemento As String
|
|
Property FechaPoliza As Date?
|
|
Property Compañia As String
|
|
Property Ramo As String
|
|
Property Tomador As String
|
|
Property Teléfono As String
|
|
|
|
Property Estado As String
|
|
|
|
End Class
|
|
|
|
|
|
Public Class ListadoGenerico
|
|
Public Sub New(Poliza As polizassg)
|
|
NumeroPropuesta = Poliza.idPoliza
|
|
FechaAlta = Poliza.FechaAlta
|
|
NumeroPóliza = Poliza.NumeroPoliza
|
|
Matrícula = Poliza.Matricula
|
|
Compañía = Poliza.companias.Nombre
|
|
Ramo = Poliza.ramos.CodigoYDescripcion
|
|
BienesAsegurados = Poliza.BienesAsegurados
|
|
TipoCobro = Poliza.TipoCobro
|
|
TipoPago = Poliza.TipoPago
|
|
If Poliza.EntidadPolizaTomador IsNot Nothing Then
|
|
CIFTomador = Poliza.EntidadPolizaTomador.entidades.CIF
|
|
Tomador = Poliza.EntidadPolizaTomador.entidades.RazonSocial
|
|
Teléfono1 = Poliza.EntidadPolizaTomador.Telefono1
|
|
Teléfono2 = Poliza.EntidadPolizaTomador.Telefono2
|
|
Email = Poliza.EntidadPolizaTomador.Email
|
|
End If
|
|
Dim r = Poliza.recibos.Where(Function(x) x.FechaBaja.HasValue = False).OrderByDescending(Function(x) x.FechaEfecto).FirstOrDefault
|
|
If r IsNot Nothing Then
|
|
UltimoRecibo = r.CodigoRecibo
|
|
FechaEfectoUltimoRecibo = r.FechaEfecto
|
|
FechaVencimientoUltimoRecibo = r.FechaVencimiento
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Property NumeroPropuesta As Integer
|
|
Property FechaAlta As Date?
|
|
Property NumeroPóliza As String
|
|
Property Matrícula As String
|
|
Property BienesAsegurados As String
|
|
Property Compañía As String
|
|
Property Ramo As String
|
|
Property TipoCobro As String
|
|
Property TipoPago As String
|
|
Property CIFTomador As String
|
|
Property Tomador As String
|
|
Property Teléfono1 As String
|
|
Property Teléfono2 As String
|
|
Property Email As String
|
|
Property UltimoRecibo As String
|
|
Property FechaEfectoUltimoRecibo As Date?
|
|
Property FechaVencimientoUltimoRecibo As Date?
|
|
|
|
|
|
End Class
|
|
|
|
#End Region
|
|
|