Ejemplo n.º 1
0
        private void editProduct(Product prod)
        {
            ProductForm pf = new ProductForm();

            pf.Title                = "Edit Product Details";
            pf.productName.Text     = prod.ProductName;
            pf.quantityPerUnit.Text = prod.QuantityPerUnit;
            pf.unitPrice.Text       = prod.UnitPrice.ToString();

            if (pf.ShowDialog().Value)
            {
                prod.ProductName           = pf.productName.Text;
                prod.QuantityPerUnit       = pf.quantityPerUnit.Text;
                prod.UnitPrice             = Decimal.Parse(pf.unitPrice.Text);
                this.saveChanges.IsEnabled = true;
            }
        }
Ejemplo n.º 2
0
        private void addNewProduct()
        {
            ProductForm pf = new ProductForm();

            pf.Title = "New Product for " + supplier.CompanyName;
            if (pf.ShowDialog().Value)
            {
                Product newProd = new Product();
                newProd.SupplierID      = supplier.SupplierID;
                newProd.ProductName     = pf.productName.Text;
                newProd.QuantityPerUnit = pf.quantityPerUnit.Text;
                newProd.UnitPrice       = Decimal.Parse(pf.unitPrice.Text);
                supplier.Products.Add(newProd);
                productsInfo.Add(newProd);
                this.saveChanges.IsEnabled = true;
            }
        }