Auditoria informatica

Solo disponible en BuenasTareas
  • Páginas : 37 (9044 palabras )
  • Descarga(s) : 0
  • Publicado : 26 de noviembre de 2010
Leer documento completo
Vista previa del texto
ModConexion:

Module ModConexion
Public conex As String = "Server=LAB05_15\SQLEXPRESS; Database= sistema de ventas;Integrated Security=True "
End Module
CLSUSUARIO:
Imports System.Data.SqlClient
Public Class ClsUsuario
Public Function getusuario() As DataTable
Try
Dim cno As New SqlConnection(conex)
Dim dap As NewSqlDataAdapter("Usuarios_Listar", cno)
Dim dst As New DataSet
With dap
.Fill(dst, "TUsuario")

End With
Return dst.Tables("TUsuario")
Catch ex As Exception

End Try
End Function
End Class
FORMULARIO SEGURIDAD:
Imports biblioteca
Imports System.Data.SqlClient
Public Class seguridad
'Private cn As New SqlConnection("DataSource=LAB03_14\SQLEXPRESS;Initial Catalog=sistema de ventas;Integrated Security=True")

Private obju As New ClsUsuario
Private dap As New SqlDataAdapter '("Select * from usuarios", cn)
Private dst As New DataSet
Private intentos As Short = 0
Private i As Short = 0

Private Sub txtpass_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)Handles txtcontraseña.KeyPress

Select Case Asc(UCase(e.KeyChar))
Case 13
btnAceptar.PerformClick()
Case 32
e.Handled = True
Case Else

End Select
End Sub
Private Sub txtpass_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcontraseña.TextChanged

Iftxtcontraseña.Text "" Then
btnAceptar.Enabled = True
Else
btnAceptar.Enabled = False
End If
End Sub

Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
Dim usuario As String = cbousuario.Text
Dim clave As String = txtcontraseña.Text
Dim CF, k As IntegerDim SW As Boolean = False

intentos += 1
Try
' dap.Fill(dst, "Tusuarios")
CF = obju.getusuario().Rows.Count 'dst.Tables(0).Rows.Count
k = 0
Do

If obju.getusuario().Rows(k).Item(0) = usuario Then
SW = True
Exit Do
End If

k += 1Loop While k < CF

If Not SW Then
MsgBox("Nombre de Usuario Incorrecto", MsgBoxStyle.Critical, "Aviso")
cbousuario.SelectAll()
cbousuario.Focus()
Exit Try
Else 'Se encontro el usuario

If obju.getusuario().Rows(k).Item(1) = clave Then
MsgBox("El Usuarioy Contraseña son correctas", MsgBoxStyle.Exclamation, "Aviso")
pb1.Visible = True
Timer2.Enabled = True
lblmensaje.Text = "Cargando....."
lblmensaje.Visible = True

Exit Sub
Else
MsgBox("Contraseña Incorrecta, Por Favor intente de nuevo",MsgBoxStyle.Critical, "Aviso")
txtcontraseña.SelectAll()
txtcontraseña.Clear()
txtcontraseña.Focus()
End If
End If

Catch ex As Exception
Throw ex
End Try
If intentos = 3 Then
MsgBox("Agoto sus intentos", MsgBoxStyle.Exclamation, "Bye")
Application.Exit()Else
Label4.Visible = True
Label4.Text = "Le Queda " & 3 - intentos & " Intentos"
Timer1.Enabled = True
End If
End Sub
Private Sub configurarCombo()
With cbousuario
.DataSource = obju.getusuario()
.DisplayMember = "CUENTA"
.Text = ""
End With

End Sub
'Private Sub...
tracking img