-- unificación de función
This commit is contained in:
@@ -34,34 +34,6 @@ Public Class ClsSisUsuarioAutenticacion
|
||||
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")
|
||||
@@ -342,7 +314,7 @@ Public Class ClsSisUsuarioAutenticacion
|
||||
|
||||
Retorno.Acceso = Data.Rows(0)("Acceso").ToString().ToEntero()
|
||||
Retorno.CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero()
|
||||
Retorno.Usuario = Usuario
|
||||
Retorno.Usuario = Data.Rows(0)("Usuario").ToString()
|
||||
Retorno.Contraseña = Data.Rows(0)("Contraseña").ToString()
|
||||
Retorno.Nombre = Data.Rows(0)("Nombre").ToString()
|
||||
Retorno.CveRol = Data.Rows(0)("CveRol").ToString().ToEntero()
|
||||
@@ -354,7 +326,7 @@ Public Class ClsSisUsuarioAutenticacion
|
||||
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.PolCambiarContraseña = If(Data.Rows(0)("PolCambiarContraseña").ToString() = "SI", True, False)
|
||||
'Retorno.PolCambiarContraseña = If(Data.Rows(0)("PolCambiarContraseña").ToString() = "SI", True, False)
|
||||
Retorno.TipoControl = Data.Rows(0)("TipoControl").ToString().ToEntero()
|
||||
'*
|
||||
Retorno.CveProveedor = Data.Rows(0)("CveProveedor").ToString().ToEntero()
|
||||
@@ -401,34 +373,7 @@ Public Class ClsSisUsuarioAutenticacion
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateUsuarioContrasenia(Contrasenia As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("UPDATE U SET [Contraseña] = @Contrasenia, FechaUltimoCambioContraseña = GETDATE() FROM Usuarios U WHERE U.CveUsuario = @CveUsuario ", CommandType.Text)
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
|
||||
.Add("@Contrasenia", SqlDbType.VarChar).Value = Contrasenia
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch Ex1 As SqlException
|
||||
If Ex1.Message.Contains("Número: 2627;") Then
|
||||
Alert("Ya existe un Usuario con el mismo nombre: " & Usuario & ".", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Me.OnError("Ocurrió un error al guardar los cambios en el Usuario", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar los cambios en el Usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
'Public Function ValidaUsuarioAsignacion(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
' Dim Retorno As Usuario = Nothing
|
||||
|
||||
@@ -575,6 +575,35 @@ Public Class ClsSisUsuarios
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateUsuarioContrasenia(Contrasenia As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("UPDATE U SET [Contraseña] = @Contrasenia, FechaUltimoCambioContraseña = GETDATE() FROM Usuarios U WHERE U.CveUsuario = @CveUsuario ", CommandType.Text)
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
|
||||
.Add("@Contrasenia", SqlDbType.VarChar).Value = Contrasenia
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch Ex1 As SqlException
|
||||
If Ex1.Message.Contains("Número: 2627;") Then
|
||||
Alert("Ya existe un Usuario con el mismo nombre: " & Usuario & ".", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Me.OnError("Ocurrió un error al guardar los cambios en el Usuario", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar los cambios en el Usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function AddUsuarioAsignar(CvePersonal As Integer, CveVendedor As Integer, CveSubProyecto As Integer, CveAlmacen As Integer, CveTipoDocumento As String, CveEmpresa As Integer, CveUsuario As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user