public ItemOverrideMenu(ItemDisplayBox itemToModify, Transaction transaction, ClosePriceOverrideMenu closeFunction)
        {
            InitializeComponent();

            m_itemBox = itemToModify;
            m_transaction = transaction;
            m_closeFunction = closeFunction;

            OriginalPriceField.Text = "Original Price: " + m_itemBox.SourceItem.OriginalPrice.ToString( "C" );
        }
        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;
        }
        public ItemEditMenu(ItemDisplayBox itemToModify, Transaction transaction, CloseEditMenu closeFunction, Employee currentUser)
        {
            InitializeComponent();

            m_itemBox = itemToModify;
            m_transaction = transaction;
            m_closeFunction = closeFunction;
            m_currentUser = currentUser;
            ItemNameBox.Text = m_itemBox.SourceItem.ItemName.ToString();

            RemoveItem = false;
            PriceOverride = false;
        }
        // Construct with an item.
        public ItemDisplayBox(Item itemInTransaction, Transaction transaction, RemoveItemFromDisplay removeFunction, UpdateItemDisplay updateFunction, AddDiscountToDisplay addDiscountFunction, Employee currentUser)
        {
            InitializeComponent();

            SourceItem = itemInTransaction;
            m_transaction = transaction;
            m_removeFunction = removeFunction;
            m_updateFunction = updateFunction;
            m_addDiscountFunction = addDiscountFunction;
            m_currentUser = currentUser;
            NameField.Text = itemInTransaction.ItemName.Substring(0, Math.Min(itemInTransaction.ItemName.Length, 40));

            AmountField.Text = SourceItem.OriginalPrice.ToString( "C" );

            PreviewMouseLeftButtonDown += DisplayItemClickedEvent;
        }
        public DiscountDisplayBox(IDiscount discount, Item possesingItem,Transaction transaction, RemoveDiscountFromDisplay removeFunction, UpdateItemDisplay updateFunction, Employee currentUser)
        {
            InitializeComponent();

            SourceDiscount = discount;
            PossessingItem = possesingItem;
            m_transaction = transaction;
            m_removeFunction = removeFunction;
            m_updateFunction = updateFunction;
            m_currentUser = currentUser;

            NameField.Text = discount.ToString().Substring(0, Math.Min(discount.ToString().Length, 40));

            UpdateDiscountString();

            AmountField.Text = Discount;

            PreviewMouseLeftButtonDown += DisplayItemClickedEvent;
        }
        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();
        }