Esempio n. 1
0
 public OrderDelivered(
     Guid orderId,
     DiningLocation diningLocation,
     OrderItem[] orderItems)
 {
     OrderId = orderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
 }
Esempio n. 2
0
 public OrderBeingPrepared(
     Guid orderId,
     DiningLocation diningLocation,
     OrderItem[] orderItems)
 {
     OrderId = orderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
 }
Esempio n. 3
0
 public OrderQueued(
     Guid cashierOrderId,
     Guid baristaOrderId,
     DiningLocation diningLocation,
     params OrderItem[] orderItems)
 {
     CashierOrderId = cashierOrderId;
     BaristaOrderId = baristaOrderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
 }
Esempio n. 4
0
 public QueueOrder(
     Guid baristaOrderId,
     Guid cashierOrderId,
     DiningLocation diningLocation,
     OrderItem[] orderItems)
 {
     BaristaOrderId = baristaOrderId;
     CashierOrderId = cashierOrderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
 }
Esempio n. 5
0
 public OrderPlaced(
     Guid orderId,
     DiningLocation diningLocation,
     OrderItem[] orderItems,
     decimal price)
 {
     OrderId = orderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
     Price = price;
 }
Esempio n. 6
0
 public OrderItemAdded(
     Guid orderId,
     DiningLocation diningLocation,
     OrderItem[] existingItems,
     OrderItem addedItem,
     decimal price)
 {
     OrderId = orderId;
     DiningLocation = diningLocation;
     ExistingItems = existingItems;
     AddedItem = addedItem;
     Price = price;
 }
Esempio n. 7
0
        private static void readDiningLocations()
        {
            string[] locations = File.ReadAllLines(@"C:\AppFiles\foodcoords.txt");

            for (int i = 0; i < locations.Length; i++)
            {
                DiningLocation loc  = new DiningLocation();
                string[]       temp = locations[i].Split(':');
                loc.Name      = temp[0];
                loc.SubTitle  = temp[1];
                loc.Latitude  = double.Parse(temp[2]);
                loc.Longitude = double.Parse(temp[3]);
                LocationAPI.AddDiningLocation(loc);
            }
        }
Esempio n. 8
0
 public OrderPaid(
     Guid orderId,
     DiningLocation diningLocation,
     OrderItem[] orderItems,
     decimal price,
     string cardHolderName,
     string cardNumber,
     Guid baristaOrderId,
     Guid coordinatorId)
 {
     OrderId = orderId;
     DiningLocation = diningLocation;
     OrderItems = orderItems;
     Price = price;
     CardHolderName = cardHolderName;
     CardNumber = cardNumber;
     BaristaOrderId = baristaOrderId;
     CoordinatorId = coordinatorId;
 }
Esempio n. 9
0
        public Order(
            Guid orderId,
            DiningLocation diningLocation,
            OrderItem[] orderItems,
            IProductInfo[] products)
            : this()
        {
            var price = orderItems
                .Select(i => new
                                 {
                                     product = products.Single(p => p.MenuItemId == i.MenuItemId),
                                     item = i
                                 })
                .Select(i => i.item.Quantity*i.product.Price)
                .Sum();

            var e = new OrderPlaced(
                orderId,
                diningLocation,
                orderItems,
                price);
            ApplyChange(e);
        }
Esempio n. 10
0
 private void Apply(OrderPlaced e)
 {
     Id = e.OrderId;
     _state = OrderState.Placed;
     _items.AddRange(e.OrderItems);
     _price = e.Price;
     _location = e.DiningLocation;
 }