Exemplo n.º 1
0
        // Zdarzenie usuwania zaznaczonych produktów z koszyka
        private void uiBtnDelete_Click(object sender, EventArgs e)
        {
            for (int i = uiClbShopingCard.CheckedItems.Count - 1; i >= 0; i--)
            {
                if (uiClbShopingCard.CheckedItems[i] is IPizza)
                {
                    IPizza pizza = uiClbShopingCard.CheckedItems[i] as IPizza;
                    _orderCost -= pizza.Price();
                    uiClbShopingCard.Items.RemoveAt(uiClbShopingCard.Items.IndexOf(uiClbShopingCard.CheckedItems[i]));
                }
                else if (uiClbShopingCard.CheckedItems[i] is IDrink)
                {
                    IDrink drink = uiClbShopingCard.CheckedItems[i] as IDrink;
                    _orderCost -= drink.Price();
                    uiClbShopingCard.Items.RemoveAt(uiClbShopingCard.Items.IndexOf(uiClbShopingCard.CheckedItems[i]));
                }
                else if (uiClbShopingCard.CheckedItems[i] is ISoup)
                {
                    ISoup soup = uiClbShopingCard.CheckedItems[i] as ISoup;
                    _orderCost -= soup.Price();
                    uiClbShopingCard.Items.RemoveAt(uiClbShopingCard.Items.IndexOf(uiClbShopingCard.CheckedItems[i]));
                }
                else if (uiClbShopingCard.CheckedItems[i] is IMainDish)
                {
                    IMainDish mainDish = uiClbShopingCard.CheckedItems[i] as IMainDish;
                    _orderCost -= mainDish.Price();
                    uiClbShopingCard.Items.RemoveAt(uiClbShopingCard.Items.IndexOf(uiClbShopingCard.CheckedItems[i]));
                }
            }

            uiTxtOrderCost.Text = _orderCost.ToString("C", _cultureInfo);
        }
Exemplo n.º 2
0
 public ToppingsForDinner(IMainDish mainDish)
     : this()
 {
     _mainDish             = mainDish;
     uiLblDinnerName.Text  = mainDish.Name();
     _actualPrice          = mainDish.Price();
     uiTxtPrice.Text       = _actualPrice.ToString("C", _cultureInfo);
     _addToMainDishObjects = _toppingsLogic.GetMainDishToppingsObjects();
     AddMenu();
 }
Exemplo n.º 3
0
 public override decimal Price()
 {
     return(_mainDish.Price() + _price);
 }