/// <summary> /// /// </summary> /// <param name="customerGroupNumber"></param> /// <returns></returns> public CustomerGroup Get(int customerGroupNumber) { string url = _client.GetUrl("/customer-groups/" + customerGroupNumber); try { var response = JsonClient.Get <CustomerGroup>(url, _client.GetHeaders()); return(response); } catch (JsonClientException e) { if (e.StatusCode == System.Net.HttpStatusCode.NotFound) { return(null); } throw e; } catch (Exception e) { throw e; } }
/// <summary></summary> /// <param name="pagesize"></param> /// <param name="skippages"></param> /// <returns>EcnomicApi.Economic.Objects.CollectionOfCustomer</returns> public CollectionOfCustomer List(int skippages = -1, int pagesize = 20) { if (pagesize > 1000) { throw new ArgumentOutOfRangeException("Maximum pagesize is 1.000"); } string url = _client.GetUrl("/customers/?pagesize=" + pagesize); try { var response = JsonClient.Get <CollectionOfCustomer>(url, _client.GetHeaders()); return(response); } catch { throw; } }
/// <summary></summary> internal RT Retrieve <RT>(string url) { try { var response = JsonClient.Get <RT>(url, _client.GetHeaders()); return(response); } catch (JsonClientException e) { if (e.StatusCode == System.Net.HttpStatusCode.NotFound) { throw e; } throw e; } catch (Exception e) { throw e; } }
/// <summary></summary> /// <param name="invoiceNumber"></param> /// <returns>EcnomicApi.Economic.Objects.Invoice</returns> public Invoice GetDraft(int invoiceNumber) { string url = _client.GetUrl("/invoices/drafts/" + invoiceNumber); try { var response = JsonClient.Get <Invoice>(url, _client.GetHeaders()); return(response); } catch (JsonClientException e) { var errorMessage = JsonConvert.DeserializeObject <ErrorMessage>(e.Message); throw new EconomicException(errorMessage, e); } catch (Exception e) { throw e; } }