Beispiel #1
0
        // orders
        public void CreateOrder(string orderid, string shipping, IEnumerable <OrderItem> items, AddressInfo address)
        {
            orderlist = new OrderList(email, password);

            var order = new Order(orderid, address, shipping);

            foreach (var item in items)
            {
                order.AddItem(item);
            }

            orderlist.AddOrder(order);
        }
Beispiel #2
0
        public void Handle(OrderMessage message)
        {
            var order = new Order
            {
                Id       = message.Id,
                Quantity = message.Quantity
            };

            //simulate processing
            Thread.Sleep(4000);

            //simlute business logic
            order.Status = message.Quantity < 100 ? OrderStatus.Approved : OrderStatus.AwaitingApproval;

            orders.AddOrder(order);

            //publish update
            var orderUpdatedEvent = bus.CreateInstance <OrderUpdatedEvent>(x => x.UpdatedOrder = order);

            bus.Publish(orderUpdatedEvent);
        }
Beispiel #3
0
    public void MakeNewOrder()
    {
        var   order = Menu.Get().GetRandomOrder();
        float price = 0.0f;
        float time  = 0.0f;

        string text = "";

        for (int i = 0; i < order.OrderElements.Count; i++)
        {
            text += string.Format("{0}. {1}", i + 1, order.OrderElements[i].Name);
            if (i != order.OrderElements.Count - 1)
            {
                text += "\n";
            }

            price += order.OrderElements[i].Price;
            time  += order.OrderElements[i].Time;
        }

        m_orders.Add(order);
        m_orderList.AddOrder(order, text, Time.time + time, price);
    }
Beispiel #4
0
        public void InitializeOrderList()
        {
            orderList = new OrderList();


            orderList.AddOrder(new Order {
                Id = 1, Cost = 1, Revenue = 11, SellPrice = 21
            });
            orderList.AddOrder(new Order {
                Id = 2, Cost = 2, Revenue = 12, SellPrice = 22
            });
            orderList.AddOrder(new Order {
                Id = 3, Cost = 3, Revenue = 13, SellPrice = 23
            });
            orderList.AddOrder(new Order {
                Id = 4, Cost = 4, Revenue = 14, SellPrice = 24
            });
            orderList.AddOrder(new Order {
                Id = 5, Cost = 5, Revenue = 15, SellPrice = 25
            });
            orderList.AddOrder(new Order {
                Id = 6, Cost = 6, Revenue = 16, SellPrice = 26
            });
            orderList.AddOrder(new Order {
                Id = 7, Cost = 7, Revenue = 17, SellPrice = 27
            });
            orderList.AddOrder(new Order {
                Id = 8, Cost = 8, Revenue = 18, SellPrice = 28
            });
            orderList.AddOrder(new Order {
                Id = 9, Cost = 9, Revenue = 19, SellPrice = 29
            });
            orderList.AddOrder(new Order {
                Id = 10, Cost = 10, Revenue = 20, SellPrice = 30
            });
            orderList.AddOrder(new Order {
                Id = 11, Cost = 11, Revenue = 21, SellPrice = 31
            });
            //orderList.AddOrder(new Order { Id = 12, Cost = 12, Revenue = 22, SellPrice = 32 });
        }