To fix the problem, one day shift is implemented during the import of exchange rates from the Central Bank of Europe to Microsoft Dynamics AX.
The rates published by “ECB” for “Day N” will be imported to Microsoft Dynamics AX as valid from “Day N+1”.
This behavior is considered by Microsoft as covering the most the business scenarios across Europe.
If these changes included in the hotfix don’t fit with current company’s processes, then the fix can be reverted as suggested below. Microsoft provides this code suggestion "as-is" to illustrate possible way for the changes reversion. You bear the risk and understand all the potential consequences of using this code. Microsoft gives no warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose.
The following code must be replaced in method TryForUrl (\Visual Studio Projects\C Sharp Projects\exchangerateprovider\Project Content\providers\CentralBankOfEuropeProvider.cs)
DateTime.TryParseExact(dateString,"yyyy-MM-dd",CultureInfo.InvariantCulture,DateTimeStyles.None,outdateStringParsed);
if(nextStringDay==DateTime.MinValue)
{
nextWorkingDay=getNextWorkingDay(dateStringParsed);
if(nextWorkingDay<=DateTime.Today)
{
dateValue=nextWorkingDay;
}
}
else
{
dateValue=nextStringDay;
}
nextStringDay=dateStringParsed;
With the code:
DateTime.TryParseExact(dateString,"yyyy-MM-dd",CultureInfo.InvariantCulture,DateTimeStyles.None,outdateValue);
dateValue=dateValue+TimeSpan.FromDays(1);
Note: the change will make some pieces of code non-used, those can be removed or left as is – per your discretion.
Method TryForUrl
DateTime nextStringDay = DateTime.MinValue;
DateTime dateStringParsed;
DateTime nextWorkingDay;
Method getNextWorkingDay (i.e. it can be removed completely)
private DateTime getNextWorkingDay(DateTime _date)
{
do
{
_date = _date + TimeSpan.FromDays(1);
} while (_date.DayOfWeek == DayOfWeek.Saturday || _date.DayOfWeek == DayOfWeek.Sunday);
return _date;
}