public void DocumentUpdated(Order order) { if (order.Paid) { _dispatcher.PublishWithoutNotify("manger", order); _dispatcher.PublishMidgetInfo("midgetObserver", "Order passed to manager"); return; } if (order.Total > 0) { _dispatcher.PublishWithoutNotify("cashier", order); _dispatcher.PublishMidgetInfo("midgetObserver", "Order passed to cashier"); return; } if (!order.IsNotCooked) { _foodHasBeenPrepared = true; _dispatcher.PublishWithoutNotify("assistant", order); _dispatcher.PublishMidgetInfo("midgetObserver", "Order passed to assistant"); return; } if (order.IsNotCooked) { _dispatcher.PublishWithoutNotify("cook", order); _dispatcher.PublishMidgetInfo("midgetObserver", "Order passed to cook"); _scheduler.ScheduleMessage(new CookDied(order), TimeSpan.FromMilliseconds(20), HandleCookDied); } }
public void Handle(Order order) { var midget = new RestaurantMidget(order.CorrelationId, _dispatcher, _scheduler); _dispatcher.SubscribeByCorrelationId(order.CorrelationId, midget); _midgetMap.Add(order.CorrelationId, midget); _dispatcher.NotifyAll(order); }
public void PublishWithoutNotify(string name, Order order) { IHandleOrders handler; if (_handlers.TryGetValue(name, out handler)) { handler.Handle(order); } }
public void NotifyAll(Order order) { ICorrelationObserver observer; if (_correlationObservers.TryGetValue(order.CorrelationId, out observer)) { observer.DocumentUpdated(order); } }
public Order(Order order) { TableNumber = order.TableNumber; OrderTime = order.OrderTime; ServerName = order.ServerName; Items = order.Items; Total = order.Total; TotalTax = order.TotalTax; Paid = order.Paid; CorrelationId = order.CorrelationId; Items = new List<OrderItem>(order.Items.Select(x => new OrderItem(x))); }
public void Handle(Order order) { foreach (var item in order.Items) { item.Price = item.Quantity*_priceTable.GetPriceFor(item.Name); order.Total += item.Price; } order.TotalTax = TaxPercentage*order.Total; order.Total += order.TotalTax; _handler.Handle(order); }
public void Publish(string name, Order order) { IHandleOrders handler; if (_handlers.TryGetValue(name, out handler)) { handler.Handle(order); ICorrelationObserver observer; if (_correlationObservers.TryGetValue(order.CorrelationId, out observer)) { observer.DocumentUpdated(order); } } }
public void Handle(Order order) { _dispatcher.Publish(_name, order); }
public void Handle(Order order) { OrdersToBeHandled.Add(order); }
public CookDied(Order order) { Order = order; }
public void StoreForLaterUse(Order order) { StoredOrders.Add(order); }
public void Handle(Order order) { PrepareTheMeal(order); _handler.Handle(order); }
public void Handle(Order order) { _dispatcher.NotifyAll(order); }
public void DocumentUpdated(Order order) { _target(order); }
public void Handle(Order order) { TimedOutOrders.Add(order); }
public void Handle(Order order) { _orderStore.Store(order); }
public void Handle(Order order) { _orders.Add(order); //Console.WriteLine("{0}: adding order to queue", _queueName); }
private void PrepareTheMeal(Order order) { _store.GetIngredients(); order.IsNotCooked = false; Thread.Sleep(10); }
public void Handle(Order order) { _handlers[_currentHandler].Handle(order); _currentHandler = (_currentHandler + 1)%_handlers.Count; }
public void Store(Order order) { OrderStore.Add(order.TableNumber, order); }