Creating a DotNetNuke Private Assembly with Crystal Reports - Part 1
page 1 of 1
Published: 27 Oct 2005
Unedited - Community Contributed
Abstract
This is the first in a series of articles showing how to integrate a Crystal Report Manager into DotNetNuke. This article will step through creating a private assembly using Visual Studio as the development environment and using the Data Access Layer in DNN.
by Eric Landes
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 10801/ 13

Introduction

DotNetNuke is a great Open Source Portal tool that many in the ASP.NET world use. Its origins trace back to the original IBuySpy portal. Microsoft developed IBuySpy when they first released ASP.NET as a learning tool for developers. I used IBuySpy to learn current best practices for data access and creating a portal. Later on, some of the intranet sites I developed were based on this framework.

I believe Shaun Walker originally enhanced IBuySpy to allow the framework to access multiple domain names. This meant that different domain names could point to the same hosting account but have totally different content, controls, look and feel, and usage. Since the original DotNetNuke, this Open Source project really has become a full-featured Portal framework that can be utilized for many projects.

For a while now I have wanted to integrate the Crystal source code from an earlier article (Automatically displaying Crystal Report Parameters) as a module for DotNetNuke. The idea is to have a built in form to display reports developed for the DotNetNuke portal using a reporting manager. It would be nice to not have to develop a different application for every report (assuming there are different parameters for those reports). The report manager will queue number of users, automatically display parameters, apply those parameters to the reports, and more.

After this series of articles, other options may be built later to enhance the functionality, such as integration with other reporting systems (Reporting Services) to allow other reporting tools to be used. Perhaps some kind of integration with enterprise reporting tools like Crystal Enterprise or Reporting Services would be good. Maybe sometime down the road I will be able to add this functionality. For now, let’s just see how to get it working!

System Requirements

I created this project using Visual Studio 2003, DotNetNuke 3.1.1, SQL Server 2000, Crystal Reports 10, and Windows XP SP2.

Setting Up the DotNetNuke Environment

Set up the Visual Studio environment following the instructions provided by Bo Norgaard using his instructions on the dotnetnuke.dk site, but I suggest modifying the instructions slightly. After downloading the DotNetNuke 3.1.1 Source code release, create a folder that you want to develop in (I created one in c:\dev\DNNCrystal). Extract the compressed files to the new directory you just created. Once that is done, you need to modify the project files that point to the website. To do that, start by opening the DotnetNuke.sln file in Notepad. Edit the line shown in Code Listing 1 to reflect your new folder name instead of http://localhost/DotnetNuke/DotnetNuke.vbproj. So in my instance, that URL is changed to http://localhost/DNNCrystal/DotNetNuke.vbproj.

Code Listing 1

“Microsoft Visual Studio Solution File, Format Version 8.00

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DotNetNuke", "http://localhost/DotNetNuke/DotNetNuke.vbproj", "{79D3BA0F-F76F-4A84-AE7F-C6A01EC247F9}"

Next, edit the DotNetNuke.vbproj.webinfo file in the same directory. Change the web URL shown in Code Listing 2 to reflect your new web URL. Again, for my example this changes to http://localhost/DNNCrystal/DotNetNuke.vbproj.

Code Listing 2

<Web URLPath = "http://localhost/DotNetNuke/DotNetNuke.vbproj" />

Now that the URL is changed, we need to make the new folder into a web application folder. Make sure that this folder allows ASP.NET user (or in the case of Windows 2003, the Service Account user) to have full permissions to that folder. In Windows XP Professional, do this by checking “Share this folder on the Network,” and checking “Allow network users to change my files.”

Next, set up the DotNetNuke database. In this case, create a database named DNNCrystal using SQL Server Enterprise Manager. I created my own SQL User DotNetNuke to have db_owner access to the DNNCrystal database.

http://www.aspalliance.com/crystal/images/DNNCrystal1.jpg

Now open the solution in Visual Studio 2003 by double clicking the DotNetNuke.sln file. When this opens up, select the web.config file in the DotNetNuke main project to make the necessary changes to reflect the new database. Check out Code Listing 3 to see what line needs to be changed.

Code Listing 3

<appSettings>

<add key="SiteSqlServer" value="Server=(local);Database=DotNetNuke;uid=;pwd=;" />

Once you have changed the database name, the user, and password information, save this file and compile the solution. Assuming your solution compiles successfully, you should open a browser and navigate to http://localhost/DNNCrystal, assuming DNNCrystal is the name that you have used for your DotNetNuke installation. Once you navigate there, DotNetNuke will configure and set up the database (this can take a few minutes). Now your environment is ready to begin setting up the CrystalReportManager Project.

Preparing the Tables for CrystalReportManager

To store information for the CrystalReportManager, the design of the application assumes that the reports will be stored in a file path rather than storing the reports in a blob on the SQL Server. The design of the table follows the SQL Script shown in Code Listing 4.

Code Listing 4

 CREATE TABLE [dbo].[ReportList] (
[ReportID] [int] IDENTITY (1, 1) NOT NULL ,
[ModuleID] [int] NOT NULL ,
[ReportName] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ReportDescription] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FilePath] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DateAdded] [DateTime] null
) ON [PRIMARY]

The create table list contains a ReportID column to keep each report unique and a ModuleID column to keep the reports in line for the different modules that might use this application. The field ReportName contains the title of the report that users see. ReportDescription can have any additional information about the report for users. FilePath denotes where the report is stored, and the ASP.NET user must have read access to this file path. Finally, DateAdded should be controlled through the administration portion of the module to determine when the report was added.

Simply run this script from your Query Analyzer to put the table in the DotNetNuke database. The script in the download also sets the Primary Key and sets a default value. Once we’ve created this table, we’ll be ready to set up the CrystalReportManager project in Visual Studio.

Setting Up the CrystalReportManager Project in the DotNetNuke Solution

Before creating the DAL classes for the ReportManager, we need to create the project that will contain our new private assembly. Add a C# web project called CrystalReportManager to the DotNetNuke solution. To make sure it works well, recompile the solution after adding CrystalReportManager in order to make sure that it compiles without a problem. Once that works, add DotNetNuke.dll from the DotnetNuke/bin directory as a reference. Make sure to set the Copy Local attribute to false. You need to do this so that any referenced dll’s do not get copied into the CrystalReportManager bin directory. (See the Bo Norgaard article for a full explanation; the idea is that our private assembly needs to be compiled with all the DotNetNuke assemblies in the DotNetNuke build project.)

Next, set the properties for the project, like assembly name and default namespace. In this case, set the assembly name and default namespace to Lancor.CrystalReportManager. Delete the WebForm1.aspx file and add a user control called ReportManager. Finally add a reference in the BuildSupport project to the CrystalReportManager project, and build the solution to make sure that there are no errors.

The next step covers building the DAL and business objects for CrystalReportManager. Look for that in the next part of this series.

Summary

This is the first part in a series to show how to integrate Crystal Report Manager into the DotNetNuke portal. This series of articles shows developers how to create a new private assembly for DotNetNuke in general but specifically shows how to integrate Crystal Reports with DotNetNuke.



User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-19 10:05:15 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search