Example #1
0
        public BasketWindow(UnidaysDiscountChallenge unidaysDiscountChallenge)
        {
            InitializeComponent();

            GetItems(unidaysDiscountChallenge, unidaysDiscountChallenge.GetBasket());

            //Get the cost of all the items
            decimal price      = unidaysDiscountChallenge.CalculateTotalPrice();
            decimal totalPrice = price;

            //Factor delivery charge
            if (price < 50)
            {
                tbShipping.Text = "Delivery - £7.00";
                totalPrice     += 7.00m;
            }
            else
            {
                tbShipping.Text = "Delivery - £0.00";
            }

            //Display
            tbPrice.Text = "Item cost - £" + price.ToString();
            tbTotal.Text = "Total Cost - £" + totalPrice.ToString();

            tbBasketSize.Text = unidaysDiscountChallenge.GetBasketSize().ToString();

            butBack.Click += ButBack_Click;
        }