示例#1
0
 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;
 }
示例#2
0
 private void BindProducts()
 {
     if (CategoryComboBox.SelectedIndex > -1)
     {
         ProductGateway gateway = new ProductGateway();
         ProductsListView.ItemsSource = gateway.GetProducts(NameTextBox.Text, CategoryComboBox.SelectedItem as ProductCategory);
     }
 }
示例#3
0
 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();
     }
 }
示例#4
0
 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();
     }
 }
示例#5
0
 /// <summary>
 /// 启动时启动输入窗体
 /// </summary>
 public ProductView(ProductGateway gateway)
 {
     InitializeComponent();
     this.gateway = gateway;
 }
示例#6
0
 /// <summary>
 /// 启动时启动输入窗体
 /// </summary>
 public ProductList()
 {
     InitializeComponent();
     gateway = new ProductGateway();
     ProductsListView.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ProductsListView_MouseDoubleClick);
 }
示例#7
0
        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();
        }
示例#8
0
 private void BindCategories()
 {
     ProductGateway gateway = new ProductGateway();
     CategoryComboBoxProductDetail.ItemsSource = gateway.GetCategories();
     CategoryComboBoxProductDetail.SelectedIndex = 0;
 }
示例#9
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);
 }