Exemplo n.º 1
0
        public void RetrieveAndProcessD365Currencies(IOrganizationService service, HttpResponseMessage response, string ignoreCases, string baseCurrencyCode, Guid exchangeIntegrationId)
        {
            // Parse the response body
            var json = response.Content.ReadAsStringAsync().Result;
            var exr  = JsonConvert.DeserializeObject <ExchangeRate>(json);

            if (exr == null)
            {
                base.UpdateIntegrationRecord(service, exchangeIntegrationId, false, "Couldn't return any rate" + response.RequestMessage);
                throw new InvalidWorkflowException("Couldn't return any rate" + response.RequestMessage);
            }

            //Retrieve CRM Currencies
            EntityCollection ecCurrencies = SDKHelper.RetrieveAllRecords(service, "transactioncurrency");

            foreach (Entity item in ecCurrencies.Entities)
            {
                CallCurrencyAction(service, item, exr, ignoreCases, baseCurrencyCode, exchangeIntegrationId);
            }
        }