Beispiel #1
0
        public void loadData(int p)
        {
            try
            {
                Common.LoaiHangTableAdapter.Connection = Common.connection;
                Common.LoaiHangTableAdapter.Fill(Common.LoaiHangDataTable);

                page = new Paging(Common.connection, "MatHang", "MatHangId desc");
                QLVTDataSet.MatHangDataTable VatTus = new QLVTDataSet.MatHangDataTable();


                DataTable dataTable = page.getPage(p);
                if (dataTable != null)
                {
                    VatTus.Merge(dataTable);
                }
                dgContent.ItemsSource = VatTus;
                tableLog = new DataTableLog((DataTable)dgContent.ItemsSource);

                tblNumPage.Text = (page.currentIndex + 1) + "/" + (page.totalPage + 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            page = new Paging(Common.connection, "MatHang where MatHangId= '" + txbSearch.Text + "'", "MatHangId desc");
            QLVTDataSet.MatHangDataTable VatTus = new QLVTDataSet.MatHangDataTable();


            DataTable dataTable = page.getPage(0);

            if (dataTable != null)
            {
                VatTus.Merge(dataTable);
            }
            dgContent.ItemsSource = VatTus;
            tableLog = new DataTableLog((DataTable)dgContent.ItemsSource);

            tblNumPage.Text = (page.currentIndex + 1) + "/" + (page.totalPage + 1);
        }
Beispiel #3
0
 private void txbVT_KeyUp(object sender, KeyEventArgs e)
 {
     QLVTDataSet.MatHangDataTable matHangs = new QLVTDataSet.MatHangDataTable();
     try
     {
         DataTable table;
         int       rs;
         if (int.TryParse(txbVT.Text, out rs))
         {
             table = Common.MatHangDataTable.Select("Ten like '%" + txbVT.Text + "%' or MatHangId = " + rs).CopyToDataTable();
         }
         else
         {
             table = Common.MatHangDataTable.Select("Ten like '%" + txbVT.Text + "%'").CopyToDataTable();
         }
         matHangs.Merge(table);
         dgMatHang.ItemsSource = matHangs;
     }
     catch (Exception ex)
     {
     }
 }