public static GetEnterprisesOKResponseEnterprisesItem GetEnterprise(ServiceHelper serviceHelper, string externalID) { GetEnterprisesArgs getEnterpriseArgs = new GetEnterprisesArgs( new GetEnterprisesArgsParameter() { ExternalID = externalID }); GetEnterprisesOKResponse response = serviceHelper.ContactService.GetEnterprises(getEnterpriseArgs); GetEnterprisesOKResponseEnterprisesItem enterprisesItem; try { enterprisesItem = response.Enterprises.SingleOrDefault(); } catch (ArgumentNullException e) { throw new ArgumentNullException("Enterprise search resultet in no enterprises", e); } catch (InvalidOperationException e) { throw new InvalidOperationException("Enterprise search has more than one result. Recno shoud be unique, check you data", e); } return(enterprisesItem); }
public static GetEnterprisesOKResponse GetEnterprises(ServiceHelper serviceHelper) { GetEnterprisesArgs getEnterpriseArgs = new GetEnterprisesArgs( new GetEnterprisesArgsParameter()); GetEnterprisesOKResponse response = serviceHelper.ContactService.GetEnterprises(getEnterpriseArgs); return(response); }
/// <summary> /// /// Retrieves enterprises from 360° based on criteria defined in the /// input parameter. At least one criteria (Name, Recno, Categories or /// EnterpriseNumber) must be given. /// /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='getEnterprisesArgs'> /// (See model for parameter info) /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GetEnterprisesOKResponse> GetEnterprisesAsync(this IContactService operations, GetEnterprisesArgs getEnterprisesArgs = default(GetEnterprisesArgs), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetEnterprisesWithHttpMessagesAsync(getEnterprisesArgs, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// /// Retrieves enterprises from 360° based on criteria defined in the /// input parameter. At least one criteria (Name, Recno, Categories or /// EnterpriseNumber) must be given. /// /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='getEnterprisesArgs'> /// (See model for parameter info) /// </param> public static GetEnterprisesOKResponse GetEnterprises(this IContactService operations, GetEnterprisesArgs getEnterprisesArgs = default(GetEnterprisesArgs)) { return(Task.Factory.StartNew(s => ((IContactService)s).GetEnterprisesAsync(getEnterprisesArgs), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }