Esempio n. 1
0
        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            MainScreen mainScreen = new MainScreen();

            mainScreen.ShowDialog();
        }
Esempio n. 2
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            MainScreen mainScreenObj = new MainScreen();



            if (Convert.ToInt32(maxTextBox.Text) < Convert.ToInt32(minTextBox.Text))
            {
                MessageBox.Show("Your min value needs to be less than the max value.", "Error");
            }
            else if (newProduct.isAssocPartsEmpty())
            {
                MessageBox.Show("You must add at least one associated part.", "Error");
            }
            else
            {
                newProduct.setName(nameTextBox.Text);
                newProduct.setPrice(Convert.ToDouble(priceTextBox.Text));
                newProduct.setInStock(Convert.ToInt32(inventoryTextBox.Text));
                newProduct.setMin(Convert.ToInt32(minTextBox.Text));
                newProduct.setMax(Convert.ToInt32(maxTextBox.Text));

                Inventory.addProduct(newProduct);

                this.Hide();
                mainScreenObj.ShowDialog();
            }
        }
Esempio n. 3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            MainScreen mainScreenObj = new MainScreen();

            Inhouse    inhousePart;
            Outsourced outsourcedPart;

            if (Convert.ToInt32(maxTextBox.Text) > Convert.ToInt32(minTextBox.Text))
            {
                if (inhouseRButton.Checked)
                {
                    inhousePart = new Inhouse();
                    inhousePart.setName(nameTextBox.Text);
                    inhousePart.setPrice(Convert.ToDouble(priceTextBox.Text));
                    inhousePart.setInStock(Convert.ToInt32(inventoryTextBox.Text));
                    inhousePart.setMin(Convert.ToInt32(minTextBox.Text));
                    inhousePart.setMax(Convert.ToInt32(maxTextBox.Text));
                    inhousePart.setMachineID(Convert.ToInt32(companyNameTextBox.Text));

                    Inventory.addPart(inhousePart);
                }

                else if (outsourcedRButton.Checked)
                {
                    outsourcedPart = new Outsourced();
                    outsourcedPart.setName(nameTextBox.Text.ToString());
                    outsourcedPart.setPrice(Convert.ToDouble(priceTextBox.Text));
                    outsourcedPart.setInStock(Convert.ToInt32(inventoryTextBox.Text));
                    outsourcedPart.setMin(Convert.ToInt32(minTextBox.Text));
                    outsourcedPart.setMax(Convert.ToInt32(maxTextBox.Text));
                    outsourcedPart.setCompanyName(companyNameTextBox.Text);

                    Inventory.addPart(outsourcedPart);
                }

                this.Hide();
                mainScreenObj.ShowDialog();
            }
            else
            {
                MessageBox.Show("Your min value is greater than the max value.", "Error");
            }
        }
Esempio n. 4
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            MainScreen mainScreenObj = new MainScreen();

            Inhouse    inhousePart;
            Outsourced outsourcedPart;

            if (inhouseRadioButton.Checked)
            {
                inhousePart = new Inhouse();
                inhousePart.setPartID(partNumber);
                inhousePart.setName(nameTextBox.Text.ToString());
                inhousePart.setPrice(Convert.ToDouble(priceTextBox.Text));
                inhousePart.setInStock(Convert.ToInt32(inventoryTextBox.Text));
                inhousePart.setMin(Convert.ToInt32(minTextBox.Text));
                inhousePart.setMax(Convert.ToInt32(maxTextBox.Text));
                inhousePart.setMachineID(Convert.ToInt32(companyNameTextBox.Text));

                Inventory.updatePart(partNumber, inhousePart);
            }

            else if (outsourcedRadioButton.Checked)
            {
                outsourcedPart = new Outsourced();
                outsourcedPart.setPartID(partNumber);
                outsourcedPart.setName(nameTextBox.Text.ToString());
                outsourcedPart.setPrice(Convert.ToDouble(priceTextBox.Text));
                outsourcedPart.setInStock(Convert.ToInt32(inventoryTextBox.Text));
                outsourcedPart.setMin(Convert.ToInt32(minTextBox.Text));
                outsourcedPart.setMax(Convert.ToInt32(maxTextBox.Text));
                outsourcedPart.setCompanyName(companyNameTextBox.Text);

                Inventory.updatePart(partNumber, outsourcedPart);
            }

            this.Hide();
            mainScreenObj.ShowDialog();
        }