Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.IO
Imports System.IO.Compression
Imports System.Linq
Imports System.Reflection
Imports System.Text
Imports DevExpress.Utils
Imports DevExpress.Xpf.DemoBase
Namespace ReportWpfDemo
Public Class DataSources
Private Shared carsDB_Renamed As DataSet
Private Shared countriesDB_Renamed As DataSet
Private Shared fishes_Renamed As DevExpress.Demos.DataSources.Fishes
Public Shared ReadOnly Property CarsDB() As DataSet
Get
If carsDB_Renamed Is Nothing Then
carsDB_Renamed = New DataSet()
carsDB_Renamed.ReadXml(GetDataStream("cars_db.xml"))
End If
Return carsDB_Renamed
End Get
End Property
Public Shared ReadOnly Property CountriesDB() As DataSet
Get
If countriesDB_Renamed Is Nothing Then
countriesDB_Renamed = New DataSet()
countriesDB_Renamed.ReadXml(GetDataStream("countries_db.xml"))
End If
Return countriesDB_Renamed
End Get
End Property
Public Shared ReadOnly Property Nwind() As DataSet
Get
Return NWindData.DataSet
End Get
End Property
Public Shared ReadOnly Property Fishes() As DevExpress.Demos.DataSources.Fishes
Get
If fishes_Renamed Is Nothing Then
Dim stream As Stream = AssemblyHelper.GetResourceStream(GetType(DataSources).Assembly, "Data/biolife.txt", True)
fishes_Renamed = New DevExpress.Demos.DataSources.Fishes(stream)
End If
Return fishes_Renamed
End Get
End Property
Private Shared Function GetDataStream(ByVal fileName As String) As Stream
Return AssemblyHelper.GetEmbeddedResourceStream(GetType(DataSources).Assembly, fileName, True)
End Function
End Class
Public Class DataFiller
Implements XtraReportsDemos.TableReport.ITableReportDataFiller, XtraReportsDemos.CustomDraw.ICustomControlReportDataFiller, XtraReportsDemos.DrillDownReport.IDrillDownReportDataFiller
Private Function GetValidColumnName(ByVal columnName As String, ByVal table As DataTable) As String
If String.IsNullOrEmpty(columnName) Then
Return String.Empty
End If
If table.Columns.Contains(columnName) Then
Return columnName
End If
Dim words() As String = columnName.Split("_"c)
If words Is Nothing OrElse words.Length = 0 Then
Return String.Empty
End If
Dim name As String = DevExpress.XtraPrinting.StringUtils.Join(" ", words)
If table.Columns.Contains(name) Then
Return name
End If
Return String.Empty
End Function
Private Sub LINQToDataTable(Of T)(ByVal query As IEnumerable(Of T), ByVal table As DataTable)
If query Is Nothing Then
Return
End If
Dim properties() As PropertyInfo = Nothing
For Each item As T In query
If properties Is Nothing Then
properties = (CType(item.GetType(), Type)).GetProperties()
End If
Dim row As DataRow = table.NewRow()
For Each [property] As PropertyInfo In properties
Dim columnName As String = GetValidColumnName([property].Name, table)
System.Diagnostics.Debug.Assert((Not String.IsNullOrEmpty(columnName)))
row(columnName) = If([property].GetValue(item, Nothing) Is Nothing, DBNull.Value, [property].GetValue(item, Nothing))
Next [property]
table.Rows.Add(row)
Next item
End Sub
Private Sub PopulateOddEvenDataTable(ByVal table As DataTable)
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim categories = _
From category In categoriesQuery _
Join products In productsQuery On category.Field(Of Integer)("CategoryID") Equals products.Field(Of Integer)("CategoryID") _
Select New With {Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = category.Field(Of Integer)("CategoryID"), Key .ProductName = products.Field(Of String)("ProductName"), Key .QuantityPerUnit = products.Field(Of String)("QuantityPerUnit"), Key .UnitPrice = products.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(categories, table)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.MasterDetailReport.Report)
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim products = _
From product In productsQuery _
Join category In categoriesQuery On product.Field(Of Integer)("CategoryID") Equals category.Field(Of Integer)("CategoryID") _
Select New With {Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = product.Field(Of Integer)("CategoryID"), Key .Discontinued = product.Field(Of Boolean)("Discontinued"), Key .ProductID = product.Field(Of Integer)("ProductID"), Key .ProductName = product.Field(Of String)("ProductName"), Key .QuantityPerUnit = product.Field(Of String)("QuantityPerUnit"), Key .SupplierID = product.Field(Of Integer)("SupplierID"), Key .UnitPrice = product.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(products, report.dsMasterDetail1.Products)
report.dsMasterDetail1.Suppliers.Merge(DataSources.Nwind.Tables("Suppliers"))
Dim orderDetailsQuery = DataSources.Nwind.Tables("Order Details").AsEnumerable()
Dim orderDetails = _
From orderDetail In orderDetailsQuery _
Select New With {Key .Discount = orderDetail.Field(Of Single)("Discount"), Key .OrderID = orderDetail.Field(Of Integer)("OrderID"), Key .ProductID = orderDetail.Field(Of Integer)("ProductID"), Key .Quantity = orderDetail.Field(Of Int16)("Quantity"), Key .UnitPrice = orderDetail.Field(Of Decimal)("UnitPrice"), Key .SubTotal = CDec(orderDetail.Field(Of Int16)("Quantity") * orderDetail.Field(Of Decimal)("UnitPrice"))}
LINQToDataTable(orderDetails, report.dsMasterDetail1.Order_Details)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.Charts.Report)
report.dsCategoriesProducts1.Products.Merge(DataSources.Nwind.Tables("Products"))
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim categories = _
From category In categoriesQuery _
Select New With {Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = category.Field(Of Integer)("CategoryID"), Key .Description = category.Field(Of String)("Description"), Key .Picture = category.Field(Of Byte())("Picture")}
LINQToDataTable(categories, report.dsCategoriesProducts1.Categories)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.ReportMerging.MergedReport)
report.FillDataFromDatabase = False
Fill(report.ChartsReport)
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim products = _
From product In productsQuery _
Join category In categoriesQuery On product.Field(Of Integer)("CategoryID") Equals category.Field(Of Integer)("CategoryID") _
Select New With {Key .ProductID = product.Field(Of Integer)("ProductID"), Key .ProductName = product.Field(Of String)("ProductName"), Key .QuantityPerUnit = product.Field(Of String)("QuantityPerUnit"), Key .UnitPrice = product.Field(Of Decimal)("UnitPrice"), Key .Description = category.Field(Of String)("Description"), Key .Picture = category.Field(Of Byte())("Picture"), Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = product.Field(Of Integer)("CategoryID")}
LINQToDataTable(products, report.dsCatalog1.Products)
Dim orderDetailsQuery = DataSources.Nwind.Tables("Order Details").AsEnumerable()
Dim orderDetails = _
From orderDetail In orderDetailsQuery _
Select New With {Key .Discount = orderDetail.Field(Of Single)("Discount"), Key .OrderID = orderDetail.Field(Of Integer)("OrderID"), Key .ProductID = orderDetail.Field(Of Integer)("ProductID"), Key .Quantity = orderDetail.Field(Of Int16)("Quantity"), Key .UnitPrice = orderDetail.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(orderDetails, report.dsCatalog1.Order_Details)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.SideBySideReports.EmployeeComparisonReport)
Dim employeesQuery = DataSources.Nwind.Tables("Employees").AsEnumerable()
Dim customersQuery = DataSources.Nwind.Tables("Customers").AsEnumerable()
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim ordersQuery = DataSources.Nwind.Tables("Orders").AsEnumerable()
Dim orderDetailsQuery = DataSources.Nwind.Tables("Order Details").AsEnumerable()
Dim employees = _
From employee In employeesQuery _
Select New With {Key .EmployeeID = employee.Field(Of Integer)("EmployeeID"), Key .FullName = String.Concat(employee.Field(Of String)("FirstName"), " "c, employee.Field(Of String)("LastName")), Key .BirthDate = employee.Field(Of DateTime)("BirthDate"), Key .HireDate = employee.Field(Of DateTime)("HireDate"), Key .Photo = employee.Field(Of Byte())("Photo")}
Dim employeeOrders = _
From customer In customersQuery _
Join order In ordersQuery On customer.Field(Of String)("CustomerID") Equals order.Field(Of String)("CustomerID") _
Join employee In employeesQuery On order.Field(Of Integer)("EmployeeID") Equals employee.Field(Of Integer)("EmployeeID") _
Join orderDetail In orderDetailsQuery On order.Field(Of Integer)("OrderID") Equals orderDetail.Field(Of Integer)("OrderID") _
Join product In productsQuery On orderDetail.Field(Of Integer)("ProductID") Equals product.Field(Of Integer)("ProductID") _
Select New With {Key .OrderID = order.Field(Of Integer)("OrderID"), Key .EmployeeID = employee.Field(Of Integer)("EmployeeID"), Key .ContactName = customer.Field(Of String)("ContactName"), Key .CompanyName = customer.Field(Of String)("CompanyName"), Key .ExtendedPrice = CDec(CDbl(orderDetail.Field(Of Decimal)("UnitPrice")) * orderDetail.Field(Of Short)("Quantity") * (1 - orderDetail.Field(Of Single)("Discount") / 100.0))}
LINQToDataTable(employees, (CType(report.xrSubreport1.ReportSource, XtraReportsDemos.SideBySideReports.EmployeeOrdersReport)).dsEmployees1.Employees)
LINQToDataTable(employees, (CType(report.xrSubreport2.ReportSource, XtraReportsDemos.SideBySideReports.EmployeeOrdersReport)).dsEmployees1.Employees)
LINQToDataTable(employeeOrders, (CType(report.xrSubreport1.ReportSource, XtraReportsDemos.SideBySideReports.EmployeeOrdersReport)).dsEmployees1.EmployeeOrders)
LINQToDataTable(employeeOrders, (CType(report.xrSubreport2.ReportSource, XtraReportsDemos.SideBySideReports.EmployeeOrdersReport)).dsEmployees1.EmployeeOrders)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.PivotGrid.Report)
report.dsOrderReports1.OrderReports.Merge(DataSources.Nwind.Tables("OrderReports"))
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.TableReport.Report)
Dim orderDetailsQuery = DataSources.Nwind.Tables("OrderDetails").AsEnumerable()
Dim orderDetails = _
From orderDetail In orderDetailsQuery _
Where orderDetail.Field(Of Integer)("OrderID") = report.OrderID _
Select New With {Key .Discount = orderDetail.Field(Of Single)("Discount"), Key .OrderID = orderDetail.Field(Of Integer)("OrderID"), Key .ProductName = orderDetail.Field(Of String)("ProductName"), Key .Quantity = orderDetail.Field(Of Int16)("Quantity"), Key .Supplier = orderDetail.Field(Of String)("Supplier"), Key .UnitPrice = orderDetail.Field(Of Decimal)("UnitPrice"), Key .SubTotal = CDec(orderDetail.Field(Of Int16)("Quantity") * orderDetail.Field(Of Decimal)("UnitPrice"))}
LINQToDataTable(orderDetails, report.dsOrderDetails1.OrderDetails)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.Subreports.MasterReport)
Dim customersQuery = DataSources.CarsDB.Tables("Customers").AsEnumerable()
Dim customers = _
From customer In customersQuery _
Select New With {Key .ID = customer.Field(Of Integer)("ID"), Key .PersonName = customer.Field(Of String)("FirstName") & " " & customer.Field(Of String)("LastName"), Key .Occupation = customer.Field(Of String)("Occupation"), Key .Company = customer.Field(Of String)("Company")}
LINQToDataTable(customers, report.dsCust1.Customers)
Dim ordersQuery = DataSources.CarsDB.Tables("Orders").AsEnumerable()
Dim orders = _
From order In ordersQuery _
Select New With {Key .CustomerID = order.Field(Of Integer)("CustomerID"), Key .ID = order.Field(Of Integer)("ID"), Key .PaymentAmount = order.Field(Of Decimal)("PaymentAmount"), Key .PaymentType = order.Field(Of String)("PaymentType"), Key .PurchaseDate = order.Field(Of DateTime)("PurchaseDate"), Key .Time = order.Field(Of DateTime)("Time")}
LINQToDataTable(orders, report.detailReport1.dsOrders1.Orders)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.MultiColumnReport.Report)
report.dsCustomers1.Customers.Merge(DataSources.Nwind.Tables("Customers"))
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.BarCodes.ProductLabelsReport)
report.dsProducts1.Products.Merge(DataSources.Nwind.Tables("Products"))
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.NorthwindTraders.ProductListReport)
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim productsList = _
From category In categoriesQuery _
Join product In productsQuery On category.Field(Of Integer)("CategoryID") Equals product.Field(Of Integer)("CategoryID") _
Select New With {Key .ProductName = product.Field(Of String)("ProductName"), Key .QuantityPerUnit = product.Field(Of String)("QuantityPerUnit"), Key .UnitsInStock = product.Field(Of Int16)("UnitsInStock"), Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = category.Field(Of Integer)("CategoryID"), Key .ProductID = product.Field(Of Integer)("ProductID")}
LINQToDataTable(productsList, report.dsProductList1.Products)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.NorthwindTraders.CatalogReport)
report.FillDataFromDatabase = False
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim products = _
From product In productsQuery _
Join category In categoriesQuery On product.Field(Of Integer)("CategoryID") Equals category.Field(Of Integer)("CategoryID") _
Select New With {Key .ProductID = product.Field(Of Integer)("ProductID"), Key .ProductName = product.Field(Of String)("ProductName"), Key .QuantityPerUnit = product.Field(Of String)("QuantityPerUnit"), Key .UnitPrice = product.Field(Of Decimal)("UnitPrice"), Key .Description = category.Field(Of String)("Description"), Key .Picture = category.Field(Of Byte())("Picture"), Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = product.Field(Of Integer)("CategoryID")}
LINQToDataTable(products, report.dsCatalog1.Products)
Dim orderDetailsQuery = DataSources.Nwind.Tables("Order Details").AsEnumerable()
Dim orderDetails = _
From orderDetail In orderDetailsQuery _
Select New With {Key .Discount = orderDetail.Field(Of Single)("Discount"), Key .OrderID = orderDetail.Field(Of Integer)("OrderID"), Key .ProductID = orderDetail.Field(Of Integer)("ProductID"), Key .Quantity = orderDetail.Field(Of Int16)("Quantity"), Key .UnitPrice = orderDetail.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(orderDetails, report.dsCatalog1.Order_Details)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.NorthwindTraders.InvoiceReport)
Dim invoicesQuery = DataSources.Nwind.Tables("Invoices").AsEnumerable()
Dim invoices = _
From invoice In invoicesQuery _
Where invoice.Field(Of Integer)("OrderID") < 10261 _
Select New With {Key .Address = invoice.Field(Of String)("Address"), Key .City = invoice.Field(Of String)("City"), Key .Country = invoice.Field(Of String)("Country"), Key .CustomerID = invoice.Field(Of String)("CustomerID"), Key .CustomersCompanyName = invoice.Field(Of String)("Customers.CompanyName"), Key .Discount = invoice.Field(Of Single)("Discount"), Key .ExtendedPrice = invoice.Field(Of Decimal)("ExtendedPrice"), Key .Freight = invoice.Field(Of Decimal)("Freight"), Key .OrderDate = invoice.Field(Of DateTime)("OrderDate"), Key .OrderID = invoice.Field(Of Integer)("OrderID"), Key .PostalCode = invoice.Field(Of String)("PostalCode"), Key .ProductID = invoice.Field(Of Integer)("ProductID"), Key .ProductName = invoice.Field(Of String)("ProductName"), Key .Quantity = invoice.Field(Of Int16)("Quantity"), Key .Region = invoice.Field(Of String)("Region"), Key .RequiredDate = invoice.Field(Of DateTime)("RequiredDate"), Key .Salesperson = invoice.Field(Of String)("Salesperson"), Key .ShipAddress = invoice.Field(Of String)("ShipAddress"), Key .ShipCity = invoice.Field(Of String)("ShipCity"), Key .ShipCountry = invoice.Field(Of String)("ShipCountry"), Key .ShipName = invoice.Field(Of String)("ShipName"), Key .ShippedDate = invoice.Field(Of DateTime)("ShippedDate"), Key .ShippersCompanyName = invoice.Field(Of String)("Shippers.CompanyName"), Key .ShipPostalCode = invoice.Field(Of String)("ShipPostalCode"), Key .ShipRegion = invoice.Field(Of String)("ShipRegion"), Key .UnitPrice = invoice.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(invoices, report.dsInvoice1.Invoices)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.ShrinkGrow.Report)
report.dsEmployees1.Merge(DataSources.Nwind.Tables("Employees"))
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.AnchorVertical.Report)
Dim carsQuery = DataSources.CarsDB.Tables("Cars").AsEnumerable()
Dim cars = _
From car In carsQuery _
Where car.Field(Of String)("RtfContent") IsNot Nothing _
Select car
report.dsCars1.Cars.Merge(cars.CopyToDataTable())
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.IListDatasource.Report)
report.DataSource = DataSources.Fishes
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.CalculatedFieldsReport.Report)
report.dsOrderReports1.OrderReports.Merge(DataSources.Nwind.Tables("OrderReports"))
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.MailMerge.Report)
Dim employeesQuery = DataSources.Nwind.Tables("Employees").AsEnumerable()
Dim employees = _
From e1 In employeesQuery _
Group Join e2 In employeesQuery On e1.Field(Of Integer?)("ReportsTo") Equals e2.Field(Of Integer)("EmployeeID") Into temp = Group _
From e In temp.DefaultIfEmpty() _
Select New With {Key .Address = e1.Field(Of String)("Address"), Key .BirthDate = e1.Field(Of DateTime)("BirthDate"), Key .City = e1.Field(Of String)("City"), Key .Country = e1.Field(Of String)("Country"), Key .EmployeeID = e1.Field(Of Integer)("EmployeeID"), Key .Extension = e1.Field(Of String)("Extension"), Key .FirstName = e1.Field(Of String)("FirstName"), Key .HireDate = e1.Field(Of DateTime)("HireDate"), Key .HomePhone = e1.Field(Of String)("HomePhone"), Key .LastName = e1.Field(Of String)("LastName"), Key .Notes = e1.Field(Of String)("Notes"), Key .Photo = e1.Field(Of Byte())("Photo"), Key .PostalCode = e1.Field(Of String)("PostalCode"), Key .Region = e1.Field(Of String)("Region"), Key .ReportsTo = e1.Field(Of Integer?)("ReportsTo"), Key .Title = e1.Field(Of String)("Title"), Key .TitleOfCourtesy = e1.Field(Of String)("TitleOfCourtesy"), Key .ReportsToInfo = If(e Is Nothing, String.Empty, e.Field(Of String)("FirstName") & " " & e.Field(Of String)("LastName"))}
LINQToDataTable(employees, report.dsEmployees1.Employees)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.FormattingRules.Report)
Dim orderDetailsQuery = DataSources.Nwind.Tables("Order Details").AsEnumerable()
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim ordersQuery = DataSources.Nwind.Tables("Orders").AsEnumerable()
Dim orders = _
From product In productsQuery _
Join orderDetail In orderDetailsQuery On product.Field(Of Integer)("ProductID") Equals orderDetail.Field(Of Integer)("ProductID") _
Join order In ordersQuery On orderDetail.Field(Of Integer)("OrderID") Equals order.Field(Of Integer)("OrderID") _
Select New With {Key .OrderID = orderDetail.Field(Of Integer)("OrderID"), Key .ProductID = orderDetail.Field(Of Integer)("ProductID"), Key .ProductName = product.Field(Of String)("ProductName"), Key .UnitPrice = orderDetail.Field(Of Decimal)("UnitPrice"), Key .Quantity = orderDetail.Field(Of Int16)("Quantity"), Key .Discount = orderDetail.Field(Of Single)("Discount"), Key .Extended_Price = CDec(CDbl(orderDetail.Field(Of Decimal)("UnitPrice")) * orderDetail.Field(Of Int16)("Quantity") * (1 - orderDetail.Field(Of Single)("Discount") / 100.0)), Key .OrderDate = order.Field(Of DateTime)("OrderDate")}
LINQToDataTable(orders, report.formattingRulesDataSet1.Orders)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.CrossBandControls.Report)
PopulateOddEvenDataTable(report.dsOddEvenStyles1.Products)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.OddEvenStyles.Report)
PopulateOddEvenDataTable(report.dsOddEvenStyles1.Products)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.RichText.Report)
Dim carsQuery = DataSources.CarsDB.Tables("Cars").AsEnumerable()
Dim cars = _
From car In carsQuery _
Where (Not String.IsNullOrEmpty(car.Field(Of String)("RtfContent"))) _
Select New With {Key .Category = car.Field(Of String)("Category"), Key .Cyl = car.Field(Of Byte)("Cyl"), Key .Description = car.Field(Of String)("Description"), Key .HP = car.Field(Of Short)("HP"), Key .Hyperlink = car.Field(Of String)("Hyperlink"), Key .ID = car.Field(Of Integer)("ID"), Key .Liter = car.Field(Of Double)("Liter"), Key .Model = car.Field(Of String)("Model"), Key .MPG_City = car.Field(Of Byte)("MPG_City"), Key .MPG_Highway = car.Field(Of Byte)("MPG_Highway"), Key .Picture = car.Field(Of Byte())("Picture"), Key .Price = car.Field(Of Decimal)("Price"), Key .RtfContent = car.Field(Of String)("RtfContent"), Key .Trademark = car.Field(Of String)("Trademark"), Key .TransmissAutomatic = car.Field(Of String)("TransmissAutomatic"), Key .TransmissSpeedCount = car.Field(Of Byte)("TransmissSpeedCount")}
LINQToDataTable(cars, report.dsCars1.Cars)
End Sub
Public Sub Fill(ByVal report As XtraReportsDemos.CustomDraw.Report)
Dim aboutRegionsQuery = DataSources.CountriesDB.Tables("AboutRegions").AsEnumerable()
Dim aboutRegions = _
From aboutRegion In aboutRegionsQuery _
Where aboutRegion.Field(Of Integer)("Id") = report.RegionID _
Select New With {Key .Country = aboutRegion.Field(Of String)("Country"), Key .Id = aboutRegion.Field(Of Integer)("Id"), Key .Region = aboutRegion.Field(Of String)("Region"), Key .PopulationPortion = aboutRegion.Field(Of Double)("PopulationPortion")}
LINQToDataTable(aboutRegions, report.dsAboutCountries.AboutRegions)
End Sub
Private Sub IDrillDownReportDataFiller_Fill(ByVal report As XtraReportsDemos.DrillDownReport.DrillDownReport) Implements XtraReportsDemos.DrillDownReport.IDrillDownReportDataFiller.Fill
Dim productsQuery = DataSources.Nwind.Tables("Products").AsEnumerable()
Dim categoriesQuery = DataSources.Nwind.Tables("Categories").AsEnumerable()
Dim categories = _
From category In categoriesQuery _
Select New With {Key .CategoryName = category.Field(Of String)("CategoryName"), Key .CategoryID = category.Field(Of Integer)("CategoryID"), Key .Description = category.Field(Of String)("Description"), Key .Picture = category.Field(Of Byte())("Picture")}
Dim products = _
From category In categoriesQuery _
Join product In productsQuery On category.Field(Of Integer)("CategoryID") Equals product.Field(Of Integer)("CategoryID") _
Select New With {Key .CategoryID = category.Field(Of Integer)("CategoryID"), Key .ProductName = product.Field(Of String)("ProductName"), Key .QuantityPerUnit = product.Field(Of String)("QuantityPerUnit"), Key .UnitPrice = product.Field(Of Decimal)("UnitPrice")}
LINQToDataTable(categories, report.dsCategoriesProducts1.Categories)
LINQToDataTable(products, report.dsCategoriesProducts1.Products)
End Sub
#Region "ITableReportDataFiller Members"
Private Sub ITableReportDataFiller_Fill(ByVal report As XtraReportsDemos.TableReport.Report) Implements XtraReportsDemos.TableReport.ITableReportDataFiller.Fill
Fill(report)
End Sub
#End Region
#Region "ICustomControlReportDataFiller Members"
Private Sub ICustomControlReportDataFiller_Fill(ByVal report As XtraReportsDemos.CustomDraw.Report) Implements XtraReportsDemos.CustomDraw.ICustomControlReportDataFiller.Fill
Fill(report)
End Sub
#End Region
End Class
End Namespace