Esempio n. 1
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. 2
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();
        }