This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserInfo.vb
115 lines (75 loc) · 3.87 KB
/
UserInfo.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
104
105
106
107
108
109
110
111
112
113
114
115
Imports System.Data.OleDb
Imports System.IO
Public Class UserInfo
Private Sub UserInfo_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
MainForm.Show()
End Sub
Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
Dim User As New ChangeInfo
Hide()
User.Show()
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Hide()
ChangePassword.Show()
End Sub
Private Sub LinkLabel3_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
Hide()
GenarateID.Show()
End Sub
Private Sub UserInfo_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim dbConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If dbConnection.State = ConnectionState.Open Then dbConnection.Close()
dbConnection.Open()
Dim dbDataReader As OleDbDataReader
Dim dbCommand As New OleDbCommand
If LoginForm.cmbFormState.Text = "Admin" Then
dbCommand.CommandText = "select [AdminID],[Username],[DateOfBirth],[PlaceOfBirth],[EmailID],[Status],[AdminPic] from AdminInfo where AdminID = '" & LoginForm.txtAdminUsername.Text & "'"
dbCommand.Connection = dbConnection
dbDataReader = dbCommand.ExecuteReader
If dbDataReader.Read Then
Username.Text = dbDataReader(1).ToString()
Dim DOB As String = dbDataReader(2).ToString()
Dim SplitPart = DOB.Split(" "c)
Dim final As String = SplitPart(0).Trim
DateOfBirth.Text = (String.Format("{0}", final)).ToString
PlaceOfBirth.Text = dbDataReader(3).ToString()
EmailID.Text = LCase(dbDataReader(4)).ToString()
Status.Text = dbDataReader(5).ToString()
Dim LoadPic As Byte() = dbDataReader("AdminPic")
Dim Memory As New MemoryStream(LoadPic)
PicID.Image = Image.FromStream(Memory)
End If
dbConnection.Close()
dbDataReader.Close()
Return
End If
If LoginForm.cmbFormState.Text = "Teacher" Then
dbCommand.CommandText = "Select [TeacherID], [Username], [DateOfBirth], [PlaceOfBirth], [EmailID], [TeacherPic] from TeacherInfo where TeacherID = '" & LoginForm.txtTeacherUsername.Text & "'"
dbCommand.Connection = dbConnection
dbDataReader = dbCommand.ExecuteReader
If dbDataReader.Read Then
Username.Text = dbDataReader(1).ToString()
Dim DOB As String = dbDataReader(2).ToString()
Dim SplitPart = DOB.Split(" "c)
Dim final As String = SplitPart(0).Trim
DateOfBirth.Text = (String.Format("{0}", final)).ToString
PlaceOfBirth.Text = dbDataReader(3).ToString()
EmailID.Text = LCase(dbDataReader(4)).ToString()
Label5.Visible = False
Status.Visible = False
Dim LoadPic As Byte() = dbDataReader("TeacherPic")
Dim Memory As New MemoryStream(LoadPic)
PicID.Image = Image.FromStream(Memory)
End If
dbConnection.Close()
dbDataReader.Close()
Return
End If
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error...")
Exit Try
End Try
End Sub
End Class