예제 #1
0
        //Cancels the order
        private void Btn_cancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            var f1 = new form_products(inv);

            f1.FormClosed += (x, args) => this.Close();
            f1.Show();
        }
예제 #2
0
        //Orders the product in the order list box
        private void Btn_order_Click(object sender, EventArgs e)
        {
            InventoryManager im = new InventoryManager();

            for (int i = 0; i < order.Count; i++)
            {
                order[i].Stock = order[i].Stock + 1;
            }
            im.SaveOrder(order);
            im.Save(inv);
            MessageBox.Show("Products Ordered for " + totalPrice.ToString("C2"));
            this.Hide();
            var f1 = new form_products(inv);

            f1.FormClosed += (x, args) => this.Close();
            f1.Show();
        }
예제 #3
0
        //Saves all the information the user changed to the current product
        private void Btn_save_Click(object sender, EventArgs e)
        {
            _product.Id         = int.Parse(tb_id.Text);
            _product.Name       = tb_brand.Text;
            _product.Model      = tb_model.Text;
            _product.Stock      = int.Parse(tb_stock.Text);
            _product.Size       = double.Parse(tb_size.Text);
            _product.Resolution = tb_resolution.Text;
            _product.Picture    = tb_picture.Text;
            _product.Price      = double.Parse(tb_price.Text);
            InventoryManager im = new InventoryManager();

            im.Save(_inv);
            MessageBox.Show("Product updated");
            this.Hide();
            var _form = new form_products(_inv);

            _form.FormClosed += (x, args) => this.Close();
            _form.Show();
        }
예제 #4
0
        //Takes information provided and builds a new Inventory object, then saves it into the Inventory array
        private void Btn_add_Click(object sender, EventArgs e)
        {
            InventoryManager im          = new InventoryManager();
            string           _Model      = tb_productModel.Text;
            string           _Name       = tb_productName.Text;
            string           _Picture    = tb_productPicture.Text;
            double           _Price      = double.Parse(tb_productPrice.Text);
            string           _Resolution = tb_productScreenResolution.Text;
            double           _Size       = double.Parse(tb_productScreenSize.Text);
            int       _Stock             = int.Parse(tb_productStock.Text);
            Inventory product            = new Inventory(id, _Name, _Model, _Stock, _Price, _Size, _Resolution, _Picture);

            //inv = im.Add(inv, product);
            inv = im.AddToList(inv, product);
            im.Save(inv);
            MessageBox.Show("Product Added.");
            this.Hide();
            var f1 = new form_products(inv);

            f1.FormClosed += (x, args) => this.Close();
            f1.Show();
        }