agregado procesos y bd clases
This commit is contained in:
83
chunk_gc.txt
Normal file
83
chunk_gc.txt
Normal file
@@ -0,0 +1,83 @@
|
||||
Friend Shared Sub GuardandoCambios(bd As bdGestionAsegasa.gestionasegasaEntities, Aplicacion As String)
|
||||
Dim recs As IEnumerable(Of ObjectStateEntry) = Nothing
|
||||
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
|
||||
recs = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "recibos")
|
||||
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 bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
|
||||
Dim su = If(bd.Aplicacion IsNot Nothing, bd.Aplicacion.ModoSuperUsuario, False)
|
||||
For Each m In recs
|
||||
Dim ra = DirectCast(m.Entity, recibos)
|
||||
Dim reant = bdtmp.recibos.First(Function(x) x.idRecibo = ra.idRecibo)
|
||||
Dim lrec = bdGestionAsegasa.logs.GeneraLog(bdtmp, "RECIBOS", reant.idRecibo, Nothing, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant), su, Aplicacion)
|
||||
Dim polant = bdtmp.polizassg.First(Function(x) x.idPoliza = reant.idPoliza)
|
||||
If reant.idRemesa.HasValue Then bdGestionAsegasa.logs.GeneraLog(bdtmp, "REMESAS", reant.idRemesa, lrec, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant.remesas), su, Aplicacion)
|
||||
If reant.asientos IsNot Nothing Then bdGestionAsegasa.logs.GeneraLog(bdtmp, "ASIENTODEVUELTOBANCO", reant.idRecibo, lrec, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant.asientos), su, Aplicacion)
|
||||
If reant.asientos1 IsNot Nothing Then bdGestionAsegasa.logs.GeneraLog(bdtmp, "ASIENTOFACTURACION", reant.idRecibo, lrec, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant.asientos1), su, Aplicacion)
|
||||
Dim lr = bdGestionAsegasa.logs.GeneraLog(bdtmp, "POLIZASSG", reant.idPoliza, lrec, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(polant), su, Aplicacion)
|
||||
|
||||
Dim lep = polant.entidadespolizas.ToList
|
||||
bdGestionAsegasa.logs.GeneraLog(bdtmp, "ENTIDADESPOLIZAS", reant.idPoliza, lrec, "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 ges = reant.gestionesrecibos.ToList
|
||||
bdGestionAsegasa.logs.GeneraLog(bdtmp, "GESTIONESRECIBOS", reant.idRecibo, lrec, "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 dirs
|
||||
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
|
||||
Reference in New Issue
Block a user