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(); }
//private DockPanel m_itemPanel = null; //private DockPanel m_discountList = null; public AdminMainWindow(Employee currentEmployee, ConnectionSession connection) { DBInterface.m_connection = connection; DBInterface.m_employee = currentEmployee; DBInterface.Log( "Logged in" ); // update the clock manually DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate { this.dateText.Text = DateTime.Now.ToString("hh:mm tt"); }, this.Dispatcher); InitializeComponent(); m_employee = currentEmployee; // set the username to the employee that logged in LoggedInAs.Text = currentEmployee.name; //dynamically draw the emblem //System.Drawing.Image leEmblem = System.Drawing.Image.FromFile("..\\..\\..\\..\\SharedResources\\Images\\Emblem.png"); System.Windows.Forms.PictureBox lePictureBox = new System.Windows.Forms.PictureBox { Name = "logoPictureBox", Image = System.Drawing.Image.FromFile("..\\..\\..\\..\\SharedResources\\Images\\Emblem.png"), SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage }; lePictureBox.BorderStyle = System.Windows.Forms.BorderStyle.None; windowsFormsHost2.Child = lePictureBox; //lePictureBox.Width = 200; //lePictureBox.Image = leEmblem; //windowsFormsHost2.Child = lePictureBox; //Do not use until all permissions groups have settings pages. //ProgramSettings.getInstance(currentEmployee).Download(); }