Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {

            if (ProductID.Text == "" || ProductName.Text == "" || QuantityPerUnit.Text == "" || CategoryID.Text == "" ||
                UnitPrice.Text == "" || UnitInStock.Text == "" || ReorderLevel.Text == "" || SupplierID.Text == "" ||
                Discontinued.Text == "")
            {
                MessageBox.Show("All Fields are required to be filled");
            }
            else
            {
                dataAccess data = new dataAccess();
                products prod = new products();
                prod.BarCode = long.Parse(ProductID.Text);
                prod.ProductName = ProductName.Text;
                prod.QuantityPerUnit = int.Parse(QuantityPerUnit.Text);
                prod.ReorderLevel = int.Parse(ReorderLevel.Text);
                prod.UnitInStock = int.Parse(UnitInStock.Text);
                prod.UnitPrice = double.Parse(UnitPrice.Text);
                prod.Discontinued = Discontinued.Text;

                data.editProducts(prod);
                MessageBox.Show("Product " + prod.ProductName + " Modified Successfully");
            }
        }