private void btnEbayOrderTest_Click(object sender, EventArgs e) { eBayOrderOptions options = new eBayOrderOptions { FromDate = DateTime.Now.AddDays(-1).Date, ToDate = DateTime.Now, }; IExternalStoreService externalService = new eBayServiceCall(); ExternalOrderResult result = externalService.GetOrders(options); if (result.Success) { MessageBox.Show("Success"); } }
public ExternalOrderResult GetUnshippedOrders(OrderSearchOptions orderOptions) { IOrderOptions extOrderOptions = null; IExternalStoreService externalService = null; if (orderOptions.StoreProvider == StoreProviderTypeEnum.eBay) { externalService = new eBayServiceCall(); extOrderOptions = new eBayOrderOptions(orderOptions.FromDate, orderOptions.ToDate); } if (orderOptions.StoreProvider == StoreProviderTypeEnum.Amazon) { externalService = new AmazonServiceClient(); extOrderOptions = new AmazonOrderOptions(orderOptions.FromDate, orderOptions.ToDate); } ExternalOrderResult orderResult = externalService.GetOrders(extOrderOptions); int serialNo = 0; //if (orderResult.Success) //{ // foreach (ExternalOrder extOrder in orderResult.Orders) // { // { // serialNo += 1; // ExternalOrderViewModel extOrderVM = new ExternalOrderViewModel(extOrder); // extOrderVM.SerialNo = serialNo; // vmResult.ExternalOrderViewModels.Add(extOrderVM); // } // } // vmResult.Success = true; //} return orderResult; }
public eBayOrderOptions GetOrderOptions() { eBayOrderOptions orderOptions = new eBayOrderOptions(); if (!ToDate.HasValue) { _toDate = Utility.ConvertToGMT(DateTime.UtcNow).AddDays(1).AddSeconds(-1); } else { _toDate = ToDate; } if (OrderCreatedBefore > 0) { int negativeIntervalValue = 0 - OrderCreatedBefore; switch (IntervalTypeValue) { case eBayOrderOptions.IntervalType.Days: _fromDate = orderOptions.ToDate.Value.AddDays(negativeIntervalValue); break; case eBayOrderOptions.IntervalType.Hours: _fromDate = orderOptions.ToDate.Value.AddHours(negativeIntervalValue); break; case eBayOrderOptions.IntervalType.Minutes: _fromDate = orderOptions.ToDate.Value.AddMinutes(negativeIntervalValue); break; } } else { _fromDate = FromDate; } return orderOptions; }