private void editProduct() { var selectedItem = (Product)dgInventoryList.SelectedItem; if (selectedItem == null) { return; } var frmAddEditProduct = new frmAddEditProduct(selectedItem); if (frmAddEditProduct.ShowDialog() == true) { var productManager = new ProductManager(); dgInventoryList.ItemsSource = productManager.GetProductsByActive((bool)chkShowActive.IsChecked); dgInventoryList.Columns[0].Header = "Product ID"; dgInventoryList.Columns[1].Header = "Product Name"; dgInventoryList.Columns[2].Header = "Vendor"; dgInventoryList.Columns[3].Header = "Product Type"; dgInventoryList.Columns[4].Header = "Buy Price"; dgInventoryList.Columns[5].Header = "Sale Price"; dgInventoryList.Columns[6].Header = "Quantity"; dgInventoryList.Columns[7].Header = "Active"; } }
private void btnAddProduct_Click(object sender, RoutedEventArgs e) { var frmAddEditProduct = new frmAddEditProduct(); if (frmAddEditProduct.ShowDialog() == true) { var productManager = new ProductManager(); dgInventoryList.ItemsSource = productManager.GetProductsByActive((bool)chkShowActiveProducts.IsChecked); dgInventoryList.Columns[0].Header = "Product ID"; dgInventoryList.Columns[1].Header = "Product Name"; dgInventoryList.Columns[2].Header = "Vendor"; dgInventoryList.Columns[3].Header = "Product Type"; dgInventoryList.Columns[4].Header = "Buy Price"; dgInventoryList.Columns[5].Header = "Sale Price"; dgInventoryList.Columns[6].Header = "Quantity"; dgInventoryList.Columns[7].Header = "Active"; } }