Mostra json de productos

This commit is contained in:
2021-04-21 18:06:10 -07:00
parent 69d3f53808
commit b382016c44

View File

@@ -392,22 +392,37 @@ Public Class E141 : Implements IHttpHandler
Select Case Metodo
Case "CrearActualizarProductos"
respuesta = CrearActualizarProductos(If(FiltrarTodos = "1", True, False))
If respuesta Then
retorno = "True"
Else
retorno = "False"
End If
Case "CrearActualizarProductosJson"
retorno = CrearActualizarProductosJson(If(FiltrarTodos = "1", True, False))
Case "ActualizarPrecios"
respuesta = ActualizarPrecios(If(FiltrarTodos = "1", True, False))
If respuesta Then
retorno = "True"
Else
retorno = "False"
End If
Case "ActualizarExistencias"
respuesta = ActualizarExistencias()
If respuesta Then
retorno = "True"
Else
retorno = "False"
End If
Case "ActualizarVendedores"
respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False))
If respuesta Then
retorno = "True"
Else
retorno = "False"
End If
End Select
If respuesta Then
retorno = "True"
Else
retorno = "False"
End If
End If
End If
context.Response.Write(retorno)
@@ -1962,6 +1977,25 @@ Public Class E141 : Implements IHttpHandler
Return Retorno
End Function
Private Function CrearActualizarProductosJson(Todos As Boolean) As String
Dim payload = New JObject()
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
Dim DtPS As DataTable = Nothing
Using ObjPS As New ClsProductosServicios
'OBTERNER PRECIOS DE PUBLICO GENERAL
If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then
DtPS = ObjPS.DtResultados.Copy()
End If
End Using
If DtPS IsNot Nothing Then
payload.Add(New JProperty("products", GenerarPayloadProductos(DtPS)))
End If
Return payload.ToString()
End Function
Private Function GenerarPayloadProductos(DtPS As DataTable) As JArray
Dim ArrayPS As New JArray
For Each RowPS As DataRow In DtPS.Rows