private void btnDangKy_Click(object sender, RoutedEventArgs e) { try { if (txtUsername.Text.Length != 0 && txtPassword.Password.Length != 0) { TaiKhoanDAO dao = new TaiKhoanDAO(); if (dao.Add(txtUsername.Text, txtPassword.Password)) { MessageBox.Show("Đã đăng ký"); this.Close(); } else { MessageBox.Show("Lỗi đăng ký, vui lòng xem lại thông tin"); } } }catch (Exception ex) { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } }