Quản lý phần mềm bán vé xe VB
8.427 lượt xem;
- Form_Cap_pass.vb
- Form /
- PhanMemBanVeXe_Full /
- project /
1 Imports System.Data.SqlClient
2 Public Class Form_Cap_pass
3 Private flag As Boolean = True
4 Private Nguoi_dung As New Nguoi_dung()
5 Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
6 Timer_Doi_Anh.Stop()
7 Me.Close()
8 End Sub
9
10 Private Sub Form_Cap_pass_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
11 txt_IdNguoiDung.Text = Form_Main.cbo_Username.Text
12 txt_IdNguoiDung.Enabled = False
13 txt_NewPassword.Focus()
14 End Sub
15
16 Private Sub btn_DongY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_DongY.Click
17 If Trim(txt_NewPassword.Text).Length < 5 Then
18 MsgBox("Password không được ít hơn 5 kí tự!", MsgBoxStyle.Exclamation, "Thông báo lỗi")
19 txt_NewPassword.Focus()
20 Else
21 Dim lenh As String = "Update NguoiDung Set PassND = '" + txt_NewPassword.Text + "' where IdNguoiDung = '" + txt_IdNguoiDung.Text + "'"
22 Dim bo_lenh As New SqlCommand(lenh, connect)
23 Try
24 connect.Open()
25 bo_lenh.ExecuteNonQuery()
26 connect.Close()
27 MessageBox.Show("Pass mới đã được cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
28 Nguoi_dung.UpdateNguoiDung()
29 Catch ex As Exception
30 MessageBox.Show("Cấp pass không thành công, yêu cầu kiểm tra lại kết nối", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error)
31 End Try
32 End If
33 End Sub
34
35 Private Sub Timer_Doi_Anh_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_Doi_Anh.Tick
36 If flag Then
37 PictureBox1.Image = My.Resources.Fermer_session
38 flag = Not flag
39 Else
40 PictureBox1.Image = My.Resources.ferme
41 flag = Not flag
42 End If
43
44 End Sub
45 End Class
2 Public Class Form_Cap_pass
3 Private flag As Boolean = True
4 Private Nguoi_dung As New Nguoi_dung()
5 Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
6 Timer_Doi_Anh.Stop()
7 Me.Close()
8 End Sub
9
10 Private Sub Form_Cap_pass_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
11 txt_IdNguoiDung.Text = Form_Main.cbo_Username.Text
12 txt_IdNguoiDung.Enabled = False
13 txt_NewPassword.Focus()
14 End Sub
15
16 Private Sub btn_DongY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_DongY.Click
17 If Trim(txt_NewPassword.Text).Length < 5 Then
18 MsgBox("Password không được ít hơn 5 kí tự!", MsgBoxStyle.Exclamation, "Thông báo lỗi")
19 txt_NewPassword.Focus()
20 Else
21 Dim lenh As String = "Update NguoiDung Set PassND = '" + txt_NewPassword.Text + "' where IdNguoiDung = '" + txt_IdNguoiDung.Text + "'"
22 Dim bo_lenh As New SqlCommand(lenh, connect)
23 Try
24 connect.Open()
25 bo_lenh.ExecuteNonQuery()
26 connect.Close()
27 MessageBox.Show("Pass mới đã được cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
28 Nguoi_dung.UpdateNguoiDung()
29 Catch ex As Exception
30 MessageBox.Show("Cấp pass không thành công, yêu cầu kiểm tra lại kết nối", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error)
31 End Try
32 End If
33 End Sub
34
35 Private Sub Timer_Doi_Anh_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_Doi_Anh.Tick
36 If flag Then
37 PictureBox1.Image = My.Resources.Fermer_session
38 flag = Not flag
39 Else
40 PictureBox1.Image = My.Resources.ferme
41 flag = Not flag
42 End If
43
44 End Sub
45 End Class