-- cambios stringbuilder, performance
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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("[]")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -381,7 +381,10 @@ Partial Class Site
|
||||
End If
|
||||
HeaderBar.AppendFormat("</li>{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
|
||||
|
||||
@@ -19,8 +19,8 @@ Public Class WsTSoft
|
||||
Inherits System.Web.Services.WebService
|
||||
|
||||
<WebMethod()>
|
||||
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
|
||||
|
||||
<WebMethod()>
|
||||
@@ -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
|
||||
<WebMethod()>
|
||||
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
|
||||
<WebMethod()>
|
||||
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
|
||||
<WebMethod()>
|
||||
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
|
||||
<WebMethod()>
|
||||
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
|
||||
<WebMethod()>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user