Ejemplo n.º 1
0
        private void btnEbayShipped_Click(object sender, EventArgs e)
        {
            IOrderShipmentRequest orderShipmentRequest = new eBayShipmentRequest();

            IExternalStoreService serviceClient = new eBayServiceCall();

            orderShipmentRequest.ShipmentList.Add(
                new eBayOrderShipmentIfo
                {
                    IsPartialShipment = false,
                    OrderId = txtOrderId.Text.Trim(),
                    ShipmentDate = Utility.ConvertToGMT(DateTime.Now),
                    StoreProvider = StoreProviderTypeEnum.eBay,
                    TrackingNo = "0",
                    TotalItems = 1,
                });

            ExternalOrderShippedResult result = serviceClient.SetOrderShipped(orderShipmentRequest);

            if (result.Success)
            {

            }
        }
        public ExternalOrderShippedResult SetOrdersShipped(ApiOrderShipmentRequest request)
        {
            ExternalOrderShippedResult result = null;
            IOrderShipmentRequest shipmentRequests = null;
            List<IOrderShipmentInfo> shipmentList = new List<IOrderShipmentInfo>();

            IExternalStoreService externalService = null;

            if (request.StoreProvider == StoreProviderTypeEnum.eBay)
            {
                shipmentRequests = new eBayShipmentRequest();

                foreach (var item in request.ShippedOrders)
                {
                    shipmentList.Add(new eBayOrderShipmentIfo
                    {

                        OrderId = item.StoreProviderOrderId,
                        IsPartialShipment = false,
                        StoreProvider = StoreProviderTypeEnum.eBay,
                        TrackingNo = "0",
                        ShipmentDate = Utility.ConvertToGMT(DateTime.UtcNow),
                        ExternalOrderHeaderId = item.ExternalOrderHeaderId,
                    });

                }

                externalService = new eBayServiceCall();

            }

            if (request.StoreProvider == StoreProviderTypeEnum.Amazon)
            {

                shipmentRequests = new AmazonOrderShipmentRequest();

                foreach (var item in request.ShippedOrders)
                {

                    shipmentList.Add(new AmazonOrderShipmentInfo
                    {

                        OrderId = item.StoreProviderOrderId,
                        IsPartialShipment = false,
                        StoreProvider = StoreProviderTypeEnum.Amazon,
                        TrackingNo = "0",
                        ShipmentDate = DateTime.UtcNow.AddMinutes(-10),
                    });

                }

                externalService = new AmazonServiceClient();
                //result = new ExternalOrderShippedResult() { Success = false, ErrorMessage = "Yet not implemented" };
                //return result;
            }

            shipmentRequests.ShipmentList = shipmentList;

            result = externalService.SetOrderShipped(shipmentRequests);

            return result;
        }