Exemplo n.º 1
0
        ////////////////// UI Events and UI Management //////////////////////

        private void StoreItems_DiscountSelected(object sender, EventArgs e)
        {
            POSDiscount discount = ((StoreDiscount)((Control)sender).Parent).Discount;

            Store.CurrentOrder.Discount = discount;

            DisplayDiscount DisplayDiscount = new DisplayDiscount();

            DisplayDiscount.name = discount.Name;
            // our business rules say only 1 order discount
            while (DisplayOrder.discounts.elements.Count > 0)
            {
                DisplayDiscount RemovedDisplayDiscount = (DisplayDiscount)DisplayOrder.discounts.elements[0];
                DisplayOrder.discounts.Remove(RemovedDisplayDiscount);
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrderDiscountRemoved(DisplayOrder, RemovedDisplayDiscount);
            }

            if (discount.Value(1000) != 0)
            {
                DisplayOrder.addDisplayDiscount(DisplayDiscount);
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrderDiscountAdded(DisplayOrder, DisplayDiscount);
            }

            UpdateUI();
        }