示例#1
0
        private void secondItemMenu_Click(object sender, EventArgs e)
        {
            Button buttonClicked = sender as Button;

            switch (buttonClicked.Text)
            {
            case "Apple Smoothy":
                drink = new AppleSmoothy();
                this.stock.appleSmoothyStock -= 1;
                break;

            case "Coke":
                drink = new Coke();
                this.stock.cokeStock -= 1;
                break;
            }
            afternoonTea = new AfternoonTea <Dessert, Drink>(dessert, drink);
            this.Close();
        }
示例#2
0
        private void menu_Click(object sender, EventArgs e)
        {
            Button buttonClicked = sender as Button;
            int    rowIndex      = orderDetails.Rows.Add();
            var    row           = orderDetails.Rows[rowIndex];

            switch (buttonClicked.Name)
            {
            case "Breakfast":
                BreakfastView breakfastView = new BreakfastView(stock);
                breakfastView.ShowDialog();
                breakfast = breakfastView.breakfast;
                row.Cells["item"].Value  = buttonClicked.Name;
                row.Cells["price"].Value = breakfast.price;

                break;

            case "Lunch":
                LunchView lunchView = new LunchView(stock);
                lunchView.ShowDialog();
                lunch = lunchView.lunch;
                row.Cells["item"].Value  = buttonClicked.Name;
                row.Cells["price"].Value = lunch.price;
                break;

            case "Afternoon Tea":
                AfternoonTeaView afternoonTeaView = new AfternoonTeaView(stock);
                afternoonTeaView.ShowDialog();
                afternoonTea             = afternoonTeaView.afternoonTea;
                row.Cells["item"].Value  = buttonClicked.Name;
                row.Cells["price"].Value = afternoonTea.price;
                break;
            }
            updateTotal();
            loadButtonsText();
        }