private void updateDataGridView() { List <Product> products = DBHelper.getAllProduct(); if (products != null) { //Load database dgvProducts.DataSource = DBHelper.getDBConnection().Dt; //Update data dgvProducts.DataSource = MainUtils.convertListToDataTable(products); //Update current cell selected. if (iIndex > 0) { dgvProducts.CurrentCell = dgvProducts[0, iIndex]; } updateIDItemCurrent(); } else { MessageBox.Show("Không có sản phẩm nào trong dữ liệu!"); } }
private void updateDataGridViewFirst() { //Load database dgvProducts.DataSource = DBHelper.getDBConnection().Dt; //Update data dgvProducts.DataSource = MainUtils.convertListToDataTable(DBHelper.getAllProduct()); //Update current cell selected. if (!addNew) { dgvProducts.CurrentCell = dgvProducts[0, MainForm.ItemSelected]; updateIDItemCurrent(); } }
private void updateSearchDescDataGridView(String value) { List <Product> products = DBHelper.getProductsLike(ProductsTable.COLUMN_DESC, value); if (products.Count > 0) { //Load database dgvProducts.DataSource = DBHelper.getDBConnection().Dt; //Update data dgvProducts.DataSource = MainUtils.convertListToDataTable(products); //Update current cell selected. //dgvProducts.CurrentCell = dgvProducts[0, iIndex]; updateIDItemCurrent(); } }