Integration/Tutorials/Customizing-Izenda-Settings.md
... ...
@@ -25,15 +25,14 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
25 25
//Creates a connection to Microsoft SQL Server
26 26
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
27 27
Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
28
+ //Handle user specific logic
29
+ AdHocSettings.CurrentUserName = (string)HttpContext.Current.Session["UserName"]; //Assumes the authenticated username is stored in a session variable
30
+ AdHocSettings.CurrentUserIsAdmin = (bool)HttpContext.Current.Session["IsAdmin"]; //Assumes the authenticated user's admin status is stored in a session variable
31
+ AdHocSettings.ShowSettingsButton = AdHocSettings.CurrentUserIsAdmin;
32
+ AdHocSettings.VisibleDataSources = GetUserDataSources();
28 33
HttpContext.Current.Session["ReportingInitialized"] = true;
29 34
}
30 35
31
- // Configure settings
32
- // Add custom global settings after setting the license key and connection string
33
- public override void ConfigureSettings() {
34
- //Add custom settings here
35
- }
36
-
37 36
// Dynamically modify the report before execution.
38 37
public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) {
39 38
// Add custom logic to run before the report is displayed
... ...
@@ -44,14 +43,6 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
44 43
public override void ProcessDataSet(System.Data.DataSet ds, string reportPart) {
45 44
// Add custom logic to modify specific areas of the report
46 45
}
47
- public override void PostLogin() {
48
- // Call Izenda.AdHoc.AdHocSettngs.AdHocConfig.PostLogin() from your login
49
- // page after authentication is successful
50
- AdHocSettings.CurrentUserName = (string)HttpContext.Current.Session["UserName"]; //Assumes the authenticated username is stored in a session variable
51
- AdHocSettings.CurrentUserIsAdmin = (bool)HttpContext.Current.Session["IsAdmin"]; //Assumes the authenticated user's admin status is stored in a session variable
52
- AdHocSettings.ShowSettingsButton = AdHocSettings.CurrentUserIsAdmin;
53
- AdHocSettings.VisibleDataSources = GetUserDataSources();
54
- }
55 46
}
56 47
</script>
57 48
```
... ...
@@ -59,13 +50,11 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
59 50
For more a more detailed code sample, click any of the headings.
60 51
61 52
* InitializeReporting() **The license key must be first!** Then add the connection string and initialize your custom AdHocConfig.
62
- * ConfigureSettings() Add global settings here. Global settings will affect all users and any settings made here will override the settings.aspx page.
63
- * PostLogin() Add per-user code here, such as setting the username and other per-user settings.
64
- * PreExecuteReportSet() Add hidden filters and other code that needs to run before the report is displayed to the user.
65
-
53
+ * [[PreExecuteReportSet()|/FAQ/PreExecuteReportSet]] Add hidden filters and other code that needs to run before the report is displayed to the user.
54
+ * [[ProcessDataSet()|/FAQ/ProcessDataSet]] You can manipulate the report how you please in this method. This is useful for substituting values in your reports.
66 55
##How do I add custom code?
67 56
68
-To enable a custom configuration, we must put the key and connection string in the ``InitializeReporting()`` method, even if they have already been set on the **Settings.aspx** page. Otherwise, the Izenda Reports application will ignore the ``ConfigureSettings()`` method completely and only use the settings set in the **settings.aspx** page. To enable custom code:
57
+To enable a custom configuration, we must put the key and connection string in the ``InitializeReporting()`` method, even if they have already been set on the **Settings.aspx** page. Otherwise, there could be complications when initializing. When adding custom code, we recommend disabling **Settings.aspx** and **Izenda.config** altogether to prevent any conflicts from occurring. Here is the process flow for enabling custom code:
69 58
70 59
* Navigate via the file system to the root directory of your Izenda Reports installation
71 60
* Open your global.asax file in a text editor or your favorite IDE
... ...
@@ -80,10 +69,10 @@ You may now add custom code to Izenda Reports.
80 69
81 70
Izenda Reports is an ASP.NET application and utilizes an object model. There are two classes upon which an integrator should primarily focus. These classes contain many settings and methods that will help you integrate our application with yours.
82 71
83
- * **AdHocSettings**: the class that contains all of the settings for Izenda Reports. Using the Settings.aspx page will enable application-wide usage of these settings. However, they can be set on a per-user basis. Customization at the user level is fairly easy and simply involves assigning values to settings. For example:
84
- * ``AdHocSettings.ShowAdminButton=false;``
85
- * **AdHocConfig**: the class that enables you to call the methods and properties that you have altered from anywhere else in your code. For example, you could call the ``PostLogin()`` method on any page and it will use the singular method definition that contains your custom logic:
86
- * ``AdHocSettings.AdHocConfig.PostLogin();``
72
+ * **AdHocSettings**: the class that contains all of the settings for Izenda Reports. Using the Settings.aspx page will enable application-wide usage of these settings. However, they can be set on a per-user basis. Customization at the user level is fairly easy but does require some experience with C♯ or VB.NET. For example:
73
+ * **C♯:** ``AdHocSettings.ShowAdminButton = (bool)HttpContext.Current.Session["IsAdmin"];``
74
+ * **VB.NET:** ``AdHocSettings.ShowAdminButton = CBool(HttpContext.Current.Session("IsAdmin"))``
75
+ * **AdHocConfig**: the class that enables you to call the methods and properties that you have altered from anywhere else in your code. Generally, your global.asax will inherit either ``DataBaseAdHocConfig`` or ``FileSystemAdHocConfig``.
87 76
88 77
Both of these classes are customized by adding your code into the global.asax file, as shown above.
89 78
... ...
@@ -93,9 +82,9 @@ By putting code in the **global.asax** file, you are simply choosing to use the
93 82
94 83
In general, most custom code will be placed in the **Global.asax** file. Custom code applies to one of the following contexts:
95 84
96
- * **Global:** Affect on the Izenda Reports application: This type of code applies to all users and all reports. This type of code should be contained in the ``ConfigureSettings()`` method in the global.asax file. [[Please see this example for details|/FAQ/ConfigureSettings]].
97
- * **Per User Basis/Per Role Basis/etc:** This type of code applies to different users in different ways. We recommend that this type of code be contained in the ``PostLogin()`` method. Note that this method needs to be called from your application's authentication process. [[Please see this example for details|/FAQ/PostLogin]].
98
- * **Per Report/Custom Processing of Reports:** Applied before execution of each report. Generally, this is used for applying hidden filters. This code needs to be placed in the ``PreExecuteReportSet()`` method. [[Please see this example for details|/FAQ/applying-hidden-filter-using-inner-query]].
85
+ * **Global:** This type of code applies to all users and all reports. Generally, these will be the first settings initialized in your application and will not require custom logic as they apply the same everywhere in your application.
86
+ * **Per User Basis/Per Role Basis/etc:** This type of code applies to different users in different ways. You can use your own logic to implement settings at this level. Core settings of this nature that Izenda offers include [[CurrentUserName|/API/CodeSamples/CurrentUserName]], [[CurrentUserTenantId|/API/CodeSamples/CurrentUserTenantId]], [[CurrentUserRoles|/API/CodeSamples/CurrentUserRoles]], and [[CurrentUserIsAdmin|/API/CodeSamples/CurrentUserIsAdmin]].
87
+ * **Per Report/Custom Processing of Reports:** Applied before execution of each report. Generally, this is used for applying hidden filters. This code needs to be placed in the [[PreExecuteReportSet()/FAQ/PreExecuteReportSet]] method. [[Please see this example for details|/FAQ/applying-hidden-filter-using-inner-query]].
99 88
100 89
##Calling Izenda Reports from your application
101 90