コード例 #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 maLoaiNV   = txtTenLoaiNV.Text;
            string tenLoaiNV  = txtTenLoaiNV.Text;
            string luongCoBan = txtLuongCoBan.Text;

            //kiểm tra nhập vào có hợp lệ hay không
            if (!KiemTraNhapLieu.laChuoi(maLoaiNV))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            if (!KiemTraNhapLieu.laChuoi(tenLoaiNV))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            if (!KiemTraNhapLieu.laSoNguyen(luongCoBan))
            {
                MessageBox.Show(ThongBao.duLieuKhongPhuHop);
                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: FormBanVe.cs プロジェクト: enpiech/LTUD_S5_Project
        /// <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);
        }