-
Notifications
You must be signed in to change notification settings - Fork 0
/
DangNhap.cs
80 lines (74 loc) · 2.57 KB
/
DangNhap.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Threading;
using System.Media;
using System.Configuration;
namespace VuongQuocTroChoi
{
public partial class DangNhap : Form
{
public DangNhap()
{
Thread t = new Thread(new ThreadStart(VuongQuocTroChoi));
t.Start();
Thread.Sleep(5000);
InitializeComponent();
t.Abort();
}
private void VuongQuocTroChoi()
{
Application.Run(new FormKhoiDongHeThong());
}
private void timer1_Tick(object sender, EventArgs e)
{
lblthoigian.Text = lblthoigian.Text.Substring(1)
+ lblthoigian.Text.Substring(0, 1);
}
SqlConnection cnn = null;
string cnstr= ConfigurationManager.ConnectionStrings["str"].ConnectionString;
private void btnsigup_Click(object sender, EventArgs e)
{
SoundPlayer loadgames = new SoundPlayer(chuoiketnoi + "button-3.wav");
loadgames.Play();
DangKi dk = new DangKi();
this.Hide();
dk.Show();
}
public static string id="";
string chuoiketnoi = @"N:\\VuongQuocTroChoi\NhacNen\";
private void btnsigin_Click(object sender, EventArgs e)
{
SoundPlayer loadgames = new SoundPlayer(chuoiketnoi + "button-3.wav");
loadgames.Play();
cnn = new SqlConnection(cnstr);
string sql = "select TenDangNhap, Password from DangKiTaiKhoan";
SqlDataAdapter ad = new SqlDataAdapter(sql,cnn);
DataSet ds = new DataSet();
ad.Fill(ds);
int trangthai = 0;
foreach (DataRow dr in ds.Tables[0].Rows)
{
if((dr["TenDangNhap"].ToString() == txttendangnhap.Text) && (dr["Password"].ToString() == txtpass.Text))
{
id = txttendangnhap.Text;
MessageBox.Show("Đăng nhập thành công!", "Thông báo!");
this.Hide();
FormMenu fm = new FormMenu();
fm.Show();
trangthai = 1;
}
}
if( trangthai == 0)
MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu!", "Thông báo!",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}