Exemplo n.º 1
0
        public void CreateAmazonOrder(SalesOrder order)
        {
            dynamic amazonOrder = new AmazonOrders();
            var existingOrder = amazonOrder.First(OrderNumber: order.OrderId);
            dynamic map = new ExpandoObject();

                                              	map.Store = "Amazon";
                                              	map.StoreEntityId = order.NativeId;
                                              	map.OrderNumber = order.OrderId;
                                              	map.StoreCreatedAt = order.StoreCreatedAt;
                                              	map.StoreUpdatedAt = order.StoreUpdatedAt;
                                              	map.StoreStatus = order.StoreStatus;
                                              	map.CustomerName = order.DeliveryCustomerName;
                                              	map.ShipStreet = order.DeliveryStreet;
                                              	map.ShipCity = order.DeliveryCity;
                                              	map.ShipState = order.DeliveryState;
                                              	map.ShipZip = order.DeliveryZip;
                                              	map.ShipCountry = order.DeliveryCountry;

            if(existingOrder == null)
            {
                NLog.LogManager.GetCurrentClassLogger().Warn("Create amazon order: {0}", order.OrderId);
                map.CreatedAt = DateTime.Now;
                var newId = amazonOrder.Insert(map);
            }
            else if(existingOrder.StoreStatus != order.StoreStatus)
            {
                NLog.LogManager.GetCurrentClassLogger().Warn("Update amazon order: {0}", order.OrderId);
                map.Updatedat = DateTime.Now;
                amazonOrder.Update(map,existingOrder.Id);
            }
        }
Exemplo n.º 2
0
 public void GetSpecificOrderAndMapToAx()
 {
     var store = new AmazonStore();
     var amazonId = "102-2130201-6848236";
     dynamic table = new AmazonOrders();
     var rec = table.First(OrderNumber:amazonId);
     var salesOrder= store.MapFromAmazonCache(rec);
     store.GetOrderItems(salesOrder);
 }