/// <summary> /// Constructor for console cashier /// </summary> /// <param name="cm"></param> /// <param name="t"></param> /// <param name="rHan"></param> /// <param name="aHan"></param> /// <param name="cmHan"></param> /// <param name="cHan"></param> public ConsoleGUI(CashierModel cm, DateTime t, RemoveItemHandler rHan, AddItemHandler aHan, CompleteSaleHandler cmHan, CreateSaleHandler cHan) { _cm = cm; _rHan = rHan; _aHan = aHan; _cmHan = cmHan; _cHan = cHan; _date = t; }
public void InvokeRemoveItem(StrategyAdapter obj) { lock (_sync) { _objectCache.Remove(obj); Debug.WriteLine("Removing item"); RemoveItemHandler handler = RemoveItem; if (handler != null) { handler(obj); } } }
/// <summary> /// Initializes the cashier GUI. /// </summary> /// <param name="cm">An instance of cashier model</param> /// <param name="t">The date for the cashier's sales</param> /// <param name="rHan">RemoveItemHandler delegate</param> /// <param name="aHan">AddItemHandler delegate</param> /// <param name="cmHan">CompleteSaleHandler delegate</param> /// <param name="cHan">CreateSaleHandler delegate</param> public CashierGUI(CashierModel cm, DateTime t, RemoveItemHandler rHan, AddItemHandler aHan, CompleteSaleHandler cmHan, CreateSaleHandler cHan) { InitializeComponent(); _cashierModel = cm; _itemsd = _cashierModel.GetItemsForSale(); uxItems.Columns.Add("Name", 93); uxItems.Columns.Add("Price", 93); uxCart.Columns.Add("Name", 93); uxCart.Columns.Add("Quantity", 93); uxCart.Columns.Add("Price", 92); date = t; _totCost = 0; this._rHan = rHan; this._aHan = aHan; this._cmHan = cmHan; this._cHan = cHan; foreach (KeyValuePair <string, double> k in _itemsd) { uxItems.Items.Add(new ListViewItem(new[] { k.Key, String.Format("{0:c}", k.Value) })); } }
public void RemoveItemByDay(int day) { if (!_items.ContainsKey(day)) { return; } ListingItem item = _items[day]; WorkedDays--; WorkedHours -= item.TimeSetting.WorkedHours; LunchHours -= item.TimeSetting.LunchHours; OtherHours -= item.TimeSetting.OtherHours; TotalWorkedHours -= item.TimeSetting.TotalWorkedHours; _items.Remove(day); RemoveItemHandler handler = OnRemovedListingItem; if (handler != null) { handler(this, new ListingItemArgs(item)); } }