Example #1
0
        private static void DeactivateAllExchangeRates(CrmService CustomService, DateTime relevanceDate)
        {
            List <sl_ExchangeRate> activeRates =
                CustomService.XrmContext
                .sl_ExchangeRateSet
                .Where(x =>
                       x.statecode == sl_ExchangeRateState.Active &&
                       x.sl_RelevanceDate <= relevanceDate)
                .ToList();

            foreach (var rate in activeRates)
            {
                CustomService.DeactivateExchangeRateById(rate.sl_ExchangeRateId.Value);
            }
        }