Esempio n. 1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (isInhouse == true)
                {
                    Part part = new Inhouse(Convert.ToInt32(TxtPartID.Text), TxtName.Text, Convert.ToInt32(TxtInventory.Text), Convert.ToDecimal(TxtPrice.Text),
                                            Convert.ToInt32(TxtMin.Text), Convert.ToInt32(TxtMax.Text), Convert.ToInt32(TxtPartSource.Text));

                    Inventory.UpdatePart(Inventory.CurrentPartIndex, part);
                    Form.ActiveForm.Close();
                }
                else if (isInhouse == false)
                {
                    Part part = new Outsourced(Convert.ToInt32(TxtPartID.Text), TxtName.Text, Convert.ToInt32(TxtInventory.Text), Convert.ToDecimal(TxtPrice.Text),
                                               Convert.ToInt32(TxtMin.Text), Convert.ToInt32(TxtMax.Text), TxtPartSource.Text);
                    Inventory.UpdatePart(Inventory.CurrentPartIndex, part);
                    Form.ActiveForm.Close();
                }
            }
            catch (FormatException FormatException)
            {
                MessageBox.Show(FormatException.Message, "Format Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        public static void AddPart(Part part)
        {
            if (part is Inhouse)
            {
                Inhouse temp  = part as Inhouse;
                Inhouse IPart = new Inhouse
                                (
                    part.PartID,
                    part.Name,
                    part.InStock,
                    part.Price,
                    part.Min,
                    part.Max,
                    temp.MachineID

                                );

                List.AllParts.Add(IPart);
            }
            else if (part is Outsourced)
            {
                Outsourced temp  = part as Outsourced;
                Outsourced OPart = new Outsourced(part.PartID, part.Name, part.InStock, part.Price, part.Max, part.Min, temp.CompanyName);


                List.AllParts.Add(OPart);
            }
        }
Esempio n. 3
0
 public Modify_Part()
 {
     InitializeComponent();
     TxtPartID.Text    = Inventory.CurrentPart.PartID.ToString();
     TxtName.Text      = Inventory.CurrentPart.Name;
     TxtInventory.Text = Inventory.CurrentPart.InStock.ToString();
     TxtPrice.Text     = Inventory.CurrentPart.Price.ToString();
     TxtMin.Text       = Inventory.CurrentPart.Min.ToString();
     TxtMax.Text       = Inventory.CurrentPart.Max.ToString();
     if (Inventory.CurrentPart is Inhouse)
     {
         Inhouse e = Inventory.CurrentPart as Inhouse;
         TxtPartSource.Text   = e.MachineID.ToString();
         isInhouse            = true;
         InHouseRadio.Checked = true;
     }
     else
     {
         Outsourced e = Inventory.CurrentPart as Outsourced;
         TxtPartSource.Text      = e.CompanyName;
         isInhouse               = false;
         OutsourcedRadio.Checked = true;
         SourceLabel.Location    = new Point(25, 298);
     }
 }