public void UpdateProduct(Product product) { ProductGateway gateway = new ProductGateway(); this.Product = gateway.GetProducts(product.Name, product.ProductCategory, 1, 0)[0]; this.FormCreateMode = false; this.Title = "Edit " + product.Name; }
private void BindProducts() { if (CategoryComboBox.SelectedIndex > -1) { ProductGateway gateway = new ProductGateway(); ProductsListView.ItemsSource = gateway.GetProducts(NameTextBox.Text, CategoryComboBox.SelectedItem as ProductCategory); } }
private void BindProducts() { if (CategoryComboBox.SelectedIndex > -1) { ProductGateway gateway = new ProductGateway(); ProductsListView.ItemsSource = gateway.GetProducts(NameTextBox.Text, CategoryComboBox.SelectedItem as ProductCategory, PageSize, this.currentPageNumber); this.UpdateNavigationButtons(); } }
private void BtnDeleteProduct_Click(object sender, RoutedEventArgs e) { Product p = ProductsListView.SelectedItem as Product; if (p != null) { ProductGateway gateway = new ProductGateway(); gateway.DeleteProduct(p); this.BindProducts(); } }
/// <summary> /// 启动时启动输入窗体 /// </summary> public ProductView(ProductGateway gateway) { InitializeComponent(); this.gateway = gateway; }
/// <summary> /// 启动时启动输入窗体 /// </summary> public ProductList() { InitializeComponent(); gateway = new ProductGateway(); ProductsListView.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ProductsListView_MouseDoubleClick); }
private void BtnSave_Click(object sender, RoutedEventArgs e) { ProductGateway gateway = new ProductGateway(); if (this.FormCreateMode) { Product.ProductCategory = (ProductCategory)CategoryComboBoxProductDetail.SelectedItem; gateway.AddProduct(Product); } else { Product.ProductCategory = (ProductCategory)CategoryComboBoxProductDetail.SelectedItem; gateway.UpdateProduct(Product); } this.Close(); }
private void BindCategories() { ProductGateway gateway = new ProductGateway(); CategoryComboBoxProductDetail.ItemsSource = gateway.GetCategories(); CategoryComboBoxProductDetail.SelectedIndex = 0; }
private void RecalculateProductsSetSize() { ProductGateway gateway = new ProductGateway(); this.productSetSize = gateway.GetProductsCount(NameTextBox.Text, CategoryComboBox.SelectedItem as ProductCategory); this.TotalProductsCountLabel.Text = string.Format(CultureInfo.CurrentUICulture, "Total Products in Category: {0}", this.productSetSize); }