public ActionResult CreateOrder() { OrderServiceSoapClient order = new OrderServiceSoapClient(); string Email = User.Identity.Name; order.CreateOrderAsync(Email); return RedirectToAction("Index", "Home"); }
public OrderStatusForm() { InitializeComponent(); CandyStoreUtil.MakeLabelsTransparent(this); _orderService = new OrderServiceSoapClient(); _orders = new List <OrderDto>(); }
public OrdersService(APICredentials credentials, string accountId, ObjectCache cache = null) { this._credentials = credentials; this.AccountId = accountId; this._client = new OrderServiceSoapClient(); this._fulfillmentServiceCredentials = new FulfillmentService.APICredentials { DeveloperKey = this._credentials.DeveloperKey, Password = this._credentials.Password }; this._fulfillmentServiceClient = new FulfillmentService.FulfillmentServiceSoapClient(); }
public OrderForm() { InitializeComponent(); InitializeProductsQuantityHash(); CandyStoreUtil.SetAutoCompleteOnComboBoxes(this); CandyStoreUtil.MakeLabelsTransparent(this); _orderService = new OrderServiceSoapClient(); _productsBySupplierHash = new Dictionary <SupplierDto, List <ProductDto> >(); }
public ShopVisibleOrdersService(ShopVisibleCredentials credentials) { this._credentials = credentials; this._client = new OrderServiceSoapClient(credentials.OrdersEndpointName); }
private void DownloadSalesData() { try { this.StatusDescription = string.Format("Creating ChannelAdvisor Client"); //Create OrderService client and ready it for request string devKey = System.Configuration.ConfigurationManager.AppSettings["CaDevK"]; string devPW = System.Configuration.ConfigurationManager.AppSettings["CaDevPw"]; //int profileID = 32001327; string accountID = System.Configuration.ConfigurationManager.AppSettings["CaAcct"]; ; APICredentials cred = new APICredentials(); cred.DeveloperKey = devKey; cred.Password = devPW; OrderServiceSoapClient ordClient = new OrderServiceSoapClient(); //Get latest order date in DB, and pull all orders since then DateTime beginTime; using (var db = new CheapeesEntities()) { beginTime = (DateTime)db.MerchantFulfilledSales.OrderByDescending(o => o.OrderTime).FirstOrDefault().OrderTime; } OrderCriteria criteria = new OrderCriteria(); criteria.OrderCreationFilterBeginTimeGMT = beginTime; criteria.OrderCreationFilterEndTimeGMT = DateTime.Now; criteria.DetailLevel = "High"; List<ChannelAdvisorSale> listOfSales = new List<ChannelAdvisorSale>(); int page = 1; criteria.PageNumberFilter = page; //Issue requests this.StatusDescription = string.Format("Requesting sales data since latest sale ({0})", beginTime); APIResultOfArrayOfOrderResponseItem response = ordClient.GetOrderList(cred, accountID, criteria); int numberOfOrders = 0; //When everything has been retrieved, pages will be returned empty and should exit loop while (response.ResultData.Length != 0) { numberOfOrders += response.ResultData.Length; this.StatusDescription = string.Format("Downloading sales data: {0} orders retrieved", numberOfOrders); foreach (OrderResponseDetailHigh order in response.ResultData) { foreach (OrderLineItemItem item in order.ShoppingCart.LineItemSKUList) { ChannelAdvisorSale sale = new ChannelAdvisorSale(); sale.SKU = item.SKU; sale.Quantity = item.Quantity; sale.Marketplace = item.ItemSaleSource; sale.UnitPrice = item.UnitPrice; sale.OrderTime = ((DateTime)order.OrderTimeGMT).ToLocalTime(); sale.Invoice = order.OrderID.ToString(); listOfSales.Add(sale); } } //Get next page of results page++; criteria.PageNumberFilter = page; response = ordClient.GetOrderList(cred, accountID, criteria); } CommitToDatabase(listOfSales); } catch (Exception e) { throw new Exception(string.Format("ChannelAdvisorOrderService - {0}", e.Message)); } }
public OrderPresenter() { _orderService = new OrderServiceSoapClient(); }
private void DownloadSalesData() { try { this.StatusDescription = string.Format("Creating ChannelAdvisor Client"); //Create OrderService client and ready it for request string devKey = System.Configuration.ConfigurationManager.AppSettings["CaDevK"]; string devPW = System.Configuration.ConfigurationManager.AppSettings["CaDevPw"]; //int profileID = 32001327; string accountID = System.Configuration.ConfigurationManager.AppSettings["CaAcct"];; APICredentials cred = new APICredentials(); cred.DeveloperKey = devKey; cred.Password = devPW; OrderServiceSoapClient ordClient = new OrderServiceSoapClient(); //Get latest order date in DB, and pull all orders since then DateTime beginTime; using (var db = new CheapeesEntities()) { beginTime = (DateTime)db.MerchantFulfilledSales.OrderByDescending(o => o.OrderTime).FirstOrDefault().OrderTime; } OrderCriteria criteria = new OrderCriteria(); criteria.OrderCreationFilterBeginTimeGMT = beginTime; criteria.OrderCreationFilterEndTimeGMT = DateTime.Now; criteria.DetailLevel = "High"; List <ChannelAdvisorSale> listOfSales = new List <ChannelAdvisorSale>(); int page = 1; criteria.PageNumberFilter = page; //Issue requests this.StatusDescription = string.Format("Requesting sales data since latest sale ({0})", beginTime); APIResultOfArrayOfOrderResponseItem response = ordClient.GetOrderList(cred, accountID, criteria); int numberOfOrders = 0; //When everything has been retrieved, pages will be returned empty and should exit loop while (response.ResultData.Length != 0) { numberOfOrders += response.ResultData.Length; this.StatusDescription = string.Format("Downloading sales data: {0} orders retrieved", numberOfOrders); foreach (OrderResponseDetailHigh order in response.ResultData) { foreach (OrderLineItemItem item in order.ShoppingCart.LineItemSKUList) { ChannelAdvisorSale sale = new ChannelAdvisorSale(); sale.SKU = item.SKU; sale.Quantity = item.Quantity; sale.Marketplace = item.ItemSaleSource; sale.UnitPrice = item.UnitPrice; sale.OrderTime = ((DateTime)order.OrderTimeGMT).ToLocalTime(); sale.Invoice = order.OrderID.ToString(); listOfSales.Add(sale); } } //Get next page of results page++; criteria.PageNumberFilter = page; response = ordClient.GetOrderList(cred, accountID, criteria); } CommitToDatabase(listOfSales); } catch (Exception e) { throw new Exception(string.Format("ChannelAdvisorOrderService - {0}", e.Message)); } }