public virtual async Task <CatalogProductAttributeInfoResponse> GetManufacturersInfoAsync(string attribute) { try { const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new catalogProductAttributeInfoResponse(); var privateClient = this.CreateMagentoServiceClient(this.BaseMagentoUrl); await ActionPolicies.GetAsync.Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; if (privateClient.State != CommunicationState.Opened && privateClient.State != CommunicationState.Created && privateClient.State != CommunicationState.Opening) { privateClient = this.CreateMagentoServiceClient(this.BaseMagentoUrl); } var sessionId = await this.GetSessionId().ConfigureAwait(false); using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) res = await privateClient.catalogProductAttributeInfoAsync(sessionId.SessionId, attribute).ConfigureAwait(false); }).ConfigureAwait(false); return(new CatalogProductAttributeInfoResponse(res)); } catch (Exception exc) { throw new MagentoSoapException(string.Format("An error occured during GetManufacturerAsync()"), exc); } }
public virtual async Task <CatalogProductAttributeInfoResponse> GetManufacturersInfoAsync(string attribute) { try { const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new catalogProductAttributeInfoResponse(); 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.catalogProductAttributeInfoAsync( sessionId, attribute ).ConfigureAwait( false ); res = await Task.FromResult <catalogProductAttributeInfoResponse>(null).ConfigureAwait(false); //TODO: Implement }).ConfigureAwait(false); return(new CatalogProductAttributeInfoResponse(res)); } catch (Exception exc) { throw new MagentoSoapException(string.Format("An error occured during GetManufacturerAsync()"), exc); } }
public CatalogProductAttributeInfoResponse(catalogProductAttributeInfoResponse res) { if (res != null && res.result != null && res.result.options != null && res.result.options.Any()) { this.Attributes = res.result.options.Select(x => new ProductAttributeInfo(x.label, x.value)).ToList(); } }
public virtual async Task <CatalogProductAttributeInfoResponse> GetManufacturersInfoAsync(string attribute) { try { const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var res = new catalogProductAttributeInfoResponse(); var privateClient = this._clientFactory.GetClient(); await ActionPolicies.GetAsync.Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; privateClient = this._clientFactory.RefreshClient(privateClient); var sessionId = await this.GetSessionId().ConfigureAwait(false); try // this try catch block is crunch for 1.7 { using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) { res = await privateClient.catalogProductAttributeInfoAsync(sessionId.SessionId, attribute).ConfigureAwait(false); } } catch (Exception exc) { if (exc.Message.ToLower().Contains("Procedure 'catalogProductAttributeInfoRequestParam' not present".ToLower()) && this.StoreVersion.StartsWith("1.7")) { res = null; } else { throw; } } }).ConfigureAwait(false); return(new CatalogProductAttributeInfoResponse(res)); } catch (Exception exc) { throw new MagentoSoapException(string.Format("An error occured during GetManufacturerAsync()"), exc); } }