Click here to Skip to main content
11,632,260 members (72,046 online)
Click here to Skip to main content
Add your own
alternative version

Conversion of Reporting Starter Kit to use Mono/MySQL

, 1 Oct 2005 23.7K 380 32
A porting of the ASP.NET reporting starter kit to use Mono, MySQL and Apache on a Linux system.
Reporting_Kit_Conversion_demo.zip
reports
bin
ASPNETReports.dll
ASPNETReports.dll.bak
MySql.Data.dll
MySql.Data.Tests.dll
components
bin
Release
ASPNETReports.dll
BLL
DAL
docs
images
1x1.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
masterdetaildetails.png
masterdetailsummary.png
masterdetailtables.png
querysample.gif
querysample2.gif
simpleoverview.png
simplesp.png
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabularextendedprice.png
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
xtabsql.png
Global.asax
images
1x1.gif
asp.net-reports.gif
background.gif
crosstab.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldown.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
grid_background.gif
hierarchal.gif
hierarchical.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
logo-neg.gif
logo.gif
masterdetail.gif
masterdetaildetails.png
masterdetails.gif
masterdetailsummary.png
masterdetailtables.png
matrix.gif
querysample.gif
querysample2.gif
report-table-bg.gif
reporting.gif
simple.gif
simpleoverview.png
simplesp.png
spacer.gif
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabular.gif
tabularcolorcode.png
tabularextendedprice.png
tabularsorting.png
text.gif
textalternate.gif
textreport.gif
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
visual.gif
xtabsql.png
sourceviewer
1x1.gif
crosstab.src
drilldown.src
grid_background.gif
hierarchical.src
masterdetail.src
simple.src
tabular.src
textreport.src
visual.src
sql
<%@ Page language="c#"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="ASPNET.StarterKit.Reports.Components" %>

<script runat="server">
	//*********************************************************************
	//
	// Visual.aspx
	//
	// The Visual.aspx page shows Sales by Category in three different views: 
	// Pie Chart, Bar Graph, and Tabular view.
	//
	//*********************************************************************

	protected bool printVersion;
	protected string _styleSheet;

	private void Page_Load(object sender, System.EventArgs e)
	{
		printVersion = Request.QueryString["Print"]=="true";

		if (!IsPostBack)
		{
			if (Session["ViewSelectIndex"] != null)
				drpChartType.SelectedIndex = (int)Session["ViewSelectIndex"];

			// call event to display default view
			drpChartType_SelectedIndexChanged(this, new System.EventArgs());
		}

		// switches the style sheet based on printer friendly view or not
		if (printVersion)
		{
			_styleSheet = "stylesPrint.css";
			PrintButton.Visible = true;
		}
		else 
		{
			_styleSheet = "styles.css";
		}
	}

	//*********************************************************************
	//
	// The BindGrid method retrieves the list of sales by category
	// and then databinds them to the SalesByCategoryGrid
	//
	//*********************************************************************

	private void BindGrid(VisualReportCollection data)
	{
		SalesByCategoryGrid.Visible = true;
		SalesByCategoryGrid.DataSource = data;
		SalesByCategoryGrid.DataBind();
	}

	//*********************************************************************
	//
	// The drpChartType_SelectedIndexChanged event handler gets the sales data and changes the view.
	//
	//*********************************************************************

	private void drpChartType_SelectedIndexChanged(object sender, System.EventArgs e)
	{
		// retrieve the sales data 
		VisualReportCollection visualReport = VisualReport.GetCategorySales();
			
		if (drpChartType.SelectedItem.Value != "Table")
		{
			StringBuilder xValues = new StringBuilder();
			StringBuilder yValues = new StringBuilder();
			int rowCount = visualReport.Count;
			int i = 1;

			// convert data to comma delimited stringbuilders
			foreach (VisualReport dr in visualReport)
			{
				xValues.Append(dr.CategoryName);
				yValues.Append(dr.Sales);
				if (i < rowCount)
				{
					xValues.Append("|");
					yValues.Append("|");
				}
				i++;
			}

			// attach image generator to image
			ChartImage.ImageUrl = "ChartGenerator.aspx?" +
				"xValues=" + xValues.ToString() + 
				"&yValues=" + yValues.ToString() + 
				"&ChartType=" + drpChartType.SelectedItem.Value.ToLower()+
				"&Print=" + printVersion.ToString();
			
			ChartImage.Visible = true;
			SalesByCategoryGrid.Visible = false;
		}
		else
		{
			BindGrid(visualReport);
			ChartImage.Visible = false;
		}

		Session["ViewSelectIndex"] = drpChartType.SelectedIndex;
	}
</script>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
	<head>
		<title>Visual</title>
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link href="<%= _styleSheet %>" type=text/css rel=stylesheet>
		<script src="scripts.js"></script>
	</head>
	<body class="Report" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
		<form id="Visual" method="post" runat="server">
			<table border="0" cellspacing="15" cellpadding="5" width="100%" id="Table1">
				<tr>
					<td colspan="1" class="ReportTitle">Sales By Category</td>
					<td align="right">
						<asp:hyperlink id="PrintButton" navigateurl="javascript:Print()" cssclass="printbutton" runat="server" visible="False">Print</asp:hyperlink>
					</td>

				</tr>
				<tr>
					<td colspan="2" class="Select">
						Select View:
						<asp:dropdownlist id="drpChartType" OnSelectedIndexChanged="drpChartType_SelectedIndexChanged" runat="server" autopostback="True">
							<asp:listitem value="Pie">Pie Chart</asp:listitem>
							<asp:listitem value="Bar">Bar Graph</asp:listitem>
							<asp:listitem value="Table">Table</asp:listitem>
						</asp:dropdownlist>
					</td>
				</tr>
				<tr>
					<td colspan="2" valign="top">
						<asp:datagrid id="SalesByCategoryGrid" runat="server" gridlines="Both" borderwidth="0" showfooter="True" autogeneratecolumns="False" width="300" cellpadding="3" cssclass="Content">
							<columns>
								<asp:boundcolumn datafield="CategoryName" headertext="Category">
									<headerstyle cssclass="HeaderStyle"></headerstyle>
									<itemstyle cssclass="ItemStyle"></itemstyle>
									<footerstyle cssclass="FooterStyle"></footerstyle>
								</asp:boundcolumn>
								<asp:boundcolumn datafield="Sales" headertext="Sales" dataformatstring="{0:c}">
									<headerstyle horizontalalign="Right" cssclass="HeaderStyleRight"></headerstyle>
									<itemstyle cssclass="ItemStyleRight"></itemstyle>
									<footerstyle cssclass="FooterStyleRight"></footerstyle>
								</asp:boundcolumn>
							</columns>
						</asp:datagrid>
						<asp:image id="ChartImage" runat="server" visible="False" borderwidth="0"></asp:image>
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

StylezHouse
Web Developer
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150728.1 | Last Updated 1 Oct 2005
Article Copyright 2005 by StylezHouse
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid