23a14b3ac5c9dc1d5e8655da3da983f7f210227e
API/CodeSamples/TimeZoneOffset.md
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +#TimeZoneOffset |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | +Sets an hour shift applied to each datetime in an Izenda report, in both data and filters. It is added before a report is executed, but not saved as part of the base report. This allows for all times to be shifted by a specific amount, which can be varied depending on the user or set globally. |
|
| 7 | + |
|
| 8 | +**Default Value:** By default no action is taken. If a TimeZoneOffset is set, then that value will be applied to all datetimes. For example, a TimeZoneOffset of -10 will cause all datetimes to be passed to the database as DATEADD(Hour, -10, [OrderDate]) |
|
| 9 | +##Global.asax (C#) |
|
| 10 | + |
|
| 11 | +```csharp |
|
| 12 | +public class CustomAdHocConfig : FileSystemAdHocConfig { |
|
| 13 | + public static void InitializeReporting() { |
|
| 14 | + //Check to see if we've already initialized. |
|
| 15 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 16 | + return; |
|
| 17 | + //Initialize System |
|
| 18 | + AdHocSettings.LicenseKey = "INSERT LICENSE KEY HERE"; |
|
| 19 | + AdHocSettings.SqlServerConnectionString = @"INSERT CONNECTION STRING HERE"; |
|
| 20 | + AdHocSettings.GenerateThumbnails = true; |
|
| 21 | + AdHocSettings.DashboardViewer = "Dashboards.aspx"; |
|
| 22 | + AdHocSettings.ShowSimpleModeViewer = true; |
|
| 23 | + AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$"; |
|
| 24 | + AdHocSettings.TabsCssUrl = "Resources/css/tabs.css"; |
|
| 25 | + AdHocSettings.ReportCssUrl = "Resources/css/Report.css"; |
|
| 26 | + AdHocSettings.ShowBetweenDateCalendar = true; |
|
| 27 | + AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 28 | + AdHocSettings.PrintMode = PrintMode.Html2PdfAndHtml; |
|
| 29 | + AdHocSettings.TimeZoneOffset = 5 |
|
| 30 | + |
|
| 31 | + |
|
| 32 | +``` |
|
| 33 | + |
|
| 34 | +##Global.asax (VB.net) |
|
| 35 | +```visualbasic |
|
| 36 | + |
|
| 37 | + <Serializable()> Public Class CustomAdHocConfig |
|
| 38 | + Inherits FileSystemAdHocConfig |
|
| 39 | + Public Shared Sub InitializeReporting() |
|
| 40 | + 'Check to see if we've already initialized. |
|
| 41 | + If (HttpContext.Current.Session Is Nothing OrElse (Not (HttpContext.Current.Session("ReportingInitialized") Is Nothing))) Then |
|
| 42 | + Return |
|
| 43 | + End If |
|
| 44 | + 'Initialize System |
|
| 45 | + AdHocSettings.LicenseKey = "Insert_license_key_here" |
|
| 46 | + AdHocSettings.SqlServerConnectionString = "Insert_connction_string_here" |
|
| 47 | + AdHocSettings.GenerateThumbnails = True |
|
| 48 | + AdHocSettings.DashboardViewer = "Dashboards.aspx" |
|
| 49 | + AdHocSettings.ShowSimpleModeViewer = True |
|
| 50 | + AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$" |
|
| 51 | + AdHocSettings.TabsCssUrl = "Resources/css/tabs.css" |
|
| 52 | + AdHocSettings.ReportCssUrl = "Resources/css/Report.css" |
|
| 53 | + AdHocSettings.ShowBetweenDateCalendar = True |
|
| 54 | + AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 55 | + AdHocSettings.TimeZoneOffset = 5 |
|
| 56 | + |
|
| 57 | +``` |
|
| ... | ... | \ No newline at end of file |