Exemplo n.º 1
0
        private void save_Click(object sender, EventArgs e)
        {
            this.Hide();
            if (machineTxt.BackColor == Color.White)
            {
                Part newPart = new Inhouse(nameText.Text, int.Parse(inventoryText.Text), decimal.Parse(priceText.Text), int.Parse(minText.Text), int.Parse(maxText.Text), int.Parse(machineTxt.Text));
                Inventory.addPart(newPart);
            }
            else
            {
                Part newPart = new Outsourced(nameText.Text, int.Parse(inventoryText.Text), decimal.Parse(priceText.Text), int.Parse(minText.Text), int.Parse(maxText.Text), companyNameTxt.Text);
                Inventory.addPart(newPart);
            }
            MainScreen mainScreen = new MainScreen();

            mainScreen.Show();
        }
Exemplo n.º 2
0
        private void save_Click(object sender, EventArgs e)
        {
            this.Hide();
            if (machineTxt.Text != "" && companyNameTxt.Text == "")
            {
                Part newPart = new Inhouse(nameText.Text, int.Parse(inventoryText.Text), decimal.Parse(priceText.Text), int.Parse(minText.Text), int.Parse(maxText.Text), int.Parse(machineTxt.Text));
                Inventory.updatePart(int.Parse(idText.Text), newPart);
            }
            else
            {
                Part newPart = new Outsourced(nameText.Text, int.Parse(inventoryText.Text), decimal.Parse(priceText.Text), int.Parse(minText.Text), int.Parse(maxText.Text), companyNameTxt.Text);
                Inventory.updatePart(int.Parse(idText.Text), newPart);
            }
            MainScreen mainScreen = new MainScreen();

            mainScreen.Show();
        }
Exemplo n.º 3
0
        private void autoPopulate()
        {
            var product = Inventory.lookupProduct(Inventory.Products[Inventory.Index].ProductID);

            if (product != null)
            {
                idText.Text        = product.ProductID.ToString();
                nameText.Text      = product.Name;
                inventoryText.Text = product.InStock.ToString();
                priceText.Text     = product.Price.ToString();
                maxText.Text       = product.Max.ToString();
                minText.Text       = product.Min.ToString();
            }
            else
            {
                MessageBox.Show("There is no matching product");
                this.Hide();
                MainScreen mainScreen = new MainScreen();
                mainScreen.Show();
            }
        }