'
' Copyright (c) 2016, MindFusion LLC - Bulgaria.
'


Partial Public Class SimpleReport
    Inherits Report

    Public Sub New()

        InitializeComponent()

    End Sub

    Public Overloads Overrides Sub Run()
        ProductsTableAdapter1.Fill(NwindDataSet1.Products)
        ProductsTableAdapter1.Fill(NwindDataSet2.Products)
        CategoriesTableAdapter1.FillBy(NwindDataSet1.Categories, GetParameterByName("FirstCategory"))
        CategoriesTableAdapter2.FillBy(NwindDataSet2.Categories, GetParameterByName("SecondCategory"))

        MyBase.Run()
    End Sub

    Private Function GetParameterByName(name As String) As Integer
        For Each param As ReportParameter In Parameters
            If param.Name = name Then
                Return CInt(param.Value)
            End If
        Next

        Return 0
    End Function

End Class
