-
Notifications
You must be signed in to change notification settings - Fork 0
/
VerificacionReg.vb
103 lines (91 loc) · 4.66 KB
/
VerificacionReg.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Imports MySql.Data.MySqlClient
Public Class VerificacionReg
Inherits Verificacion
Private Email As String
Dim db As ReMe_DB
Dim pers As Persona
Public Sub New(usr As String, clv As String, email As String)
MyBase.New(usr, clv)
Me.Email = email
End Sub
Public Sub VerificacionRegistro()
Try
db = New ReMe_DB
db.miComando.CommandText = "Verificar_Registro"
db.miComando.CommandType = CommandType.StoredProcedure
Dim pa1 As New MySqlParameter("n1", MySqlDbType.VarChar)
Dim pa2 As New MySqlParameter("n2", MySqlDbType.VarChar)
pa1.Direction = ParameterDirection.Input
pa2.Direction = ParameterDirection.Input
pa1.Value = Usr
pa2.Value = Email
db.miComando.Parameters.Add(pa1)
db.miComando.Parameters.Add(pa2)
Dim rd As MySqlDataReader = db.miComando.ExecuteReader
If rd.HasRows Then
While rd.Read()
If rd.GetValue(0).ToString = "correcto" Then
Try
db = New ReMe_DB
db.miComando.CommandText = "Registro"
db.miComando.CommandType = CommandType.StoredProcedure
Dim p1 As New MySqlParameter("n1", MySqlDbType.VarChar)
Dim p2 As New MySqlParameter("n2", MySqlDbType.VarChar)
Dim p3 As New MySqlParameter("n3", MySqlDbType.VarChar)
p1.Direction = ParameterDirection.Input
p2.Direction = ParameterDirection.Input
p3.Direction = ParameterDirection.Input
p1.Value = Usr
p2.Value = Email
p3.Value = Clv
db.miComando.Parameters.Add(p1)
db.miComando.Parameters.Add(p2)
db.miComando.Parameters.Add(p3)
Dim rd2 As MySqlDataReader = db.miComando.ExecuteReader
If rd2.HasRows Then
While rd2.Read()
Id = rd2.GetValue(0)
LoginForm.Hide()
Form1.Show()
LoginForm.LimpiarLogin()
End While
rd2.NextResult()
End If
db.Dispose()
Catch ex As Exception
LoginForm.txt_error_login.Location = New Point(151, 337)
LoginForm.txt_error_login.Text = "* No es posible realizar el registro con las credenciales introducidas"
LoginForm.txt_error_login.Visible = True
End Try
ElseIf rd.GetValue(0).ToString = "existente" Then
LoginForm.txt_error_login.Location = New Point(151, 337)
LoginForm.txt_error_login.Text = "* No es posible realizar el registro con las credenciales introducidas"
LoginForm.txt_error_login.Visible = True
End If
End While
rd.NextResult()
End If
Catch ex As Exception
ComprobarFormato()
End Try
End Sub
Public Overrides Sub ComprobarFormato()
If LoginForm.box_usuario.Text = "" Then
LoginForm.txt_error_login.Location = New Point(265, 288)
LoginForm.txt_error_login.Text = "* Campo de usuario inválido"
LoginForm.txt_error_login.Visible = True
ElseIf LoginForm.box_clave.Text = "" Then
LoginForm.txt_error_login.Location = New Point(273, 288)
LoginForm.txt_error_login.Text = "* Campo de clave inválido"
LoginForm.txt_error_login.Visible = True
ElseIf LoginForm.box_usuario.Text = "" And LoginForm.box_clave.Text = "" Then
LoginForm.txt_error_login.Location = New Point(242, 288)
LoginForm.txt_error_login.Text = "* Campo de usuario y clave inválido"
LoginForm.txt_error_login.Visible = True
ElseIf LoginForm.txt_email.Text = "" Then
LoginForm.txt_error_login.Location = New Point(215, 288)
LoginForm.txt_error_login.Text = "* Campo de email inválido"
LoginForm.txt_error_login.Visible = True
End If
End Sub
End Class