From 071de5481b6953cf8ea0baa9cbb709478ed6b29b Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 18 Apr 2024 20:23:17 -0700 Subject: [PATCH] =?UTF-8?q?--=20unificar=20y=20se=20elimin=C3=B3=20clsmeto?= =?UTF-8?q?dos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsMetodosPagos.vb | 144 ----------------------------------- Sistemas/CatSesiones.aspx.vb | 2 +- asmx/WS_PuntoVenta.asmx | 2 +- 3 files changed, 2 insertions(+), 146 deletions(-) delete mode 100644 App_Code/ClsMetodosPagos.vb diff --git a/App_Code/ClsMetodosPagos.vb b/App_Code/ClsMetodosPagos.vb deleted file mode 100644 index f6bf0b888..000000000 --- a/App_Code/ClsMetodosPagos.vb +++ /dev/null @@ -1,144 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Data.SqlClient -Imports Extensiones - -Public Class ClsMetodosPagos - Implements IDisposable - -#Region "Campos" - - 'SQL - Private SqlConexion As SqlConnection - Private SqlAdapter As SqlDataAdapter - Private SqlCommand As SqlCommand - Private Data As DataTable - - 'Atributos de la clase - Private disposedValue As Boolean = False ' Para detectar llamadas redundantes - 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 - -#End Region - -#Region "Propiedades" - - Public ReadOnly Property DtResultados() As DataTable - Get - DtResultados = Data - End Get - End Property - -#End Region - - Sub New() - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ClsPaginas.UsuarioActualRutaDB - Try - SqlConexion.Open() - Catch ex As Exception - Me.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) - End Try - SqlAdapter = New SqlDataAdapter("", SqlConexion) - 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 = 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 - 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 - CveConexion = 0 - End If - - End Sub - Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlAdapter.SelectCommand - .Parameters.Clear() - .CommandText = pStrSQL - .CommandType = TipoComando - End With - Data = New DataTable - End Sub -#End Region - 'Public Function GetMetodosPago() As Boolean - ' Dim Retorno As Boolean = False - ' Data = New DataTable - ' SqlAdapter = New SqlDataAdapter("PA_MetodosPagosGet", SqlConexion) - ' SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As SqlException - ' OnError("Ocurrió un error al consultar los Métodos de Pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - ' SqlAdapter.Dispose() - ' Return Retorno - 'End Function - -#Region "IDisposable Support" - - - ' IDisposable - Protected Overridable Sub Dispose(disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - ' TODO: dispose managed state (managed objects). - If Not Data Is Nothing Then Data.Dispose() : Data = Nothing - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing - If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing - If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() - If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing - - End If - - ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. - ' TODO: set large fields to null. - End If - Me.disposedValue = True - End Sub - - ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources. - 'Protected Overrides Sub Finalize() - ' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. - ' Dispose(False) - ' MyBase.Finalize() - 'End Sub - - ' 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 -#End Region - -End Class diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index 3211d4219..75c6fbe30 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -464,7 +464,7 @@ Partial Class Sistemas_CatSesiones 'End Sub Private Sub CargaMetodosPago() - Dim ObjMetodoPago As New ClsMetodosPagos() + Dim ObjMetodoPago As New ClsVentas() If ObjMetodoPago.GetMetodosPago() Then Application("GlobalDTMetodosPago") = ObjMetodoPago.DtResultados Else diff --git a/asmx/WS_PuntoVenta.asmx b/asmx/WS_PuntoVenta.asmx index f212cb3a5..26f317894 100644 --- a/asmx/WS_PuntoVenta.asmx +++ b/asmx/WS_PuntoVenta.asmx @@ -816,7 +816,7 @@ Public Class WS_PuntoVenta #Region "MetodosPago" Public Function GetMetodosPagos() As RespuestaWS - Dim objMetodoPago As New ClsMetodosPagos + Dim objMetodoPago As New ClsVentas Dim Respuesta As New RespuestaWS If objMetodoPago.GetMetodosPago() Then