API/CodeSamples/ShowBetweenDateCalendar.md
... ...
@@ -17,56 +17,32 @@ Below is a sample global.asax using the ShowBetweenDateCalendar setting.
17 17
18 18
<script runat="server">
19 19
20
- void Session_Start(object sender, EventArgs e)
21
- {
22
- AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
23
- Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
24
- }
25
-
26
- public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
27
- {
28
- // Configure settings
29
- // Add Custom Setting below license key and connection string setting
30
- public override void ConfigureSettings()
31
- {
32
- AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
33
- //AdHocSettings.VisibleTables = new string[] { "VIEW1", "TABLE2" };
34
- AdHocSettings.ShowBetweenDateCalendar = true;
35
-
36
- }
37
-
38
- // Control what reports are visible for the current user
39
- public override Izenda.AdHoc.ReportInfo[] ListReports()
40
- {
41
- return base.ListReports();
42
- }
43
-
44
- // Customize a report on the fly prior to execution on a per user basis
45
- public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet)
46
- {
47
-
48
- }
49
-
50
- }
51
-</script>
20
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
21
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
22
+{
23
+ // Configure settings
24
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
25
+ public static void InitializeReporting() {
26
+ //Check to see if we've already initialized.
27
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
28
+ return;
29
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
30
+ //Creates a connection to Microsoft SQL Server
31
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
32
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
33
+ HttpContext.Current.Session["ReportingInitialized"] = true;
34
+ }
35
+
36
+ //Add custom settings below
37
+ public override void ConfigureSettings() {
38
+ AdHocSettings.ShowBetweenDateCalendar = true;
39
+ }
40
+}
52 41
```
53 42
54
-##VB.NET
43
+##Global.asax (VB.NET)
55 44
56 45
```visualbasic
57
-<%@ Application Language="VB" %>
58
-<%@ Import Namespace="Izenda.AdHoc" %>
59
-
60
-<script runat="server">
61
-
62
- Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
63
- AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
64
- Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
65
- End Sub
66
-
67
- Public Class CustomAdHocConfig
68
- Inherits Izenda.AdHoc.DatabaseAdHocConfig
69
-
70 46
' Configure settings
71 47
' Add Custom Setting below license key and connection string setting
72 48
Public Overrides Sub ConfigureSettings()
... ...
@@ -93,10 +69,10 @@ Below is a sample global.asax using the ShowBetweenDateCalendar setting.
93 69
94 70
##Screenshots
95 71
96
-###AdHocSettings.ShowBetweenDateCalendar = true
72
+**AdHocSettings.ShowBetweenDateCalendar = true**
97 73
98 74
![ShowBetweenDateCalendar=true](http://wiki.izenda.us/API/CodeSamples/ShowBetweenDateCalendar/between_date_calendar.png)
99 75
100
-###AdHocSettings.ShowBetweenDateCalendar = false
76
+**AdHocSettings.ShowBetweenDateCalendar = false**
101 77
102 78
![ShowBetweenDateCalendar=false](http://wiki.izenda.us/API/CodeSamples/ShowBetweenDateCalendar/between_date_no_calendar.png)
... ...
\ No newline at end of file