f7b596d71c30e0c2fb2f997e7a2904b15cb0ffae
CodeSamples/ShowBetweenDateCalendar.md
| ... | ... | @@ -7,86 +7,48 @@ When enabled, the Between(Calendar) option appears in the Operator dropdown at t |
| 7 | 7 | |
| 8 | 8 | Default value: true |
| 9 | 9 | |
| 10 | -##C♯ |
|
| 11 | - |
|
| 12 | -```csharp |
|
| 13 | -<%@ Application Language="C#" %> |
|
| 14 | -<%@ Import Namespace="Izenda.AdHoc" %> |
|
| 15 | - |
|
| 16 | -<script runat="server"> |
|
| 17 | - |
|
| 18 | - void Session_Start(object sender, EventArgs e) |
|
| 19 | - { |
|
| 20 | - AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 21 | - Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 25 | - { |
|
| 26 | - // Configure settings |
|
| 27 | - // Add Custom Setting below license key and connection string setting |
|
| 28 | - public override void ConfigureSettings() |
|
| 29 | - { |
|
| 30 | - AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 31 | - //AdHocSettings.VisibleTables = new string[] { "VIEW1", "TABLE2" }; |
|
| 32 | - AdHocSettings.ShowBetweenDateCalendar = true; |
|
| 33 | - |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - // Control what reports are visible for the current user |
|
| 37 | - public override Izenda.AdHoc.ReportInfo[] ListReports() |
|
| 38 | - { |
|
| 39 | - return base.ListReports(); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - // Customize a report on the fly prior to execution on a per user basis |
|
| 43 | - public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) |
|
| 44 | - { |
|
| 45 | - |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - } |
|
| 49 | -</script> |
|
| 10 | +##Global.asax (C♯) |
|
| 11 | +```c# |
|
| 12 | + |
|
| 13 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 14 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 15 | +{ |
|
| 16 | + // Configure settings |
|
| 17 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 18 | + public static void InitializeReporting() { |
|
| 19 | + //Check to see if we've already initialized. |
|
| 20 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 21 | + return; |
|
| 22 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 23 | + //Creates a connection to Microsoft SQL Server |
|
| 24 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 25 | + AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 26 | + AdHocSettings.ShowBetweenDateCalendar = true; //The relevant setting |
|
| 27 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 28 | + } |
|
| 29 | +} |
|
| 50 | 30 | ``` |
| 51 | 31 | |
| 52 | -##VB.NET |
|
| 32 | +##Global.asax (VB.NET) |
|
| 53 | 33 | |
| 54 | 34 | ```visualbasic |
| 55 | -<%@ Application Language="VB" %> |
|
| 56 | -<%@ Import Namespace="Izenda.AdHoc" %> |
|
| 57 | 35 | |
| 58 | -<script runat="server"> |
|
| 36 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 37 | +Public Class CustomAdHocConfig |
|
| 38 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 59 | 39 | |
| 60 | - Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) |
|
| 40 | + Shared Sub InitializeReporting() |
|
| 41 | + 'Check to see if we've already initialized |
|
| 42 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 43 | + Return |
|
| 44 | + 'Initialize System |
|
| 61 | 45 | AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
| 62 | - Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 46 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 47 | + AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 48 | + AdHocSettings.ShowBetweenDateCalendar = True 'The relevant setting |
|
| 49 | + HttpContext.Current.Session("ReortingInitialized") = True |
|
| 63 | 50 | End Sub |
| 64 | - |
|
| 65 | - Public Class CustomAdHocConfig |
|
| 66 | - Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 67 | - |
|
| 68 | - ' Configure settings |
|
| 69 | - ' Add Custom Setting below license key and connection string setting |
|
| 70 | - Public Overrides Sub ConfigureSettings() |
|
| 71 | - AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 72 | - 'AdHocSettings.VisibleTables = New String() { "VIEW1", "TABLE2" } |
|
| 73 | - AdHocSettings.ShowBetweenDateCalendar = True |
|
| 74 | - |
|
| 75 | - End Sub |
|
| 76 | - |
|
| 77 | - ' Control what reports are visible for the current user |
|
| 78 | - Public Overrides Function ListReports() As Izenda.AdHoc.ReportInfo() |
|
| 79 | - Return MyBase.ListReports |
|
| 80 | - End Function |
|
| 81 | - |
|
| 82 | - ' Customize a report on the fly prior to execution on a per user basis |
|
| 83 | - Public Overrides Sub PreExecuteReportSet(ByVal reportSet As Izenda.AdHoc.ReportSet) |
|
| 84 | - |
|
| 85 | - End Sub |
|
| 86 | - |
|
| 87 | - End Class |
|
| 88 | - |
|
| 89 | -</script> |
|
| 51 | +End Class |
|
| 90 | 52 | ``` |
| 91 | 53 | |
| 92 | 54 | ##Screenshots |