private void bt_DangKi_Click(object sender, EventArgs e) { try { if (cmb_MaNhanVien.Text == "" || txt_NhanVien.Text == "" || txt_TaiKhoan.Text == "" || txt_MatKhau1.Text == "" || txt_MatKhau2.Text == "") { throw new Exception("Bạn chưa điền đầy đủ thông tin đăng kí tài khoản"); } else { TK1.MA_NHAN_VIEN1 = cmb_MaNhanVien.Text; TK1.TEN_TAI_KHOAN1 = txt_TaiKhoan.Text; if (txt_MatKhau1.Text == txt_MatKhau2.Text) { TK1.MAT_KHAU1 = txt_MatKhau2.Text; } else { throw new Exception("Mật khẩu không trùng khớp!"); } DataTable tb = TK.Danh_Sach_Tai_Khoan(txt_TaiKhoan.Text); if (tb.Rows.Count > 0) { throw new Exception(" Tên tài khoản đã tồn tại, mời bạn nhập tài khoản mới!"); } else { TK.Them_Tai_Khoan(TK1); Lap_Bang_Trang_Thai_Ban_Dau(txt_TaiKhoan.Text); MessageBox.Show("Đăng kí tài khoản thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { cmb_MaNhanVien.ResetText(); txt_NhanVien.ResetText(); time_NgaySinh.ResetText(); txt_TaiKhoan.ResetText(); txt_MatKhau1.ResetText(); txt_MatKhau2.ResetText(); } }