diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb
index 80217ec28..417d972e9 100644
--- a/App_Code/ClsCGame.vb
+++ b/App_Code/ClsCGame.vb
@@ -19,6 +19,7 @@ Public Class ClsCGame
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIÓN
Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
Public ReadOnly Property DtResultados() As DataTable
Get
@@ -54,6 +55,7 @@ Public Class ClsCGame
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -71,7 +73,7 @@ Public Class ClsCGame
#Region "Conexiones"
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
diff --git a/App_Code/ClsClaseBase.vb b/App_Code/ClsClaseBase.vb
index 47a302402..a51bde5ba 100644
--- a/App_Code/ClsClaseBase.vb
+++ b/App_Code/ClsClaseBase.vb
@@ -194,6 +194,10 @@ Public Class ClsClaseBase
SqlAdapter.Dispose()
End If
+ If DTSet IsNot Nothing Then
+ DTSet.Dispose()
+ End If
+
GC.SuppressFinalize(Me)
End Sub
diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index 7f1096c37..33c02da87 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -25,6 +25,7 @@ Public Class ClsContabilidad
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
Public Property CvePrePolizaDetalle As Integer
#End Region
@@ -97,6 +98,7 @@ Public Class ClsContabilidad
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
Mensaje = New StringBuilder
SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -115,7 +117,7 @@ Public Class ClsContabilidad
#Region "Conexiones"
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
@@ -1120,7 +1122,11 @@ Public Class ClsContabilidad
If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG
- ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa)
+ Retorno = ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa)
+
+ If Retorno Then
+ Mensaje.Append(String.Format("{1}
", CvePrePoliza, _ContaFolio))
+ End If
Else
If CvePrePoliza <= 0 Then Return False
diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb
index 2efbc2f65..8d0ca08f7 100644
--- a/App_Code/ClsContratos.vb
+++ b/App_Code/ClsContratos.vb
@@ -18,6 +18,7 @@ Public Class ClsContratos
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
#End Region
#Region "Propiedades"
@@ -65,6 +66,7 @@ Public Class ClsContratos
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -85,7 +87,7 @@ Public Class ClsContratos
#Region "Conexiones"
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
diff --git a/App_Code/ClsEdocumentacion.vb b/App_Code/ClsEdocumentacion.vb
index b850d1078..8ca3b451f 100644
--- a/App_Code/ClsEdocumentacion.vb
+++ b/App_Code/ClsEdocumentacion.vb
@@ -19,6 +19,7 @@ Public Class ClsEdocumentacion
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
Private Sub SqlDataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
With SqlAdapter.SelectCommand
@@ -56,6 +57,7 @@ Public Class ClsEdocumentacion
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -69,11 +71,11 @@ Public Class ClsEdocumentacion
End With
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
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
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb
index ffbec5e23..68e9423ba 100644
--- a/App_Code/ClsInventarios.vb
+++ b/App_Code/ClsInventarios.vb
@@ -18,6 +18,7 @@ Public Class ClsInventarios
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
#End Region
@@ -151,6 +152,7 @@ Public Class ClsInventarios
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -169,7 +171,7 @@ Public Class ClsInventarios
#Region "Conexiones"
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb
index 7a8561d47..16d4ca047 100644
--- a/App_Code/ClsProductosServicios.vb
+++ b/App_Code/ClsProductosServicios.vb
@@ -2042,6 +2042,7 @@ Public Class ClsProductosServicios
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ConexionClose()
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb
index 2d5c46f6a..358cc7495 100644
--- a/App_Code/ClsRH.vb
+++ b/App_Code/ClsRH.vb
@@ -50,20 +50,27 @@ Public Class ClsRH
Get
DSResultados = DSet
End Get
- End Property
-
+ End Property
+
#End Region
- Sub New()
- SqlConexion = New SqlConnection
- SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
- SqlAdapter = New SqlDataAdapter("", SqlConexion)
- Try
- SqlConexion.Open()
- ConexionAdd()
- Catch ex As Exception
- OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
- End Try
-
+ Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
+
+ If TransaccionCompartida Is Nothing Then
+ SqlConexion = New SqlConnection
+ SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
+ Try
+ SqlConexion.Open()
+ Catch ex As Exception
+ OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
+ End Try
+ Else
+ SqlConexion = TransaccionCompartida.Connection
+ SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
+ End If
+
+ SqlAdapter = New SqlDataAdapter("", SqlConexion)
+ ConexionAdd()
End Sub
Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
With SqlAdapter.SelectCommand
@@ -73,21 +80,23 @@ Public Class ClsRH
End With
Data = New DataTable
End Sub
- Private CveConexion As Integer = 0
-
+ Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
+
+
#Region "Conexiones"
-
+
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
-
- 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo
-
- Try
- DataAdapter("PA_Sis_RegistrarConexion")
- With SqlAdapter.SelectCommand.Parameters
- .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
- .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
- .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+
+ 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo
+
+ Try
+ DataAdapter("PA_Sis_RegistrarConexion")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
+ .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
+ .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
End With
SqlAdapter.Fill(Data)
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
@@ -95,6 +104,7 @@ Public Class ClsRH
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
+
End If
End Sub
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index efc1d2d3f..109597599 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -22,6 +22,8 @@ Public Class ClsVentas
'Atributos de la clase
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
+ Private CveConexion As Integer = 0
+ Private EsTransaccionCompartida As Boolean = False
#End Region
@@ -75,7 +77,7 @@ Public Class ClsVentas
Public Sub RollBack()
SqlTransacc.Rollback()
End Sub
- Private CveConexion As Integer = 0
+
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
If TransaccionCompartida Is Nothing Then
@@ -89,6 +91,7 @@ Public Class ClsVentas
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
+ EsTransaccionCompartida = True
End If
SqlAdapter = New SqlDataAdapter("", SqlConexion)
ConexionAdd()
@@ -107,7 +110,7 @@ Public Class ClsVentas
#Region "Conexiones"
Private Sub ConexionAdd()
- If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+ If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
@@ -740,11 +743,13 @@ Public Class ClsVentas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
+ .Add("@Cancelada", SqlDbType.SmallInt).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
- Retorno = True
+ Retorno = If(SqlAdapter.SelectCommand.Parameters("@Cancelada").Value.ToString.ToEntero = 1, True, False)
+
Catch ex As Exception
OnError("Ocurrió un error al Guardar el estatus de cancelacion Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb
index 55dc738c9..93fc805d2 100644
--- a/App_Code/Usuario.vb
+++ b/App_Code/Usuario.vb
@@ -247,6 +247,7 @@ Namespace ADSSession
Dim resultado As String = ""
Try
+
Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
request.Timeout = maxTimeMilliseconds
request.Method = "POST"
@@ -263,10 +264,15 @@ Namespace ADSSession
End Using
End Using
- Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
- Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
- resultado = sr.ReadToEnd()
- sr.Close()
+ Using response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
+ Using sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
+
+ resultado = sr.ReadToEnd()
+ sr.Close()
+ End Using
+
+ End Using
+ request = Nothing
Catch ex As Exception
'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}")
End Try