Click here to Skip to main content
15,892,298 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   19  
Porting and deploying the report starter kit to Linux (RH7.3/Tomcat5.0.28/Grasshoper1.61)
Imports System
Imports System.Data
Imports System.Configuration
Imports ASPNET.StarterKit.Reports.DataAccessLayer
Imports System.Collections

Namespace ASPNET.StarterKit.Reports.Components

    Public Class DrillDownReport
        Private _customerID As String
        Private _companyName As String
        Private _contactName As String
        Private _shipAddress As String
        Private _shipCity As String
        Private _shipCountry As String
        Private _shipPostalCode As String
        Private _orderDate As DateTime
        Private _orderID As Integer
        Private _shippedDate As DateTime
        Private _productID As Integer
        Private _productName As String
        Private _unitPrice As Decimal
        Private _quantity As Integer

        Public Property CustomerID() As String
            Get
                Return _customerID
            End Get
            Set(ByVal Value As String)
                _customerID = Value
            End Set
        End Property

        Public Property CompanyName() As String
            Get
                Return _companyName
            End Get
            Set(ByVal Value As String)
                _companyName = Value
            End Set
        End Property

        Public Property ContactName() As String
            Get
                Return _contactName
            End Get
            Set(ByVal Value As String)
                _contactName = Value
            End Set
        End Property

        Public Property ShipAddress() As String
            Get
                Return _shipAddress
            End Get
            Set(ByVal Value As String)
                _shipAddress = Value
            End Set
        End Property

        Public Property ShipCity() As String
            Get
                Return _shipCity
            End Get
            Set(ByVal Value As String)
                _shipCity = Value
            End Set
        End Property

        Public Property ShipCountry() As String
            Get
                Return _shipCountry
            End Get
            Set(ByVal Value As String)
                _shipCountry = Value
            End Set
        End Property

        Public Property ShipPostalCode() As String
            Get
                Return _shipPostalCode
            End Get
            Set(ByVal Value As String)
                _shipPostalCode = Value
            End Set
        End Property

        Public Property OrderDate() As DateTime
            Get
                Return _orderDate
            End Get
            Set(ByVal Value As DateTime)
                _orderDate = Value
            End Set
        End Property

        Public Property OrderID() As Integer
            Get
                Return _orderID
            End Get
            Set(ByVal Value As Integer)
                _orderID = Value
            End Set
        End Property

        Public Property ShippedDate() As DateTime
            Get
                Return _shippedDate
            End Get
            Set(ByVal Value As DateTime)
                _shippedDate = Value
            End Set
        End Property

        Public Property ProductID() As Integer
            Get
                Return _productID
            End Get
            Set(ByVal Value As Integer)
                _productID = Value
            End Set
        End Property

        Public Property ProductName() As String
            Get
                Return _productName
            End Get
            Set(ByVal Value As String)
                _productName = Value
            End Set
        End Property

        Public Property UnitPrice() As Decimal
            Get
                Return _unitPrice
            End Get
            Set(ByVal Value As Decimal)
                _unitPrice = Value
            End Set
        End Property

        Public Property Quantity() As Integer
            Get
                Return _quantity
            End Get
            Set(ByVal Value As Integer)
                _quantity = Value
            End Set
        End Property

        '*********************************************************************
        '
        ' GetCustomers method
        '
        ' The GetCustomers method retrieves all customers in the Reports database 
        '
        '*********************************************************************

        Public Shared Function GetCustomers() As DrillDownReportCollection
            Dim dsData As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "Reports_GetAllCustomers")
            Dim items As New DrillDownReportCollection()

            Dim row As DataRow
            For Each row In dsData.Tables(0).Rows
                Dim item As New DrillDownReport()
                item.CustomerID = row("CustomerID").ToString()
                item.CompanyName = row("CompanyName").ToString()
                item.ContactName = row("ContactName").ToString()
                items.Add(item)
            Next row

            Return items
        End Function 'GetCustomers


        '*********************************************************************
        '
        ' GetOrders method
        '
        ' The GetOrders method retrieves all orders shipped for a particular customer.
        '
        '*********************************************************************

        Public Shared Function GetOrders(ByVal customerID As String) As DrillDownReportCollection
            Dim dsData As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "Reports_GetOrders", customerID)
            Dim items As New DrillDownReportCollection()

            Dim row As DataRow
            For Each row In dsData.Tables(0).Rows
                Dim item As New DrillDownReport()
                item.OrderID = Convert.ToInt32(row("OrderID"))
                item.OrderDate = Convert.ToDateTime(row("OrderDate"))
                item.ShippedDate = Convert.ToDateTime(row("ShippedDate"))
                item.ShipAddress = row("ShipAddress").ToString()
                item.ShipCity = row("ShipCity").ToString()
                item.ShipCountry = row("ShipCountry").ToString()
                item.ShipPostalCode = row("ShipPostalCode").ToString()
                items.Add(item)
            Next row

            Return items
        End Function 'GetOrders

        '*********************************************************************
        '
        ' GetOrderDetails method
        '
        ' The GetOrderDetails method retrieves the order info for order with orderID.
        '
        '*********************************************************************

        Public Shared Function GetOrderDetails(ByVal orderID As Integer) As DrillDownReportCollection

            Dim dsData As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "Reports_GetOrderDetails", orderID)
            Dim items As New DrillDownReportCollection()

            Dim row As DataRow
            For Each row In dsData.Tables(0).Rows
                Dim item As New DrillDownReport()
                item.ProductID = Convert.ToInt32(row("ProductID"))
                item.ProductName = row("ProductName").ToString()
                item.UnitPrice = Convert.ToDecimal(row("UnitPrice"))
                item.Quantity = Convert.ToInt32(row("Quantity"))
                items.Add(item)
            Next row

            Return items
        End Function 'GetOrderDetails
    End Class 'DrillDownReport
End Namespace 'ASPNET.StarterKit.Reports.Components

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