Click here to Skip to main content
15,885,767 members
Articles / Web Development / ASP.NET

Conversion of Reporting Starter Kit to use Mono/MySQL

Rate me:
Please Sign up or sign in to vote.
3.69/5 (9 votes)
1 Oct 20053 min read 28.3K   411   32  
A porting of the ASP.NET reporting starter kit to use Mono, MySQL and Apache on a Linux system.
<html>
	<head>
		<title>ASP.NET Reporting Documentation</title>
		<link rel="stylesheet" href="../style.css">
	</head>
	<body class="NormalIndent">
		<h1>
			MasterDetail.aspx Page
		</h1>
		<p>
			<b>Description:</b> &nbsp;&nbsp;The Master Detail page displays a list of 
			orders filtered by year and optionally by quarter. It provides a summary 
			breakdown by quarter as well as a more detailed list of all orders for the year 
			and quarter.
		</p>
		<p>
			<strong>Overview:</strong> &nbsp;&nbsp;This reports show a simple way of 
			creating and databinding two different <strong>DataGrids</strong> on the same 
			page, one for the summary and one for the details. Both DataGrids are bound to 
			two separate stored procedures. For the summary, the results are filtered by 
			year. For the details,&nbsp;the results are filtered by year and quarter 
			(optional).
		</p>
		<P>
			The summary breaks down the number of orders shipped and the amount of sales by 
			quarter. The <strong>Sales Total</strong> for the year is reported at the 
			bottom of the summary.
		</P>
		<p>
			<img src="../images/1x1.gif" width="25"> <img src="../images/masterdetailsummary.png">
		</p>
		<p>
			The detail displays a list of all the orders for the year and quarter 
			(optional), reporting on it's Order ID, Order Date, and Sales amount.
		</p>
		<p>
			<img src="../images/1x1.gif" width="25"> <img src="../images/masterdetaildetails.png">
		</p>
		<p>
			The user can specify the year and quarter by selecting them from the <strong>YearDropDownList</strong>
			and <strong>QuarterDropDownList</strong> at the top of the page.
		</p>
		<p>
			<strong>Implementation Notes:&nbsp;</strong> &nbsp;&nbsp; Two separate 
			DataGrids are created and binded to two separate stored procedures named 
			GetOrderSummary and GetOrderDetails. This is done by calling GetSales and 
			GetSalesDetails in the MasterDetail component in the Business Logic Layer, 
			which will utilize the SQLHelper (DAAB)&nbsp;component in the Data Access 
			Layer. Note that the <strong>YearDropDownList</strong> is used to pass in the 
			year which the results are filtered by.
		</p>
		<pre>
	<font color=blue>private void</font> BindSummary()
	{
		SummaryLabel.Text = YearDropDownList.SelectedItem.Text + " Summary";
		SummaryDataGrid.DataSource = GetSales(Convert.ToInt32(YearDropDownList.SelectedItem.Value));
		SummaryDataGrid.DataBind();
	}

	<font color=blue>protected</font> MasterDetailReportCollection GetSales(<font color=blue>int</font> year)
	{
		<font color=blue>return</font> MasterDetailReport.GetSummary(year);
	}		
		</pre>
		<p>
			In order to calculate the <strong>Sales Total</strong> , an event handler is 
			added to the Summary DataGrid. We iterate thru the DataGrid's list of table 
			rows. We use the third cell in each row, which represents the <strong>Sales</strong>
			column, to calculate the sales total. This total is then added back to the 
			actual DataGrid's footer row.
		</p>
		<pre>
	<font color=blue>private void</font> SumItems(<font color=blue>object</font> sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
	{
		<font color=blue>if</font> (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
		{
			CalcTotal( e.Item.Cells[2].Text );
			e.Item.Cells[2].Text = <font color=blue>string</font>.Format("{0:c}", Convert.ToDouble(e.Item.Cells[2].Text));
		}
		<font color=blue>else if</font> (e.Item.ItemType == ListItemType.Footer )
		{
			e.Item.Cells[0].Text="Sales Total";
			e.Item.Cells[2].Text = <font color=blue>string</font>.Format("{0:c}", _salesTotal);
		}
	}

	<font color=blue>private void</font> CalcTotal(<font color=blue>string</font> _price)
	{
		_salesTotal += Double.Parse(_price);
	} 
		</pre>
	</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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions