private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            //Error here
            int itemID   = int.Parse(txbUpdateItemID.Text);
            int numTeeth = int.Parse(txbNumOfTeeth.Text);
            int numItems = int.Parse(txbNumOfItems.Text);

            //Error
            try
            {
                if (cbxItemType.Text == "Steel")
                {
                    Sprocket = new SteelSprocket(itemID, numItems, numTeeth);
                    //order.Add(Sprocket);
                    order.items.Add(Sprocket);
                }
                else if (cbxItemType.Text == "Aluminum")
                {
                    Sprocket = new AluminumSprocket(itemID, numItems, numTeeth);
                    order.items.Add(Sprocket);
                }
                else if (cbxItemType.Text == "Plastic")
                {
                    Sprocket = new PlasticSprocket(itemID, numItems, numTeeth);
                    order.items.Add(Sprocket);
                }

                DialogResult = true;
                Close();
            }

            catch (Exception)
            {
                DialogResult = false;
                Close();
            }
        }
Пример #2
0
 public void Remove(Sprocket item)
 {
     //remove an item from the list
     items.Remove(item);
     Calc();
 }
Пример #3
0
        //public SprocketOrder() { }



        public void Add(Sprocket item)
        {
            //Add an item from the list
            items.Add(item);
            Calc();
        }