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; }
private void InitDiscountSubTree(TreeNode root, IDiscount Idiscount) { TreeNode localRoot = new TreeNode(Idiscount.ToString()); localRoot.Tag = Idiscount; root.Nodes.Add(localRoot); if (Idiscount.GetType() == typeof(DiscountManager)) { localRoot.ForeColor = Color.Red; foreach (var discount in ((DiscountManager)Idiscount).Discounts) { InitDiscountSubTree(localRoot, discount); } } }