497ebff4c45e1e6b56731dc5654cc033e4f3561b
API/CodeSamples/Culture.md
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +#Culture |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +Gets or sets the default culture for Ad Hoc. Note: use this only in special cases. Normally you should use Language setting for localization, see links below: |
|
| 8 | + |
|
| 9 | +[[Language|/API/CodeSamples/Language]] |
|
| 10 | + |
|
| 11 | +[[Izenda Language Pack|http://wiki.izenda.us/Integration/Tutorials/Localization]] |
|
| 12 | + |
|
| 13 | +##Global.asax (C♯) |
|
| 14 | + |
|
| 15 | +```csharp |
|
| 16 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 17 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 18 | +{ |
|
| 19 | + // Configure settings |
|
| 20 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 21 | + public static void InitializeReporting() { |
|
| 22 | + //Check to see if we've already initialized. |
|
| 23 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 24 | + return; |
|
| 25 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 26 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 27 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 28 | + AdHocSettings.Culture = new CultureInfo("en-US"); //the relevant setting |
|
| 29 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 30 | + } |
|
| 31 | +} |
|
| 32 | +``` |
|
| 33 | + |
|
| 34 | +##Global.asax (VB.NET) |
|
| 35 | + |
|
| 36 | +``` |
|
| 37 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 38 | +Public Class CustomAdHocConfig |
|
| 39 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 40 | + |
|
| 41 | + 'Configure settings |
|
| 42 | + 'Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 43 | + Shared Sub InitializeReporting() |
|
| 44 | + 'Check to see if we've already initialized. |
|
| 45 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 46 | + Return |
|
| 47 | + 'Initialize System |
|
| 48 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 49 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 50 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 51 | + AdHocSettings.Culture = new CultureInfo("en-US") 'The relevant setting |
|
| 52 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 53 | + End Sub |
|
| 54 | +End Class |
|
| 55 | +``` |
|
| ... | ... | \ No newline at end of file |