From 616af1a2125c1ee99391ece01b0f79396b45db97 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 15 May 2020 22:53:48 -0700 Subject: [PATCH] Correcion en de global en servicio web del pescadito --- asmx/WSApp.asmx | 52 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 461d63f35..88b6270ad 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -1,5 +1,5 @@ -<%@ WebService Language="VB" Class="WSApp" %> - +<%@ WebService Language="VB" Class="WSApp" %> + Option Explicit On Imports System.Data @@ -22,9 +22,9 @@ Imports Newtonsoft.Json.Linq Public Class WSApp - Inherits System.Web.Services.WebService + Inherits System.Web.Services.WebService #Region "G L O B A L - D T" - + Public ReadOnly Property UrlSitio As String Get Return ConfigurationManager.AppSettings("UrlSitio").ToString @@ -425,9 +425,34 @@ Public Class WSApp Set(value As DataTable) Application("GlobalDTMotivosHorasExtras") = value End Set - End Property + End Property + + + Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim ObjUnidadesMedida As New ClsUnidadesMedida() + If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados + ObjUnidadesMedida.Dispose() + End If + + If CveEmpresa <> -1 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + GlobalDTUnidadesMedida = Dv.ToTable + Dv.Dispose() + Else + GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property #End Region - + Public Property CveEmpresa As Integer = 143 Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) @@ -448,7 +473,7 @@ Public Class WSApp Else End If ObjEmpresa.Dispose() - End Sub + End Sub #Region "M E T O D O S - S E R V I C I O" Public Function ValidaUsuario(CveUsuario As Integer) As Usuario Dim UsuarioActual As Usuario = Nothing @@ -783,9 +808,9 @@ Public Class WSApp Retorno.Mensajes.Add("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.") End If ObjInv.Dispose() - End Sub + End Sub #End Region - + #Region "P E D I D O S" Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre @@ -899,9 +924,9 @@ Public Class WSApp i += 1 Next Return Timbre - End Function + End Function #End Region - + #Region "R E M I S I O N E S" Private Function CreaFactura(ByRef Retorno As Modelos.Factura.MMensajeFactura, CveCliente As Integer, CveAlmacen As Integer, CveSubProyecto As Integer, CveMoneda As Integer, UsuarioActual As Usuario, Observaciones As String, ListaPS As List(Of MVentaProductos)) As Modelos.Factura If CveSubProyecto <= 0 Then @@ -1430,9 +1455,10 @@ Public Class WSApp End Try ObjVentas.Dispose() Return strBody.ToString - End Function + End Function #End Region - + + End Class Namespace WebServiceAppModels2