예제 #1
0
 public void UpdateBasketItem(ucBasketItem basketItem)
 {
     basketItem.SumPrice               = basketItem.Price * basketItem.QTY;
     basketItem.lblFoodPrice.Text      = basketItem.SumPrice.ToString("0.00") + " TL";
     basketItem.lblFoodName.Text       = basketItem.FoodName + " x" + basketItem.QTY;
     basketItem.lblDeleteFood.Location = new Point(basketItem.lblFoodName.Location.X + 5 + basketItem.lblFoodName.Width, basketItem.lblDeleteFood.Location.Y);
     basketItem.lblFoodDesc.Text       = basketItem.FoodDesc;
     ms.LoggedUser.CurrentOrder.PrintFoods(ms.lboxUrunler);
 }
예제 #2
0
 public void RemoveFood(ucBasketItem basketItem)
 {
     basketItem.QTY--;
     basketItem.UpdateBasketItem();
     if (basketItem.QTY == 0)
     {
         this.foodIDListInBasket.Remove(basketItem.FoodID);
         this.FoodsInBasket.Remove(basketItem);
         ms.panelBasket.Controls.Remove(basketItem);
     }
     this.ms.CurrentOrder.GetSumBasketPrice();
     ms.CurrentOrder.CheckRestMinPriceStatus();
     ms.lblSumPrice.Text      = ms.CurrentOrder.SumBasketPrice.ToString("0.00") + " TL";
     ms.lblSumDiscount.Text   = ms.CurrentOrder.DiscountPrice.ToString("0.00") + " TL";;
     ms.lblFinalSumPrice.Text = (ms.CurrentOrder.FinalPrice).ToString("0.00") + " TL";
 }
예제 #3
0
        public ucBasketItem AddFood(ucFoodItem ucFoodItem, MainScreen ms)
        {
            int id = CheckID(ucFoodItem.FoodID);

            if (id == -1)
            {
                ucBasketItem basketItem = new ucBasketItem();
                this.foodIDListInBasket.Add(ucFoodItem.FoodID);
                basketItem.Dock     = DockStyle.Top;
                basketItem.FoodID   = ucFoodItem.FoodID;
                basketItem.Price    = ucFoodItem.Price;
                basketItem.FoodName = ucFoodItem.lblFoodName.Text;
                basketItem.FoodDesc = ucFoodItem.lblFoodDesc.Text;
                basketItem.ms       = ms;
                basketItem.UpdateBasketItem();
                this.ms = ms;
                this.FoodsInBasket.Add(basketItem);
                ms.CurrentOrder.PrintFoods(ms.lboxUrunler);
                ms.CurrentOrder.GetSumBasketPrice();
                ms.CurrentOrder.CheckRestMinPriceStatus();
                return(basketItem);
            }
            else
            {
                foreach (Control c in ms.panelBasket.Controls)
                {
                    if (c is ucBasketItem)
                    {
                        if (((ucBasketItem)c).FoodID == id)
                        {
                            ((ucBasketItem)c).QTY++;
                            ((ucBasketItem)c).UpdateBasketItem();
                        }
                    }
                }
            }
            ms.CurrentOrder.PrintFoods(ms.lboxUrunler);
            ms.CurrentOrder.GetSumBasketPrice();
            ms.CurrentOrder.CheckRestMinPriceStatus();
            return(null);
        }