public MainWindow(Employee x)
        {
            InitializeComponent();

            listBox.ItemsSource = Product.GetAll();

            foreach (Category item in categories)
            {
                category_comboBox.Items.Add(item);
            }
            foreach (ProductLocation item in locations)
            {
                Location_comboBox.Items.Add(item);
            }

            //This shows which employee is logged in
            k = x;
        }
        private void Disc_Product_button_Click(object sender, RoutedEventArgs e)
        {
            Product item = (Product)listBox.SelectedItem;

            item.DiscontinueItem();
            listBox.ItemsSource = Product.GetAll();

            //Set the proper button enablings
            Disc_Product_button.IsEnabled   = false;
            Update_Product_button.IsEnabled = false;
            Add_Product_button.IsEnabled    = true;
            Location_comboBox.IsEnabled     = true;

            //Re-enable the textboxes that can't be modified
            Product_Code_Textbox.IsEnabled = true;
            Product_Name_textBox.IsEnabled = true;
            Unit_Price_textBox.IsEnabled   = true;

            ResetBoxesToBlank();
        }
        //Update the selected product
        private void Update_Product_button_Click(object sender, RoutedEventArgs e)
        {
            //Check all of the text/combo box fields
            string product_Code = Product_Code_Textbox.Text.ToString();
            string product_Name = Product_Name_textBox.Text.ToString();
            double list_price, unit_price;
            bool   listPrice, unitPrice, reorderLevel, reorderQuant, onHand;
            int    reorder_level, reorder_quant, on_Hand;

            CheckTextBoxes(out list_price, out listPrice, out unit_price, out unitPrice, out reorder_level, out reorderLevel, out reorder_quant, out reorderQuant, out on_Hand, out onHand);


            if (listPrice && unitPrice && reorderLevel && reorderQuant && onHand && product_Code.Length > 1 && product_Name.Length > 1)
            {
                Product   product   = (Product)listBox.SelectedItem;
                Inventory inventory = Inventory.GetWithCode(product.Product_Code);

                string category = category_comboBox.Text.ToString();

                Product.ChangeProductCategory(product.Product_Id, category);
                Product.UpdateListPrice(product.Product_Id, list_price);

                Inventory.setFiltersToOrder(product.Product_Id, reorder_level, reorder_quant);
                inventory.ModifyItemStock(on_Hand);

                //Re-enable the textboxes that can't be updated in case a new product is to be added
                Product_Code_Textbox.IsEnabled = true;
                Product_Name_textBox.IsEnabled = true;
                Unit_Price_textBox.IsEnabled   = true;

                //reset/update all fields
                listBox.ItemsSource             = Product.GetAll();
                Disc_Product_button.IsEnabled   = false;
                Update_Product_button.IsEnabled = false;
                Add_Product_button.IsEnabled    = true;
                Location_comboBox.IsEnabled     = true;

                ResetBoxesToBlank();
            }
        }
        private void Add_Product_button_Click(object sender, RoutedEventArgs e)
        {
            string product_Code = Product_Code_Textbox.Text.ToString();
            string product_Name = Product_Name_textBox.Text.ToString();

            double list_price, unit_price;
            bool   listPrice, unitPrice, reorderLevel, reorderQuant, onHand;
            int    reorder_level, reorder_quant, on_Hand;

            CheckTextBoxes(out list_price, out listPrice, out unit_price, out unitPrice, out reorder_level, out reorderLevel, out reorder_quant, out reorderQuant, out on_Hand, out onHand);

            //Ensure all fields have actually been filled out
            if (listPrice && unitPrice && reorderLevel && reorderQuant && onHand && product_Code.Length >= 4 && product_Name.Length >= 1 && category_comboBox.SelectedIndex >= 0)
            {
                //Create and Add the product to the database
                string  category = category_comboBox.Text.ToString();
                Product product  = new Product(product_Name, product_Code, category, list_price, unit_price);

                string    location      = Location_comboBox.Text.ToString();
                Inventory inventoryitem = new Inventory(product_Name, location, product_Code, on_Hand, reorder_level, reorder_quant);

                ProductLocation pl = (ProductLocation)Location_comboBox.SelectedItem;
                ProductLocation.ChangeItemAtLocation(pl.Product_Location, product_Code, on_Hand);

                product.Save();
                inventoryitem.Save();

                //Reset all Textboxes to blank;
                ResetBoxesToBlank();
                listBox.ItemsSource = Product.GetAll(); //refresh the listbox items
                List <ProductLocation> locations = ProductLocation.GetAllEmpty();
                Location_comboBox.Items.Clear();
                foreach (ProductLocation item in locations)
                {
                    Location_comboBox.Items.Add(item);
                }
            }
        }