public DiscountOverrideMenu(DiscountDisplayBox discountToModify, Transaction transaction, ClosePriceOverrideMenu closeFunction) { InitializeComponent(); m_discountBox = discountToModify; m_transaction = transaction; m_closeFunction = closeFunction; OriginalAmountField.Text = "Original Amount: " + m_discountBox.Discount; }
private void RemoveDiscount(DiscountDisplayBox discountToRemove) { m_stackOfDiscounts.Children.Remove(discountToRemove); if (m_stackOfDiscounts.Children.Count == 0) { m_noDiscounts = true; Grid blankCoupon = new Grid(); blankCoupon.Height = boxHeight; m_stackOfDiscounts.Children.Add(blankCoupon); m_noDiscounts = true; } m_updateFunction(); }
public ItemAndDiscountOutputObject(Item newItem, Transaction transaction, double heightOfEachBox, StackPanel itemOutputPanel, StackPanel couponOutputPanel, UpdateTotals updateFunction, Employee currentUser) { m_item = newItem; m_transaction = transaction; boxHeight = heightOfEachBox; m_itemOutputPanel = itemOutputPanel; m_discountOutputPanel = couponOutputPanel; m_currentUser = currentUser; m_stackOfDiscounts = new StackPanel(); m_updateFunction = updateFunction; ItemDisplayBox itemDisplayBox = new ItemDisplayBox(m_item, m_transaction, RemoveItem, UpdateItemDetails, AddDiscount, m_currentUser); itemDisplayBox.VerticalAlignment = System.Windows.VerticalAlignment.Top; itemDisplayBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; itemDisplayBox.Height = boxHeight; m_itemDescriptionBox = new Grid(); m_itemDescriptionBox.Children.Add(itemDisplayBox); if (m_item.Discounts.Count() == 0) { Grid blankCoupon = new Grid(); blankCoupon.Height = boxHeight; m_stackOfDiscounts.Children.Add(blankCoupon); m_noDiscounts = true; } else { m_noDiscounts = false; foreach (IDiscount discount in m_item.Discounts) { DiscountDisplayBox autoAppliedDiscount = new DiscountDisplayBox(discount, m_item, m_transaction, RemoveDiscount, UpdateItemDetails, m_currentUser); autoAppliedDiscount.Height = boxHeight; m_stackOfDiscounts.Children.Add(autoAppliedDiscount); } } UpdateHeight(); OutputItem(); }
public void AddDiscount(IDiscount discount) { if (m_noDiscounts) m_stackOfDiscounts.Children.Clear(); m_noDiscounts = false; DiscountDisplayBox newDiscount = new DiscountDisplayBox(discount, m_item, m_transaction, RemoveDiscount, UpdateItemDetails, m_currentUser); newDiscount.Height = boxHeight; m_stackOfDiscounts.Children.Add(newDiscount); UpdateHeight(); }