예제 #1
0
        private void goodsListView2_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var selectedGoods = goodsListView2.SelectedItem as Good;

            Good updatedGoods = busGoods.GetGoodsById(selectedGoods.ID);

            if (updatedGoods.ID == selectedGoods.ID)
            {
                var updateWindowsScreen = new UpdateWindows(updatedGoods);

                if (updateWindowsScreen.ShowDialog() == true)
                {
                    goodsListView1.ItemsSource = busGoods.GetAllGoods();
                    goodsListView2.ItemsSource = busGoods.GetAllGoods();

                    //Thêm Filter vào Search
                    CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(goodsListView2.ItemsSource);
                    view.Filter = GoodsFilter;

                    return;
                }
                else
                {
                    return;
                }
            }
        }
예제 #2
0
        private void searchButton2_Click(object sender, RoutedEventArgs e)
        {
            if (searchTextBox2.Text.Contains("Mã Code") || searchTextBox2.Text.Length == 0)
            {
                return;
            }

            Good goods = busGoods.GetGoodsByGoodsCode(searchTextBox2.Text);

            if (goods.GoodsCode == searchTextBox2.Text)
            {
                var updateWindowsScreen = new UpdateWindows(goods);

                if (updateWindowsScreen.ShowDialog() == true)
                {
                    goodsListView1.ItemsSource = busGoods.GetAllGoods();
                    goodsListView2.ItemsSource = busGoods.GetAllGoods();

                    //Thêm Filter vào Search
                    CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(goodsListView2.ItemsSource);
                    view.Filter = GoodsFilter;

                    return;
                }
                else
                {
                    return;
                }
            }

            MessageBox.Show("Không tìm thấy...Vui lòng nhập lại Code!");
        }