-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGiaodien.cs
202 lines (180 loc) · 5.72 KB
/
Giaodien.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
namespace BTL_QLThuvien_Csharp_Nhom10
{
public partial class Giaodien : Form
{
SqlDataAdapter dat;
DataTable dataTable;
string A;
SqlConnection conn;
SqlCommand cmd;
private void mnudk_Click(object sender, EventArgs e)
{
frmdangky dangky = new frmdangky();
dangky.ShowDialog();
}
private void mnudmqlsv_Click(object sender, EventArgs e)
{
frmthethuvien frmthethuvien = new frmthethuvien();
frmthethuvien.ShowDialog();
}
private void mnudlsach_Click(object sender, EventArgs e)
{
frmSach frm = new frmSach();
frm.ShowDialog();
}
private void mnudlsachmuon_Click(object sender, EventArgs e)
{
frmSachmuon frm = new frmSachmuon();
frm.ShowDialog();
}
private void mnudlphieumuon_Click(object sender, EventArgs e)
{
frmPhieumuonsach frm = new frmPhieumuonsach();
frm.ShowDialog();
}
private void mnudlphieunhactra_Click(object sender, EventArgs e)
{
frmPhieuNhacTra frm = new frmPhieuNhacTra();
frm.ShowDialog();
}
private void mnudmqlnv_Click(object sender, EventArgs e)
{
frmNhanVien frm = new frmNhanVien();
frm.ShowDialog();
}
public Object laygiatri(string sql)
{
string ten, mk;
ten = txttaikhoan.Text;
mk = txtmatkhau.Text;
cmd = new SqlCommand();
cmd.CommandText = "select * from TAIKHOAN";
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Open();
Object o = cmd.ExecuteScalar();
conn.Close();
return o;
}
private void bunifuFlatButton1_Click(object sender, EventArgs e)
{
dangnhap();
}
private void ckhienthimk_OnChange(object sender, EventArgs e)
{
if (ckhienthimk.Checked)
{
txttaikhoan.PasswordChar = '\0';
txtmatkhau.PasswordChar = '\0';
}
else
{
txttaikhoan.PasswordChar = '\0';
txtmatkhau.PasswordChar = '*';
}
}
private void Giaodien_Load(object sender, EventArgs e)
{
A = lbl1.Text;
txtmatkhau.PasswordChar = '*';
mnudanhmuc.Enabled = true;
mnuxuly.Enabled = false;
mnubaocao.Enabled = false;
}
private void dangnhap()
{
lblthongbao.Text = "";
string ten, mk;
ten = txttaikhoan.Text;
mk = txtmatkhau.Text;
if (txttaikhoan.Text == "")
{
lblthongbao.Text = "Ten khong duoc de trong";
lblthongbao.ForeColor = Color.Red;
txttaikhoan.Focus();
return;
}
if (txtmatkhau.Text == "")
{
lblthongbao.Text = "Mat khau khong duoc de trong";
lblthongbao.ForeColor = Color.Red;
txtmatkhau.Focus();
return;
}
if (ten != "")
{
object Q = laygiatri("select * from TAIKHOAN where TenDN='" + ten + "'AND MK='" + mk + "'");
if (Q == null)
{
lblthongbao.ForeColor = Color.Red;
lblthongbao.Text = "Sai tai khoan";
}
else
{
lblthongbao.ForeColor = Color.Green;
lblthongbao.Text = "Thanh cong";
txttaikhoan.Text = "";
txtmatkhau.Text = "";
mnudanhmuc.Enabled = true;
mnuxuly.Enabled = true;
mnubaocao.Enabled = true;
}
}
}
public Giaodien()
{
InitializeComponent();
conn = new SqlConnection("Data Source=THINKPADE14/MSSQLSERVER01;Initial Catalog=QLThuVien_BTL_NET1;Integrated Security=True;User Id=sa;Password=1");
}
private void bunifuCustomLabel2_Click(object sender, EventArgs e)
{
}
private void dữToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
int d = 0, x;
x = A.Length;
d++;
string a = A.Substring(0, 1);
A = A.Substring(1, A.Length - 1);
lbl1.Text = lbl1.Text + a;
if (d == x)
{
timer1.Stop();
}
}
private void mnudx_Click(object sender, EventArgs e)
{
mnudanhmuc.Enabled = false;
mnuxuly.Enabled = false;
mnubaocao.Enabled = false;
}
private void mnubaocao_Click(object sender, EventArgs e)
{
frmthongtinsach frm = new frmthongtinsach();
frm.ShowDialog();
}
private void mnutimkiem_Click(object sender, EventArgs e)
{
frmtimkiemsach frm = new frmtimkiemsach();
frm.ShowDialog();
}
private void mnuxuly_Click(object sender, EventArgs e)
{
frmmuontrasach frm = new frmmuontrasach();
frm.ShowDialog();
}
private void mnutrogiup_Click(object sender, EventArgs e)
{
frmnoiquy frm = new frmnoiquy();
frm.ShowDialog();
}
}
}