public bool SetMarketplaceUserPreference(UserPreferenceFeed preference) { // create and init the API Context var context = new ApiContext(); context.ApiCredential = RequestHelper.ApiCredential; context.SoapApiServerUrl = RequestHelper.ServiceUrl; try { // create the preference feed var preferenceType = new SetUserPreferencesRequestType { OutOfStockControlPreference = preference.OutOfStockControlPreference, OutOfStockControlPreferenceSpecified = preference.isOutOfStockControlPreference, }; var apiCall = new SetUserPreferencesCall(context); var response = apiCall.ExecuteRequest(preferenceType); if (response.Ack == AckCodeType.Success) { return(true); } // log the error _logger.LogError(LogEntryType.eBayProductProvider, string.Format("{0} - Error in sending user preference - Message: {1}", ChannelName, response.Errors[0].LongMessage), string.Join(",", response.Errors[0].ErrorParameters)); return(false); } catch (Exception ex) { _logger.LogError(LogEntryType.eBayProductProvider, string.Format("Unexpected error in sending user preference\". Err Message: {0}", EisHelper.GetExceptionMessage(ex)), ex.StackTrace); return(false); } }
/// <summary> /// /// </summary> /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param> public SetUserPreferencesCall(ApiContext ApiContext) { ApiRequest = new SetUserPreferencesRequestType(); this.ApiContext = ApiContext; }
/// <summary> /// /// </summary> public SetUserPreferencesCall() { ApiRequest = new SetUserPreferencesRequestType(); }