/// <summary> /// hàm kiểm tra nhập liệu /// </summary> /// <returns></returns> private bool coLoi() { //lấy dữ liệu từ các control string tenKH = txtTenKH.Text; string CMND = txtCMND.Text; string sDT = txtSoDienThoai.Text; //kiểm tra nhập vào có hợp lệ hay không if (!KiemTraNhapLieu.laChuoi(tenKH)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.laCMND(CMND)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.laSoDienThoai(sDT)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } return(false); }
/// <summary> /// Kiểm tra nếu người dùng nhập dữ liệu bị lỗi /// </summary> private bool coLoi() { string maKH = txtMaKhachHang.Text; string tenKhachHang = txtTenKhachHang.Text; string cmnd = txtCmnd.Text; string sdt = txtSoDienThoai.Text; string maGhe = txtMaGhe.Text; if (!KiemTraNhapLieu.khongRong(maKH)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.khongRong(tenKhachHang)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.laCMND(cmnd)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.khongRong(sdt)) { txtSoDienThoai.Text = ""; } else if (!KiemTraNhapLieu.laSoDienThoai(sdt)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } else if (!KiemTraNhapLieu.khongRong(maGhe)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } return(false); }