VERSION 5.00
Begin VB.Form fseguridad 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Seguridad Ventas SOROS"
   ClientHeight    =   2760
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4455
   Icon            =   "fseguridad_ventas.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2760
   ScaleWidth      =   4455
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CMD_CANCELAR 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   2340
      Picture         =   "fseguridad_ventas.frx":0442
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1800
      Width           =   1935
   End
   Begin VB.CommandButton CMD_ACEPTAR 
      Caption         =   "Aceptar"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   180
      Picture         =   "fseguridad_ventas.frx":074C
      Style           =   1  'Graphical
      TabIndex        =   4
      Tag             =   "R ASDASD"
      Top             =   1800
      Width           =   1935
   End
   Begin VB.TextBox txt_password 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      IMEMode         =   3  'DISABLE
      Left            =   1732
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   990
      Width           =   2295
   End
   Begin VB.TextBox txt_usuario 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   1732
      TabIndex        =   0
      Top             =   240
      Width           =   2295
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Password:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   427
      TabIndex        =   3
      Top             =   1027
      Width           =   1245
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Usuario:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   652
      TabIndex        =   2
      Top             =   300
      Width           =   1020
   End
End
Attribute VB_Name = "fseguridad"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mobj_cseguridad As DB_SE_MANTENIMIENTOS.c_seguridad
Dim MStrusuario As String
Dim MintIntentos As Integer

Private Sub CMD_ACEPTAR_Click()
Set mobj_cseguridad = New DB_SE_MANTENIMIENTOS.c_seguridad
Dim qwerty As String
Dim ytrewq As String
Dim cadena As String
Dim clave As String
Dim validar As Integer

qwerty = UCase(Trim(txt_usuario.Text))
ytrewq = Trim(Encrip(Trim(UCase(txt_password.Text))))

If Len(qwerty) = 0 Then
    MsgBox ("Debe ingresar un usuario"), vbDefaultButton1 + vbExclamation, "Advertencia"
    txt_usuario.SetFocus
    Exit Sub
End If
If Len(ytrewq) = 0 Then
    MsgBox ("Debe ingresar un password"), vbDefaultButton1 + vbExclamation, "Advertencia"
    txt_password.SetFocus
    Exit Sub
End If

validar = mobj_cseguridad.ValidarUsuario(qwerty, ytrewq)
Call MENSAJES_USUARIO(validar)

If validar = 0 Then
    GCUSERID = qwerty
    Verifica_dias_Venc GCUSERID, Trim(UCase(txt_password.Text))
    MDIFVENTAS.Show
    Unload Me
Else
    If validar = 2 Then
        If Trim(MStrusuario) = Empty Then
            MStrusuario = UCase(txt_usuario.Text)
            MintIntentos = MintIntentos + 1
        Else
            If Trim(MStrusuario) = UCase(txt_usuario.Text) Then
               MintIntentos = MintIntentos + 1
               If MintIntentos = 3 Then
                  If Trim(qwerty) <> "SYSADMIN" Then
                    GBloquearUsuario qwerty
                  End If
                  
                  MStrusuario = Empty
                  MintIntentos = 0
               End If
            Else
               MStrusuario = Empty
               MintIntentos = 0
            End If
        End If
    End If
End If

End Sub


Private Sub CMD_CANCELAR_Click()
    End
End Sub

