agregado procesos y bd clases

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

52
guia/Extensiones/logs.vb Normal file
View File

@@ -0,0 +1,52 @@

Imports tsl5.Extensiones
Partial Public Class logs
Public Shared Function GeneraLog(bd As gestionasegasaEntities, Tabla As String, id As Integer, idrelacionado As Integer?, Tipo As String, LogXML As String, SuperUsuario As Boolean, Aplicacion As String) As Integer
Try
If bd Is Nothing Then
bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
End If
Dim nl As New logs
With nl
.Tabla = Tabla
.Aplicacion = Aplicacion
.LogXML = LogXML
.id = id
.idRelacionado = idrelacionado
.ip = bd.ip
.FechaHora = tsl5.bbdd.AhoraMysql(bd)
.Tipo = Tipo
If SuperUsuario Then
.Usuario = Utilidades.Usuario & " (SU)"
Else
.Usuario = Utilidades.Usuario
End If
.idTimeStamp = CDbl(Now.Ticks)
End With
bd.logs.AddObject(nl)
bd.GuardarCambios()
Return nl.idLog
Catch ex As Exception
Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En GeneraLog", ex.Message, ex)
Return -1
End Try
End Function
Public ReadOnly Property GeneradoPor As String
Get
If Me.idRelacionado.HasValue Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim lp = bd.logs.FirstOrDefault(Function(x) x.idLog = Me.idRelacionado)
If lp IsNot Nothing Then
Return lp.Aplicacion
Else
Return "DESCONOCIDO"
End If
Else
Return Me.Aplicacion
End If
End Get
End Property
End Class