02cc575fbd208bfa6db998c9942b45b4dd92ed71
Integration/Tutorials/Customizing-Izenda-Settings.md
| ... | ... | @@ -12,45 +12,46 @@ Izenda Reports can be integrated with the navigation, security, and appearance o |
| 12 | 12 | <%@ Application Language="C#" %> |
| 13 | 13 | <%@ Import Namespace="Izenda.AdHoc" %> |
| 14 | 14 | <script runat="server"> |
| 15 | - |
|
| 16 | -void Session_Start(object sender, EventArgs e) |
|
| 17 | -{ |
|
| 18 | - // set license key and connection string |
|
| 19 | - Izenda.AdHoc.AdHocSettings.LicenseKey = "IzendaReports|Corporate|XXXXXXXXXXXX"; |
|
| 20 | - Izenda.AdHoc.AdHocSettings.SqlServerConnectionString = "server=localhost;Database=Database1;Trusted_Connection=True"; |
|
| 21 | - //initialize a new custom configuration |
|
| 22 | - Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 23 | -} |
|
| 24 | 15 | |
| 25 | 16 | [Serializable] |
| 26 | 17 | public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig |
| 27 | 18 | { |
| 28 | - public override void ConfigureSettings() |
|
| 29 | - { |
|
| 30 | - //Add custom global settings |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) |
|
| 34 | - { |
|
| 35 | - // Add hidden filters before the report is displayed |
|
| 36 | - } |
|
| 19 | + //the method to be called by each of your reporting web pages in the OnPreInit() method. This will instantiate Izenda reports throughout your reporting application. |
|
| 20 | + public static void InitializeReporting() { |
|
| 21 | + //Check to see if we've already initialized. |
|
| 22 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 23 | + return; |
|
| 24 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 25 | + //Creates a connection to Microsoft SQL Server |
|
| 26 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 27 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 28 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + // Configure settings |
|
| 32 | + // Add custom settings after setting the license key and connection string |
|
| 33 | + public override void ConfigureSettings() { |
|
| 34 | + //Add custom settings here |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + // Dynamically modify the report before execution. |
|
| 38 | + public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) { |
|
| 39 | + // Add custom logic to run before the report is displayed |
|
| 40 | + } |
|
| 37 | 41 | |
| 38 | - public override void PostLogin() |
|
| 39 | - { |
|
| 40 | - // Call Izenda.AdHoc.AdHocSettngs.AdHocConfig.PostLogin() from your login |
|
| 41 | - // page after authentication is successful |
|
| 42 | - |
|
| 43 | - if (userName == joe) |
|
| 44 | - { |
|
| 45 | - AdHocSettings.CurrentUserName = userName; |
|
| 46 | - AdHocSettings.CurrentUserIsAdmin = false; |
|
| 47 | - AdHocSettings.ShowSettingsButton = false; |
|
| 48 | - } |
|
| 49 | - else |
|
| 50 | - { |
|
| 51 | - AdHocSettings.CurrentUserIsAdmin = true; |
|
| 52 | - } |
|
| 53 | - } |
|
| 42 | + // Dynamically modify the results after they come back |
|
| 43 | + // from the database and before they are rendered |
|
| 44 | + public override void ProcessDataSet(System.Data.DataSet ds, string reportPart) { |
|
| 45 | + // Add custom logic to modify specific areas of the report |
|
| 46 | + } |
|
| 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 | + } |
|
| 54 | 55 | } |
| 55 | 56 | </script> |
| 56 | 57 | ``` |