Click here to Skip to main content
15,896,606 members
Articles / Containers / Virtual Machine

ASP.NET Report Kit Grasshoper (Race to Linux)

Rate me:
Please Sign up or sign in to vote.
2.38/5 (5 votes)
2 Oct 20057 min read 38K   397   19  
Porting and deploying the report starter kit to Linux (RH7.3/Tomcat5.0.28/Grasshoper1.61)
<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">Imports</font> System
<font color= "blue">Imports</font> System.Data
<font color= "blue">Imports</font> System.Configuration
<font color= "blue">Imports</font> ASPNET.StarterKit.Reports.DataAccessLayer
<font color= "blue">Imports</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">    ' TabularReport Class</font>
<font color= "green">    '</font>
<font color= "green">    ' The TabularReport class is used to represent a data item for Tabular </font>
<font color= "green">    ' Report and is mainly used to retrieve data from the database.</font>
<font color= "green">    '</font>
<font color= "green">    '*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">    Public Class</font> TabularReport
<font color= "blue">        Private </font>_categoryID <font color= "blue">As </font>Integer
<font color= "blue">        Private </font>_categoryName <font color= "blue">As </font>String
<font color= "blue">        Private </font>_productName <font color= "blue">As </font>String
<font color= "blue">        Private </font>_quantityPerUnit <font color= "blue">As </font>String
<font color= "blue">        Private </font>_totalInStock <font color= "blue">As </font>Integer
<font color= "blue">        Private </font>_unitPrice <font color= "blue">As </font>Decimal
<font color= "blue">        Private </font>_unitsInStock <font color= "blue">As </font>Integer
<font color= "blue"></font>
<font color= "blue">        Public Property</font> CategoryID() As Integer
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_categoryID
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As Integer)
<font color= "blue">                </font>_categoryID <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> CategoryName() As String
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_categoryName
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As String)
<font color= "blue">                </font>_categoryName <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> ProductName() As String
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_productName
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As String)
<font color= "blue">                </font>_productName <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> QuantityPerUnit() As String
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_quantityPerUnit
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As String)
<font color= "blue">                </font>_quantityPerUnit <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> TotalInStock() As Integer
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_totalInStock
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As Integer)
<font color= "blue">                </font>_totalInStock <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> UnitPrice() As Decimal
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_unitPrice
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As Decimal)
<font color= "blue">                </font>_unitPrice <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "blue">        Public Property</font> UnitsInStock() As Integer
<font color= "blue">            Get</font>
<font color= "blue">                </font>Return <font color= "blue"></font>_unitsInStock
<font color= "blue">            End Get</font>
<font color= "blue">            </font>Set(ByVal Value As Integer)
<font color= "blue">                </font>_unitsInStock <font color= "blue"></font>= Value
<font color= "blue">            End Set</font>
<font color= "blue">        End Property</font>
<font color= "blue"></font>
<font color= "green">        '*********************************************************************</font>
<font color= "green">        '</font>
<font color= "green">        ' GetCategories method retrieves all available category names with total </font>
<font color= "green">        ' unit in stock information from the database and transforms the result </font>
<font color= "green">        ' to a TabularReportCollection custom colletion before returning it to </font>
<font color= "green">        ' the calling function</font>
<font color= "green">        '</font>
<font color= "green">        ' This method is called to get header information for the Tabular Report</font>
<font color= "green">        '</font>
<font color= "green">        '*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        Public Shared Function</font> GetCategories() As TabularReportCollection
<font color= "blue">            Dim </font>dsData <font color= "blue">As </font>DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "Reports_GetCategories")
<font color= "blue">            Dim </font>items <font color= "blue">As </font>New TabularReportCollection()
<font color= "blue"></font>
<font color= "blue">            Dim </font>row <font color= "blue">As </font>DataRow
<font color= "blue">            For Each</font> row In dsData.Tables(0).Rows
<font color= "blue">                Dim </font>item <font color= "blue">As </font>New TabularReport()
<font color= "blue">                </font>item.CategoryID = Convert.ToInt32(row("CategoryID"))
<font color= "blue">                </font>item.CategoryName = row("CategoryName").ToString()
<font color= "blue">                </font>item.TotalInStock = Convert.ToInt32(row("TotalInStock"))
<font color= "blue"></font>
<font color= "blue">                </font>items.Add(item)
<font color= "blue">            Next</font> row
<font color= "blue"></font>
<font color= "blue">            </font>Return <font color= "blue"></font>items
<font color= "blue"></font><font color= "blue">        End Function</font><font color= "blue"></font><font color= "green"> 'GetCategories</font>
<font color= "blue"></font>
<font color= "green">        '*********************************************************************</font>
<font color= "green">        '</font>
<font color= "green">        ' GetProducts method retrieves all product details for the specified  </font>
<font color= "green">        ' category from the database and transforms the result </font>
<font color= "green">        ' to a TabularReportCollection custom colletion before returning it to </font>
<font color= "green">        ' the calling function</font>
<font color= "green">        '</font>
<font color= "green">        ' This method is used to get detail information for each category in </font>
<font color= "green">        ' Tabular Report</font>
<font color= "green">        '</font>
<font color= "green">        '*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue">        Public Shared Function</font> GetProducts(ByVal categoryID As Integer) As TabularReportCollection
<font color= "blue">            Dim </font>dsData <font color= "blue">As </font>DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "Reports_GetProductsByCategory", categoryID)
<font color= "blue">            Dim </font>items <font color= "blue">As </font>New TabularReportCollection()
<font color= "blue"></font>
<font color= "blue">            Dim </font>row <font color= "blue">As </font>DataRow
<font color= "blue">            For Each</font> row In dsData.Tables(0).Rows
<font color= "blue">                Dim </font>item <font color= "blue">As </font>New TabularReport()
<font color= "blue">                </font>item.CategoryID = Convert.ToInt32(row("CategoryID"))
<font color= "blue">                </font>item.ProductName = row("ProductName").ToString()
<font color= "blue">                </font>item.QuantityPerUnit = row("QuantityPerUnit").ToString()
<font color= "blue">                </font>item.UnitsInStock = Convert.ToInt32(row("UnitsInStock"))
<font color= "blue">                </font>item.UnitPrice = Convert.ToDecimal(row("UnitPrice"))
<font color= "blue"></font>
<font color= "blue">                </font>items.Add(item)
<font color= "blue">            Next</font> row
<font color= "blue">            </font>Return <font color= "blue"></font>items
<font color= "blue"></font><font color= "blue">        End Function</font><font color= "blue"></font><font color= "green"> 'GetProducts</font>
<font color= "blue"></font><font color= "blue">    End Class</font><font color= "blue"></font><font color= "green"> 'TabularReport</font>
<font color= "blue"></font><font color= "blue">End Namespace</font><font color= "blue"></font><font color= "green"> 'ASPNET.StarterKit.Reports.Components</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
Software Developer (Senior)
United States United States
I love to code! Working in C# is my passion, visit my github

Comments and Discussions