// Hàm để reset lại các vị trí bị sai mà error provider đã đánh dấu private void ResetErrorProvider() { ErrorPlaceEP.SetError(BookTitleCodeTxb, ""); ErrorPlaceEP.SetError(NewBookNumberNum, ""); ErrorPlaceEP.SetError(GoodsReceivedDayDTP, ""); ErrorPlaceEP.SetError(ShipmentCodeTxb, ""); ErrorPlaceEP.SetError(GoodsReceivedPlaceTxb, ""); ErrorPlaceEP.SetError(InvoiceCodeTxb, ""); }
// Hàm để check xem các thông tin người dùng nhập đã đúng hay chưa private bool CheckBookRepoInfo() { ResetErrorProvider(); // Gồi hàm để reset lại các vị trí bị sai mà error provider đã đánh dấu trc đó if (string.IsNullOrEmpty(BookTitleCodeTxb.Text) == true || string.IsNullOrWhiteSpace(BookTitleCodeTxb.Text) == true) { ErrorPlaceEP.SetError(BookTitleCodeTxb, "Vui lòng nhập mã tựa sách!"); return(false); } if (NewBookNumberNum.Value == 0) { ErrorPlaceEP.SetError(NewBookNumberNum, "Vui lòng nhập số lượng mới"); return(false); } if (string.IsNullOrEmpty(ShipmentCodeTxb.Text) == true || string.IsNullOrWhiteSpace(ShipmentCodeTxb.Text) == true) { ErrorPlaceEP.SetError(ShipmentCodeTxb, "Vui lòng nhập mã lô hàng"); return(false); } if (string.IsNullOrEmpty(GoodsReceivedPlaceTxb.Text) == true || string.IsNullOrWhiteSpace(GoodsReceivedPlaceTxb.Text) == true) { ErrorPlaceEP.SetError(GoodsReceivedPlaceTxb, "Vui lòng nhập thông tin nơi nhập hàng"); return(false); } if (string.IsNullOrEmpty(InvoiceCodeTxb.Text) == true || string.IsNullOrWhiteSpace(InvoiceCodeTxb.Text) == true) { ErrorPlaceEP.SetError(InvoiceCodeTxb, "Vui lòng nhập mã hoả đơn thanh toán của lô hàng"); return(false); } if (bookRepoManage.CheckInvoiceCode(InvoiceCodeTxb.Text) == true && CheckButton == 1) { ErrorPlaceEP.SetError(InvoiceCodeTxb, "Mã hoá đơn đã tồn tại vui lòng kiểm tra lại"); return(false); } return(true); }