Beispiel #1
0
        private void addToOrderButton_Click(object sender, EventArgs e)
        {
            chipsOrder.NameOfItem = "Chips";

            #region Storing items into Object
            if (chipsCustomiseCheckBox.GetItemChecked(0))
            {
                chipsOrder.ChipsSalt = true;
            }
            else
            {
                chipsOrder.ChipsSalt = false;
            }
            if (chipsCustomiseCheckBox.GetItemChecked(1))
            {
                chipsOrder.ChipsPepper = true;
            }
            else
            {
                chipsOrder.ChipsPepper = false;
            }
            if (chipsCustomiseCheckBox.GetItemChecked(2))
            {
                chipsOrder.ChipsCheese = true;
            }
            else
            {
                chipsOrder.ChipsCheese = false;
            }
            if (chipsCustomiseCheckBox.GetItemChecked(3))
            {
                chipsOrder.ChipsKetchupDip = true;
            }
            else
            {
                chipsOrder.ChipsKetchupDip = false;
            }

            #endregion Storing items into Object

            chipsOrder.PriceOfItem = chipsOrder.ReturnTotalCost(); //adds up all the prices of each additional customisation
                                                                   //store This perticular item price to Price of item
            orderScreen.AddToOrderList(chipsOrder);

            orderScreen.Show();
            this.Dispose();
        }
Beispiel #2
0
        private void chipsButton_Click(object sender, EventArgs e)
        {
            float totalCost = float.Parse(totalCostTextBox.Text);

            //creating setting name and price of object
            Chips chipsItem = new Chips();

            chipsItem.NameOfItem  = "Medium Chips";
            chipsItem.PriceOfItem = chipsItem.ReturnTotalCost();
            chipsItem.PriceOfItem = 1.69f;
            order.addItem(chipsItem);

            //adding to customer order list
            orderListBox.Items.Add(chipsItem.NameOfItem + " \t\t\t\t £" + chipsItem.PriceOfItem);

            //adding cost of item to total
            totalCost            += (float)(chipsItem.PriceOfItem);
            totalCostTextBox.Text = totalCost.ToString();
        }