Пример #1
0
        public void EditProduct()
        {
            if (SelectedProduct != null)
            {
                var window = new Windows.EditProductWindow();
                window.Owner = Application.Current.MainWindow;
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;

                var selectedProduct = new Classes.PRODUCT();

                selectedProduct.ID           = SelectedProduct.ID;
                selectedProduct.ProductName  = SelectedProduct.ProductName;
                selectedProduct.GenericName  = SelectedProduct.GenericName;
                selectedProduct.Type         = SelectedProduct.Type;
                selectedProduct.Form         = SelectedProduct.Form;
                selectedProduct.BuyingPrice  = SelectedProduct.BuyingPrice;
                selectedProduct.SellingPrice = SelectedProduct.SellingPrice;
                selectedProduct.Quantity     = SelectedProduct.Quantity;

                window.DataContext = selectedProduct;
                var result = window.ShowDialog();
            }
            else
            {
                MessageBox.Show("Please select a product to edit!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
        public void AddProduct()
        {
            var window = new Windows.AddProductWindow();

            window.Owner = Application.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            var newProduct = new Classes.PRODUCT();

            window.DataContext = newProduct;

            var result = window.ShowDialog();

            if (result == true)
            {
                _productList.Add(newProduct);
            }
        }