Checkpoint registro de conexiones
This commit is contained in:
@@ -21,7 +21,8 @@ Public Class ClsFISConfiguracion
|
|||||||
'Atributos de la clase
|
'Atributos de la clase
|
||||||
|
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||||
|
'REGISTRAR CONEXIONES ABIERTAS
|
||||||
|
Private CveConexion As Integer = 0
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Propiedades"
|
#Region "Propiedades"
|
||||||
@@ -49,8 +50,52 @@ Public Class ClsFISConfiguracion
|
|||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Me.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
Me.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
ConexionAdd()
|
||||||
|
End Sub
|
||||||
|
#Region "Conexiones"
|
||||||
|
|
||||||
|
Private Sub ConexionAdd()
|
||||||
|
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
Try
|
||||||
|
DataAdapter("PA_Sis_RegistrarConexion")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
||||||
|
.Add("@Modulo", SqlDbType.VarChar).Value = HttpContext.Current.Request.Url.AbsolutePath.ToString
|
||||||
|
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
|
End With
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ConexionClose()
|
||||||
|
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
|
||||||
|
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
|
With SqlAdapter.SelectCommand
|
||||||
|
.Parameters.Clear()
|
||||||
|
.CommandText = StrSQL
|
||||||
|
.CommandType = TipoComando
|
||||||
|
End With
|
||||||
|
Data = New DataTable
|
||||||
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
Public Function GetConfiguracion(CveEmpresa As Integer) As Boolean
|
Public Function GetConfiguracion(CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
@@ -140,6 +185,7 @@ Public Class ClsFISConfiguracion
|
|||||||
' This code added by Visual Basic to correctly implement the disposable pattern.
|
' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||||
Public Sub Dispose() Implements IDisposable.Dispose
|
Public Sub Dispose() Implements IDisposable.Dispose
|
||||||
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
||||||
|
ConexionClose()
|
||||||
Dispose(True)
|
Dispose(True)
|
||||||
GC.SuppressFinalize(Me)
|
GC.SuppressFinalize(Me)
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Public Class ClsFinanzas
|
|||||||
|
|
||||||
'Atributos de la clase
|
'Atributos de la clase
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||||
|
'REGISTRAR CONEXIONES ABIERTAS
|
||||||
|
Private CveConexion As Integer = 0
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
@@ -124,7 +126,7 @@ Public Class ClsFinanzas
|
|||||||
|
|
||||||
SqlCommand = New SqlCommand("", SqlConexion)
|
SqlCommand = New SqlCommand("", SqlConexion)
|
||||||
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
||||||
|
ConexionAdd()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
With SqlAdapter.SelectCommand
|
With SqlAdapter.SelectCommand
|
||||||
@@ -135,6 +137,42 @@ Public Class ClsFinanzas
|
|||||||
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||||
Data = New DataTable
|
Data = New DataTable
|
||||||
End Sub
|
End Sub
|
||||||
|
#Region "Conexiones"
|
||||||
|
|
||||||
|
Private Sub ConexionAdd()
|
||||||
|
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
Try
|
||||||
|
DataAdapter("PA_Sis_RegistrarConexion")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
||||||
|
.Add("@Modulo", SqlDbType.VarChar).Value = HttpContext.Current.Request.Url.AbsolutePath.ToString
|
||||||
|
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
|
End With
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ConexionClose()
|
||||||
|
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
|
||||||
|
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
#End Region
|
||||||
Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
With SqlCommand
|
With SqlCommand
|
||||||
.Parameters.Clear()
|
.Parameters.Clear()
|
||||||
@@ -174,6 +212,7 @@ Public Class ClsFinanzas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Dispose() Implements IDisposable.Dispose
|
Public Sub Dispose() Implements IDisposable.Dispose
|
||||||
|
ConexionClose()
|
||||||
Dispose(True)
|
Dispose(True)
|
||||||
GC.SuppressFinalize(Me)
|
GC.SuppressFinalize(Me)
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ Public Class ClsFlotillas
|
|||||||
'Atributos de la clase
|
'Atributos de la clase
|
||||||
|
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||||
|
'REGISTRAR CONEXIONES ABIERTAS
|
||||||
|
Private CveConexion As Integer = 0
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
@@ -66,7 +68,7 @@ Public Class ClsFlotillas
|
|||||||
|
|
||||||
SqlCommand = New SqlCommand("", SqlConexion)
|
SqlCommand = New SqlCommand("", SqlConexion)
|
||||||
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
||||||
|
ConexionAdd()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
@@ -78,7 +80,42 @@ Public Class ClsFlotillas
|
|||||||
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||||
Data = New DataTable
|
Data = New DataTable
|
||||||
End Sub
|
End Sub
|
||||||
|
#Region "Conexiones"
|
||||||
|
|
||||||
|
Private Sub ConexionAdd()
|
||||||
|
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
Try
|
||||||
|
DataAdapter("PA_Sis_RegistrarConexion")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
||||||
|
.Add("@Modulo", SqlDbType.VarChar).Value = HttpContext.Current.Request.Url.AbsolutePath.ToString
|
||||||
|
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
|
End With
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ConexionClose()
|
||||||
|
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
|
||||||
|
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
#End Region
|
||||||
Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
With SqlCommand
|
With SqlCommand
|
||||||
.Parameters.Clear()
|
.Parameters.Clear()
|
||||||
@@ -725,6 +762,7 @@ Public Class ClsFlotillas
|
|||||||
' This code added by Visual Basic to correctly implement the disposable pattern.
|
' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||||
Public Sub Dispose() Implements IDisposable.Dispose
|
Public Sub Dispose() Implements IDisposable.Dispose
|
||||||
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
||||||
|
ConexionClose()
|
||||||
Dispose(True)
|
Dispose(True)
|
||||||
GC.SuppressFinalize(Me)
|
GC.SuppressFinalize(Me)
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user