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

Race to Linux - Race 3: Reports Starter Kit using Mono SqlServer/Firebird

Rate me:
Please Sign up or sign in to vote.
2.33/5 (2 votes)
30 Sep 20052 min read 53K   328   15  
Reports Starter Kit port to Linux using Mono
<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= "green">    //*********************************************************************</font>
<font color= "green">    //</font>
<font color= "green">    // VisualReport Class</font>
<font color= "green">    //</font>
<font color= "green">    // The VisualReport class is used to represent a data item for Visual</font>
<font color= "green">    // Report.</font>
<font color= "green">    //</font>
<font color= "green">    //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">    public class</font> VisualReport
<font color= "blue">    </font>{
<font color= "blue">        private </font>string    _categoryName;
<font color= "blue">        private </font>decimal _sales;
<font color= "blue"></font>
<font color= "blue">        public </font>string CategoryName
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _categoryName; }
<font color= "blue">            set</font> { _categoryName = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "blue">        public </font>decimal Sales
<font color= "blue">        </font>{
<font color= "blue">            get</font> { return _sales; }
<font color= "blue">            set</font> { _sales = value; }
<font color= "blue">        </font>}
<font color= "blue"></font>
<font color= "green">        //*********************************************************************</font>
<font color= "green">        //</font>
<font color= "green">        // GetCategorySales method retrieves the total of all category sales</font>
<font color= "green">        // from the database and transforms the result to a VisualReportCollection</font>
<font color= "green">        // custom colletion before returning it to the calling function</font>
<font color= "green">        //</font>
<font color= "green">        //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        public </font>static VisualReportCollection GetCategorySales()
<font color= "blue">        </font>{
<font color= "blue">            </font>DataSet dsData = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings[Global.CfgKeyConnString], "Reports_GetCategorySales");
<font color= "blue">            </font>VisualReportCollection items = new VisualReportCollection();
<font color= "blue"></font>
<font color= "blue">            </font>foreach(DataRow row in dsData.Tables[0].Rows)
<font color= "blue">            </font>{
<font color= "blue">                </font>VisualReport item = new VisualReport();
<font color= "blue">                </font>item.CategoryName = row["CategoryName"].ToString();
<font color= "blue">                </font>item.Sales = Convert.ToDecimal(row["Sales"]);
<font color= "blue">                </font>items.Add(item);
<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
Uruguay Uruguay
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions