/// <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); }
/// <summary> /// Kiểm tra lỗi nhập liệu /// </summary> /// <returns>true Nếu có lỗi nhập liệu</returns> private bool coLoi() { // Lấy dữ liệu từ control string maHangXe = txtMaHangXe.Text; string tenHangXe = txtTenHangXe.Text; string soLuong = txtSoLuongXe.Text; string chiPhi = txtChiPhiThueBai.Text; // Kiểm tra xem tên hãng xe có hợp lệ hay không if (!KiemTraNhapLieu.khongRong(tenHangXe)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } // Kiểm tra xem mã hãng xe có hợp lệ hay không if (!KiemTraNhapLieu.khongRong(maHangXe)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } if (!KiemTraNhapLieu.khongRong(soLuong)) { txtSoLuongXe.Text = "0"; } // Kiểm tra xem số lượng xe có hợp lệ không if (!KiemTraNhapLieu.laSoNguyen(soLuong)) { MessageBox.Show(ThongBao.duLieuKhongPhuHop); return(true); } // Kiểm tra chi phí thuê bãi có hợp lệ không if (!KiemTraNhapLieu.khongRong(chiPhi)) { txtChiPhiThueBai.Text = "0"; } return(false); }