コード例 #1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            Welcome welcome = new Welcome();

            InHouse    inHouse;
            Outsourced outsourced;

            if (errorFound == false)
            {
                if (Convert.ToInt32(PartMaxText.Text) < Convert.ToInt32(PartMinText.Text))
                {
                    MessageBox.Show("Your Min Qty is greater than the Max Qty value");
                }
                else
                {
                    if (InHouseRadio.Checked)
                    {
                        inHouse = new InHouse();

                        inHouse.setName(PartNameText.Text);
                        inHouse.setPartPrice(Convert.ToDouble(PartPriceText.Text));
                        inHouse.setInStock(Convert.ToInt32(PartInvText.Text));
                        inHouse.setPartQtyMin(Convert.ToInt32(PartMinText.Text));
                        inHouse.setPartQtyMax(Convert.ToInt32(PartMaxText.Text));
                        inHouse.setMachineID(Convert.ToInt32(MachineIDText.Text));

                        Inventory.addPart(inHouse);
                    }

                    else if (OutSourceRadio.Checked)
                    {
                        outsourced = new Outsourced();

                        outsourced.setPartID(Convert.ToInt32(PartIDText.Text));
                        outsourced.setName(PartNameText.Text.ToString());
                        outsourced.setPartPrice(Convert.ToDouble(PartPriceText.Text));
                        outsourced.setInStock(Convert.ToInt32(PartInvText.Text));
                        outsourced.setPartQtyMin(Convert.ToInt32(PartMinText.Text));
                        outsourced.setPartQtyMax(Convert.ToInt32(PartMaxText.Text));
                        outsourced.setCompanyName(MachineIDText.Text);

                        Inventory.addPart(outsourced);
                    }

                    this.Hide();

                    welcome.ShowDialog();
                }
            }
        }
コード例 #2
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            Welcome    welcome = new Welcome();
            InHouse    inhouse;
            Outsourced outsourced;

            if (errorFound == false)
            {
                if (inHouse.Checked)
                {
                    inhouse = new InHouse();
                    inhouse.setPartID(part);
                    inhouse.setName(PartNameText.Text.ToString());
                    inhouse.setPartPrice(Convert.ToDouble(PartPriceText.Text));
                    inhouse.setInStock(Convert.ToInt32(PartInvText.Text));
                    inhouse.setPartQtyMin(Convert.ToInt32(PartMinText.Text));
                    inhouse.setPartQtyMax(Convert.ToInt32(PartMaxText.Text));
                    inhouse.setMachineID(Convert.ToInt32(MachineIDText.Text));

                    Inventory.updatePart(part, inhouse);
                }

                else if (outsource.Checked)
                {
                    outsourced = new Outsourced();
                    outsourced.setPartID(part);
                    outsourced.setName(PartNameText.Text.ToString());
                    outsourced.setPartPrice(Convert.ToDouble(PartPriceText.Text));
                    outsourced.setInStock(Convert.ToInt32(PartInvText.Text));
                    outsourced.setPartQtyMin(Convert.ToInt32(PartMinText.Text));
                    outsourced.setPartQtyMax(Convert.ToInt32(PartMaxText.Text));
                    outsourced.setCompanyName(MachineIDText.Text);

                    Inventory.updatePart(part, outsourced);
                }
            }

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