private void bt_dangnhap_Click(object sender, EventArgs e) { if (txt_taikhoan.TextLength == 0) { lbtrangthai.ForeColor = Color.Red; lbtrangthai.Text = "Chưa điền tên tài khoản."; // MessageBox.Show("Chưa điền tên tài khoản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_taikhoan.Focus(); } else if (txt_matkhau.TextLength == 0) { lbtrangthai.ForeColor = Color.Red; lbtrangthai.Text = "Chưa điền mật khẩu."; // MessageBox.Show("Chưa điền mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_matkhau.Focus(); } else { DTO_TAIKHOAN taikhoan_public = new DTO_TAIKHOAN(); taikhoan_public.TENTK = txt_taikhoan.Text; taikhoan_public.MATKHAU = txt_matkhau.Text; int trangthaitaikhoan = 0; trangthaitaikhoan = taikhoan_bul.check_dangnhap(taikhoan_public); if (trangthaitaikhoan == 1) { QuanLy dk = new QuanLy(); this.Hide(); dk.ShowDialog(); } else if (trangthaitaikhoan == 0) { lbtrangthai.ForeColor = Color.Red; lbtrangthai.Text = "Sai tên tài khoản hoặc mật khẩu."; txt_taikhoan.Focus(); // MessageBox.Show("Sai tên tài khoản hoặc mật khẩu.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); // txt_taikhoan.Focus(); } } }
private void btnquanly_Click(object sender, EventArgs e) { QuanLy quanly = new QuanLy(TenDangNhap, Quyen); quanly.ShowDialog(); }