-- validar acceso al usuario.
This commit is contained in:
@@ -204,11 +204,11 @@ Public Class ClsSisEmpresas
|
||||
'Public Property PwdContPAQi As String
|
||||
#End Region
|
||||
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing, Optional NombreCadena As String = "Conexion")
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
|
||||
|
||||
If TransaccionCompartida Is Nothing Then
|
||||
SqlConexion = New SqlConnection
|
||||
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
|
||||
Try
|
||||
SqlConexion.Open()
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -248,18 +248,16 @@ Public Class ClsSisNotificaciones
|
||||
|
||||
#Region "V A L I D A - U S U A R I O"
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
564
App_Code/ClsSisUsuarioAutenticacion.vb
Normal file
564
App_Code/ClsSisUsuarioAutenticacion.vb
Normal file
@@ -0,0 +1,564 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports Extensiones
|
||||
Public Class ClsSisUsuarioAutenticacion
|
||||
Implements IDisposable
|
||||
|
||||
|
||||
#Region "Campos"
|
||||
|
||||
'SQL
|
||||
Private SqlConexion As SqlConnection
|
||||
Private SqlAdapter As SqlDataAdapter
|
||||
Private SqlTransacc As SqlTransaction
|
||||
Private SqlCommand As SqlCommand
|
||||
Private Data As DataTable
|
||||
|
||||
'Atributos de la clase
|
||||
|
||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
'PARA REGISTRAR CONEXION
|
||||
Private CveConexion As Integer = 0
|
||||
Private ConnStr As String = ""
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Propiedades"
|
||||
|
||||
Public ReadOnly Property DtResultados() As DataTable
|
||||
Get
|
||||
DtResultados = Data
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Public Property CveUsuario As Integer
|
||||
Public Property Usuario As String
|
||||
Public Property Nombre As String
|
||||
Public Property CveRol As Integer
|
||||
Public Property Correo As String
|
||||
Public Property CveSupervisa As Integer
|
||||
Public Property CveAutoriza As Integer
|
||||
Public Property CveEmpresa As Integer
|
||||
Public Property CveAlmacen As Integer
|
||||
Public Property CveEmpresaPredeterminada As Integer
|
||||
Public Property CvePersonal As Integer
|
||||
Public Property CveVendedor As Integer
|
||||
Public Property CveTipoDocumento As String
|
||||
Public Property Estado As Boolean
|
||||
Public Property Fecha As DateTime
|
||||
Public Property Registro As Integer
|
||||
Public Property UsuarioCreo As String
|
||||
Public Property Contraseña As String
|
||||
Public Property EsLogIn As Integer
|
||||
Public Property FechaUltimoAcceso As Date
|
||||
Public Property FechaUltimoCambioContraseña As Date
|
||||
Public Property PolCambiarContraseña As Boolean
|
||||
Public Property TipoControl As Integer
|
||||
Public Property CveSubProyecto As Integer
|
||||
Public Property AsignarAutomaticamenteSubProyecto As Boolean
|
||||
Public Property AsignarAutomaticamenteOC As Boolean
|
||||
Public Property DescuentoAutorizado As Double
|
||||
#End Region
|
||||
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing, Optional NombreCadena As String = "Conexion")
|
||||
|
||||
If TransaccionCompartida Is Nothing Then
|
||||
SqlConexion = New SqlConnection
|
||||
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
ConnStr = ConfigurationManager.ConnectionStrings(NombreCadena).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
|
||||
End If
|
||||
|
||||
SqlCommand = New SqlCommand("", SqlConexion)
|
||||
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
||||
ConexionAdd()
|
||||
End Sub
|
||||
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand
|
||||
.Parameters.Clear()
|
||||
.CommandText = StrSQL
|
||||
.CommandType = TipoComando
|
||||
End With
|
||||
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||
Data = New DataTable
|
||||
End Sub
|
||||
#Region "Conexiones"
|
||||
|
||||
Private Sub ConexionAdd()
|
||||
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||
|
||||
Try
|
||||
'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
|
||||
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
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ConexionClose()
|
||||
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||
|
||||
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
CveConexion = 0
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||
With SqlCommand
|
||||
.Parameters.Clear()
|
||||
.CommandText = pStrSQL
|
||||
.CommandType = TipoComando
|
||||
End With
|
||||
|
||||
If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc
|
||||
|
||||
End Sub
|
||||
Public Function IniciaTransacSQL() As SqlTransaction
|
||||
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
||||
Return SqlTransacc
|
||||
End Function
|
||||
Public Sub RollBack()
|
||||
If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback()
|
||||
SqlTransacc = Nothing
|
||||
End Sub
|
||||
Public Sub Commit()
|
||||
If SqlTransacc IsNot Nothing Then SqlTransacc.Commit()
|
||||
SqlTransacc = Nothing
|
||||
End Sub
|
||||
|
||||
Public Function UsuariosGetTokenXEquipo(CveUsuario As Integer, CveUsuarioAutoriza As Integer, AdsCodex As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Sis_UsuariosGetTokenXEquipo")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveUsuarioAutoriza", SqlDbType.Int).Value = CveUsuarioAutoriza
|
||||
.Add("@AdsCodex", SqlDbType.VarChar).Value = AdsCodex
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
'If Data.Rows.Count > 0 Then
|
||||
' = Data.Rows(0)("Token").ToString()
|
||||
'End If
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al guardar token por equipo.", ex)
|
||||
Retorno = False
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetModulosUsuariosPlataforma(CveUsuario As Integer, CvePlataforma As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("SELECT M.* FROM [dbo].[UsuariosModulos] UM INNER JOIN Modulos M ON M.CveModulo=UM.CveModulo WHERE M.CvePlataforma =@CvePlataforma AND @CveUsuario = UM .CveUsuario AND UM.Permitir =1", CommandType.Text)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CvePlataforma", SqlDbType.Int).Value = CvePlataforma
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al obtener el menu.", ex)
|
||||
Retorno = False
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function ValidaUsuario(Usuario As String, Password As String, Optional CveEmpresa As Integer = -1, Optional GrupoEmpresa As String = "", Optional GenerarMenu As Boolean = True) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
DataAdapter("PA_Sis_UsuarioValidacionGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@GrupoEmpresa", SqlDbType.VarChar).Value = GrupoEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.Acceso = Data.Rows(0)("Acceso").ToString().ToEntero()
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero()
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString()
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString()
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString().ToEntero()
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString()
|
||||
|
||||
If CveEmpresa > 0 Then Retorno.CveEmpresa = CveEmpresa Else Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero()
|
||||
Retorno.CvePlataforma = Data.Rows(0)("CvePlataforma").ToString().ToEntero()
|
||||
|
||||
Retorno.FechaUltimoAcceso = Data.Rows(0)("FechaUltimoAcceso").ToString().ToDate()
|
||||
Retorno.FechaUltimoCambioContraseña = Data.Rows(0)("FechaUltimoCambioContraseña").ToString().ToDate()
|
||||
Retorno.ActCambiarContraseña = If(Data.Rows(0)("ActCambiarContraseña").ToString() = "SI", True, False)
|
||||
Retorno.TipoControl = Data.Rows(0)("TipoControl").ToString().ToEntero()
|
||||
'*
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
Retorno.EsSupervisorRH = CBool(Data.Rows(0)("EsSupervisorRH").ToString())
|
||||
|
||||
Retorno.CveCliente = Data.Rows(0)("CveCliente").ToString().ToEntero()
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
|
||||
Retorno.NombreAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString()
|
||||
Retorno.DescuentoAutorizado = Data.Rows(0)("DescuentoAutorizado").ToString().ToDouble()
|
||||
|
||||
Retorno.PorcentajeMaximoAutorizacion = Data.Rows(0)("PorcentajeMaximoAutorizacion").ToString().ToDecimal()
|
||||
Retorno.DiasMaximoAutorizacion = Data.Rows(0)("DiasMaximoAutorizacion").ToString().ToEntero()
|
||||
|
||||
Retorno.CodigoAutorizado = Data.Rows(0)("CodigoAutorizado").ToString()
|
||||
Dim autoip As String = Data.Rows(0)("AutorizadoxIP").ToString().ToUpper()
|
||||
Retorno.AutorizadoxIP = (autoip = "1" OrElse autoip = "TRUE")
|
||||
Retorno.RutaDB = ConnStr
|
||||
|
||||
' Esto es parta el punto de venta
|
||||
Retorno.CveSucursal = Data.Rows(0)("CveSubProyecto").ToString().ToEntero
|
||||
|
||||
Dim ObjUsr As New ClsSisUsuarios(UsuarioActual:=Retorno)
|
||||
|
||||
'cargo los modulos del usuario y genero el menú
|
||||
Dim dttmp As DataTable = ObjUsr.GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveEmpresa)
|
||||
If GenerarMenu Then GeneraMenu(Retorno.CveUsuario, dttmp, Retorno.CvePlataforma)
|
||||
|
||||
Dim UsuariosModulos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
|
||||
Next
|
||||
Retorno.Modulos = UsuariosModulos
|
||||
'cargo los procesos del usuario
|
||||
dttmp = ObjUsr.GetUsuariosRolesProcesos(Retorno.CveUsuario)
|
||||
Dim UsuariosProcesos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
|
||||
Next
|
||||
Retorno.Procesos = UsuariosProcesos
|
||||
|
||||
Dim UsuariosIndicadores As New HybridDictionary
|
||||
Dim dTableIndicadores As DataTable = ObjUsr.getUsuarioIndicadores(Retorno.CveUsuario, Retorno.CveEmpresa, Retorno.CveRol)
|
||||
|
||||
|
||||
For Each Row As DataRow In dTableIndicadores.Rows
|
||||
UsuariosIndicadores.Add(Convert.ToInt32(Row("CveIndicador")), Row("Indicador").ToString)
|
||||
Next
|
||||
Retorno.Indicadores = UsuariosIndicadores
|
||||
|
||||
If ObjUsr.GetUsuariosDetalleAsignaciones(Retorno.CveUsuario, If(CveEmpresa = -1, Retorno.CveEmpresa, CveEmpresa)) Then
|
||||
Dim drt As DataRow = ObjUsr.DtResultados.FiltroPrimero("")
|
||||
Retorno.CveSubProyecto = drt("CveSucursal").ToString.ToEntero
|
||||
Retorno.CveVendedor = drt("CveVendedor").ToString.ToEntero
|
||||
Retorno.CvePersonal = drt("CvePersonal").ToString.ToEntero
|
||||
Retorno.CveAlmacen = drt("CveAlmacen").ToString.ToEntero
|
||||
Retorno.CveTipoDocumento = drt("CveTipoDocumento").ToString
|
||||
Else
|
||||
Retorno.CveSubProyecto = -1
|
||||
Retorno.CveVendedor = -1
|
||||
Retorno.CvePersonal = -1
|
||||
Retorno.CveAlmacen = -1
|
||||
Retorno.CveTipoDocumento = "-1"
|
||||
End If
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas(UsuarioActual:=Retorno)
|
||||
If ObjEmpresa.GetEmpresas(Retorno.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(Retorno.CveEmpresa) Then
|
||||
Dim dttmp2 As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
For Each Row As Data.DataRow In dttmp2.Rows
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
Next
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
End If
|
||||
Retorno.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
|
||||
If ObjUsr.GetUsuariosEmpresas(Retorno.CveUsuario, -1) Then
|
||||
Dim dt As Data.DataTable = ObjUsr.DtResultados
|
||||
If dt IsNot Nothing Then
|
||||
If dt.Rows.Count >= 1 Then
|
||||
If dt.Rows.Count > 1 Then
|
||||
Retorno.MultipleEmpresa = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
dt.Dispose()
|
||||
End If
|
||||
Retorno.ListaPersonalizacion = ObjUsr.CargaPersonalizacionUsuario(Retorno.CveUsuario)
|
||||
ObjUsr.Dispose()
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetUsuarioDetalle(CveUsuario As Integer, Optional CveEmpresa As Integer = -1) As Usuario
|
||||
|
||||
Dim Retorno As Usuario = Nothing
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = "-1"
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = "-1"
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 0
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.Acceso = Data.Rows(0)("Acceso").ToString().ToEntero()
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero()
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString()
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString()
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString().ToEntero()
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString()
|
||||
|
||||
If CveEmpresa > 0 Then Retorno.CveEmpresa = CveEmpresa Else Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero()
|
||||
Retorno.CvePlataforma = Data.Rows(0)("CvePlataforma").ToString().ToEntero()
|
||||
|
||||
Retorno.FechaUltimoAcceso = Data.Rows(0)("FechaUltimoAcceso").ToString().ToDate()
|
||||
Retorno.FechaUltimoCambioContraseña = Data.Rows(0)("FechaUltimoCambioContraseña").ToString().ToDate()
|
||||
Retorno.ActCambiarContraseña = If(Data.Rows(0)("ActCambiarContraseña").ToString() = "SI", True, False)
|
||||
Retorno.TipoControl = Data.Rows(0)("TipoControl").ToString().ToEntero()
|
||||
'*
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
Retorno.EsSupervisorRH = CBool(Data.Rows(0)("EsSupervisorRH").ToString())
|
||||
|
||||
Retorno.CveCliente = Data.Rows(0)("CveCliente").ToString().ToEntero()
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
|
||||
Retorno.NombreAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString()
|
||||
Retorno.DescuentoAutorizado = Data.Rows(0)("DescuentoAutorizado").ToString().ToDouble()
|
||||
|
||||
Retorno.PorcentajeMaximoAutorizacion = Data.Rows(0)("PorcentajeMaximoAutorizacion").ToString().ToDecimal()
|
||||
Retorno.DiasMaximoAutorizacion = Data.Rows(0)("DiasMaximoAutorizacion").ToString().ToEntero()
|
||||
|
||||
Retorno.CodigoAutorizado = Data.Rows(0)("CodigoAutorizado").ToString()
|
||||
Dim autoip As String = Data.Rows(0)("AutorizadoxIP").ToString().ToUpper()
|
||||
Retorno.AutorizadoxIP = (autoip = "1" OrElse autoip = "TRUE")
|
||||
Retorno.RutaDB = ConnStr
|
||||
|
||||
' Esto es parta el punto de venta
|
||||
Retorno.CveSucursal = Data.Rows(0)("CveSubProyecto").ToString().ToEntero
|
||||
Dim ObjEmpresa As New ClsSisEmpresas(UsuarioActual:=Retorno)
|
||||
If ObjEmpresa.GetEmpresas(Retorno.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(Retorno.CveEmpresa) Then
|
||||
Dim dttmp2 As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
For Each Row As Data.DataRow In dttmp2.Rows
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
Next
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
End If
|
||||
Retorno.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Consultar Usuarios.", ex)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
'Public Function ValidaUsuarioAsignacion(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
' Dim Retorno As Usuario = Nothing
|
||||
|
||||
' DataAdapter("PA_Sis_UsuariosAsignacionesGet")
|
||||
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
|
||||
' End With
|
||||
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' If Data.Rows.Count > 0 Then
|
||||
' Retorno = New Usuario
|
||||
|
||||
' Try
|
||||
' Retorno.CveSubProyecto = Data.Rows(0)("CveSucursal").ToString.ToEntero
|
||||
' Catch ex As Exception
|
||||
' Retorno.CveSubProyecto = -1
|
||||
' End Try
|
||||
|
||||
' Retorno.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero
|
||||
' Retorno.CvePersonal = Data.Rows(0)("CvePersonal").ToString.ToEntero
|
||||
' Retorno.CveAlmacen = Data.Rows(0)("CveAlmacen").ToString.ToEntero
|
||||
' End If
|
||||
' Catch ex As SqlException
|
||||
' OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
' Retorno = Nothing
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
|
||||
'Public Function ValidaUsuarioWs(Usuario As String, Password As String, tIMEI As String) As Usuario
|
||||
' Dim Retorno As Usuario = Nothing
|
||||
|
||||
' DataAdapter("PA_Sis_UsuariosGet")
|
||||
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
' .Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
' .Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
' .Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
' .Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
' End With
|
||||
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
|
||||
' Catch ex As SqlException
|
||||
' OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
' Retorno = Nothing
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
'Public Function ValidaUsuarioAppGPS(Usuario As String, Password As String, tIMEI As String) As Usuario
|
||||
' Dim Retorno As Usuario = Nothing
|
||||
|
||||
' DataAdapter("PA_Sis_UsuariosAppGet")
|
||||
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
' .Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
' .Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
' .Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
' .Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
' End With
|
||||
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' If Data.Rows.Count > 0 Then
|
||||
' Retorno = New Usuario
|
||||
|
||||
' Retorno.Acceso = Data.Rows(0)("Acceso").ToString.ToEntero
|
||||
' Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
' Retorno.Usuario = Usuario
|
||||
' Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
|
||||
' Retorno.Nombre = Data.Rows(0)("Nombre").ToString
|
||||
' Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
|
||||
' Retorno.Rol = Data.Rows(0)("Rol").ToString
|
||||
' Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
' Try
|
||||
' Retorno.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
' Catch ex As Exception
|
||||
' Retorno.CveSubProyecto = -1
|
||||
' End Try
|
||||
' Retorno.FechaUltimoAcceso = Data.Rows(0)("FechaUltimoAcceso").ToString.ToDate
|
||||
' Retorno.FechaUltimoCambioContraseña = Data.Rows(0)("FechaUltimoCambioContraseña").ToString.ToDate
|
||||
' Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero
|
||||
' Retorno.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero
|
||||
' Retorno.CveCliente = Data.Rows(0)("CveCliente").ToString.ToEntero
|
||||
' Retorno.NombreAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString
|
||||
' End If
|
||||
|
||||
' Catch ex As SqlException
|
||||
' OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
' Retorno = Nothing
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
|
||||
|
||||
|
||||
Private Function GeneraMenu(CveUsuario As Integer, dtMenu As DataTable, Optional CvePlataforma As Integer = 1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
dtMenu.TableName = "UsuariosModulos"
|
||||
|
||||
Try
|
||||
Dim Carpeta As String = ""
|
||||
|
||||
'GPS
|
||||
Carpeta = $"{AppDomain.CurrentDomain.BaseDirectory}/Menu/GPS"
|
||||
Carpeta.DirectoryExistsCreate
|
||||
dtMenu.FiltraParametros("CvePlataforma = 3").WriteXml($"{Carpeta}/{CveUsuario}.xml", XmlWriteMode.WriteSchema)
|
||||
|
||||
Carpeta = $"{AppDomain.CurrentDomain.BaseDirectory}/Menu/ERP"
|
||||
Carpeta.DirectoryExistsCreate
|
||||
Select Case CvePlataforma
|
||||
Case 6, 7
|
||||
dtMenu.FiltraParametros($"CvePlataforma = {CvePlataforma}").WriteXml($"{Carpeta}/{CveUsuario}.xml", XmlWriteMode.WriteSchema)
|
||||
Case Else
|
||||
dtMenu.FiltraParametros("CvePlataforma = 1").WriteXml($"{Carpeta}/{CveUsuario}.xml", XmlWriteMode.WriteSchema)
|
||||
End Select
|
||||
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el menú del usuario.", ex)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
#Region "IDisposable Support"
|
||||
Protected Overridable Sub Dispose(disposing As Boolean)
|
||||
If Not Me.disposedValue Then
|
||||
If disposing Then
|
||||
|
||||
|
||||
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||
If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
||||
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
|
||||
|
||||
End If
|
||||
End If
|
||||
Me.disposedValue = True
|
||||
End Sub
|
||||
Public Sub Dispose() Implements IDisposable.Dispose
|
||||
ConexionClose()
|
||||
Dispose(True)
|
||||
GC.SuppressFinalize(Me)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
@@ -64,12 +64,14 @@ Public Class ClsSisUsuarios
|
||||
Public Property DescuentoAutorizado As Double
|
||||
#End Region
|
||||
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing, Optional NombreCadena As String = "Conexion")
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
|
||||
|
||||
If TransaccionCompartida Is Nothing Then
|
||||
SqlConexion = New SqlConnection
|
||||
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
ConnStr = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
|
||||
|
||||
'SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
'ConnStr = ConfigurationManager.ConnectionStrings(NombreCadena).ConnectionString
|
||||
Try
|
||||
SqlConexion.Open()
|
||||
Catch ex As Exception
|
||||
@@ -153,7 +155,29 @@ Public Class ClsSisUsuarios
|
||||
If SqlTransacc IsNot Nothing Then SqlTransacc.Commit()
|
||||
SqlTransacc = Nothing
|
||||
End Sub
|
||||
Public Function ValidaUsuarioCodigoAcceso(CodigoAcceso As String, CveEmpresa As Integer) As Integer
|
||||
Dim Retorno As Integer = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosCodigoAccesoGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un error al obtener el usuario.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UsuariosGetTokenXEquipo(CveUsuario As Integer, CveUsuarioAutoriza As Integer, AdsCodex As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Sis_UsuariosGetTokenXEquipo")
|
||||
@@ -191,136 +215,15 @@ Public Class ClsSisUsuarios
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function ValidaUsuario(Usuario As String, Password As String, Optional CveEmpresa As Integer = -1, Optional GrupoEmpresa As String = "", Optional GenerarMenu As Boolean = True) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
DataAdapter("PA_Sis_UsuarioValidacionGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@GrupoEmpresa", SqlDbType.VarChar).Value = GrupoEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.Acceso = Data.Rows(0)("Acceso").ToString().ToEntero()
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero()
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString()
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString()
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString().ToEntero()
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString()
|
||||
|
||||
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero()
|
||||
Retorno.CvePlataforma = Data.Rows(0)("CvePlataforma").ToString().ToEntero()
|
||||
|
||||
Retorno.FechaUltimoAcceso = Data.Rows(0)("FechaUltimoAcceso").ToString().ToDate()
|
||||
Retorno.FechaUltimoCambioContraseña = Data.Rows(0)("FechaUltimoCambioContraseña").ToString().ToDate()
|
||||
Retorno.ActCambiarContraseña = If(Data.Rows(0)("ActCambiarContraseña").ToString() = "SI", True, False)
|
||||
Retorno.TipoControl = Data.Rows(0)("TipoControl").ToString().ToEntero()
|
||||
'*
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
Retorno.EsSupervisorRH = CBool(Data.Rows(0)("EsSupervisorRH").ToString())
|
||||
|
||||
Retorno.CveCliente = Data.Rows(0)("CveCliente").ToString().ToEntero()
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
|
||||
Retorno.NombreAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString()
|
||||
Retorno.DescuentoAutorizado = Data.Rows(0)("DescuentoAutorizado").ToString().ToDouble()
|
||||
|
||||
Retorno.PorcentajeMaximoAutorizacion = Data.Rows(0)("PorcentajeMaximoAutorizacion").ToString().ToDecimal()
|
||||
Retorno.DiasMaximoAutorizacion = Data.Rows(0)("DiasMaximoAutorizacion").ToString().ToEntero()
|
||||
|
||||
Retorno.CodigoAutorizado = Data.Rows(0)("CodigoAutorizado").ToString()
|
||||
Dim autoip As String = Data.Rows(0)("AutorizadoxIP").ToString().ToUpper()
|
||||
Retorno.AutorizadoxIP = (autoip = "1" OrElse autoip = "TRUE")
|
||||
Retorno.RutaDB = ConnStr
|
||||
|
||||
' Esto es parta el punto de venta
|
||||
Retorno.CveSucursal = Data.Rows(0)("CveSubProyecto").ToString().ToEntero
|
||||
|
||||
''Toma la primer letra de cada nombre
|
||||
'Dim sbr As New StringBuilder
|
||||
'For Each St As String In Retorno.Nombre.Split(" "c)
|
||||
' sbr.AppendFormat("{0}.", St.Substring(0, 1))
|
||||
'Next
|
||||
'Retorno.NombreIniciales = sbr.ToString
|
||||
'sbr.Clear()
|
||||
'Retorno.Liga = Data.Rows(0)("Liga" ).ToString
|
||||
|
||||
'cargo los modulos del usuario y genero el menú
|
||||
Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveEmpresa)
|
||||
If GenerarMenu Then GeneraMenu(Retorno.CveUsuario, dttmp, Retorno.CvePlataforma)
|
||||
|
||||
Dim UsuariosModulos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
|
||||
Next
|
||||
Retorno.Modulos = UsuariosModulos
|
||||
'cargo los procesos del usuario
|
||||
dttmp = GetUsuariosRolesProcesos(Retorno.CveUsuario)
|
||||
Dim UsuariosProcesos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
|
||||
Next
|
||||
Retorno.Procesos = UsuariosProcesos
|
||||
|
||||
Dim UsuariosIndicadores As New HybridDictionary
|
||||
Dim dTableIndicadores As DataTable = getUsuarioIndicadores(Retorno.CveUsuario, Retorno.CveEmpresa, Retorno.CveRol)
|
||||
|
||||
|
||||
For Each Row As DataRow In dTableIndicadores.Rows
|
||||
UsuariosIndicadores.Add(Convert.ToInt32(Row("CveIndicador")), Row("Indicador").ToString)
|
||||
Next
|
||||
Retorno.Indicadores = UsuariosIndicadores
|
||||
|
||||
If GetUsuariosDetalleAsignaciones(Retorno.CveUsuario, If(CveEmpresa = -1, Retorno.CveEmpresa, CveEmpresa)) Then
|
||||
Try
|
||||
Retorno.CveSubProyecto = Data.Rows(0)("CveSucursal").ToString.ToEntero
|
||||
Catch ex As Exception
|
||||
Retorno.CveSubProyecto = -1
|
||||
End Try
|
||||
|
||||
Retorno.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero
|
||||
Retorno.CvePersonal = Data.Rows(0)("CvePersonal").ToString.ToEntero
|
||||
Retorno.CveAlmacen = Data.Rows(0)("CveAlmacen").ToString.ToEntero
|
||||
Retorno.CveTipoDocumento = Data.Rows(0)("CveTipoDocumento").ToString
|
||||
Else
|
||||
Retorno.CveSubProyecto = -1
|
||||
Retorno.CveVendedor = -1
|
||||
Retorno.CvePersonal = -1
|
||||
Retorno.CveAlmacen = -1
|
||||
Retorno.CveTipoDocumento = "-1"
|
||||
End If
|
||||
|
||||
Retorno.ListaPersonalizacion = CargaPersonalizacionUsuario(Retorno.CveUsuario)
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function CargaPersonalizacionUsuario(CveUsuarioParamerto As Integer) As Hashtable
|
||||
|
||||
Dim Retorno As New Hashtable
|
||||
If GetUsuariosPersonalizaciones(CveUsuarioParamerto) Then
|
||||
|
||||
For Each drow As DataRow In Data.Rows
|
||||
Retorno.Add(drow("PersonalizacionNombre").ToString, drow("PersonalizacionValor").ToString)
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioAsignacion(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
@@ -357,214 +260,6 @@ Public Class ClsSisUsuarios
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioWs(Usuario As String, Password As String, tIMEI As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function ValidaUsuarioAppGPS(Usuario As String, Password As String, tIMEI As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosAppGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.Acceso = Data.Rows(0)("Acceso").ToString.ToEntero
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString
|
||||
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
Try
|
||||
Retorno.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
Catch ex As Exception
|
||||
Retorno.CveSubProyecto = -1
|
||||
End Try
|
||||
Retorno.FechaUltimoAcceso = Data.Rows(0)("FechaUltimoAcceso").ToString.ToDate
|
||||
Retorno.FechaUltimoCambioContraseña = Data.Rows(0)("FechaUltimoCambioContraseña").ToString.ToDate
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero
|
||||
Retorno.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero
|
||||
Retorno.CveCliente = Data.Rows(0)("CveCliente").ToString.ToEntero
|
||||
Retorno.NombreAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioCodigoAcceso(CodigoAcceso As String, CveEmpresa As Integer) As Integer
|
||||
Dim Retorno As Integer = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosCodigoAccesoGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un error al obtener el usuario.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function ValidaUsuarioPortalCliente(CveCliente As Integer, Usuario As String, Password As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString
|
||||
'Retorno.NombreEmpresa = Data.Rows(0)("Empresa").ToString
|
||||
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
Retorno.CveCliente = CveCliente
|
||||
Retorno.ClienteGPS = False
|
||||
Retorno.Portal = True
|
||||
Retorno.Referencia = Data.Rows(0)("Referencia").ToString
|
||||
Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False)
|
||||
Retorno.RutaDB = ConnStr
|
||||
'cargo los modulos del usuario y genero el menú
|
||||
Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveCliente)
|
||||
|
||||
Dim UsuariosModulos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
|
||||
Next
|
||||
Retorno.Modulos = UsuariosModulos
|
||||
''cargo los procesos del usuario
|
||||
dttmp = GetUsuariosRolesProcesos(Retorno.CveUsuario)
|
||||
Dim UsuariosProcesos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
|
||||
Next
|
||||
Retorno.Procesos = UsuariosProcesos
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioPortalProveedor(CveProveedor As Integer, Usuario As String, Password As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString
|
||||
'Retorno.NombreEmpresa = Data.Rows(0)("Empresa").ToString
|
||||
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
Retorno.CveProveedor = CveProveedor
|
||||
Retorno.ClienteGPS = False
|
||||
Retorno.Portal = True
|
||||
Retorno.Referencia = Data.Rows(0)("Referencia").ToString
|
||||
Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False)
|
||||
Retorno.RutaDB = ConnStr
|
||||
'cargo los modulos del usuario y genero el menú
|
||||
Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveProveedor)
|
||||
|
||||
Dim UsuariosModulos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
|
||||
Next
|
||||
|
||||
Retorno.Modulos = UsuariosModulos
|
||||
''cargo los procesos del usuario
|
||||
dttmp = GetUsuariosRolesProcesos(Retorno.CveUsuario)
|
||||
Dim UsuariosProcesos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
|
||||
Next
|
||||
Retorno.Procesos = UsuariosProcesos
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
#Region "U S U A R I O - I N D I C A D O R E S"
|
||||
Public Function getUsuarioIndicadores(_CveUsuario As Integer, _CveEmpresa As Integer, _CveRol As Integer) As DataTable
|
||||
@@ -2620,170 +2315,6 @@ Public Class ClsSisUsuarios
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function ValidaUsuarioGPS2(Clave As String, Usuario As String, Password As String) As Usuario
|
||||
Dim Retorno As Usuario = Nothing
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@CveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@Usuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@Contraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@EsLogIn", SqlDbType.Bit).Value = 1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If Data.Rows.Count > 0 Then
|
||||
Retorno = New Usuario
|
||||
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString.ToEntero
|
||||
Retorno.Rol = Data.Rows(0)("Rol").ToString
|
||||
'Retorno.NombreEmpresa = Data.Rows(0)("Empresa").ToString
|
||||
Retorno.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
Retorno.CveCliente = Clave.ToEntero
|
||||
Retorno.ClienteGPS = True
|
||||
Retorno.Referencia = Data.Rows(0)("Referencia").ToString
|
||||
Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False)
|
||||
'Retorno.Liga = Data.Rows(0)("Liga").ToString
|
||||
'cargo los modulos del usuario y genero el menú
|
||||
Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveCliente)
|
||||
GeneraMenuGPS(Retorno.CveUsuario, dttmp)
|
||||
Dim UsuariosModulos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosModulos.Add(Convert.ToInt32(Row("CveModulo")), Row("CveModulo").ToString)
|
||||
Next
|
||||
Retorno.Modulos = UsuariosModulos
|
||||
''cargo los procesos del usuario
|
||||
dttmp = GetUsuariosRolesProcesos(Retorno.CveUsuario)
|
||||
Dim UsuariosProcesos As New HybridDictionary
|
||||
For Each Row As DataRow In dttmp.Rows
|
||||
UsuariosProcesos.Add(Convert.ToInt32(Row("CveProceso")), Row("CveProceso").ToString)
|
||||
Next
|
||||
Retorno.Procesos = UsuariosProcesos
|
||||
End If
|
||||
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetUsuarioGPS(Clave As String, Usuario As String, Password As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Sis_UsuariosPortalGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@pCveUsuario", SqlDbType.Int).Value = -1
|
||||
.Add("@pCveRol", SqlDbType.Int).Value = 1200
|
||||
.Add("@pCveClave", SqlDbType.VarChar).Value = Clave
|
||||
.Add("@pUsuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@pContraseña", SqlDbType.VarChar).Value = Password
|
||||
.Add("@pEsLogIn", SqlDbType.Bit).Value = 1
|
||||
.Add("@pCveCliente", SqlDbType.Int).Value = -1
|
||||
.Add("@pCveProveedor", SqlDbType.Int).Value = -1
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Iniciar Acceso a Sitio.", ex)
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetUsuariosPortalGPS(pCveUsuarioPortal As Integer, pCveCliente As Integer, pCveProveedor As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosPortalGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@pCveUsuario", SqlDbType.Int).Value = pCveUsuarioPortal
|
||||
.Add("@pCveRol", SqlDbType.Int).Value = -1
|
||||
.Add("@pCveClave", SqlDbType.VarChar).Value = -1
|
||||
.Add("@pUsuario", SqlDbType.VarChar).Value = "-1"
|
||||
.Add("@pContraseña", SqlDbType.VarChar).Value = "-1"
|
||||
.Add("@pEsLogIn", SqlDbType.Bit).Value = 0
|
||||
.Add("@pCveCliente", SqlDbType.Int).Value = pCveCliente
|
||||
.Add("@pCveProveedor", SqlDbType.Int).Value = pCveProveedor
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrio un error al Consultar los usuarios.", ex)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Public Function UpdateUsuarioPortalGPS(Usuario As String, Nombre As String, Correo As String,
|
||||
pPermiso1 As Boolean, pPermiso2 As Boolean, pPermiso3 As Boolean, pPermiso4 As Boolean, pPermiso5 As Boolean,
|
||||
pPermiso6 As Boolean, pPermiso7 As Boolean, pPermiso8 As Boolean, pPermiso9 As Boolean, pPermiso10 As Boolean,
|
||||
Activo As Boolean, pContrasenia As String, pCveCliente As Integer, pCveProveedor As Integer, CveUsuarioPortal As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosPortalUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@pUsuario", SqlDbType.VarChar).Value = Usuario
|
||||
.Add("@pNombre", SqlDbType.VarChar).Value = Nombre
|
||||
.Add("@pCorreo", SqlDbType.VarChar).Value = Correo
|
||||
.Add("@pPermiso1", SqlDbType.Bit).Value = If(pPermiso1, 1, 0)
|
||||
.Add("@pPermiso2", SqlDbType.Bit).Value = If(pPermiso2, 1, 0)
|
||||
.Add("@pPermiso3", SqlDbType.Bit).Value = If(pPermiso3, 1, 0)
|
||||
.Add("@pPermiso4", SqlDbType.Bit).Value = If(pPermiso4, 1, 0)
|
||||
.Add("@pPermiso5", SqlDbType.Bit).Value = If(pPermiso5, 1, 0)
|
||||
.Add("@pPermiso6", SqlDbType.Bit).Value = If(pPermiso6, 1, 0)
|
||||
.Add("@pPermiso7", SqlDbType.Bit).Value = If(pPermiso7, 1, 0)
|
||||
.Add("@pPermiso8", SqlDbType.Bit).Value = If(pPermiso8, 1, 0)
|
||||
.Add("@pPermiso9", SqlDbType.Bit).Value = If(pPermiso9, 1, 0)
|
||||
.Add("@pPermiso10", SqlDbType.Bit).Value = If(pPermiso10, 1, 0)
|
||||
.Add("@pEstatus", SqlDbType.Bit).Value = If(Activo, 1, 0)
|
||||
.Add("@pContrasenia", SqlDbType.VarChar).Value = pContrasenia
|
||||
.Add("@pCveCliente", SqlDbType.Int).Value = pCveCliente
|
||||
.Add("@pCveProveedor", SqlDbType.Int).Value = pCveProveedor
|
||||
.Add("@pCveUsuarioPortal", SqlDbType.Int).Value = CveUsuarioPortal
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al modificar el usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveUsuarioPortalGPS(CveUsuario As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Sis_UsuariosPortalRemove")
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@pCveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Function GeneraMenuGPS(CveUsuario As Integer, dtMenu As DataTable) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
dtMenu = dtMenu.FiltraParametros("CvePlataforma = 3")
|
||||
|
||||
@@ -3723,7 +3723,6 @@ Public Class ClsVentas
|
||||
If CveVentas IsNot Nothing Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ObjCancelacion As New Timbrado
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario = Nothing
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
|
||||
@@ -3733,7 +3732,6 @@ Public Class ClsVentas
|
||||
Dim RFCReceptor As String = "-1"
|
||||
Dim Nombre As String = "-1"
|
||||
Dim DbRowVenta As DataRow
|
||||
Dim CveUsuario As Integer = -1
|
||||
Dim pCveEmpresa As Integer = -1
|
||||
Dim Contraseña As String = "-1"
|
||||
|
||||
@@ -3745,32 +3743,30 @@ Public Class ClsVentas
|
||||
CveEstatus = DbRowVenta("CveEstatusFactura").ToString.ToEntero
|
||||
Total = DbRowVenta("Total").ToString.ToDecimal
|
||||
RFCReceptor = DbRowVenta("ClienteRFC").ToString
|
||||
CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero
|
||||
'CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero
|
||||
pCveEmpresa = DbRowVenta("CveEmpresa").ToString.ToEntero
|
||||
Nombre = DbRowVenta("Nombre").ToString
|
||||
|
||||
If ObjUsuario.GetUsuarios(CveUsuario, -1, -1) Then
|
||||
Contraseña = ObjUsuario.DtResultados.Rows(0)("Contraseña").ToString
|
||||
Else
|
||||
CveVentasError.Add(PCveVenta.ToEntero)
|
||||
Continue For
|
||||
End If
|
||||
Usuario = ObjUsuario.ValidaUsuario(Nombre, Contraseña)
|
||||
'If ObjUsuario.GetUsuarios(CveUsuario, -1, -1) Then
|
||||
' Contraseña = ObjUsuario.DtResultados.Rows(0)("Contraseña").ToString
|
||||
'Else
|
||||
' CveVentasError.Add(PCveVenta.ToEntero)
|
||||
' Continue For
|
||||
'End If
|
||||
'Usuario = ObjUsuario.ValidaUsuario(Nombre, Contraseña)
|
||||
|
||||
If Not ObjEmpresa.GetEmpresas(pCveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
|
||||
If ObjEmpresa.GetEmpresas(pCveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
Usuario.Empresa = ObjEmpresa.Empresa
|
||||
Usuario.CveEmpresa = ObjEmpresa.Empresa.CveEmpresa
|
||||
Else
|
||||
CveVentasError.Add(PCveVenta.ToEntero)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
'SOLO SI ESTA CANCELADA ANTE SAT EN SIG SE INTENTARA CANCELAR DE NUEVO CONTRA EL SAT
|
||||
If CveEstatus = 5 Then
|
||||
Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC)
|
||||
Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(ObjEmpresa.Empresa, FolioFiscal, Total, RFCReceptor, ObjEmpresa.Empresa.RFC)
|
||||
If Resp.Verificado Then
|
||||
|
||||
If Not ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, ClsPaginas.NowADS(), PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
|
||||
If Not ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, ClsPaginas.NowADS(), PCveVenta.ToEntero, -1, CvePAC:=ObjEmpresa.Empresa.CvePAC) Then
|
||||
CveVentasError.Add(PCveVenta.ToEntero)
|
||||
End If
|
||||
Else
|
||||
@@ -3783,7 +3779,6 @@ Public Class ClsVentas
|
||||
Next
|
||||
|
||||
ObjVentas.Dispose()
|
||||
ObjUsuario.Dispose()
|
||||
ObjEmpresa.Dispose()
|
||||
Else
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Namespace SIG
|
||||
|
||||
Dim Retorno As List(Of String) = Nothing
|
||||
If continuar Then
|
||||
Using objuser As New ClsSisUsuarios
|
||||
Using objuser As New ClsSisUsuarioAutenticacion
|
||||
Dim user As Usuario = objuser.ValidaUsuario(username, Extensiones.ModExtensiones.Encripta(password), CveEmpresa:=CveEmpresastr.ToEntero())
|
||||
|
||||
Dim OjEmpresa As Empresa = Nothing
|
||||
|
||||
@@ -23,81 +23,81 @@ Public Class WsSIGWeb
|
||||
End Function
|
||||
|
||||
|
||||
#Region " CANCELAR VENTAS ANTE EL SAT - CANCELADAS EN SISTEMA "
|
||||
<WebMethod()>
|
||||
Public Function CancelarVentasSAT(PCveVenta As Integer) As Boolean
|
||||
Dim Retorno = False
|
||||
Dim MensajeError = ""
|
||||
'#Region " CANCELAR VENTAS ANTE EL SAT - CANCELADAS EN SISTEMA "
|
||||
' <WebMethod()>
|
||||
' Public Function CancelarVentasSAT(PCveVenta As Integer) As Boolean
|
||||
' Dim Retorno = False
|
||||
' Dim MensajeError = ""
|
||||
|
||||
If PCveVenta > 0 Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ObjCancelacion As New Timbrado
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim Usuario As Usuario = Nothing
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
' If PCveVenta > 0 Then
|
||||
' Dim ObjVentas As New ClsVentas
|
||||
' Dim ObjCancelacion As New Timbrado
|
||||
' Dim ObjUsuario As New ClsSisUsuarios
|
||||
' Dim Usuario As Usuario = Nothing
|
||||
' Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
|
||||
Dim FolioFiscal = "-1"
|
||||
Dim CveEstatus = -1
|
||||
Dim Total = 0.0D
|
||||
Dim RFCReceptor = "-1"
|
||||
Dim Nombre = "-1"
|
||||
Dim DbRowVenta As DataRow
|
||||
Dim CveUsuario = -1
|
||||
Dim pCveEmpresa = -1
|
||||
Dim Contraseña = "-1"
|
||||
' Dim FolioFiscal = "-1"
|
||||
' Dim CveEstatus = -1
|
||||
' Dim Total = 0.0D
|
||||
' Dim RFCReceptor = "-1"
|
||||
' Dim Nombre = "-1"
|
||||
' Dim DbRowVenta As DataRow
|
||||
' Dim CveUsuario = -1
|
||||
' Dim pCveEmpresa = -1
|
||||
' Dim Contraseña = "-1"
|
||||
|
||||
If ObjVentas.GetVenta(PCveVenta.ToEntero, -1) Then
|
||||
DbRowVenta = ObjVentas.DtResultados.Rows(0)
|
||||
' If ObjVentas.GetVenta(PCveVenta.ToEntero, -1) Then
|
||||
' DbRowVenta = ObjVentas.DtResultados.Rows(0)
|
||||
|
||||
FolioFiscal = DbRowVenta("FolioFiscal").ToString
|
||||
CveEstatus = DbRowVenta("CveEstatusFactura").ToString.ToEntero
|
||||
Total = DbRowVenta("Total").ToString.ToDecimal
|
||||
RFCReceptor = DbRowVenta("ClienteRFC").ToString
|
||||
CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero
|
||||
pCveEmpresa = DbRowVenta("CveEmpresa").ToString.ToEntero
|
||||
Nombre = DbRowVenta("Nombre").ToString
|
||||
' FolioFiscal = DbRowVenta("FolioFiscal").ToString
|
||||
' CveEstatus = DbRowVenta("CveEstatusFactura").ToString.ToEntero
|
||||
' Total = DbRowVenta("Total").ToString.ToDecimal
|
||||
' RFCReceptor = DbRowVenta("ClienteRFC").ToString
|
||||
' CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero
|
||||
' pCveEmpresa = DbRowVenta("CveEmpresa").ToString.ToEntero
|
||||
' Nombre = DbRowVenta("Nombre").ToString
|
||||
|
||||
If ObjUsuario.GetUsuarios(CveUsuario, -1, -1) Then
|
||||
Contraseña = ObjUsuario.DtResultados.Rows(0)("Contraseña").ToString
|
||||
Usuario = ObjUsuario.ValidaUsuario(Nombre, Contraseña)
|
||||
' If ObjUsuario.GetUsuarios(CveUsuario, -1, -1) Then
|
||||
' Contraseña = ObjUsuario.DtResultados.Rows(0)("Contraseña").ToString
|
||||
' Usuario = ObjUsuario.ValidaUsuario(Nombre, Contraseña)
|
||||
|
||||
If ObjEmpresa.GetEmpresas(pCveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
Usuario.Empresa = ObjEmpresa.Empresa
|
||||
Usuario.CveEmpresa = ObjEmpresa.Empresa.CveEmpresa
|
||||
' If ObjEmpresa.GetEmpresas(pCveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
' Usuario.Empresa = ObjEmpresa.Empresa
|
||||
' Usuario.CveEmpresa = ObjEmpresa.Empresa.CveEmpresa
|
||||
|
||||
'SOLO SI ESTA CANCELADA ANTE SAT EN SIG SE INTENTARA CANCELAR DE NUEVO CONTRA EL SAT
|
||||
If CveEstatus = 5 Then
|
||||
Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC)
|
||||
If Resp.Verificado Then
|
||||
If ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, Resp.CancelacionFecha, PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
|
||||
Retorno = True
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al actualizar la cancelación la CveVenta {PCveVenta}"
|
||||
End If
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al Cancelar ante SAT la CveVenta {PCveVenta}"
|
||||
End If
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al verificar el estatus de la CveVenta {PCveVenta}"
|
||||
End If
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al cargar la empresa de la CveVenta {PCveVenta}"
|
||||
End If
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al cargar el usuario de la CveVenta {PCveVenta}"
|
||||
End If
|
||||
Else
|
||||
MensajeError = $"Ocurrió un error al cargar la CveVenta {PCveVenta}"
|
||||
End If
|
||||
' 'SOLO SI ESTA CANCELADA ANTE SAT EN SIG SE INTENTARA CANCELAR DE NUEVO CONTRA EL SAT
|
||||
' If CveEstatus = 5 Then
|
||||
' Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC)
|
||||
' If Resp.Verificado Then
|
||||
' If ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, Resp.CancelacionFecha, PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
|
||||
' Retorno = True
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al actualizar la cancelación la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al Cancelar ante SAT la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al verificar el estatus de la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al cargar la empresa de la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al cargar el usuario de la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
' Else
|
||||
' MensajeError = $"Ocurrió un error al cargar la CveVenta {PCveVenta}"
|
||||
' End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
ObjUsuario.Dispose()
|
||||
ObjEmpresa.Dispose()
|
||||
End If
|
||||
' ObjVentas.Dispose()
|
||||
' ObjUsuario.Dispose()
|
||||
' ObjEmpresa.Dispose()
|
||||
' End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
|
||||
End Class
|
||||
@@ -40,7 +40,7 @@ Public Class wsSIG
|
||||
If Fecha > ClsPaginas.NowADS().AddSeconds(TiempoValido) Then
|
||||
|
||||
Dim ttDato As Usuario
|
||||
Dim tUsuario As New ClsSisUsuarios
|
||||
Dim tUsuario As New ClsSisUsuarioAutenticacion
|
||||
|
||||
ttDato = tUsuario.ValidaUsuario(Usuario, Encripta(Contrasenia))
|
||||
|
||||
@@ -91,7 +91,7 @@ Public Class wsSIG
|
||||
If Fecha > ClsPaginas.NowADS().AddSeconds(TiempoValido) Then
|
||||
|
||||
Dim ttDato As Usuario = Nothing
|
||||
Using tUsuario As New ClsSisUsuarios()
|
||||
Using tUsuario As New ClsSisUsuarioAutenticacion()
|
||||
ttDato = tUsuario.ValidaUsuario(Usuario, Encripta(Contrasenia), CveEmpresa:=CveEmpresa)
|
||||
End Using
|
||||
If validatesubproyecto Then
|
||||
@@ -691,7 +691,7 @@ Public Class wsSIG
|
||||
|
||||
|
||||
Dim ttDato As Usuario
|
||||
Dim tUsuario As New ClsSisUsuarios
|
||||
Dim tUsuario As New ClsSisUsuarioAutenticacion
|
||||
|
||||
ttDato = tUsuario.ValidaUsuario(objuser.Usuario, Encripta(objuser.Contrasenia))
|
||||
|
||||
|
||||
@@ -53,38 +53,36 @@ Public Class E119 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios(NombreCadena:=NombreCadena)
|
||||
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario As String = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia As String = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa, GenerarMenu:=False)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100, CveEmpresa)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
'CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.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
|
||||
'Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
' Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
' If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
' If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
' Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
' 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
|
||||
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
' UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
|
||||
' End If
|
||||
' ObjEmpresa.Dispose()
|
||||
'End Sub
|
||||
#End Region
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
|
||||
@@ -62,38 +62,36 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios(NombreCadena:="ConexionEcono")
|
||||
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa, GenerarMenu:=False)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(141)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
'CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
'Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
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
|
||||
' Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
' If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
' If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
' Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
' 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
|
||||
|
||||
' UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
' End If
|
||||
' ObjEmpresa.Dispose()
|
||||
'End Sub
|
||||
|
||||
#End Region
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
@@ -1672,20 +1670,7 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe
|
||||
Return JsonConvert.SerializeObject(respuesta)
|
||||
End If
|
||||
|
||||
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios(NombreCadena:="ConexionEcono")
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario As String = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia As String = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
||||
|
||||
Using ObjPS As New ClsProductosServicios()
|
||||
If ObjPS.GetExistenciasEmpresa(Codigo, CveEmpresa) Then
|
||||
|
||||
@@ -400,17 +400,15 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
End Property
|
||||
Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario As String = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia As String = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
'CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
@@ -44,7 +44,8 @@ Public Class MobileHandler : Implements IHttpHandler
|
||||
|
||||
|
||||
Private Sub ValidaUsuario()
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(41)
|
||||
Dim ObjUsuario As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
Dim User As Usuario
|
||||
|
||||
Dim IP As String
|
||||
@@ -58,18 +59,18 @@ Public Class MobileHandler : Implements IHttpHandler
|
||||
|
||||
Dim Json As New StringBuilder
|
||||
|
||||
User = ObjUsuario.ValidaUsuario(Contexto.Request("Usuario"), Contexto.Request("Password"))
|
||||
User = ObjUsuario.ValidaUsuario(Contexto.Request("Usuario"), Contexto.Request("Password"), 41)
|
||||
|
||||
If User IsNot Nothing Then
|
||||
|
||||
Dim Token As String = String.Format("{0}*{1}*{2}", ClsPaginas.NowADS().ToString, IP, User.CveUsuario)
|
||||
Token = Encripta(Token)
|
||||
json.AppendFormat("{{ ""CveUsuario"" : ""{0}"", ""Nombre"" : ""{1}"", ""Token"" : ""{2}"" }} ", User.CveUsuario, User.Nombre, Token)
|
||||
Json.AppendFormat("{{ ""CveUsuario"" : ""{0}"", ""Nombre"" : ""{1}"", ""Token"" : ""{2}"" }} ", User.CveUsuario, User.Nombre, Token)
|
||||
Else
|
||||
json.Append("{ ""CveUsuario"" : ""-1"", ""Nombre"" : ""No valido"" } ")
|
||||
Json.Append("{ ""CveUsuario"" : ""-1"", ""Nombre"" : ""No valido"" } ")
|
||||
End If
|
||||
|
||||
Contexto.Response.Write(json.ToString)
|
||||
ObjUsuario.Dispose()
|
||||
Contexto.Response.Write(Json.ToString)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
@@ -222,15 +222,13 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
|
||||
@@ -58,17 +58,15 @@ Public Class SIGFacturacionCiclica : Implements IHttpHandler, IRequiresSessionSt
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(119)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
@@ -18,153 +18,152 @@ public class SIGFreightVerify : IHttpHandler, IRequiresSessionState
|
||||
private Usuario ValidaUsuarioSistema(int CveEmpresa)
|
||||
{
|
||||
Usuario UsuarioActual = null;
|
||||
ClsSisUsuarios ObjUsuarios = new ClsSisUsuarios();
|
||||
if (ObjUsuarios.GetUsuarios(1727))
|
||||
{
|
||||
if (ObjUsuarios.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
string NombreCadena = ClsPaginas.get_GlobalNombreCadenaConexion(141);
|
||||
ClsSisUsuarioAutenticacion ObjUsuarios = new ClsSisUsuarioAutenticacion(NombreCadena: NombreCadena);
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(1727);
|
||||
if (UsuarioActual !=null)
|
||||
{
|
||||
var Usuario = ObjUsuarios.DtResultados.Rows[0]["Usuario"].ToString();
|
||||
var Contrasenia = ObjUsuarios.DtResultados.Rows[0]["Contraseña"].ToString();
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa: CveEmpresa);
|
||||
var Contrasenia = ObjUsuarios.DtResultados.Rows[0]["Contraseña"].ToString();
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa: CveEmpresa);
|
||||
UsuarioActual.CveEmpresa = CveEmpresa;
|
||||
UsuarioActual.CveCliente = 183798;
|
||||
CreaObjetoEmpresa(ref UsuarioActual);
|
||||
//CreaObjetoEmpresa(ref UsuarioActual);
|
||||
CargaZonasHorarias(ref UsuarioActual);
|
||||
}
|
||||
}
|
||||
ObjUsuarios.Dispose();
|
||||
return UsuarioActual;
|
||||
}
|
||||
ObjUsuarios.Dispose();
|
||||
return UsuarioActual;
|
||||
}
|
||||
private void CreaObjetoEmpresa(ref Usuario UsuarioActual)
|
||||
{
|
||||
ClsSisEmpresas ObjEmpresa = new ClsSisEmpresas();
|
||||
if (ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1"))
|
||||
{
|
||||
ClsSisEmpresas ObjEmpresa = new ClsSisEmpresas();
|
||||
if (ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1"))
|
||||
if (ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
if (ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
System.Data.DataTable dttmp = ObjEmpresa.DtResultados;
|
||||
System.Data.DataTable dttmp = ObjEmpresa.DtResultados;
|
||||
|
||||
var EmpresasFuncionalidades = new HybridDictionary();
|
||||
foreach (System.Data.DataRow Row in dttmp.Rows)
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row["CveFuncionalidad"]), Row["Valor"].ToString());
|
||||
var EmpresasFuncionalidades = new HybridDictionary();
|
||||
foreach (System.Data.DataRow Row in dttmp.Rows)
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row["CveFuncionalidad"]), Row["Valor"].ToString());
|
||||
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades);
|
||||
}
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa;
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades);
|
||||
}
|
||||
ObjEmpresa.Dispose();
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa;
|
||||
}
|
||||
private void CargaZonasHorarias(ref Usuario UsuarioActual)
|
||||
ObjEmpresa.Dispose();
|
||||
}
|
||||
private void CargaZonasHorarias(ref Usuario UsuarioActual)
|
||||
{
|
||||
ClsClientes ObjClientes = new ClsClientes();
|
||||
try
|
||||
{
|
||||
ClsClientes ObjClientes = new ClsClientes();
|
||||
try
|
||||
if (ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus: 1))
|
||||
{
|
||||
if (ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus: 1))
|
||||
{
|
||||
if (ObjClientes.DtResultados.Rows.Count == 1)
|
||||
UsuarioActual.UTCOffset = ObjClientes.DtResultados.Rows[0]["UTCOffset"].ToString().ToEntero();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString().GuardaLog();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ObjClientes.Dispose();
|
||||
if (ObjClientes.DtResultados.Rows.Count == 1)
|
||||
UsuarioActual.UTCOffset = ObjClientes.DtResultados.Rows[0]["UTCOffset"].ToString().ToEntero();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReusable => false;
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
context.Response.ContentType = "text/plain";
|
||||
IniciarTransmision(context);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.GuardaLog(ex.Message);
|
||||
}
|
||||
ex.ToString().GuardaLog();
|
||||
}
|
||||
|
||||
private void IniciarTransmision(HttpContext context)
|
||||
finally
|
||||
{
|
||||
var UsuarioActual = ValidaUsuarioSistema(121);
|
||||
DataTable dtShipments = null;
|
||||
var FVCARRIERID = "";
|
||||
var SCAC = "";
|
||||
var UsuarioFV = "";
|
||||
var ContraseniaFV = "";
|
||||
var ObjGPS = new ClsGPS();
|
||||
try
|
||||
{
|
||||
if (ObjGPS.GetShipments(UsuarioActual.CveCliente, -1))
|
||||
{
|
||||
dtShipments = ObjGPS.DtResultados.FiltraParametros("TransmitirTexto = 'Si'");
|
||||
}
|
||||
if (ObjGPS.GetFVConfiguracion(UsuarioActual.CveCliente, -1))
|
||||
{
|
||||
if (ObjGPS.DtResultados.Rows.Count == 1)
|
||||
{
|
||||
var row = ObjGPS.DtResultados.Rows[0];
|
||||
FVCARRIERID = row["fvCarrierId"].ToString().Trim();
|
||||
SCAC = row["scac"].ToString().Trim();
|
||||
UsuarioFV = row["Usuario"].ToString().Trim();
|
||||
ContraseniaFV = row["Contrasenia"].ToString().Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnError("Ocurrió un error al obtener la configuración", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ObjGPS.Dispose();
|
||||
var array = new JArray();
|
||||
if (dtShipments != null)
|
||||
{
|
||||
foreach (DataRow Row in dtShipments.Rows)
|
||||
{
|
||||
var datos = GeneraRequestLO(UsuarioActual, Row["CveShipment"].ToString().ToEntero(), FVCARRIERID, SCAC);
|
||||
if (datos != null)
|
||||
{
|
||||
var retorno = EnviarEventoAPI(UsuarioActual, Row["ShipmentID"].ToString(), Row["Customer"].ToString(), FVCARRIERID, UsuarioFV, ContraseniaFV, datos.ToString());
|
||||
array.Add(retorno);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.Response.Write(array);
|
||||
}
|
||||
ObjClientes.Dispose();
|
||||
}
|
||||
protected JObject GeneraRequestLO(Usuario UsuarioActual, int CveShipment, string FVCARRIERID, string SCAC)
|
||||
{
|
||||
var route_id = "";
|
||||
var trailer_number = "";
|
||||
var trackingAssetId = "";
|
||||
double lat = 0;
|
||||
double lon = 0;
|
||||
}
|
||||
|
||||
var ObjGPS = new ClsGPS();
|
||||
if (ObjGPS.GetShipmentDetail(CveShipment))
|
||||
public bool IsReusable => false;
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
context.Response.ContentType = "text/plain";
|
||||
IniciarTransmision(context);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.GuardaLog(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void IniciarTransmision(HttpContext context)
|
||||
{
|
||||
var UsuarioActual = ValidaUsuarioSistema(121);
|
||||
DataTable dtShipments = null;
|
||||
var FVCARRIERID = "";
|
||||
var SCAC = "";
|
||||
var UsuarioFV = "";
|
||||
var ContraseniaFV = "";
|
||||
var ObjGPS = new ClsGPS();
|
||||
try
|
||||
{
|
||||
if (ObjGPS.GetShipments(UsuarioActual.CveCliente, -1))
|
||||
{
|
||||
dtShipments = ObjGPS.DtResultados.FiltraParametros("TransmitirTexto = 'Si'");
|
||||
}
|
||||
if (ObjGPS.GetFVConfiguracion(UsuarioActual.CveCliente, -1))
|
||||
{
|
||||
if (ObjGPS.DtResultados.Rows.Count == 1)
|
||||
{
|
||||
var row = ObjGPS.DtResultados.Rows[0];
|
||||
lat = row["Lat"].ToString().ToDouble();
|
||||
lon = row["Lon"].ToString().ToDouble();
|
||||
route_id = row["RouteID"].ToString();
|
||||
trailer_number = row["TrailerID"].ToString();
|
||||
trackingAssetId = row["AssetID"].ToString();
|
||||
FVCARRIERID = row["fvCarrierId"].ToString().Trim();
|
||||
SCAC = row["scac"].ToString().Trim();
|
||||
UsuarioFV = row["Usuario"].ToString().Trim();
|
||||
ContraseniaFV = row["Contrasenia"].ToString().Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnError("Ocurrió un error al obtener la configuración", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ObjGPS.Dispose();
|
||||
var array = new JArray();
|
||||
if (dtShipments != null)
|
||||
{
|
||||
foreach (DataRow Row in dtShipments.Rows)
|
||||
{
|
||||
var datos = GeneraRequestLO(UsuarioActual, Row["CveShipment"].ToString().ToEntero(), FVCARRIERID, SCAC);
|
||||
if (datos != null)
|
||||
{
|
||||
var retorno = EnviarEventoAPI(UsuarioActual, Row["ShipmentID"].ToString(), Row["Customer"].ToString(), FVCARRIERID, UsuarioFV, ContraseniaFV, datos.ToString());
|
||||
array.Add(retorno);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.Response.Write(array);
|
||||
}
|
||||
}
|
||||
protected JObject GeneraRequestLO(Usuario UsuarioActual, int CveShipment, string FVCARRIERID, string SCAC)
|
||||
{
|
||||
var route_id = "";
|
||||
var trailer_number = "";
|
||||
var trackingAssetId = "";
|
||||
double lat = 0;
|
||||
double lon = 0;
|
||||
|
||||
var json = new JObject()
|
||||
var ObjGPS = new ClsGPS();
|
||||
if (ObjGPS.GetShipmentDetail(CveShipment))
|
||||
{
|
||||
if (ObjGPS.DtResultados.Rows.Count == 1)
|
||||
{
|
||||
var row = ObjGPS.DtResultados.Rows[0];
|
||||
lat = row["Lat"].ToString().ToDouble();
|
||||
lon = row["Lon"].ToString().ToDouble();
|
||||
route_id = row["RouteID"].ToString();
|
||||
trailer_number = row["TrailerID"].ToString();
|
||||
trackingAssetId = row["AssetID"].ToString();
|
||||
}
|
||||
}
|
||||
ObjGPS.Dispose();
|
||||
|
||||
var json = new JObject()
|
||||
{
|
||||
new JProperty("carrier", new JObject()
|
||||
{
|
||||
@@ -203,35 +202,35 @@ public class SIGFreightVerify : IHttpHandler, IRequiresSessionState
|
||||
})
|
||||
};
|
||||
|
||||
return json;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
private JObject EnviarEventoAPI(Usuario UsuarioActual, string ShipmentID, string Customer, string FVCARRIERID, string UsuarioFV, string ContraseniaFV, string Datos)
|
||||
private JObject EnviarEventoAPI(Usuario UsuarioActual, string ShipmentID, string Customer, string FVCARRIERID, string UsuarioFV, string ContraseniaFV, string Datos)
|
||||
{
|
||||
var retorno = "[]";
|
||||
var token = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(string.Format("{0}:{1}", UsuarioFV, ContraseniaFV)));
|
||||
string correlationId = GuidGenerator.GenerateTimeBasedGuid(UsuarioActual.FechaActualCliente).ToString();
|
||||
HttpClient wc = new HttpClient();
|
||||
try
|
||||
{
|
||||
var retorno = "[]";
|
||||
var token = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(string.Format("{0}:{1}", UsuarioFV, ContraseniaFV)));
|
||||
string correlationId = GuidGenerator.GenerateTimeBasedGuid(UsuarioActual.FechaActualCliente).ToString();
|
||||
HttpClient wc = new HttpClient();
|
||||
try
|
||||
{
|
||||
var fvShipmentId = $"{FVCARRIERID}|{Customer}|{ShipmentID}";
|
||||
var fvShipmentId = $"{FVCARRIERID}|{Customer}|{ShipmentID}";
|
||||
|
||||
var Url = new Uri("https://api.freightverify.com/ws/rest/v2/tl/shipment/event");
|
||||
var content = new StringContent(Datos, Encoding.UTF8, "application/json");
|
||||
wc.DefaultRequestHeaders.Add("Authorization", $"Basic {token}");
|
||||
wc.DefaultRequestHeaders.Add("WSS-correlationId", correlationId);
|
||||
wc.DefaultRequestHeaders.Add("X-WSS-fvShipmentId", fvShipmentId);
|
||||
var response = wc.PostAsync(Url, content).Result;
|
||||
retorno = response.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
wc.Dispose();
|
||||
|
||||
return JObject.Parse(retorno);
|
||||
var Url = new Uri("https://api.freightverify.com/ws/rest/v2/tl/shipment/event");
|
||||
var content = new StringContent(Datos, Encoding.UTF8, "application/json");
|
||||
wc.DefaultRequestHeaders.Add("Authorization", $"Basic {token}");
|
||||
wc.DefaultRequestHeaders.Add("WSS-correlationId", correlationId);
|
||||
wc.DefaultRequestHeaders.Add("X-WSS-fvShipmentId", fvShipmentId);
|
||||
var response = wc.PostAsync(Url, content).Result;
|
||||
retorno = response.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
wc.Dispose();
|
||||
|
||||
return JObject.Parse(retorno);
|
||||
}
|
||||
}
|
||||
namespace FluentGenerator
|
||||
{
|
||||
|
||||
@@ -25,38 +25,22 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer, Optional CveUsuario As Integer = 100) As Usuario
|
||||
|
||||
Dim UsuarioToken As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioToken = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioToken.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioToken)
|
||||
End If
|
||||
End If
|
||||
Dim UsuarioToken As Usuario = Nothing
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioToken = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioToken.CveEmpresa = CveEmpresa
|
||||
|
||||
End If
|
||||
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioToken
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioToken As Usuario)
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioToken.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioToken.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
|
||||
|
||||
UsuarioToken.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
|
||||
@@ -117,8 +117,9 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
|
||||
If GlobalDTUsuarios.Rows.Count > 0 Then
|
||||
Dim dtrow As DataRow = GlobalDTUsuarios.Rows(0)
|
||||
Dim ObjUsuario As New ClsSisUsuarios
|
||||
Dim dtrow As DataRow = GlobalDTUsuarios.Rows(0)
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(cveEmpresa)
|
||||
Dim ObjUsuario As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
usuario = ObjUsuario.ValidaUsuario(dtrow("Usuario").ToString, dtrow("Contraseña").ToString, CveEmpresa:=cveEmpresa)
|
||||
ObjUsuario.Dispose()
|
||||
|
||||
@@ -225,8 +226,9 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
#End Region
|
||||
#Region "obtengo el usuario con el username y la pass"
|
||||
|
||||
Using ObjUsuario As New ClsSisUsuarios()
|
||||
'Dim tGrupoEmpresa As String = ClsPaginas.GlobalGrupoEmpresa(Request.Url.Host.ToUpper())
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Using ObjUsuario As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
usuario = ObjUsuario.ValidaUsuario(username, pass, CveEmpresa:=CveEmpresa)
|
||||
End Using
|
||||
#End Region
|
||||
@@ -345,41 +347,19 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario As String = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia As String = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.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
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
'CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
|
||||
Private Function EjecutarEnvioEstadoCuenta(UsuarioActual As Usuario, FechaEnvio As DateTime, FechaActual As DateTime, Optional pCveCliente As Integer = -1) As JObject
|
||||
Dim ClientesSinEnviar As New JArray()
|
||||
|
||||
Reference in New Issue
Block a user