private void fillSaleDGandProductDG()
        {
            DB.resetConnString();
            productsDG.Items.Clear();
            salesHistoryDG.Items.Clear();
            listView.Items.Clear();
            deleteSelected.IsEnabled = false;
            adjustQuantity.IsEnabled = false;

            if (productModel.SelectedIndex == -1)
            {
                return;
            }

            // for product and barocde datagrid
            product = ProductTableData.getProductByModel(productModel.SelectedItem.ToString());
            Barcode[] barcodes = ProductTableData.getBarcodesByPID(product.ID);

            if (product.Unique_Barcode.StartsWith("Y"))
            {
                deleteSelected.IsEnabled = true;
            }
            else
            {
                adjustQuantity.IsEnabled = true;
            }

            foreach (var item in barcodes)
            {
                if (premitBarcodeinListView(item.Barcode_Serial) == true)
                {
                    listView.Items.Add(new ListViewItems(listView.Items.Count + 1, item.Barcode_Serial, item.Color, item.Date.ToString()));
                }
            }

            productsDG.Items.Add(product);

            //for sales table
            List <Customer_Sale> customer_Sale_List = Customer_SaleTableData.getCustomer_SalebyMatchingProduct(product);

            foreach (var item in customer_Sale_List)
            {
                if (item.Sale == null)
                {
                    MessageBox.Show("Error showing this item. ");
                    continue;
                }
                SalesHistoryDataGrid salesHis;
                if (item.Gifts.Count == 0)
                {
                    salesHis = new SalesHistoryDataGrid(item, "");
                }
                else
                {
                    salesHis = new SalesHistoryDataGrid(item, item.Gifts.First().Barcode);
                }

                salesHistoryDG.Items.Add(salesHis);
            }
        }
コード例 #2
0
        private void sameBarcode_Checked(object sender, RoutedEventArgs e)
        {
            Product pro = ProductTableData.getProductByModel(productModel.Text);

            Barcode[] barcodeList = ProductTableData.getBarcodesByPID(pro.ID);
            listView.Items.Clear();
            if (barcodeList.Count() == 1)
            {
                listView.Items.Add(new ListViewItems(1, barcodeList[0].Barcode_Serial, barcodeList[0].Color));
                barcodeSerial.IsEnabled  = false;
                color.IsEnabled          = false;
                barcodeSerial.Background = new SolidColorBrush(Colors.LightBlue);
                listView.IsEnabled       = false;
                clearAll.IsEnabled       = false;
                Add_Color.IsEnabled      = false;
            }
        }