Exemple #1
0
        public static Order Deserialise(string json)
        {
            var jsonObject = JObject.Parse(json);

            var order = new Order();
            order.OrderId = jsonObject.GetValue("OrderId").ToObject<string>();
            order.TableNumber = jsonObject.GetValue("TableNumber").ToObject<int>();
            order.ServerName = jsonObject.GetValue("ServerName").ToObject<string>();
            order.TimeStamp = jsonObject.GetValue("TimeStamp").ToObject<string>();
            order.TimeToCook = jsonObject.GetValue("TimeToCook").ToObject<string>();
            order.Subtotal = jsonObject.GetValue("Subtotal").ToObject<decimal>();
            order.Total = jsonObject.GetValue("Total").ToObject<decimal>();
            order.Tax = jsonObject.GetValue("Tax").ToObject<decimal>();
            order.Ingredients = jsonObject.GetValue("Ingredients").Select(i => i.ToObject<string>()).ToArray();
            order.Items = jsonObject.GetValue("Items").Select(i => 
                new OrderItem
                {
                    ItemName = i["ItemName"].ToObject<string>(), 
                    Qty = i["Qty"].ToObject<int>(), 
                    Price = i["Price"].ToObject<decimal>()
                }).ToArray();
            order.OriginalDoc = jsonObject;
            order.Paid = jsonObject.GetValue("Paid").ToObject<bool>();
            return order;
        }
Exemple #2
0
 public OrderComplete(Order order, Guid causationId, Guid correlationId, DateTime? timeToLive = null)
     : base(causationId, correlationId, timeToLive)
 {
     Order = order;
 }
 public CookFood(Order order, Guid causationId, Guid correlationId, DateTime? timeToLive = null)
     : base (causationId, correlationId, timeToLive)
 {
     Order = order;
 }
 public TakePayment(Order order, Guid causationId, Guid correlationId, DateTime? timeToLive = null)
     : base(causationId, correlationId, timeToLive)
 {
     Order = order;
 }