예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        /// Kiểm tra lỗi nhập liệu
        /// </summary>
        /// <returns></returns>
        private bool coLoi()
        {
            string   maNV         = txtMaNV.Text;
            string   tenNV        = txtTenNV.Text;
            string   cmnd         = txtCmnd.Text;
            DateTime ngaySinh     = dtpNgaySinh.Value;
            string   diaChi       = txtDiaChi.Text;
            string   queQuan      = txtQueQuan.Text;
            DateTime ngayBatDau   = dtpNgayBatDau.Value;
            string   loaiNhanVien = cboLoaiNV.Text;
            string   sdt          = txtSdt.Text;
            string   luong        = txtLuong.Text;

            // Kiểm tra người dùng đã nhập mã nhân viên mới
            if (!KiemTraNhapLieu.khongRong(maNV))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            // Kiểm tra người dùng đã nhập tên nhân viên mới
            if (!KiemTraNhapLieu.khongRong(tenNV))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            //Kiểm tra xem người dùng đã nhập chứng minh nhân dân của nhân viên mới
            if (!KiemTraNhapLieu.laCMND(cmnd))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            // Kiểm tra nhân viên mới đủ tuổi
            if (!KiemTraNhapLieu.duTuoi(ngaySinh))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            // Kiểm tra người dùng đã chọn loại nhân viên
            if (!KiemTraNhapLieu.khongRong(loaiNhanVien))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            if (!KiemTraNhapLieu.khongRong(sdt))
            {
                txtSdt.Text = "";
            }
            if (!KiemTraNhapLieu.khongRong(luong))
            {
                txtLuong.Text = "0";
            }
            return(false);
        }
예제 #3
0
        /// <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);
        }