private async Task <salesOrderRepositoryV1GetListResponse1> GetOrdersPageByFilter(SalesOrderRepositoryV1GetListRequest filters, Mark mark) { const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new salesOrderRepositoryV1GetListResponse1(); var privateClient = this._clientFactory.CreateMagentoSalesOrderRepositoryServiceClient(); await ActionPolicies.GetWithMarkAsync(mark).Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; privateClient = this._clientFactory.RefreshMagentoSalesOrderRepositoryServiceClient(privateClient); using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) res = await privateClient.salesOrderRepositoryV1GetListAsync(filters).ConfigureAwait(false); }).ConfigureAwait(false); return(res); }
public virtual async Task <GetOrdersResponse> GetOrdersAsync(IEnumerable <string> ordersIds) { var ordersIdsAgregated = string.Empty; try { ordersIdsAgregated = string.Join(",", ordersIds); var frameworkSearchFilterGroups = new List <FrameworkSearchFilterGroup> { new FrameworkSearchFilterGroup() { filters = new[] { new FrameworkFilter() { field = "increment_id", conditionType = "eq", value = ordersIdsAgregated } } }, }; if (string.IsNullOrWhiteSpace(this.Store)) { frameworkSearchFilterGroups.Add(new FrameworkSearchFilterGroup() { filters = new[] { new FrameworkFilter() { field = "store_Id", conditionType = "eq", value = this.Store } } }); } var filters = new SalesOrderRepositoryV1GetListRequest { searchCriteria = new FrameworkSearchCriteria() { currentPage = 1, currentPageSpecified = true, filterGroups = frameworkSearchFilterGroups.ToArray(), sortOrders = new FrameworkSortOrder[] { new FrameworkSortOrder() { direction = "ASC", field = "Id" } }, pageSize = 100, pageSizeSpecified = true, } }; const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new salesOrderRepositoryV1GetListResponse1(); var privateClient = this._clientFactory.CreateMagentoSalesOrderRepositoryServiceClient(); await ActionPolicies.GetAsync.Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; privateClient = this._clientFactory.RefreshMagentoSalesOrderRepositoryServiceClient(privateClient); using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) res = await privateClient.salesOrderRepositoryV1GetListAsync(filters).ConfigureAwait(false); }).ConfigureAwait(false); return(new GetOrdersResponse(res)); } catch (Exception exc) { throw new MagentoSoapException($"An error occured during GetOrdersAsync({ordersIdsAgregated})", exc); } }
public virtual async Task <GetOrdersResponse> GetOrdersAsync(DateTime modifiedFrom, DateTime modifiedTo, Mark mark = null) { try { var frameworkSearchFilterGroups = new List <FrameworkSearchFilterGroup> { new FrameworkSearchFilterGroup() { filters = new[] { new FrameworkFilter() { field = "updated_At", conditionType = "gt", value = modifiedFrom.ToSoapParameterString() } } }, new FrameworkSearchFilterGroup() { filters = new[] { new FrameworkFilter() { field = "updated_At", conditionType = "lt", value = modifiedTo.ToSoapParameterString() } } }, }; if (!string.IsNullOrWhiteSpace(this.Store)) { frameworkSearchFilterGroups.Add(new FrameworkSearchFilterGroup() { filters = new[] { new FrameworkFilter() { field = "store_Id", conditionType = "eq", value = this.Store } } }); } var filters = new SalesOrderRepositoryV1GetListRequest { searchCriteria = new FrameworkSearchCriteria() { currentPage = 1, currentPageSpecified = true, filterGroups = frameworkSearchFilterGroups.ToArray(), //sortOrders = new[] { new FrameworkSortOrder() { direction = "ASC", field = "Id" } }, crunch for 2.1 pageSize = 100, pageSizeSpecified = true, } }; const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new salesOrderRepositoryV1GetListResponse1(); var privateClient = this._clientFactory.CreateMagentoSalesOrderRepositoryServiceClient(); await ActionPolicies.GetAsync.Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; privateClient = this._clientFactory.RefreshMagentoSalesOrderRepositoryServiceClient(privateClient); using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) res = await privateClient.salesOrderRepositoryV1GetListAsync(filters).ConfigureAwait(false); }).ConfigureAwait(false); return(new GetOrdersResponse(res)); } catch (Exception exc) { throw new MagentoSoapException($"An error occured during GetOrdersAsync(modifiedFrom:{modifiedFrom},modifiedTo{modifiedTo})", exc); } }