/// <summary> /// Grabs all missing meals as soon as possible. /// </summary> private void GrabMissingMeals() { var changedEntries = new Dictionary <MealTypes, int>(); while (_restOrder.Count > 0) { Thread.Sleep(Constants.CashierGrabMealRetryTimeoutMs); Console.WriteLine(@"Cashier {0} has pending meals. Retrying....", _employeeName); foreach (var orderEntry in _restOrder.Where(x => x.Value > 0)) { ICook cook = _cooks[orderEntry.Key]; int takenCount; cook.TryGetMeals(orderEntry.Value, out takenCount); changedEntries.Add(orderEntry.Key, orderEntry.Value - takenCount); } //clean _restOrder collection from outside to avoid CollectionChanged exception. foreach (var changedEntry in changedEntries) { _restOrder[changedEntry.Key] = changedEntry.Value; if (changedEntry.Value == 0) { _restOrder.Remove(changedEntry.Key); } } changedEntries.Clear(); } _restOrder.Clear(); Console.WriteLine(@"Order for client {0} is completed.", _currentClient.ClientId); }
public void Setup(ICook cook) { foreach(var drink in cook.Drinks) { var drinkView = new DrinkView(); this._panel.Controls.Add(drinkView); drinkView.Setup(new DrinkViewItem(drink)); drinkView.BuyClicked += drinkView_BuyClicked; } }
public void Setup(ICook cook) { foreach (var drink in cook.Drinks) { var drinkView = new DrinkView(); this._panel.Controls.Add(drinkView); drinkView.Setup(new DrinkViewItem(drink)); drinkView.BuyClicked += drinkView_BuyClicked; } }
public ActionResult Cook(int id, string action) { IDictionary <int, Applience> applienceDictionary = (SortedDictionary <int, Applience>)Session["Apps"]; ICook app = applienceDictionary[id] as ICook; if (action == "Food") { app.Food = true; app.Cook(); } return(RedirectToAction("Index")); }
public Operation( IWallet userWallet, IWallet machineWallet, ICook cook) { if(userWallet == null) { throw new ArgumentNullException(); } if (machineWallet == null) { throw new ArgumentNullException(); } if(cook == null) { throw new ArgumentNullException(); } this.UserWallet = userWallet; this.MachineWallet = machineWallet; this.Cook = cook; }
public Operation( IWallet userWallet, IWallet machineWallet, ICook cook) { if (userWallet == null) { throw new ArgumentNullException(); } if (machineWallet == null) { throw new ArgumentNullException(); } if (cook == null) { throw new ArgumentNullException(); } this.UserWallet = userWallet; this.MachineWallet = machineWallet; this.Cook = cook; }
/// <summary> /// Tries to gather next client's order. /// </summary> public void TryToGatherOrder() { _currentClient = _line.Dequeue(); foreach (var mealCountPair in _currentClient.Order.Where(order => order.Value > 0)) { int takenCount; ICook cook = _cooks[mealCountPair.Key]; #region log4net[debug] log.Debug(Id + " try to get " + mealCountPair.Value + " " + mealCountPair.Key); #endregion if (!cook.TryGetMeals(mealCountPair.Value, out takenCount)) { _restOrder.Add(mealCountPair.Key, mealCountPair.Value - takenCount); } } }
public Restaurant(string name, ICook chef) { Name = name; Chef = chef; }
protected BaseCommand(ICook cook) => _cook = cook;
public Restaurant(string name, ICook cook) { this.Name = name; this.chef = cook; }
public void SetUp() { _cook = Substitute.For <ICook>(); _accounting = Substitute.For <IAccounting>(); _waiter = new Waiter(_cook, _accounting); }
static void Cook(ICook cook) { cook.Cook(""); }
public Stove(ICook cook, IBake bake) { _cook = cook; _bake = bake; }
public Program(ICook cook) { this.cook = cook; }
public void SetStrategy(ICook cookStrategy) { cookStrategy.Cook(_food); }
public Waiter(ICook cook, IAccounting accounting) { _cook = cook; _accounting = accounting; }