From 9d4372c564e5cab362a740a65a2c3ae79b5a882d Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 26 May 2020 12:50:43 -0700 Subject: [PATCH 01/19] Correcion en servicio de facturacion masiva --- Ashx/SIGFacturacion.ashx | 70 ++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 461d85c62..fa0c9409b 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -1657,44 +1657,38 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTProyectos") = value End Set End Property - 'Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - ' Get - - ' If DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - ' Dim P As New ClsSubProyectos - ' If P.GetSubProyectos Then - ' HttpContext.Current.Application("GlobalDTSubProyectos") = P.DtResultados - ' End If - ' P.Dispose() - - ' Dim msg As String = "aqui no se carga subproyectos" - - ' End If - - ' If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - ' Dim StrSQL As New StringBuilder - ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - ' If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - ' If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - ' If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - ' GlobalDTSubProyectos = Dv.ToTable - ' Dv.Dispose() - - ' Else - ' GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) - ' End If - - ' End Get - ' Set(ByVal value As DataTable) - ' If value Is Nothing OrElse value.Rows.Count = 0 Then - ' Dim msg As String = "aqui no se carga subproyectos" - - ' End If - ' HttpContext.Current.Application("GlobalDTSubProyectos") = value - ' End Set - 'End Property + Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim P As New ClsSubProyectos + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = P.DtResultados + P.Dispose() + + End If + + If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + Dim StrSQL As New StringBuilder + If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + GlobalDTSubProyectos = Dv.ToTable + Dv.Dispose() + + Else + GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + + End Get + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + End Set + End Property Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable Get From d203d219e5fe663114c6093cc7066021a9993eee Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 26 May 2020 12:52:31 -0700 Subject: [PATCH 02/19] Bitacora de refacturacion --- App_Code/Modelos.vb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index ec360eed3..c3c7db3ce 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4260,8 +4260,14 @@ Namespace Modelos 'BITACORA, SOLICITUD DE CANCELACION If CveEstatus > 0 AndAlso CveEstatusFacturaAsignado <= 0 Then + + Dim msgBitacora As String = "Solicitud de cancelación de factura" + If EsRefacturacion Then + msgBitacora = "Solicitud de cancelación por refacturación" + End If + Dim ObjE As New ClsOIEventos() - ObjE.AddEventoBitacora("Solicitud de cancelación de factura", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) + ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) ObjE.Dispose() End If From b8d4cd1fbf2bb381b78b4e13551a3b9cd263a8ee Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 26 May 2020 15:00:02 -0700 Subject: [PATCH 03/19] -parametro subproyecto en concepto 51 --- Inventarios/EntradasSalidas.aspx.vb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index a0b2632f5..b9dec00ba 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -3711,7 +3711,10 @@ Partial Class Inventarios_EntradasSalidas Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUM("Total", "").ToDecimal.RoundSQL() ValorSalida = tValorInventario Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", DdlAlmacenInventarioFisico.SelectedValue)) - If drA2 IsNot Nothing Then idCtaContableSalida = drA2("IdCtaContable").ToString.ToEntero + If drA2 IsNot Nothing Then + idCtaContableSalida = drA2("IdCtaContable").ToString.ToEntero + tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero + End If Else ErrorMovInv = True Mensaje = "Ocurrió un error al validar los movimientos contables de salida" From 24a2e1d9f4409ead715a99acbe80b0d31e9da460 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 27 May 2020 12:28:30 -0700 Subject: [PATCH 04/19] considerando refacturaciones al relacionar ventas --- Ventas/Ventas.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b775018f3..985191e66 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9473,7 +9473,7 @@ Partial Class Ventas Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else - If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then + If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then If DtVentasNC IsNot Nothing Then For Each row As DataRow In DtVentasNC.Rows If Not row("CveVenta").ToString().ToEntero() = -1 Then From 9288e4ce8e551bcea143d0487c268e15d46cec27 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:46:55 -0700 Subject: [PATCH 05/19] -- transaccion compartida --- App_Code/ClsCGame.vb | 4 +- App_Code/ClsClaseBase.vb | 4 ++ App_Code/ClsContabilidad.vb | 10 ++++- App_Code/ClsContratos.vb | 4 +- App_Code/ClsEdocumentacion.vb | 8 ++-- App_Code/ClsInventarios.vb | 4 +- App_Code/ClsProductosServicios.vb | 1 + App_Code/ClsRH.vb | 62 ++++++++++++++++++------------- App_Code/ClsVentas.vb | 11 ++++-- App_Code/Usuario.vb | 14 +++++-- 10 files changed, 81 insertions(+), 41 deletions(-) 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 From 0324c2fb85632326c586e960bae8619d6ccf9f22 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:50:22 -0700 Subject: [PATCH 06/19] -- cambios stringbuilder, performance --- App_Code/ClsSisNotificaciones.vb | 6 +++- Ashx/SIGWeb.ashx | 48 ++++++++++++++++++++++---------- Inicio.aspx.vb | 4 ++- Site.master.vb | 17 +++++++---- asmx/WsTSoft.asmx | 44 ++++++++++++++++++----------- 5 files changed, 81 insertions(+), 38 deletions(-) diff --git a/App_Code/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index c914aa79e..79b05c132 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -2041,12 +2041,16 @@ Public Class ClsSisNotificaciones Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index ff6662eda..832d3c44e 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -96,7 +96,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Retorno = 200 End If ObjConta.Dispose() - + Empresa = Nothing 'context.Response.Write(CveUsuario.ToString()) context.Response.StatusCode = Retorno End Sub @@ -114,7 +114,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.WriteFile(FileInfo.FullName) context.Response.End() End If - + FileInfo = Nothing + Url = "" End If End Sub @@ -127,6 +128,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState savepath = context.Server.MapPath(tempPath) Dim nombre As String = String.Format("{0}\{1}", savepath, context.Request("nombre")) File.Delete(nombre) + tempPath = "" + savepath = "" context.Response.StatusCode = 200 End Sub @@ -149,16 +152,18 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If copyFile <> "" Then Dim ext As Integer = copyFile.IndexOf(","c) + 1 - Dim extncion As String = copyFile.Substring(5, ext - 5) - If extncion.Contains("image/") Then extncion = extncion.Replace("image/", "").Replace(";base64,", "") + Dim extension As String = copyFile.Substring(5, ext - 5) + If extension.Contains("image/") Then extension = extension.Replace("image/", "").Replace(";base64,", "") 'Dim extncion As String = - filename = String.Format("{0}-{1}.{2}", tick, Cve, extncion) + filename = String.Format("{0}-{1}.{2}", tick, Cve, extension) Dim msf As New MemoryStream(Convert.FromBase64String(copyFile.Substring(ext))) Dim stem As Stream = New FileStream(String.Format("{0}\{1}", savepath, filename), FileMode.Create) msf.WriteTo(stem) msf.Close() stem.Close() + msf.Dispose() + stem.Dispose() End If Else @@ -166,10 +171,13 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState postedFile = context.Request.Files(0) filename = String.Format("{0}-{1}", tick, postedFile.FileName) - postedFile.SaveAs((savepath & "\") + filename) + postedFile.SaveAs(String.Format("{0}\{1}", savepath, filename)) End If context.Response.Write(tick) context.Response.StatusCode = 200 + savepath = "" + tempPath = "" : filename = "" + postedFile = Nothing End Sub #End Region @@ -206,9 +214,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'End If 'ObjClientes.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"NombreComercial like '%{Name}%' OR Nombre like '%{Name}%' ") + DtRetorno = dt.FiltraParametros(String.Format("NombreComercial like '%{0}%' OR Nombre like '%{0}%' ", Name)) End If dt.Dispose() End If @@ -254,9 +262,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ' DtRetorno = ObjProveedores.DtResultados 'End If 'ObjProveedores.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"NombreCortoProveedor like '%{Name}%'") + DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name)) End If dt.Dispose() End If @@ -321,6 +329,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Else context.Response.Write("[]") End If + DtPSRetorno.Dispose() Return retorno End Function @@ -485,9 +494,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If usuario.TienePermisoProceso(300) And usuario.TienePermisoProceso(301) Then DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados - ElseIf usuario.TienePermisoProceso(300) Then 'TipoComprobacion 1 Biaticos + ElseIf usuario.TienePermisoProceso(300) Then 'TipoComprobacion 1 Viaticos DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados.FiltraParametros("TipoComprobacion = 1") - Else 'TipoComprobacion 2 Compreobacines + Else 'TipoComprobacion 2 caja chica DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados.FiltraParametros("TipoComprobacion = 2") End If @@ -515,6 +524,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'no regresar datos herror al consultar DtPSRetorno.Clear() End If + DTTmp.Dispose() + ObjClasificaciones.Dispose() End If @@ -556,7 +567,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState #Region "Funciones" Public Function GetJson(ByVal dt As DataTable) As String - + Dim Retorno As String = "" Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer() Dim rows As New List(Of Dictionary(Of String, Object)) Dim row As Dictionary(Of String, Object) @@ -568,7 +579,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Next rows.Add(row) Next - Return serializer.Serialize(rows) + If dt IsNot Nothing Then dt.Dispose() + Retorno = serializer.Serialize(rows) + rows = Nothing + serializer = Nothing + Return Retorno End Function ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario Get @@ -631,6 +646,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtPSRetorno.Columns("ClaveNombre").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString context.Response.Write(retorno) + DtPSRetorno.Dispose() Else context.Response.Write("[]") End If @@ -738,6 +754,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Catch ex As Exception DtPSRetorno = Nothing End Try + DTPS = Nothing + End If End If @@ -745,6 +763,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtPSRetorno.Columns("CvePS").ColumnName = "id" DtPSRetorno.Columns("PSCodigo").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString + DtPSRetorno.Dispose() context.Response.Write(retorno) Else context.Response.Write("[]") @@ -795,6 +814,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtRetorno.Columns("CvePersonal").ColumnName = "id" DtRetorno.Columns("NombreCompleto").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString + DtRetorno.Dispose() context.Response.Write(retorno) Else context.Response.Write("[]") diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb index 266efe3e5..9f42c525e 100644 --- a/Inicio.aspx.vb +++ b/Inicio.aspx.vb @@ -544,6 +544,7 @@ Partial Class Inicio SBJSScript.AppendFormat("graficahighcharts2('{0}','{1}','{2}','{3}',[{4}],1,'{5}','{6}',[{8}],[{7}]);", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, Info, XReferencia, Promedio, SBPie1, SBPie2) RegistraScript(SBJSScript.ToString, Indicador) + DTDatos.Dispose() End Sub Private Sub MuestraGrafica(DTDatos As DataTable, ColTitle As String, ColValue As String, TipoDato As String, DivId As String) Dim Info As String = "" @@ -912,7 +913,7 @@ Partial Class Inicio Next grafica.series.Add(serie) Next - + data.Dispose() End If Return grafica End Function @@ -990,6 +991,7 @@ Partial Class Inicio grafica.series.Add(serie) Next End If + data.Dispose() End If Return grafica End Function diff --git a/Site.master.vb b/Site.master.vb index 71df0dc42..bef60c318 100644 --- a/Site.master.vb +++ b/Site.master.vb @@ -381,7 +381,10 @@ Partial Class Site End If HeaderBar.AppendFormat("{0}", ScriptColorGrupoModulo) BarraNavegacion.Text = HeaderBar.ToString - CargaMenu(MenuHTML) + 'CargaMenu(MenuHTML) + Menu.Text = MenuHTML.ToString + MenuHTML.Clear() + HeaderBar.Clear() End Sub @@ -413,9 +416,9 @@ Partial Class Site End Select End Function - Private Sub CargaMenu(Texto As StringBuilder) - Menu.Text = Texto.ToString - End Sub + 'Private Sub CargaMenu(Texto As StringBuilder) + ' Menu.Text = Texto.ToString + 'End Sub #Region "Notificaciones" @@ -458,6 +461,7 @@ Partial Class Site 'OC.Dispose() LtlMNotificaciones.Text = LtlMNotificaciones.Text & Notificaciones.ToString + Notificaciones.Clear() End Sub @@ -474,7 +478,10 @@ Partial Class Site Dim x509 As New X509Certificate2() x509.Import(Data) - Return x509.NotAfter.ToShortDateString() + Dim Retorno = x509.NotAfter.ToShortDateString() + x509 = Nothing + Data = Nothing + Return Retorno End If Catch ex As Exception diff --git a/asmx/WsTSoft.asmx b/asmx/WsTSoft.asmx index 5c10a6d20..541ab2d77 100644 --- a/asmx/WsTSoft.asmx +++ b/asmx/WsTSoft.asmx @@ -19,8 +19,8 @@ Public Class WsTSoft Inherits System.Web.Services.WebService - Public Function AddRemision(FolioRemision As String, NoEconomico As String, CveEstatus As Integer, GeoInicial As String, GeoCarga As String, GeoEntrega As String, Fecha As String) As String - Dim retorno As String = "" + Public Function AddRemision(FolioRemision As String, NoEconomico As String, CveEstatus As Integer, GeoInicial As String, GeoCarga As String, GeoEntrega As String, Fecha As String) As String + Dim retorno As String = "" Dim objTsoft As New ClsTSoft objTsoft.IniciaTransacSQL() Dim Continuar As Boolean = objTsoft.AddRemisiones(FolioRemision, NoEconomico, CveEstatus, GeoInicial, GeoCarga, GeoEntrega, Fecha) @@ -34,9 +34,10 @@ Public Class WsTSoft objRem.CveRemision = 0 objRem.CurrentError = objTsoft.MyCurrentError End If - objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + objTsoft.Dispose() + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function @@ -53,8 +54,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function Public Function GetUltimaPosicion(DevID As String) As String @@ -85,8 +87,9 @@ Public Class WsTSoft ObjPos.CurrentError = "No se pudo obtener la posición." End If ObjGPS.Dispose() - retorno = JsonConvert.SerializeObject(ObjPos) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(ObjPos) + ObjPos = Nothing + Return retorno End Function Public Function TerminoRemision(FolioRemision As String, NoEconomico As String) As String @@ -102,8 +105,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function Public Function GetRemisionHistorial(FolioRemision As String, NoEconomico As String) As String @@ -136,8 +140,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + retorno = Nothing + Return retorno End Function Public Function GetInfoEventos(FechaInicio As String, FechaFin As String) As String @@ -167,7 +172,7 @@ Public Class WsTSoft End If objTsoft.Dispose() - Return retorno.ToString + Return retorno End Function Public Function TieneRemisionesActivas(NoEconomico As String) As String @@ -183,7 +188,8 @@ Public Class WsTSoft .CurrentError = ObjTSoft.MyCurrentError } ObjTSoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing Return retorno End Function @@ -203,12 +209,16 @@ Public Class WsTSoft Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result - retorno = JArray.Parse(result) + retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try From ad40879607e5a94a60eb13368c56d185aef20f17 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:54:32 -0700 Subject: [PATCH 07/19] -- cambios para performance --- App_Code/ClsGenerales.vb | 10 ++++++---- GPS/Rastreo.aspx.vb | 18 +++++++++++++----- GPS/TrayectoDetalle.aspx.vb | 8 ++++++-- OC/OC.aspx.vb | 2 +- PortalGPS/Penske.aspx.vb | 6 +++++- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index b47b3d317..d34542eab 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -18,9 +18,10 @@ Public Class ClsGenerales Private Data As DataTable Private disposedValue As Boolean = False 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region - + #Region "Propiedades" Public Property Colectiva As String Public Property Codigo As String @@ -73,7 +74,8 @@ Public Class ClsGenerales End Try Else SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -91,7 +93,7 @@ Public Class ClsGenerales #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/GPS/Rastreo.aspx.vb b/GPS/Rastreo.aspx.vb index ebed128cf..af2d7eff3 100644 --- a/GPS/Rastreo.aspx.vb +++ b/GPS/Rastreo.aspx.vb @@ -1741,13 +1741,17 @@ Partial Class GPS_Rastreo Dim Base64array = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(posicionesArray.ToString())) Using wc As New HttpClient() - Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Try + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result - retorno = JArray.Parse(result) + retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try @@ -2214,12 +2218,16 @@ Partial Class GPS_Rastreo Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result - retorno = JArray.Parse(result) + retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try diff --git a/GPS/TrayectoDetalle.aspx.vb b/GPS/TrayectoDetalle.aspx.vb index 1498d5bb4..3df27cc25 100644 --- a/GPS/TrayectoDetalle.aspx.vb +++ b/GPS/TrayectoDetalle.aspx.vb @@ -186,12 +186,16 @@ Partial Class GPS_TrayectoDetalle Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result - retorno = JArray.Parse(result) + retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index f070cb6d2..7e6042a87 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -5182,7 +5182,7 @@ Partial Class OC Protected Function ActualizarCotizacion(ByRef ObjVentas As ClsVentas) As Boolean Dim OcurrioError As Boolean = False Try - Dim PorcentajeGanancia As Decimal = 0.1D + Dim PorcentajeGanancia As Decimal = 0.3D For Each Row As DataRow In DtDetalle.Rows Dim CvePS As Integer = Row("CvePS").ToString.ToEntero Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("") diff --git a/PortalGPS/Penske.aspx.vb b/PortalGPS/Penske.aspx.vb index 5df25f0cd..38e4d8041 100644 --- a/PortalGPS/Penske.aspx.vb +++ b/PortalGPS/Penske.aspx.vb @@ -74,12 +74,16 @@ Partial Class PortalGPS_Penske Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try From 3e034bbbc8e44b7acfc5a665a4c4a405d19c31ba Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:56:11 -0700 Subject: [PATCH 08/19] -- cambios de performance y validar al editar un concepto, que valide existencia --- Ventas/Ventas.aspx.vb | 57 ++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d1d61a0b7..eb6abe994 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5955,15 +5955,17 @@ Partial Class Ventas If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero() - Dim CveUM As Integer = DatarowPS("CveUM").ToString().ToEntero() + Dim CveUM As Integer = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() 'DatarowPS("CveUM").ToString().ToEntero() Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString().ToEntero() - CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString().ToDecimal + CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToDecimal + Dim CveUMInicial As Integer = GvPS.Rows(e.RowIndex).DataKey("CveUM").ToEntero Dim ValidaExistencia As Boolean = True If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia ValidaExistencia = False End If + If CveUM <> CveUMInicial Then ValidaExistencia = True 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then @@ -6066,6 +6068,7 @@ Partial Class Ventas Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6079,6 +6082,7 @@ Partial Class Ventas MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6127,6 +6131,7 @@ Partial Class Ventas PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 + DrPS = Nothing End If Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) @@ -6699,6 +6704,7 @@ Partial Class Ventas If MensajeCosto.ToString().Length > 1 Then Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() Exit Sub End If @@ -6815,6 +6821,7 @@ Partial Class Ventas Next Alert(str.ToString(), TipoMensaje.MsgAdvertencia) dttsat.Dispose() + str.Clear() Exit Sub End If dttsat.Dispose() @@ -7409,6 +7416,7 @@ Partial Class Ventas Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";")) Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) + MensajeAlert.Clear() 'LIMPIA CONDICIONES DE PAGO - CONTADO RBLPago.SelectedValue = "1" @@ -7435,6 +7443,7 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() @@ -7457,13 +7466,17 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear() ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() TmpDT = TmpDTError.Copy End If + ObjFactura = Nothing + Obj2 = Nothing End If + End If End Sub @@ -10152,10 +10165,10 @@ Partial Class Ventas Exit For Else ViewState("SeGuardoPrePoliza") = True - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then - ErrorPrepoliza = True - Exit For - End If + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then + ErrorPrepoliza = True + Exit For + End If 'se hace acreditamiento de impuestos 'IVA X TRASLADAR Dim EsAnticipoEspecial As Boolean = False @@ -10208,10 +10221,10 @@ Partial Class Ventas End If - End If - End If + End If + End If Next End If @@ -16721,7 +16734,7 @@ Partial Class Ventas End If End If - + TextoExistencia.Clear() Return TieneError End Function 'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click @@ -19163,7 +19176,7 @@ Partial Class Ventas Else ResultadoMail = 0 End If - + sb.Clear() End If End Sub @@ -19181,7 +19194,7 @@ Partial Class Ventas End If LbCancelarDescripcion.Text = SbCondiciones.ToString() - + SbCondiciones.Clear() UpCancelarDocumento.Update() End Sub @@ -19226,7 +19239,7 @@ Partial Class Ventas RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() - + sb.Clear() Else CancelarDocumento() End If @@ -20649,7 +20662,7 @@ Partial Class Ventas RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") Exit Sub End If - + MensajeAlert.Clear() Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios @@ -20693,7 +20706,7 @@ Partial Class Ventas Else RegistraScript("playsonidito('beep-07.wav')", "Existo") End If - + MensajeSinExistencias.Clear() End Sub Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting @@ -21772,13 +21785,12 @@ Partial Class Ventas Cuerpo.AppendLine("") End If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) + Cuerpo.Clear() Exit Select End Select - - End Sub Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String) Dim ObjEventos As New ClsOIEventos() @@ -23519,6 +23531,7 @@ Partial Class Ventas DtCotizacionesPS = ObjClientes.DtResultados End If ObjClientes.Dispose() + Cves.Clear() If Not AgregaPSCotizacion() Then Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -23893,6 +23906,7 @@ Partial Class Ventas sb.Remove(sb.Length - 1, 1) CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1)) + sb.Clear() End Select Dim CveTipoDocto = DdlTipoComprobante.SelectedValue @@ -23938,7 +23952,10 @@ Partial Class Ventas DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}") DdlContrato.DataBind() End If - + MensajeRemisiones.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() End If End If @@ -24263,6 +24280,7 @@ Partial Class Ventas DtPedidos2PS = ObjVentas.DtResultados End If ObjVentas.Dispose() + Cves.Clear() If Not AgregaPSPedido2() Then Alert("Ocurrió un error validar las partidas de los pedidos seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -24295,6 +24313,10 @@ Partial Class Ventas TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "") TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "") + MensajePedidos2.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() UpModalPedidos2.Update() UpFacturar.Update() @@ -25333,6 +25355,7 @@ Partial Class Ventas ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") End If ObjEventos.Dispose() + Msg.Clear() Else Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) End If From 2729679d35bfefe19463c51a0fa30cce23366e92 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:58:17 -0700 Subject: [PATCH 09/19] -- IE, validacion de que tenga vinculado complementos, no pueda eliminarlo -- sessionsactivas. boton par acorrer GC --- Bancos/IE.aspx.vb | 57 +++++++++++-------------------- Sistemas/SessionesActivas.aspx | 4 +++ Sistemas/SessionesActivas.aspx.vb | 41 ++++++++++++++++++++++ 3 files changed, 65 insertions(+), 37 deletions(-) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 7e142edeb..24541825a 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -707,6 +707,7 @@ Partial Class Bancos_IE Dim ObjIE2 As New ClsBancos() If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then + Dim NumComplementos As Integer Try Tipo = ObjIE.DtResultados.Rows(0)("Tipo").ToString @@ -719,6 +720,7 @@ Partial Class Bancos_IE Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString CveIEDeposito2 = ObjIE.DtResultados(0)("CveIEDeposito2").ToString.ToEntero + NumComplementos = ObjIE.DtResultados(0)("NumComplementos").ToString.ToEntero If UsuarioActual.TienePermisoProceso(99) Then 'BtnActualizar.Visible = True @@ -887,10 +889,10 @@ Partial Class Bancos_IE If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + If UsuarioActual.TienePermisoProceso(80) AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True End If End If @@ -906,10 +908,10 @@ Partial Class Bancos_IE LblEstatus.ForeColor = Drawing.Color.Red 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + If UsuarioActual.TienePermisoProceso(80) AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True End If @@ -1089,7 +1091,7 @@ Partial Class Bancos_IE '2019-08-28 unificados vista de controles complemento (Cancelado, conciliciado, Con complemento vigente, sin complemento vigente) Dim ExistenComplementosVigentes As Boolean = VerificaComplementos(True) - Dim ExistenComplementos As Boolean = VerificaComplementos(False) + 'Dim ExistenComplementos As Boolean = VerificaComplementos(False) If Not ChkConciliado.Checked And ObjIE.CveEstatusIE <> 2 Then @@ -3121,40 +3123,19 @@ Partial Class Bancos_IE MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" End If End If - - End If - - If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." End If End If - End Select - - 'El movimiento 1 es el de Venta - 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If CveCuentaBeneficiario > 0 And CveCuentaConta > 0 Then - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - IDPoliza = ObjMov.ContaIdPoliza - Else - Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) - End If - Else - If CveCuentaConta < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) - End If - If CveCuentaBeneficiario < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) - End If - End If - End If - - 'Conta ContPAQ + End Select + + 'El movimiento 1 es el de Venta + + 'Conta ContPAQ If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then @@ -4774,16 +4755,17 @@ Partial Class Bancos_IE Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) Exit Sub End If - Dim ObjGral As New ClsGenerales + + + Dim ObjAC As ClsContPAQi = Nothing + Dim Banc As New ClsBancos + Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) + Dim ObjGral As New ClsGenerales(Banc.IniciaTransacSQL()) If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Banco", TxtFolio.Text + " / " + Cuenta) Then Borrar = True End If - ObjGral.Dispose() - If Borrar = True Then - Dim ObjAC As ClsContPAQi = Nothing - Dim Banc As New ClsBancos - Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) + If Borrar = True Then Dim ErrorCompra = False 'VERIFICA SI EL IES ESTA VINCULADO A UNA SOLICITUD VIATICO @@ -4840,6 +4822,7 @@ Partial Class Bancos_IE If ObjAC IsNot Nothing Then ObjAC.Dispose() Banc.Dispose() ObjConta.Dispose() + ObjGral.Dispose() End If Else Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion) diff --git a/Sistemas/SessionesActivas.aspx b/Sistemas/SessionesActivas.aspx index cac53f774..a61a989a3 100644 --- a/Sistemas/SessionesActivas.aspx +++ b/Sistemas/SessionesActivas.aspx @@ -20,6 +20,10 @@ +
  • + +
  • diff --git a/Sistemas/SessionesActivas.aspx.vb b/Sistemas/SessionesActivas.aspx.vb index d75a25113..71db01552 100644 --- a/Sistemas/SessionesActivas.aspx.vb +++ b/Sistemas/SessionesActivas.aspx.vb @@ -196,4 +196,45 @@ Partial Class SessionesActivas Notificaciones.AlertaVentana(TxtMensaje.Text, lista, timeoutseconds:=0) RegistraScript($"$(""#DivMensaje"").modal('hide');console.log('{Decripta(Context.User.Identity.Name)}')") End Sub + + + + Private Sub VerGC() + + Dim myGCCol As MyGCCollectClass = New MyGCCollectClass() + Console.WriteLine("The highest generation is {0}", GC.MaxGeneration) + myGCCol.MakeSomeGarbage() + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + GC.Collect(0) + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + GC.Collect(2) + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + Console.Read() + + GC.Collect() + GC.WaitForPendingFinalizers() + + End Sub + + Private Sub LBGC_Click(sender As Object, e As EventArgs) Handles LBGC.Click + GC.Collect() + GC.WaitForPendingFinalizers() + End Sub + + Class MyGCCollectClass + Public Sub MakeSomeGarbage() + Dim vt As Version + + For i As Integer = 0 To 1000 - 1 + vt = New Version() + Next + End Sub + + End Class + + + End Class From ff8f94b528cb5575c1cffb9d72e4ad5c3be3be3b Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 27 May 2020 19:46:05 -0700 Subject: [PATCH 10/19] cambios en css para el modal de pago de contado --- Compras/Compras.aspx | 68 ++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 9ef3bda65..8be958e7d 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -141,6 +141,11 @@ select.selecthidden { display: none; } + + radioContado { + border:1px solid black; + width:85%; + } /*IPP*/ @@ -3845,19 +3850,24 @@