Пример #1
0
 public void getPartINFO(int inHouse, int outsourced, string companyName, int machineID)
 {
     if (inHouse == 1)
     {
         house = true;
         Inhouse inHouseINFO = new Inhouse();
         inHouseINFO.setInhouse(inHouse);
         inHouseINFO.setMachineID(machineID);
         inHouseINFO.setoutsourced(outsourced);
         //return inHouseINFO;
         info = inHouseINFO;
     }
     else
     {
         house = false;
         Outsourced outSourceINFO = new Outsourced();
         outSourceINFO.setInhouse(inHouse);
         outSourceINFO.setoutsourced(outsourced);
         outSourceINFO.setCompanyName(companyName);
         infoO = outSourceINFO;
     }
 }
Пример #2
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            bool pass = validation();

            if (pass)
            {
                //Grab ID for the part we are changing
                int id = modifyPart.getParttID();
                //Grab fields on form and set those to Modify Part
                String partName = partNameTextbox.Text;

                Double partPrice = Convert.ToDouble(priceCostTextbox.Text);

                int partInStock = Convert.ToInt32(invTextbox.Text);

                int partMin = Convert.ToInt32(minTextbox.Text);

                int partMax = Convert.ToInt32(maxTextbox.Text);

                bool inHouse = inHouseRadio.Checked;

                bool outsourced = outsourcedRadio.Checked;

                if (inHouse)
                {
                    Console.WriteLine("Updateding inHouse");

                    modifyOutSource.setInhouse(1);
                    modifyOutSource.setoutsourced(0);

                    modifyInHouse.setInhouse(1);
                    modifyInHouse.setoutsourced(0);
                    modifyInHouse.setMachineID(Convert.ToInt32(variableTextbox.Text));
                }
                else
                {
                    Console.WriteLine("Updateding outSourced");

                    modifyInHouse.setInhouse(0);
                    modifyInHouse.setoutsourced(1);

                    modifyOutSource.setInhouse(0);
                    modifyOutSource.setoutsourced(1);
                    modifyOutSource.setCompanyName(Convert.ToString(variableTextbox.Text));
                }

                modifyPart.setMax(partMax);
                modifyPart.setMin(partMin);
                modifyPart.setinStock(partInStock);
                modifyPart.setName(partName);
                modifyPart.setPrice(partPrice);


                //Call updatePart passing in ID and modifyPart
                Inventory modify = new Inventory();
                //adds inhouse or outsourced info
                if (inHouse)
                {
                    modify.houseInfo(modifyInHouse);
                }
                else
                {
                    modify.outSourceInfo(modifyOutSource);
                }

                modify.updatePart(id, modifyPart);

                this.Close();
                MainScreen main = new MainScreen();
                main.Show();
            }
        }