Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -273,7 +273,7 @@ Public Class ClsCRM
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddMedioCaptacion(MedioCaptacion As String, Descripcion As String, CveEmpresa As Integer, CveUsuarioIng As Integer) As Boolean
|
||||
Public Function AddMedioCaptacion(MedioCaptacion As String, Descripcion As String, CveEmpresa As Integer, CveUsuarioIng As Integer, Optional CveTipoProceso As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_CRM_MedioCaptacionAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -281,6 +281,7 @@ Public Class ClsCRM
|
||||
.Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng
|
||||
.Add("@CveTipoProceso", SqlDbType.Int).Value = CveTipoProceso
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
@@ -291,7 +292,8 @@ Public Class ClsCRM
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateMedioCaptacion(MedioCaptacion As String, Descripcion As String, CveEstatus As Boolean, CveMedioCaptacion As Integer) As Boolean
|
||||
Public Function UpdateMedioCaptacion(MedioCaptacion As String, Descripcion As String, CveEstatus As Boolean, CveMedioCaptacion As Integer,
|
||||
Optional CveTipoProceso As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_CRM_MedioCaptacionUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -299,6 +301,7 @@ Public Class ClsCRM
|
||||
.Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion
|
||||
.Add("@CveEstatus", SqlDbType.Bit).Value = CveEstatus
|
||||
.Add("@CveMedioCaptacion", SqlDbType.Int).Value = CveMedioCaptacion
|
||||
.Add("@CveTipoProceso", SqlDbType.Int).Value = CveTipoProceso
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
@@ -590,13 +593,14 @@ Public Class ClsCRM
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddProbabilidadAcercamiento(ProbabilidadAcercamiento As String, CveEmpresa As Integer, CveUsuarioIng As Integer) As Boolean
|
||||
Public Function AddProbabilidadAcercamiento(ProbabilidadAcercamiento As String, CveEmpresa As Integer, CveUsuarioIng As Integer, Optional CveTipoProceso As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_CRM_ProbabilidadAcercamientoAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@ProbabilidadAcercamiento", SqlDbType.VarChar).Value = ProbabilidadAcercamiento
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng
|
||||
.Add("@CveTipoProceso", SqlDbType.Int).Value = CveTipoProceso
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
@@ -607,7 +611,8 @@ Public Class ClsCRM
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateProbabilidadAcercamiento(ProbabilidadAcercamiento As String, CveEstatus As Boolean, CveProbabilidadAcercamiento As Integer) As Boolean
|
||||
Public Function UpdateProbabilidadAcercamiento(ProbabilidadAcercamiento As String, CveEstatus As Boolean, CveProbabilidadAcercamiento As Integer,
|
||||
Optional CveTipoProceso As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_CRM_ProbabilidadAcercamientoUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -615,6 +620,7 @@ Public Class ClsCRM
|
||||
|
||||
.Add("@CveEstatus", SqlDbType.Bit).Value = CveEstatus
|
||||
.Add("@CveProbabilidadAcercamiento", SqlDbType.Int).Value = CveProbabilidadAcercamiento
|
||||
.Add("@CveTipoProceso", SqlDbType.Int).Value = CveTipoProceso
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
@@ -5141,56 +5141,74 @@ Public Class ClsPaginas
|
||||
'limpio ReportViwer
|
||||
Dim sw As New System.Diagnostics.Stopwatch()
|
||||
sw.Start()
|
||||
Dim bdir As String = AppDomain.CurrentDomain.BaseDirectory
|
||||
RutaReporte.Replace("/", "\")
|
||||
If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then
|
||||
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
|
||||
End If
|
||||
Dim CveUsuario As Integer = 0
|
||||
Dim CveEmpresa As Integer = 0
|
||||
If Context.Session("UsuarioSIG") IsNot Nothing Then
|
||||
CveUsuario = UsuarioActual.CveUsuario
|
||||
CveEmpresa = UsuarioActual.CveEmpresa
|
||||
|
||||
End If
|
||||
Dim Bytes As Byte() = Nothing
|
||||
Dim wsreport As New WSRDLC.WebServiceSoapClient
|
||||
Dim params As New List(Of WSRDLC.ReportParameter)
|
||||
Dim ds As New DataSet
|
||||
For Each rpds As ReportDataSource In DataSource
|
||||
Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable)
|
||||
dt.TableName = rpds.Name
|
||||
ds.Tables.Add(dt)
|
||||
Next
|
||||
For Each rpds As ReportParameter In Parametros
|
||||
Dim param As New WSRDLC.ReportParameter
|
||||
param.Name = rpds.Name
|
||||
param.Values = {rpds.Values(0)}
|
||||
params.Add(param)
|
||||
Next
|
||||
|
||||
Dim ruta = wsreport.StreamPDF(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
|
||||
If File.Exists(ruta) Then
|
||||
Bytes = File.ReadAllBytes(ruta)
|
||||
File.Delete(ruta)
|
||||
End If
|
||||
'Dim setup As AppDomainSetup = New AppDomainSetup
|
||||
'With setup
|
||||
' .ApplicationBase = Environment.CurrentDirectory
|
||||
' .LoaderOptimization = LoaderOptimization.MultiDomainHost
|
||||
'End With
|
||||
'setup.SetCompatibilitySwitches({"NetFx40_LegacySecurityPolicy"})
|
||||
'Dim _casPolicyEnabledDomain As AppDomain = AppDomain.CreateDomain("Full Trust", Nothing, setup)
|
||||
'Dim fllreport As ADSReportLib.FullTrustReportviewer = Nothing
|
||||
'Try
|
||||
|
||||
Dim setup As AppDomainSetup = New AppDomainSetup
|
||||
With setup
|
||||
.ApplicationBase = Environment.CurrentDirectory
|
||||
.LoaderOptimization = LoaderOptimization.MultiDomainHost
|
||||
End With
|
||||
setup.SetCompatibilitySwitches({"NetFx40_LegacySecurityPolicy"})
|
||||
Dim _casPolicyEnabledDomain As AppDomain = AppDomain.CreateDomain("Full Trust", Nothing, setup)
|
||||
Dim fllreport As ADSReportLib.FullTrustReportviewer = Nothing
|
||||
Try
|
||||
'Dim rvNextgenReport2 As WebReportviewer.FullTrustReportviewer = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(WebReportviewer.FullTrustReportviewer).Assembly.CodeBase, GetType(WebReportviewer.FullTrustReportviewer).FullName), WebReportviewer.FullTrustReportviewer)
|
||||
'rvNextgenReport2.Initialize(DisplayName, ReportPath, Visible, reportParam, reportRenderFormat, DeviceInfo, repMainContent, repSubContent)
|
||||
' fllreport = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(ADSReportLib.FullTrustReportviewer).Assembly.CodeBase, GetType(ADSReportLib.FullTrustReportviewer).FullName), ADSReportLib.FullTrustReportviewer)
|
||||
|
||||
'For Each _ReportDataSource As ReportDataSource In DataSources
|
||||
' rvNextgenReport2.AddDataSources(_ReportDataSource.Name, CType(_ReportDataSource.Value, DataTable))
|
||||
'Next
|
||||
|
||||
'Return rvNextgenReport2.Render(reportRenderFormat, DeviceInfo)
|
||||
fllreport = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(ADSReportLib.FullTrustReportviewer).Assembly.CodeBase, GetType(ADSReportLib.FullTrustReportviewer).FullName), ADSReportLib.FullTrustReportviewer)
|
||||
|
||||
Dim bdir As String = AppDomain.CurrentDomain.BaseDirectory
|
||||
RutaReporte.Replace("/", "\")
|
||||
If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then
|
||||
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
|
||||
End If
|
||||
fllreport.Initialize("DisplayName", RutaReporte, Parametros.AsEnumerable(), New List(Of String()), True)
|
||||
For Each RDS As ReportDataSource In DataSource
|
||||
fllreport.AddDataSources(RDS.Name, DirectCast(RDS.Value, DataTable))
|
||||
Next
|
||||
Dim Warnings As Warning() = Nothing
|
||||
Dim StreamIds As String() = Nothing
|
||||
Dim MimeType As String = Nothing
|
||||
Dim Encoding As String = Nothing
|
||||
Dim Extension As String = Nothing
|
||||
Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds)
|
||||
fllreport = Nothing
|
||||
Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
|
||||
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
Catch ex As Exception
|
||||
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
Finally
|
||||
AppDomain.Unload(_casPolicyEnabledDomain)
|
||||
End Try
|
||||
If fllreport IsNot Nothing Then fllreport.liberarecursos()
|
||||
' fllreport.Initialize("DisplayName", RutaReporte, Parametros.AsEnumerable(), New List(Of String()), True)
|
||||
' For Each RDS As ReportDataSource In DataSource
|
||||
' fllreport.AddDataSources(RDS.Name, DirectCast(RDS.Value, DataTable))
|
||||
' Next
|
||||
' Dim Warnings As Warning() = Nothing
|
||||
' Dim StreamIds As String() = Nothing
|
||||
' Dim MimeType As String = Nothing
|
||||
' Dim Encoding As String = Nothing
|
||||
' Dim Extension As String = Nothing
|
||||
' Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds)
|
||||
' fllreport = Nothing
|
||||
'Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
|
||||
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
' 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
'Catch ex As Exception
|
||||
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
|
||||
' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
' 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
'Finally
|
||||
' AppDomain.Unload(_casPolicyEnabledDomain)
|
||||
'End Try
|
||||
'If fllreport IsNot Nothing Then fllreport.liberarecursos()
|
||||
|
||||
sw.Stop()
|
||||
If sw.Elapsed.TotalSeconds > 1 Then
|
||||
|
||||
@@ -4,51 +4,51 @@ Option Strict On
|
||||
<Serializable()>
|
||||
Public Class Empresa
|
||||
|
||||
Public CveEmpresa As Integer
|
||||
Public Empresa As String
|
||||
Public NombreCorto As String
|
||||
Public Direccion As String
|
||||
Public NoExt As String
|
||||
Public NoInt As String
|
||||
Public Colonia As String
|
||||
Public Ciudad As String
|
||||
Public Estado As String
|
||||
Public CP As Integer
|
||||
Public RFC As String
|
||||
Public CURP As String
|
||||
Public RegistroPatronal As String
|
||||
Public Telefono As String
|
||||
Public Contacto As String
|
||||
Public Mail As String
|
||||
Public TipoFacturacion As String
|
||||
Public ContraseñaKey As String
|
||||
Public ArchivoKey As String
|
||||
Public ArchivoCer As String
|
||||
Public ArchivoPfx As String
|
||||
Public BIUsuario As String
|
||||
Public BIContraseña As String
|
||||
Public Banner As String
|
||||
Public FacturaProduccion As Boolean
|
||||
Public FechaIng As Date
|
||||
Public CveUsuario As Integer
|
||||
Public SendMail As String
|
||||
Public SendMailPassword As String
|
||||
Public SendMailServer As String
|
||||
Public SendMailPuerto As Integer
|
||||
Public SendMailSSL As Boolean
|
||||
Public Usuario As String
|
||||
Public MostrarRetIVA As Boolean
|
||||
Public EjercicioActual As Integer
|
||||
Public PeriodoActual As Integer
|
||||
Public GralSoloProyecto As Boolean
|
||||
Public MetodoOC As Integer
|
||||
Public CveMetodoInventario As Integer
|
||||
Public RequiereCentroCostos As Boolean
|
||||
Public EmpresaEncabezado As String
|
||||
Public GrupoEmpresa As Integer
|
||||
Public Extension As String
|
||||
Public EsComercializadora As Boolean
|
||||
Public BaseDatosNombre As String = "Ventas"
|
||||
Public Property CveEmpresa As Integer
|
||||
Public Property Empresa As String
|
||||
Public Property NombreCorto As String
|
||||
Public Property Direccion As String
|
||||
Public Property NoExt As String
|
||||
Public Property NoInt As String
|
||||
Public Property Colonia As String
|
||||
Public Property Ciudad As String
|
||||
Public Property Estado As String
|
||||
Public Property CP As Integer
|
||||
Public Property RFC As String
|
||||
Public Property CURP As String
|
||||
Public Property RegistroPatronal As String
|
||||
Public Property Telefono As String
|
||||
Public Property Contacto As String
|
||||
Public Property Mail As String
|
||||
Public Property TipoFacturacion As String
|
||||
Public Property ContraseñaKey As String
|
||||
Public Property ArchivoKey As String
|
||||
Public Property ArchivoCer As String
|
||||
Public Property ArchivoPfx As String
|
||||
Public Property BIUsuario As String
|
||||
Public Property BIContraseña As String
|
||||
Public Property Banner As String
|
||||
Public Property FacturaProduccion As Boolean
|
||||
Public Property FechaIng As Date
|
||||
Public Property CveUsuario As Integer
|
||||
Public Property SendMail As String
|
||||
Public Property SendMailPassword As String
|
||||
Public Property SendMailServer As String
|
||||
Public Property SendMailPuerto As Integer
|
||||
Public Property SendMailSSL As Boolean
|
||||
Public Property Usuario As String
|
||||
Public Property MostrarRetIVA As Boolean
|
||||
Public Property EjercicioActual As Integer
|
||||
Public Property PeriodoActual As Integer
|
||||
Public Property GralSoloProyecto As Boolean
|
||||
Public Property MetodoOC As Integer
|
||||
Public Property CveMetodoInventario As Integer
|
||||
Public Property RequiereCentroCostos As Boolean
|
||||
Public Property EmpresaEncabezado As String
|
||||
Public Property GrupoEmpresa As Integer
|
||||
Public Property Extension As String
|
||||
Public Property EsComercializadora As Boolean
|
||||
Public Property BaseDatosNombre As String = "Ventas"
|
||||
'Nuevos
|
||||
|
||||
Public AreaGeografica As String
|
||||
|
||||
85
App_Code/WS/WSSIGVentas.vb
Normal file
85
App_Code/WS/WSSIGVentas.vb
Normal file
@@ -0,0 +1,85 @@
|
||||
Imports System.Net
|
||||
Imports System.Web.Http
|
||||
Imports Extensiones
|
||||
Imports WsUtility
|
||||
|
||||
Namespace SIG
|
||||
|
||||
<Extensiones.BasicAuthentication()>
|
||||
<RoutePrefix("api/SIGVentas")>
|
||||
Public Class SIGVentasController
|
||||
Inherits ApiController
|
||||
|
||||
<Route("creartrama")>
|
||||
<HttpPost>
|
||||
Public Function CrearTrama(<FromBody()> params As WsBody) As Object
|
||||
Dim respuesta = "Entraste " 'New With {.Correcto = False, .Mensaje = "", .Datos = New JObject}
|
||||
|
||||
Return respuesta
|
||||
End Function
|
||||
|
||||
|
||||
<Route("GetComplementoPago")>
|
||||
<HttpPost>
|
||||
Public Function GetComplementoPago(<FromBody()> params As WsBody) As Object
|
||||
Dim respuesta As Data.DataTable = Nothing 'New With {.Correcto = False, .Mensaje = "", .Datos = New JObject}
|
||||
|
||||
Dim CveCliente As Integer = -1
|
||||
Dim FechaI As DateTime = DateTime.Now
|
||||
Dim FechaF As DateTime = DateTime.Now
|
||||
Dim CveIE As Integer = -1
|
||||
Dim CveVenta As Integer = -1
|
||||
Dim opcion As Integer = -1
|
||||
Dim CveEmpresa As Integer = -1
|
||||
Dim status As Integer = -1
|
||||
|
||||
Dim continuar As Boolean = True
|
||||
Dim jsobj As New JSutil(params.Datos)
|
||||
|
||||
Dim value As String = Nothing
|
||||
If continuar Then continuar = jsobj.GetValue("CveCliente", value)
|
||||
If continuar Then CveCliente = value.ToEntero()
|
||||
If continuar Then continuar = jsobj.GetValue("FechaInicio", value)
|
||||
If continuar Then DateTime.TryParseExact(value, "yyyyMMdd", New Globalization.CultureInfo("es-MX"), Globalization.DateTimeStyles.None, FechaI)
|
||||
If continuar Then continuar = jsobj.GetValue("FechaFin", value)
|
||||
If continuar Then DateTime.TryParseExact(value, "yyyyMMdd", New Globalization.CultureInfo("es-MX"), Globalization.DateTimeStyles.None, FechaF)
|
||||
If continuar Then continuar = jsobj.GetValue("CveIE", value)
|
||||
If continuar Then CveIE = value.ToEntero()
|
||||
If continuar Then continuar = jsobj.GetValue("Opcion", value)
|
||||
If continuar Then opcion = value.ToEntero()
|
||||
If continuar Then continuar = jsobj.GetValue("CveVenta", value)
|
||||
If continuar Then CveVenta = value.ToEntero()
|
||||
If continuar Then continuar = jsobj.GetValue("CveEmpresa", value)
|
||||
If continuar Then CveEmpresa = value.ToEntero()
|
||||
If continuar Then continuar = jsobj.GetValue("Estatus", value)
|
||||
If continuar Then status = value.ToEntero()
|
||||
|
||||
|
||||
Using Banco As New ClsBancos()
|
||||
If Banco.GetComplementoPagosRep(CveCliente, FechaI, FechaF, CveIE, CveVenta, opcion, CveEmpresa, Estatus:=status) Then
|
||||
respuesta = Banco.DtResultados
|
||||
End If
|
||||
End Using
|
||||
|
||||
Return JSutil.strresponse(respuesta, (Not IsNothing(respuesta)), "")
|
||||
End Function
|
||||
' GET api/<controller>
|
||||
Public Function GetValues() As IEnumerable(Of String)
|
||||
Return New String() {"value1", "value2"}
|
||||
End Function
|
||||
' GET api/<controller>/5
|
||||
Public Function GetValue(ByVal id As Integer) As String
|
||||
Return "value"
|
||||
End Function
|
||||
' POST api/<controller>
|
||||
Public Sub PostValue(<FromBody()> ByVal value As String)
|
||||
End Sub
|
||||
' PUT api/<controller>/5
|
||||
Public Sub PutValue(ByVal id As Integer, <FromBody()> ByVal value As String)
|
||||
End Sub
|
||||
' DELETE api/<controller>/5
|
||||
Public Sub DeleteValue(ByVal id As Integer)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
151
App_Code/WS/WSUSer.vb
Normal file
151
App_Code/WS/WSUSer.vb
Normal file
@@ -0,0 +1,151 @@
|
||||
|
||||
Imports System.Net
|
||||
Imports System.Web.Http
|
||||
Imports Extensiones
|
||||
Imports WsUtility
|
||||
|
||||
Namespace SIG
|
||||
|
||||
<Extensiones.BasicAuthentication()>
|
||||
<RoutePrefix("api/usuario")>
|
||||
Public Class usuarioController 'SIGVentasController
|
||||
Inherits ApiController
|
||||
|
||||
<Route("Login")>
|
||||
<HttpPost>
|
||||
Public Function Login(<FromBody()> params As WsBody) As Object
|
||||
'Dim respuesta = "" 'New With {.Correcto = False, .Mensaje = "", .Datos = New JObject}
|
||||
Dim continuar As Boolean = True
|
||||
Dim Token As Integer
|
||||
If True Then
|
||||
Dim authHeader = Request.Headers.Authorization
|
||||
Dim dataArray = Extensiones.Decripta(authHeader.Parameter).Split("|"c)
|
||||
If dataArray.Length > 4 AndAlso IsNumeric(dataArray(0)) AndAlso IsNumeric(dataArray(1)) AndAlso IsNumeric(dataArray(4)) Then
|
||||
|
||||
Dim CveUsuario As Integer = dataArray(0).ToEntero()
|
||||
Dim FechaPeticion As DateTime
|
||||
DateTime.TryParseExact(String.Format("{0} {1}", dataArray(2), dataArray(3)), "ddMMyyyy HHmm", New Globalization.CultureInfo("es-MX"), Globalization.DateTimeStyles.None, FechaPeticion)
|
||||
Dim CveEmpresa As Integer = dataArray(4).ToEntero()
|
||||
|
||||
Dim diferencia As Double = (FechaPeticion - DateTime.Now).TotalMinutes
|
||||
Token = diferencia.ToString("N0").ToEntero()
|
||||
End If
|
||||
End If
|
||||
Dim jsobj As New JSutil(params.Datos)
|
||||
|
||||
Dim username As String = Nothing
|
||||
Dim password As String = Nothing
|
||||
Dim CveEmpresastr As String = "-1"
|
||||
Dim value As String = Nothing
|
||||
If continuar Then continuar = jsobj.GetValue("UsuarioName", value)
|
||||
If continuar Then username = value
|
||||
If continuar Then continuar = jsobj.GetValue("Password", value)
|
||||
If continuar Then password = value
|
||||
If jsobj.GetValue("CveEmpresa", value) Then CveEmpresastr = value
|
||||
|
||||
Dim Retorno As List(Of String) = Nothing
|
||||
If continuar Then
|
||||
Using objuser As New ClsSisUsuarios
|
||||
Dim user As Usuario = objuser.ValidaUsuario(username, Extensiones.ModExtensiones.Encripta(password), "-1", CveEmpresastr.ToEntero())
|
||||
|
||||
Dim OjEmpresa As Empresa = Nothing
|
||||
If user IsNot Nothing Then
|
||||
If CveEmpresastr.ToEntero() > 0 Then
|
||||
user.CveEmpresa = CveEmpresastr.ToEntero()
|
||||
End If
|
||||
Using ObjEmpresa As New ClsSisEmpresas()
|
||||
|
||||
If ObjEmpresa.GetEmpresas(user.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
'If ObjEmpresa.GetEmpresasFuncionalidades(user.CveEmpresa) Then
|
||||
' Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
' Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
' For Each Row As Data.DataRow In dttmp.Rows
|
||||
' EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
' Next
|
||||
' ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
'End If
|
||||
|
||||
OjEmpresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
End Using
|
||||
Dim Retornouser As UsuarioApp
|
||||
Retornouser = New UsuarioApp With {
|
||||
.CveUsuario = user.CveUsuario,
|
||||
.Nombre = user.Nombre,
|
||||
.UsuarioName = user.Usuario,
|
||||
.CveRol = user.CveRol,
|
||||
.Rol = user.Rol,
|
||||
.CveEmpresa = user.CveEmpresa,
|
||||
.Token = Token', .Empresa = OjEmpresa
|
||||
}
|
||||
Retorno = New List(Of String)
|
||||
Retorno.Add(Extensiones.ModExtensiones.Encripta(Newtonsoft.Json.JsonConvert.SerializeObject(Retornouser)))
|
||||
Retorno.Add(Extensiones.ModExtensiones.Encripta(Newtonsoft.Json.JsonConvert.SerializeObject(OjEmpresa)))
|
||||
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
Dim objrt = New WsBody With {
|
||||
.Datos = Newtonsoft.Json.JsonConvert.SerializeObject(Retorno),
|
||||
.IsFail = False,
|
||||
.FailStr = ""
|
||||
}
|
||||
Return objrt
|
||||
'Return JSutil.strresponse(Retorno, (Not IsNothing(Retorno)), "")
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
<Route("GetEmpresa")>
|
||||
<HttpPost>
|
||||
Public Function GetEmpresa() As Object
|
||||
Dim retorno As Data.DataTable = Nothing
|
||||
Using ObjEmpresas As New ClsSisEmpresas()
|
||||
If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then
|
||||
'verifico si existe la carpeta de la empresa, sino la crea
|
||||
For Each dr As Data.DataRow In ObjEmpresas.DtResultados.Rows
|
||||
Dim Ruta As String = String.Format("{0}Empresas\{1}", AppDomain.CurrentDomain.BaseDirectory, dr("CveEmpresa"))
|
||||
If Not IO.Directory.Exists(Ruta) Then IO.Directory.CreateDirectory(Ruta)
|
||||
If Not System.IO.Directory.Exists(String.Format("{0}\XML\", Ruta)) Then System.IO.Directory.CreateDirectory(String.Format("{0}\XML\", Ruta))
|
||||
If Not System.IO.Directory.Exists(String.Format("{0}\PDF\", Ruta)) Then System.IO.Directory.CreateDirectory(String.Format("{0}\PDF\", Ruta))
|
||||
|
||||
Next
|
||||
retorno = ObjEmpresas.DtResultados
|
||||
End If
|
||||
End Using
|
||||
|
||||
|
||||
Return JSutil.strresponse(retorno, (Not IsNothing(retorno)), "")
|
||||
End Function
|
||||
|
||||
<Route("GetUsuariosEmpresa")>
|
||||
<HttpPost>
|
||||
Public Function GetUsuariosEmpresa(<FromBody()> params As WsBody) As Object
|
||||
Dim retorno As Data.DataTable = Nothing
|
||||
|
||||
Using ObjUsuarios As New ClsSisUsuarios()
|
||||
If ObjUsuarios.GetUsuarios(-1, -1) Then
|
||||
retorno = ObjUsuarios.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", Extensiones.ModExtensiones.Decripta(params.Datos).ToEntero()))
|
||||
End If
|
||||
End Using
|
||||
Return JSutil.strresponse(retorno, (Not IsNothing(retorno)), "")
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
Public Class UsuarioApp
|
||||
Public Sub New()
|
||||
End Sub
|
||||
|
||||
Public Property CveUsuario As Integer
|
||||
Public Property CveEmpresa As Integer
|
||||
Public Property CveRol As Integer
|
||||
Public Property Rol As String
|
||||
Public Property Token As Integer
|
||||
Public Property UsuarioName As String
|
||||
Public Property Password As String
|
||||
Public Property Nombre As String
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
105
App_Code/WS/WsUtility.vb
Normal file
105
App_Code/WS/WsUtility.vb
Normal file
@@ -0,0 +1,105 @@
|
||||
Imports System.Net.Http
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
|
||||
Namespace WsUtility
|
||||
|
||||
'Public Class SigAuthenticationAttribute
|
||||
' Inherits Http.Filters.AuthorizationFilterAttribute
|
||||
|
||||
|
||||
' Public Sub New()
|
||||
|
||||
' End Sub
|
||||
|
||||
' Public Overrides Sub OnAuthorization(ByVal actionContext As Http.Controllers.HttpActionContext)
|
||||
' Dim authHeader = actionContext.Request.Headers.Authorization
|
||||
' Dim noautorizado As Boolean = True
|
||||
' If authHeader IsNot Nothing Then
|
||||
' Try
|
||||
|
||||
' Dim decodedAuthenticationToken = Extensiones.Decripta(authHeader.Parameter)
|
||||
' Dim dataArray = decodedAuthenticationToken.Split("|"c)
|
||||
' If dataArray.Length > 4 Then
|
||||
|
||||
' Dim CveUsuario As Integer = dataArray(0)
|
||||
' Dim Token As Integer = dataArray(1)
|
||||
' Dim FechaPeticion As DateTime
|
||||
' DateTime.TryParseExact(String.Format("{0} {1}", dataArray(2), dataArray(3)), "ddMMyyyy HHmm", New Globalization.CultureInfo("es-MX"), Globalization.DateTimeStyles.None, FechaPeticion)
|
||||
' FechaPeticion = FechaPeticion.AddMinutes(Token)
|
||||
' Dim CveEmpresa As Integer = dataArray(4)
|
||||
|
||||
' Dim diferencia As Integer = Math.Abs((FechaPeticion - DateTime.Now).TotalMinutes)
|
||||
' If diferencia < 30 Then
|
||||
' noautorizado = False
|
||||
' End If
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' noautorizado = True
|
||||
' End Try
|
||||
' End If
|
||||
' If noautorizado Then
|
||||
' HandleUnathorized(actionContext)
|
||||
' End If
|
||||
' End Sub
|
||||
|
||||
' Private Shared Sub HandleUnathorized(ByVal actionContext As Http.Controllers.HttpActionContext)
|
||||
' actionContext.Response = actionContext.Request.CreateResponse(Net.HttpStatusCode.Unauthorized)
|
||||
' actionContext.Response.Headers.Add("WWW-Authenticate", "Basic Scheme='Data' location = 'http://localhost:")
|
||||
' End Sub
|
||||
|
||||
'End Class
|
||||
Public Class JSutil
|
||||
Public Property jsobj As Newtonsoft.Json.Linq.JObject
|
||||
Public Sub New(strjson As String, Optional isencripted As Boolean = True)
|
||||
If isencripted Then strjson = Extensiones.ModExtensiones.Decripta(strjson)
|
||||
Try
|
||||
jsobj = Newtonsoft.Json.Linq.JObject.Parse(strjson)
|
||||
Catch ex As Exception
|
||||
Extensiones.GuardaLog(String.Format("Json Invalido '{0}'{2}{1}", strjson, ex.ToString(), vbNewLine))
|
||||
End Try
|
||||
End Sub
|
||||
Public Function GetValue(FieldName As String, ByRef Valor As String) As Boolean
|
||||
Dim continuar As Boolean = False
|
||||
If Not IsNothing(jsobj) Then
|
||||
|
||||
Dim value As Newtonsoft.Json.Linq.JToken = Nothing
|
||||
|
||||
continuar = jsobj.TryGetValue(FieldName, value)
|
||||
If continuar Then
|
||||
Valor = value.ToString()
|
||||
End If
|
||||
End If
|
||||
Return continuar
|
||||
End Function
|
||||
|
||||
Public Shared Function strresponse(objeto As Object, isFail As Boolean, FailStr As String) As WsBody
|
||||
Dim retorno As String = ""
|
||||
retorno = Newtonsoft.Json.JsonConvert.SerializeObject(objeto)
|
||||
retorno = Extensiones.ModExtensiones.Encripta(retorno)
|
||||
Dim objrt = New WsBody With {
|
||||
.Datos = retorno,
|
||||
.IsFail = isFail,
|
||||
.FailStr = FailStr
|
||||
}
|
||||
'retorno = Newtonsoft.Json.JsonConvert.SerializeObject(objrt)
|
||||
Return objrt
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Class UserValidation
|
||||
Public Property CveUsuario As Integer
|
||||
Public Property Token As String
|
||||
Public Property Valida As Boolean
|
||||
Public Property Min As Integer
|
||||
|
||||
End Class
|
||||
Public Class WsBody
|
||||
Public Property Datos As String
|
||||
Public Property Metodo As String
|
||||
Public Property IsFail As Boolean
|
||||
Public Property FailStr As String
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -9,5 +9,6 @@ Public Class WebApiConfig
|
||||
config.EnableCors(Cors)
|
||||
config.MapHttpAttributeRoutes()
|
||||
config.Filters.Add(New Extensiones.BasicAuthenticationAttribute("sigfoxapiuser", "_$83965./54"))
|
||||
'config.Filters.Add(New WsUtility.SigAuthenticationAttribute())
|
||||
End Sub
|
||||
End Class
|
||||
@@ -3330,33 +3330,62 @@ Namespace Extensiones
|
||||
#Region "A T R I B U T O S"
|
||||
Public Class BasicAuthenticationAttribute
|
||||
Inherits AuthorizationFilterAttribute
|
||||
|
||||
Private Const SigfoxPath As String = "/api/sigfox"
|
||||
Private Const LoginPath As String = "/api/usuario/Login"
|
||||
Public Property Usuario As String
|
||||
Public Property Contra As String
|
||||
|
||||
Public Property Contra As String
|
||||
|
||||
Public Sub New()
|
||||
End Sub
|
||||
Public Sub New(Usuario As String, Contra As String)
|
||||
Me.Usuario = Usuario
|
||||
Me.Contra = Contra
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub OnAuthorization(ByVal actionContext As HttpActionContext)
|
||||
Dim authHeader = actionContext.Request.Headers.Authorization
|
||||
|
||||
Dim authHeader = actionContext.Request.Headers.Authorization
|
||||
Dim noautorizado As Boolean = True
|
||||
If authHeader IsNot Nothing Then
|
||||
Dim authenticationToken = actionContext.Request.Headers.Authorization.Parameter
|
||||
Dim decodedAuthenticationToken = Encoding.UTF8.GetString(Convert.FromBase64String(authenticationToken))
|
||||
Dim usernamePasswordArray = decodedAuthenticationToken.Split(":"c)
|
||||
Dim userName = usernamePasswordArray(0)
|
||||
Dim password = usernamePasswordArray(1)
|
||||
If Left(actionContext.Request.RequestUri.AbsolutePath, 11).ToUpper() = SigfoxPath.ToUpper() Then
|
||||
Dim usernamePasswordArray = Encoding.UTF8.GetString(Convert.FromBase64String(authHeader.Parameter)).Split(":"c)
|
||||
Dim userName = usernamePasswordArray(0)
|
||||
Dim password = usernamePasswordArray(1)
|
||||
noautorizado = Not (userName = Me.Usuario AndAlso password = Me.Contra)
|
||||
Else
|
||||
Try
|
||||
|
||||
If actionContext.Request.RequestUri.AbsolutePath.ToUpper() <> LoginPath.ToUpper() Then
|
||||
Dim dataArray = Extensiones.Decripta(authHeader.Parameter).Split("|"c)
|
||||
If dataArray.Length > 4 AndAlso IsNumeric(dataArray(0)) AndAlso IsNumeric(dataArray(1)) AndAlso IsNumeric(dataArray(4)) Then
|
||||
|
||||
Dim CveUsuario As Integer = dataArray(0).ToEntero()
|
||||
Dim Token As Integer = dataArray(1).ToEntero()
|
||||
Dim FechaPeticion As DateTime
|
||||
DateTime.TryParseExact(String.Format("{0} {1}", dataArray(2), dataArray(3)), "ddMMyyyy HHmm", New Globalization.CultureInfo("es-MX"), Globalization.DateTimeStyles.None, FechaPeticion)
|
||||
FechaPeticion = FechaPeticion.AddMinutes(Token)
|
||||
Dim CveEmpresa As Integer = dataArray(4).ToEntero()
|
||||
|
||||
Dim diferencia As Double = (FechaPeticion - DateTime.Now).TotalMinutes
|
||||
|
||||
diferencia = Math.Abs(diferencia)
|
||||
If diferencia < 5 Then 'si la fecha que me envía es de cuando menos hace cinco minuto, se permite accesar, para que no se copie ese parámetro y se esté recuperando información "medida de seguridad"
|
||||
noautorizado = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
noautorizado = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
noautorizado = True
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
Dim isValid = (userName = Me.Usuario AndAlso password = Me.Contra)
|
||||
|
||||
If isValid Then
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
|
||||
If noautorizado Then
|
||||
HandleUnathorized(actionContext)
|
||||
End If
|
||||
|
||||
HandleUnathorized(actionContext)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub HandleUnathorized(ByVal actionContext As HttpActionContext)
|
||||
|
||||
@@ -94,7 +94,9 @@
|
||||
<tr>
|
||||
<td>Altas:</td>
|
||||
<td>
|
||||
<asp:Label runat="server" ID="LbNumeroAltas" Width="80px"></asp:Label></td>
|
||||
<%--<asp:Label runat="server" ID="LbNumeroAltas" Width="80px"></asp:Label></td>--%>
|
||||
|
||||
<asp:LinkButton CssClass="Texto" style="font-weight:bold" runat="server" ID="LnkNumeroAltas" Width="80px" OnClick="LnkCabecera_Click" ></asp:LinkButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Interbancarias:</td>
|
||||
@@ -250,9 +252,7 @@
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink ID="HLImporte" Text='<%# Eval("Abonado", "{0:N2}") %>' Target="_blank" CssClass="Texto" runat="server" />
|
||||
</ItemTemplate>
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton ID="LnkCabeceraPendientes" runat="server" OnClick="LnkCabecera_Click" Text="" CssClass="Texto" ></asp:LinkButton>
|
||||
</HeaderTemplate>
|
||||
|
||||
</asp:TemplateField>
|
||||
<%--<asp:BoundField DataField="Abonado" HeaderText="Importe" DataFormatString="{0:N2}" />--%>
|
||||
</Columns>
|
||||
|
||||
@@ -290,7 +290,7 @@ Partial Class Bancos_PagoElectronicoGrupos
|
||||
End If
|
||||
Next
|
||||
|
||||
LbNumeroAltas.Text = Altas.ToString
|
||||
LnkNumeroAltas.Text = Altas.ToString
|
||||
LbNumeroInterbancarias.Text = Interbancarias.ToString
|
||||
LbNumeroBancomer.Text = Bancomer.ToString
|
||||
|
||||
@@ -404,11 +404,6 @@ Partial Class Bancos_PagoElectronicoGrupos
|
||||
|
||||
Protected Sub GvPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.Header Then
|
||||
|
||||
e.Row.FCLinkButton("LnkCabeceraPendientes").Text = LbNumeroAltas.Text
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2553,9 +2553,13 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
BtnIEGuardar.Enabled = False
|
||||
BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito"
|
||||
UpGuardar.Update()
|
||||
Else
|
||||
BtnIEGuardar.Enabled = True
|
||||
BtnIEGuardar.ToolTip = ""
|
||||
End If
|
||||
|
||||
UpGuardar.Update()
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="2.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net4" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="5.2.4" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.4" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.4" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.4" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
|
||||
|
||||
Reference in New Issue
Block a user