private void btnSearch_Click(object sender, RoutedEventArgs e) { page = new Paging(Common.connection, "LoaiHang where LoaiHangId= '" + txbSearch.Text + "'", "LoaiHangId desc"); QLVTDataSet.LoaiHangDataTable DanhMucVatTus = new QLVTDataSet.LoaiHangDataTable(); DataTable dataTable = page.getPage(0); if (dataTable != null) { DanhMucVatTus.Merge(dataTable); } dgContent.ItemsSource = DanhMucVatTus; tableLog = new DataTableLog((DataTable)dgContent.ItemsSource); tblNumPage.Text = (page.currentIndex + 1) + "/" + (page.totalPage + 1); }
public void loadData(int p) { try { page = new Paging(Common.connection, "LoaiHang", "LoaiHangId desc"); QLVTDataSet.LoaiHangDataTable DanhMucVatTus = new QLVTDataSet.LoaiHangDataTable(); DataTable dataTable = page.getPage(p); if (dataTable != null) { DanhMucVatTus.Merge(dataTable); } dgContent.ItemsSource = DanhMucVatTus; tableLog = new DataTableLog((DataTable)dgContent.ItemsSource); tblNumPage.Text = (page.currentIndex + 1) + "/" + (page.totalPage + 1); }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void tbxLoaiHang_KeyUp(object sender, KeyEventArgs e) { QLVTDataSet.LoaiHangDataTable loaiHangs = new QLVTDataSet.LoaiHangDataTable(); try { DataTable table; int rs; if (int.TryParse(tbxLoaiHang.Text, out rs)) { table = Common.LoaiHangDataTable.Select("Ten like '%" + tbxLoaiHang.Text + "%' or LoaiHangId = " + rs).Take(5).CopyToDataTable(); } else { table = Common.LoaiHangDataTable.Select("Ten like '%" + tbxLoaiHang.Text + "%'").Take(5).CopyToDataTable(); } loaiHangs.Merge(table); dgLoaiMatHang.ItemsSource = loaiHangs; } catch (Exception ex) { } }