Click here to Skip to main content
15,886,091 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><link rel=stylesheet href=style.css></head><body><div class=SourcePanel style='font-size:12'><pre style='background-color:white'>
<font color= "blue">using</font> System;
<font color= "blue">using</font> System.Data;
<font color= "blue">using</font> System.Configuration;
<font color= "blue">using</font> ASPNET.StarterKit.Reports.DataAccessLayer;
<font color= "blue">using</font> System.Collections;
<font color= "blue"></font>
<font color= "blue">namespace</font> ASPNET.StarterKit.Reports.Components
<font color= "blue"></font>{
<font color= "blue">    public class</font> DrillDownReport
<font color= "blue">    </font>{
<font color= "blue">        private </font>string        _customerID;
<font color= "blue">        private </font>string        _companyName;
<font color= "blue">        private </font>string        _contactName;
<font color= "blue">        private </font>string        _shipAddress;
<font color= "blue">        private </font>string        _shipCity;
<font color= "blue">        private </font>string        _shipCountry;
<font color= "blue">        private </font>string        _shipPostalCode;
<font color= "blue">        private </font>DateTime    _orderDate;
<font color= "blue">        private </font>int            _orderID;
<font color= "blue">        private </font>DateTime    _shippedDate;
<font color= "blue">        private </font>int            _productID;
<font color= "blue">        private </font>string        _productName;
<font color= "blue">        private </font>decimal        _unitPrice;
<font color= "blue">        private </font>int         _quantity;
<font color= "blue"></font>
<font color= "blue">        public </font>string CustomerID
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _customerID; }
<font color= "blue">            set</font> { _customerID = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string CompanyName
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _companyName; }
<font color= "blue">            set</font> { _companyName = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ContactName
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _contactName; }
<font color= "blue">            set</font> { _contactName = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ShipAddress
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _shipAddress; }
<font color= "blue">            set</font> { _shipAddress = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ShipCity
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _shipCity; }
<font color= "blue">            set</font> { _shipCity = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ShipCountry
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _shipCountry; }
<font color= "blue">            set</font> { _shipCountry = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ShipPostalCode
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _shipPostalCode; }
<font color= "blue">            set</font> { _shipPostalCode = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>DateTime OrderDate
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _orderDate; }
<font color= "blue">            set</font> { _orderDate = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>int OrderID
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _orderID; }
<font color= "blue">            set</font> { _orderID = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>DateTime ShippedDate
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _shippedDate; }
<font color= "blue">            set</font> { _shippedDate = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>int ProductID
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _productID; }
<font color= "blue">            set</font> { _productID = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>string ProductName
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _productName; }
<font color= "blue">            set</font> { _productName = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>decimal UnitPrice
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _unitPrice; }
<font color= "blue">            set</font> { _unitPrice = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>int Quantity
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _quantity; }
<font color= "blue">            set</font> { _quantity = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "green">        //*********************************************************************</font>
<font color= "green">        //</font>
<font color= "green">        // GetCustomers method</font>
<font color= "green">        //</font>
<font color= "green">        // The GetCustomers method retrieves all customers in the Reports database </font>
<font color= "green">        //</font>
<font color= "green">        //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        public </font>static DrillDownReportCollection GetCustomers()
<font color= "blue">        </font>{
<font color= "blue">            </font>DataSet dsData = SqlHelper.ExecuteDataset(
<font color= "blue">                </font>ConfigurationSettings.AppSettings[Global.CfgKeyConnString], "Reports_GetAllCustomers");
<font color= "blue">            </font>DrillDownReportCollection items = new DrillDownReportCollection();
<font color= "blue"></font>
<font color= "blue">            </font>foreach(DataRow row in dsData.Tables[0].Rows)
<font color= "blue">            </font>{
<font color= "blue">                </font>DrillDownReport item = new DrillDownReport();
<font color= "blue">                </font>item.CustomerID = row["CustomerID"].ToString();
<font color= "blue">                </font>item.CompanyName = row["CompanyName"].ToString();
<font color= "blue">                </font>item.ContactName = row["ContactName"].ToString();
<font color= "blue">                </font>items.Add(item);
<font color= "blue">            </font>}
<font color= "blue"></font>
<font color= "blue">            return</font> items;
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "green">        //*********************************************************************</font>
<font color= "green">        //</font>
<font color= "green">        // GetOrders method</font>
<font color= "green">        //</font>
<font color= "green">        // The GetOrders method retrieves all orders shipped for a particular customer.</font>
<font color= "green">        //</font>
<font color= "green">        //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        public </font>static DrillDownReportCollection GetOrders(string customerID)
<font color= "blue">        </font>{
<font color= "blue">            </font>DataSet dsData = SqlHelper.ExecuteDataset(
<font color= "blue">                </font>ConfigurationSettings.AppSettings[Global.CfgKeyConnString], "Reports_GetOrders", customerID);
<font color= "blue">            </font>DrillDownReportCollection items = new DrillDownReportCollection();
<font color= "blue"></font>
<font color= "blue">            </font>foreach(DataRow row in dsData.Tables[0].Rows)
<font color= "blue">            </font>{
<font color= "blue">                </font>DrillDownReport item = new DrillDownReport();
<font color= "blue">                </font>item.OrderID = Convert.ToInt32(row["OrderID"]);
<font color= "blue">                </font>item.OrderDate = Convert.ToDateTime(row["OrderDate"]);
<font color= "blue">                </font>item.ShippedDate = Convert.ToDateTime(row["ShippedDate"]);
<font color= "blue">                </font>item.ShipAddress = row["ShipAddress"].ToString();
<font color= "blue">                </font>item.ShipCity = row["ShipCity"].ToString();
<font color= "blue">                </font>item.ShipCountry = row["ShipCountry"].ToString();
<font color= "blue">                </font>item.ShipPostalCode = row["ShipPostalCode"].ToString();
<font color= "blue">                </font>items.Add(item);
<font color= "blue">            </font>}
<font color= "blue"></font>
<font color= "blue">            return</font> items;
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "green">        //*********************************************************************</font>
<font color= "green">        //</font>
<font color= "green">        // GetOrderDetails method</font>
<font color= "green">        //</font>
<font color= "green">        // The GetOrderDetails method retrieves the order info for order with orderID.</font>
<font color= "green">        //</font>
<font color= "green">        //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        public </font>static DrillDownReportCollection GetOrderDetails(int orderID)
<font color= "blue">        </font>{
<font color= "blue"></font>
<font color= "blue">            </font>DataSet dsData = SqlHelper.ExecuteDataset(
<font color= "blue">                </font>ConfigurationSettings.AppSettings[Global.CfgKeyConnString], "Reports_GetOrderDetails", orderID);
<font color= "blue">            </font>DrillDownReportCollection items = new DrillDownReportCollection();
<font color= "blue"></font>
<font color= "blue">            </font>foreach(DataRow row in dsData.Tables[0].Rows)
<font color= "blue">            </font>{
<font color= "blue">                </font>DrillDownReport item = new DrillDownReport();
<font color= "blue">                </font>item.ProductID = Convert.ToInt32(row["ProductID"]);
<font color= "blue">                </font>item.ProductName = row["ProductName"].ToString();
<font color= "blue">                </font>item.UnitPrice = Convert.ToDecimal(row["UnitPrice"]);
<font color= "blue">                </font>item.Quantity = Convert.ToInt32(row["Quantity"]);
<font color= "blue">                </font>items.Add(item);
<font color= "blue">            </font>}
<font color= "blue"></font>
<font color= "blue">            return</font> items;
<font color= "blue">        </font>}
<font color= "blue">    </font>}
<font color= "blue"></font>}
</pre>

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