751 lines
29 KiB
VB.net
751 lines
29 KiB
VB.net
Imports System.Data.Objects
|
|
Imports tsl5.Extensiones
|
|
|
|
|
|
Partial Public Class siniestros
|
|
|
|
Public Property idPoliza_Nulable As Integer?
|
|
Get
|
|
If Me.idPoliza = 0 Then
|
|
Return Nothing
|
|
Else
|
|
Return Me.idPoliza
|
|
End If
|
|
End Get
|
|
Set(value As Integer?)
|
|
If value.HasValue Then Me.idPoliza = value.Value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
#Region "Contrario"
|
|
Private _CifContrarioTmpEsNulo As Boolean = True
|
|
Private _CifContrarioTmp As String
|
|
Public Property CifContrarioTmp As String
|
|
Get
|
|
If _CifContrarioTmpEsNulo Then
|
|
If Me.entidades Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_CifContrarioTmp = Me.entidades.CIF
|
|
_CifContrarioTmpEsNulo = False
|
|
Return Me.entidades.CIF
|
|
End If
|
|
Else
|
|
Return _CifContrarioTmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing Then
|
|
' If _CifContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CifContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.CIF
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CifContrarioTmp = value
|
|
_CifContrarioTmpEsNulo = False
|
|
|
|
If Me.entidades IsNot Nothing Then
|
|
If value.NothingAVacio = "" Then
|
|
Me.entidades.CIF = Nothing
|
|
Else
|
|
Me.entidades.CIF = value
|
|
End If
|
|
End If
|
|
Me.OnPropertyChanged("CifContrarioTmp")
|
|
Me.OnPropertyChanged("RazonSocialContrarioTmp")
|
|
Me.OnPropertyChanged("CodigoPostalContrarioTmp")
|
|
Me.OnPropertyChanged("DomicilioContrarioTmp")
|
|
Me.OnPropertyChanged("CodigoPoblacionContrarioTmp")
|
|
Me.OnPropertyChanged("PoblacionContrarioTmp")
|
|
Me.OnPropertyChanged("ProvinciaContrarioTmp")
|
|
Me.OnPropertyChanged("TelefonoContrario1Tmp")
|
|
Me.OnPropertyChanged("TelefonoContrario2Tmp")
|
|
Me.OnPropertyChanged("EmailContrarioTmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _RazonSocialContrarioTmpEsNulo As Boolean = True
|
|
Private _RazonSocialContrarioTmp As String
|
|
Public Property RazonSocialContrarioTmp As String
|
|
Get
|
|
If _RazonSocialContrarioTmpEsNulo Then
|
|
If Me.entidades Is Nothing Then
|
|
Return ""
|
|
Else
|
|
Dim rs As String
|
|
If Me.entidades.RazonSocial = "" Then
|
|
rs = (Me.entidades.Apellidos & ", " & Me.entidades.Nombre).Trim.Trim(",")
|
|
Else
|
|
rs = Me.entidades.RazonSocial
|
|
End If
|
|
_RazonSocialContrarioTmpEsNulo = False
|
|
_RazonSocialContrarioTmp = rs
|
|
Return rs
|
|
End If
|
|
Else
|
|
Return _RazonSocialContrarioTmp
|
|
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing Then
|
|
' If _RazonSocialContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _RazonSocialContrarioTmp
|
|
' End If
|
|
'Else
|
|
' If Me.entidades.RazonSocial = "" Then
|
|
' Return (Me.entidades.Apellidos & ", " & Me.entidades.Nombre).Trim.Trim(",")
|
|
' Else
|
|
' Return Me.entidades.RazonSocial
|
|
' End If
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_RazonSocialContrarioTmp = value
|
|
_RazonSocialContrarioTmpEsNulo = False
|
|
|
|
If Me.entidades IsNot Nothing Then
|
|
Me.entidades.RazonSocial = value
|
|
If Me.entidades.CIF.NothingAVacio <> "" AndAlso "1234567890X".Contains(Me.entidades.CIF.Substring(1, 1)) AndAlso value.Contains(",") Then
|
|
Me.entidades.Apellidos = value.Split(",")(0).Trim
|
|
Me.entidades.Nombre = value.Split(",")(1).Trim
|
|
End If
|
|
End If
|
|
Me.OnPropertyChanged("RazonSocialContrarioTmp")
|
|
End Set
|
|
End Property
|
|
Private _CodigoPostalContrarioTmpEsNulo As Boolean = True
|
|
Private _CodigoPostalContrarioTmp As String
|
|
Public Property CodigoPostalContrarioTmp As String
|
|
Get
|
|
If _CodigoPostalContrarioTmpEsNulo Then
|
|
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_CodigoPostalContrarioTmp = Me.entidades.DireccionPrincipal.CodigoPostal
|
|
_CodigoPostalContrarioTmpEsNulo = False
|
|
Return Me.entidades.DireccionPrincipal.CodigoPostal
|
|
End If
|
|
Else
|
|
Return _CodigoPostalContrarioTmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
|
|
' If _CodigoPostalContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CodigoPostalContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.DireccionPrincipal.CodigoPostal
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CodigoPostalContrarioTmp = value
|
|
_CodigoPostalContrarioTmpEsNulo = False
|
|
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades.DireccionPrincipal.CodigoPostal = value
|
|
End If
|
|
Me.OnPropertyChanged("CodigoPostalContrarioTmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _DomicilioContrarioTmpEsNulo As Boolean = True
|
|
Private _DomicilioContrarioTmp As String
|
|
Public Property DomicilioContrarioTmp As String
|
|
Get
|
|
If _DomicilioContrarioTmpEsNulo Then
|
|
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_DomicilioContrarioTmp = Me.entidades.DireccionPrincipal.Direccion
|
|
_DomicilioContrarioTmpEsNulo = False
|
|
Return Me.entidades.DireccionPrincipal.Direccion
|
|
End If
|
|
Else
|
|
Return _DomicilioContrarioTmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
|
|
' If _DomicilioContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _DomicilioContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.DireccionPrincipal.Direccion
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_DomicilioContrarioTmp = value
|
|
_DomicilioContrarioTmpEsNulo = False
|
|
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades.DireccionPrincipal.Direccion = value
|
|
End If
|
|
Me.OnPropertyChanged("DomicilioContrarioTmp")
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private _CodigoPoblacionContrarioTmpEsNulo As Boolean = True
|
|
Private _CodigoPoblacionContrarioTmp As String
|
|
Public Property CodigoPoblacionContrarioTmp As String
|
|
Get
|
|
If _CodigoPoblacionContrarioTmpEsNulo Then
|
|
|
|
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing OrElse Me.entidades.DireccionPrincipal.municipios Is Nothing Then
|
|
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing AndAlso Me.entidades.DireccionPrincipal.municipios Is Nothing Then
|
|
If Me.entidades.DireccionPrincipal.CodigoPostal.NothingAVacio <> "" Then
|
|
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
|
|
Dim pob = bd.codigospostales.First(Function(x) x.CodigoPostal = Me.entidades.DireccionPrincipal.CodigoPostal)
|
|
Me.entidades.DireccionPrincipal.CodigoMunicipio = pob.CodigoMunicipio
|
|
_CodigoPoblacionContrarioTmp = pob.CodigoMunicipio
|
|
_CodigoPoblacionContrarioTmpEsNulo = False
|
|
Return _CodigoPoblacionContrarioTmp
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
_CodigoPoblacionContrarioTmp = Me.entidades.DireccionPrincipal.CodigoMunicipio
|
|
_CodigoPoblacionContrarioTmpEsNulo = False
|
|
Return Me.entidades.DireccionPrincipal.CodigoMunicipio
|
|
End If
|
|
Else
|
|
Return _CodigoPoblacionContrarioTmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing OrElse Me.entidades.DireccionPrincipal.municipios Is Nothing Then
|
|
' If _CodigoPoblacionContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CodigoPoblacionContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.DireccionPrincipal.CodigoMunicipio
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CodigoPoblacionContrarioTmp = value
|
|
_CodigoPoblacionContrarioTmpEsNulo = False
|
|
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades.DireccionPrincipal.CodigoMunicipio = value
|
|
End If
|
|
Me.OnPropertyChanged("CodigoPoblacionContrarioTmp")
|
|
Me.OnPropertyChanged("PoblacionContrarioTmp")
|
|
Me.OnPropertyChanged("ProvinciaContrarioTmp")
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Public ReadOnly Property PoblacionContrarioTmp As String
|
|
Get
|
|
Return municipios.ObtienePoblacion(CodigoPoblacionContrarioTmp)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ProvinciaContrarioTmp As String
|
|
Get
|
|
Return municipios.ObtieneProvincia(CodigoPoblacionContrarioTmp)
|
|
End Get
|
|
End Property
|
|
|
|
|
|
Private _TelefonoContrario1TmpEsNulo As Boolean = True
|
|
Private _TelefonoContrario1Tmp As String
|
|
Public Property TelefonoContrario1Tmp As String
|
|
Get
|
|
If _TelefonoContrario1TmpEsNulo Then
|
|
|
|
If Me.entidades Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_TelefonoContrario1Tmp = Me.entidades.Telefono1
|
|
_TelefonoContrario1TmpEsNulo = False
|
|
Return Me.entidades.Telefono1
|
|
End If
|
|
Else
|
|
Return _TelefonoContrario1Tmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing Then
|
|
' If _TelefonoContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _TelefonoContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.Telefono1
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_TelefonoContrario1Tmp = value
|
|
_TelefonoContrario1TmpEsNulo = False
|
|
|
|
If Me.entidades IsNot Nothing Then
|
|
Me.entidades.Telefono1 = value
|
|
End If
|
|
Me.OnPropertyChanged("TelefonoContrario1Tmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _TelefonoContrario2TmpEsNulo As Boolean = True
|
|
Private _TelefonoContrario2Tmp As String
|
|
Public Property TelefonoContrario2Tmp As String
|
|
Get
|
|
If _TelefonoContrario2TmpEsNulo Then
|
|
|
|
If Me.entidades Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_TelefonoContrario2Tmp = Me.entidades.Telefono2
|
|
_TelefonoContrario2TmpEsNulo = False
|
|
Return Me.entidades.Telefono2
|
|
End If
|
|
Else
|
|
Return _TelefonoContrario2Tmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing Then
|
|
' If _TelefonoContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _TelefonoContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.Telefono1
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_TelefonoContrario2Tmp = value
|
|
_TelefonoContrario2TmpEsNulo = False
|
|
If Me.entidades IsNot Nothing Then
|
|
Me.entidades.Telefono2 = value
|
|
End If
|
|
Me.OnPropertyChanged("TelefonoContrario2Tmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _EmailContrarioTmpEsNulo As Boolean = True
|
|
Private _EmailContrarioTmp As String
|
|
Public Property EmailContrarioTmp As String
|
|
Get
|
|
If _EmailContrarioTmpEsNulo Then
|
|
If Me.entidades Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_EmailContrarioTmp = Me.entidades.Email
|
|
_EmailContrarioTmpEsNulo = False
|
|
Return Me.entidades.Email
|
|
End If
|
|
Else
|
|
Return _EmailContrarioTmp
|
|
End If
|
|
|
|
'If Me.entidades Is Nothing Then
|
|
' If _EmailContrarioTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _EmailContrarioTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades.Email
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_EmailContrarioTmp = value
|
|
_EmailContrarioTmpEsNulo = False
|
|
If Me.entidades IsNot Nothing Then
|
|
Me.entidades.Email = value
|
|
End If
|
|
Me.OnPropertyChanged("EmailContrarioTmp")
|
|
End Set
|
|
End Property
|
|
Public Sub ReiniciaValoresTMPContrario()
|
|
_CifContrarioTmpEsNulo = True
|
|
_RazonSocialContrarioTmpEsNulo = True
|
|
_CodigoPoblacionContrarioTmpEsNulo = True
|
|
_CodigoPostalContrarioTmpEsNulo = True
|
|
_DomicilioContrarioTmpEsNulo = True
|
|
_TelefonoContrario1TmpEsNulo = True
|
|
_TelefonoContrario2TmpEsNulo = True
|
|
_EmailContrarioTmpEsNulo = True
|
|
End Sub
|
|
#End Region
|
|
#Region "Taller"
|
|
Private _CifTallerTmpEsNulo As Boolean = True
|
|
Private _CifTallerTmp As String
|
|
Public Property CifTallerTmp As String
|
|
Get
|
|
If _CifTallerTmpEsNulo Then
|
|
If Me.entidades1 Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_CifTallerTmp = Me.entidades1.CIF
|
|
_CifTallerTmpEsNulo = False
|
|
Return Me.entidades1.CIF
|
|
End If
|
|
Else
|
|
Return _CifTallerTmp
|
|
End If
|
|
'If Me.entidades1 Is Nothing Then
|
|
' If _CifTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CifTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.CIF
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CifTallerTmp = value
|
|
_CifTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing Then
|
|
If value.NothingAVacio = "" Then
|
|
Me.entidades1.CIF = Nothing
|
|
Else
|
|
Me.entidades1.CIF = value
|
|
End If
|
|
End If
|
|
Me.OnPropertyChanged("CifTallerTmp")
|
|
Me.OnPropertyChanged("RazonSocialTallerTmp")
|
|
Me.OnPropertyChanged("CodigoPostalTallerTmp")
|
|
Me.OnPropertyChanged("DomicilioTallerTmp")
|
|
Me.OnPropertyChanged("CodigoPoblacionTallerTmp")
|
|
Me.OnPropertyChanged("PoblacionTallerTmp")
|
|
Me.OnPropertyChanged("ProvinciaTallerTmp")
|
|
Me.OnPropertyChanged("TelefonoTallerTmp")
|
|
Me.OnPropertyChanged("EmailTallerTmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _RazonSocialTallerTmpEsNulo As Boolean = True
|
|
Private _RazonSocialTallerTmp As String
|
|
Public Property RazonSocialTallerTmp As String
|
|
Get
|
|
If _RazonSocialTallerTmpEsNulo Then
|
|
If Me.entidades1 IsNot Nothing Then
|
|
Dim rs As String
|
|
If Me.entidades1.RazonSocial.NothingAVacio = "" Then
|
|
rs = (Me.entidades1.Apellidos & ", " & Me.entidades1.Nombre).Trim.Trim(",")
|
|
Else
|
|
rs = Me.entidades1.RazonSocial
|
|
End If
|
|
_RazonSocialTallerTmpEsNulo = False
|
|
_RazonSocialTallerTmp = rs
|
|
Return rs
|
|
Else
|
|
Return ""
|
|
End If
|
|
|
|
Else
|
|
Return _RazonSocialTallerTmp
|
|
End If
|
|
'If Me.entidades1 Is Nothing Then
|
|
' If _RazonSocialTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _RazonSocialTallerTmp
|
|
' End If
|
|
'Else
|
|
' If Me.entidades1.RazonSocial = "" Then
|
|
' Return (Me.entidades1.Apellidos & ", " & Me.entidades1.Nombre).Trim.Trim(",")
|
|
' Else
|
|
' Return Me.entidades1.RazonSocial
|
|
' End If
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_RazonSocialTallerTmp = value
|
|
_RazonSocialTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing Then
|
|
Me.entidades1.RazonSocial = value
|
|
If Me.entidades1.CIF.NothingAVacio <> "" AndAlso "1234567890X".Contains(Me.entidades1.CIF.Substring(1, 1)) AndAlso value.Contains(",") Then
|
|
Me.entidades1.Apellidos = value.Split(",")(0).Trim
|
|
Me.entidades1.Nombre = value.Split(",")(1).Trim
|
|
End If
|
|
End If
|
|
Me.OnPropertyChanged("RazonSocialTallerTmp")
|
|
End Set
|
|
End Property
|
|
Private _CodigoPostalTallerTmpEsNulo As Boolean = True
|
|
Public _CodigoPostalTallerTmp As String
|
|
Public Property CodigoPostalTallerTmp As String
|
|
Get
|
|
If _CodigoPostalTallerTmpEsNulo Then
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
|
|
_CodigoPostalTallerTmp = Me.entidades1.DireccionPrincipal.CodigoPostal
|
|
_CodigoPostalTallerTmpEsNulo = False
|
|
Return Me.entidades1.DireccionPrincipal.CodigoPostal
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
Return _CodigoPostalTallerTmp
|
|
End If
|
|
'If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing Then
|
|
' If _CodigoPostalTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CodigoPostalTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.DireccionPrincipal.CodigoPostal
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CodigoPostalTallerTmp = value
|
|
_CodigoPostalTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades1.DireccionPrincipal.CodigoPostal = value
|
|
End If
|
|
Me.OnPropertyChanged("CodigoPostalTallerTmp")
|
|
End Set
|
|
End Property
|
|
|
|
Private _DomicilioTallerTmpEsNulo As Boolean = True
|
|
Private _DomicilioTallerTmp As String
|
|
Public Property DomicilioTallerTmp As String
|
|
Get
|
|
If _DomicilioTallerTmpEsNulo Then
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
|
|
_DomicilioTallerTmp = Me.entidades1.DireccionPrincipal.Direccion.NothingAVacio
|
|
_DomicilioTallerTmpEsNulo = False
|
|
Return Me.entidades1.DireccionPrincipal.Direccion
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
Return _DomicilioTallerTmp
|
|
End If
|
|
'If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing Then
|
|
' If _DomicilioTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _DomicilioTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.DireccionPrincipal.Direccion
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_DomicilioTallerTmp = value
|
|
_DomicilioTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades1.DireccionPrincipal.Direccion = value
|
|
End If
|
|
Me.OnPropertyChanged("DomicilioTallerTmp")
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private _CodigoPoblacionTallerTmpEsNulo As Boolean = True
|
|
Private _CodigoPoblacionTallerTmp As String
|
|
Public Property CodigoPoblacionTallerTmp As String
|
|
Get
|
|
If _CodigoPoblacionTallerTmpEsNulo Then
|
|
'If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal.municipios IsNot Nothing Then
|
|
' _CodigoPoblacionTallerTmp = Me.entidades1.DireccionPrincipal.CodigoMunicipio
|
|
' _CodigoPoblacionTallerTmpEsNulo = False
|
|
' Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
|
|
'Else
|
|
' Return ""
|
|
'End If
|
|
If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing OrElse Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
|
|
If Me.entidades1.DireccionPrincipal.CodigoPostal.NothingAVacio <> "" Then
|
|
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
|
|
Dim pob = bd.codigospostales.First(Function(x) x.CodigoPostal = Me.entidades1.DireccionPrincipal.CodigoPostal)
|
|
Me.entidades1.DireccionPrincipal.CodigoMunicipio = pob.CodigoMunicipio
|
|
_CodigoPoblacionTallerTmp = pob.CodigoMunicipio
|
|
_CodigoPoblacionTallerTmpEsNulo = False
|
|
Return _CodigoPoblacionTallerTmp
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
Return ""
|
|
End If
|
|
|
|
Else
|
|
_CodigoPoblacionTallerTmp = Me.entidades1.DireccionPrincipal.CodigoMunicipio
|
|
_CodigoPoblacionTallerTmpEsNulo = False
|
|
Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
|
|
End If
|
|
Else
|
|
Return _CodigoPoblacionTallerTmp
|
|
End If
|
|
|
|
|
|
' If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing OrElse Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
|
|
' If _CodigoPoblacionTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _CodigoPoblacionTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_CodigoPoblacionTallerTmp = value
|
|
_CodigoPoblacionTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
|
|
Me.entidades1.DireccionPrincipal.CodigoMunicipio = value
|
|
End If
|
|
Me.OnPropertyChanged("CodigoPoblacionTallerTmp")
|
|
Me.OnPropertyChanged("PoblacionTallerTmp")
|
|
Me.OnPropertyChanged("ProvinciaTallerTmp")
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Public ReadOnly Property PoblacionTallerTmp As String
|
|
Get
|
|
Return municipios.ObtienePoblacion(CodigoPoblacionTallerTmp)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ProvinciaTallerTmp As String
|
|
Get
|
|
Return municipios.ObtieneProvincia(CodigoPoblacionTallerTmp)
|
|
End Get
|
|
End Property
|
|
|
|
Private _TelefonoTallerTmpEsNulo As Boolean = True
|
|
Private _TelefonoTallerTmp As String
|
|
Public Property TelefonoTallerTmp As String
|
|
Get
|
|
If _TelefonoTallerTmpEsNulo Then
|
|
If Me.entidades1 IsNot Nothing Then
|
|
_TelefonoTallerTmp = Me.entidades1.Telefono1
|
|
_TelefonoTallerTmpEsNulo = False
|
|
Return Me.entidades1.Telefono1
|
|
Else
|
|
Return ""
|
|
End If
|
|
Else
|
|
Return _TelefonoTallerTmp
|
|
End If
|
|
|
|
'If Me.entidades1 Is Nothing Then
|
|
' If _TelefonoTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _TelefonoTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.Telefono1
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_TelefonoTallerTmp = value
|
|
_TelefonoTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing Then
|
|
Me.entidades1.Telefono1 = value
|
|
End If
|
|
Me.OnPropertyChanged("TelefonoTallerTmp")
|
|
End Set
|
|
End Property
|
|
Private _EmailTallerTmpEsNulo As Boolean = True
|
|
Private _EmailTallerTmp As String
|
|
|
|
|
|
Public Property EmailTallerTmp As String
|
|
Get
|
|
If _EmailTallerTmpEsNulo Then
|
|
If Me.entidades1 Is Nothing Then
|
|
Return ""
|
|
Else
|
|
_EmailTallerTmp = Me.entidades1.Email
|
|
_EmailTallerTmpEsNulo = False
|
|
Return Me.entidades1.Email
|
|
End If
|
|
Else
|
|
Return _EmailTallerTmp
|
|
End If
|
|
|
|
|
|
|
|
'If Me.entidades1 Is Nothing Then
|
|
' If _EmailTallerTmpEsNulo Then
|
|
' Return ""
|
|
' Else
|
|
' Return _EmailTallerTmp
|
|
' End If
|
|
'Else
|
|
' Return Me.entidades1.Email
|
|
'End If
|
|
End Get
|
|
Set(value As String)
|
|
_EmailTallerTmp = value
|
|
_EmailTallerTmpEsNulo = False
|
|
If Me.entidades1 IsNot Nothing Then
|
|
Me.entidades1.Email = value
|
|
End If
|
|
Me.OnPropertyChanged("EmailTallerTmp")
|
|
End Set
|
|
End Property
|
|
Public Sub ReiniciaValoresTMPTaller()
|
|
_CifTallerTmpEsNulo = True
|
|
_RazonSocialTallerTmpEsNulo = True
|
|
_CodigoPoblacionTallerTmpEsNulo = True
|
|
_CodigoPostalTallerTmpEsNulo = True
|
|
_DomicilioTallerTmpEsNulo = True
|
|
_TelefonoTallerTmpEsNulo = True
|
|
_EmailTallerTmpEsNulo = True
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Friend Shared Sub GuardandoCambios(bd As bdGestionAsegasa.gestionasegasaEntities)
|
|
Dim gestioness = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Where(Function(x) x.EntitySet.Name.ToLower = "gestionessiniestros")
|
|
AsignaidUsuarioCreadorGestionesSiniestros(bd, gestioness)
|
|
gestioness = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "gestionessiniestros")
|
|
AsignaidUsuarioModificadorGestionesSiniestros(bd, gestioness)
|
|
End Sub
|
|
|
|
Private Shared Sub AsignaidUsuarioCreadorGestionesSiniestros(bd As bdGestionAsegasa.gestionasegasaEntities, ms As IEnumerable(Of ObjectStateEntry))
|
|
Try
|
|
If ms.Count > 0 And Utilidades.dsc.idUsuario > 0 Then
|
|
Dim Ahora = tsl5.bbdd.AhoraMysql(bd)
|
|
For Each m In ms
|
|
Dim r = DirectCast(m.Entity, gestionessiniestros)
|
|
r.idUsuarioCreador = Utilidades.dsc.idUsuario
|
|
r.idUsuarioModificador = Utilidades.dsc.idUsuario
|
|
r.FechaModificacion = Ahora
|
|
Next
|
|
End If
|
|
Catch ex As Exception
|
|
Throw
|
|
End Try
|
|
End Sub
|
|
Private Shared Sub AsignaidUsuarioModificadorGestionesSiniestros(bd As bdGestionAsegasa.gestionasegasaEntities, ms As IEnumerable(Of ObjectStateEntry))
|
|
Try
|
|
If ms.Count > 0 And Utilidades.dsc.idUsuario > 0 Then
|
|
Dim Ahora = tsl5.bbdd.AhoraMysql(bd)
|
|
For Each m In ms
|
|
Dim r = DirectCast(m.Entity, gestionessiniestros)
|
|
r.idUsuarioModificador = Utilidades.dsc.idUsuario
|
|
r.FechaModificacion = Ahora
|
|
Next
|
|
End If
|
|
Catch ex As Exception
|
|
Throw
|
|
End Try
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
|