AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
NAV
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.03.2015, 20:00   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
We live in a world of global interaction, and this is reflected in the software that we use at work and at home. As expected this culture differences brings also more complexity and one more extra care for our development side. For instance, a Germany company that is now expanding its business to USA do need to take care of the cultural differences present on our system as date formats, number formats, and so on. Since in Germany we do for instance use the date as DD/MM/YY and in USA MM/DD/YY, we do have an issue when integrating those two systems.

So for such cases, in Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2013 R2, and Microsoft Dynamics NAV 2015, you can set up the cultural settings so that our Microsoft Dynamics NAV system understands how to “translate” culture-specific data when exchanging data between the two countries.

Here below I show an example of how to configure and use Microsoft Dynamics NAV web services on different cultural environments (as I explained before I did this using the example of Germany and USA culture settings).

First lets discuss the necessary setup in Microsoft Dynamics NAV:
  1. In the CustomSettings.config file for the relevant Microsoft Dynamics NAV Server instance, add the following key:
    <add key="ServicesCultureDefaultUserPersonalization" value="true"/>
  2. Make sure that the server where our middletier (the Microsoft Dynamics NAV Server instance) is running has the right regional settings.

    Please do use the standard format Additional settings such as Decimal, and so on.
  3. Finally, in the Microsoft Dynamics NAV client, on the Personalization Card, set the relevant language for the Microsoft Dynamics NAV Server user - in this example Language ID 1031 for German.
For more information, see the Web Services and Regional Settings section here: https://msdn.microsoft.com/en-us/lib...nav.80%29.aspx .

This finishes the setup part. Now we need to be sure that our VB application is using the correct code to &ldquo;translate&rdquo; the input date into the correct format when using Microsoft Dynamics NAV web services. This will indicates to our Microsoft Dynamics NAV Server how we do want to insert the date in our NAV database.

For this example I will take the Date and Decimal from our C# application project and convert them to pass the Data to Web Services that will finally &ldquo;insert&rdquo; it into our NAV System.
As for my setup in Microsoft Dynamics NAV, for this example I'm using the German language/cultural settings. In this example, I create a table and a page called WebServicesCultureTable and WebServicesCulturePage.





The page displays the following fields from the table:



Actually we will only use now the CultureCode ( the primary key), CultureDate that we will use to set the Date, and finally the CultureDecimal that we will use to check if the decimals are been passed correctly.

In the Visual Studio, in my C# project, I have created an application that can be used to insert the desired values for test.
So there I will use my web services to &ldquo;pass&rdquo; to Microsoft Dynamics NAV the date 11-08-15 (with the format) and the decimal 33.73M (we need this M so that C# understands that this is a decimal number). This class refers to a button in my C# application, but it resumes the necessary setting up for the Culture format that we need to use in order to our Web Server to understand correct the formats.

private void button3_Click(object sender, EventArgs e)

{

NavOData.NAV nav = new NavOData.NAV(new Uri("http://localhost:7148/DynamicsNAV71/OData/Company('CRONUS%20AG')"));

//Here define the companies, if need set a new company

nav.Credentials = CredentialCache.DefaultNetworkCredentials;



//Cultural Setting to Use on Date/Decimal

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE");



//Converting Cultural Date

String TESTDate = "11-08-15";

DateTime finalDate = DateTime.ParseExact(TESTDate, "DD-MM-YY", CultureInfo.CurrentCulture);



//Converting Cultural Decimal

decimal DecimalTEST = 33.73M;

System.Convert.ToDecimal(DecimalTEST, new System.Globalization.CultureInfo("de-DE"));



var WebServicesCultureTable = new NavOData.WebServicesCulturePage

{

//Here we can create new rows

CultureCode = "DE",

CultureDate = finalDate,

CultureDecimal = DecimalTEST,

};

nav.AddToWebServicesCulturePage(WebServicesCultureTable);

nav.SaveChanges();

}

Finally I inserted manually direct on the page the following test:



Then using my new button3 = Insert, I inserted the values to test on the web service side.



There you go: the culture personalization does works as desired!

Bonus info: This test I did using Microsoft Dynamics NAV 2013 R2 Cumulative Update 6 (build # 39665), but this functionality has been available since Microsoft Dynamics NAV 2013 Cumulative Update 9, and is also working as it should in Microsoft Dynamics NAV 2013 R2 and Microsoft Dynamics NAV 2015.



Best Regards,

Daniel De Castro Santos Silva

Microsoft Dynamics NAV Support Engineer

[img]//feeds.feedburner.com/~r/MicrosoftDynamicsNavTeamBlog/~4/PE7i2CkW2FE[/img]

Источник: http://feedproxy.google.com/~r/Micro...-services.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:47.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.