Me.tableOrders.Constraints.Add(New System.Data.ForeignKeyConstraint("CustomersOrders", New DataColumn() {Me.tableCustomers.CustomerIDColumn}, New DataColumn() {Me.tableOrders.CustomerIDColumn}))
Me.relationCustomersOrders = New DataRelation("CustomersOrders", New DataColumn() {Me.tableCustomers.CustomerIDColumn}, New DataColumn() {Me.tableOrders.CustomerIDColumn}, false)
Me.Relations.Add(Me.relationCustomersOrders)
End Sub
Private Function ShouldSerializeCustomers() As Boolean
Return false
End Function
Private Function ShouldSerializeOrders() As Boolean
Return false
End Function
Public Delegate Sub CustomersRowChangeEventHandler(ByVal sender As Object, ByVal e As CustomersRowChangeEvent)
Public Delegate Sub OrdersRowChangeEventHandler(ByVal sender As Object, ByVal e As OrdersRowChangeEvent)
Public Class CustomersDataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private columnCustomerID As DataColumn
Private columnCompanyName As DataColumn
Private columnContactName As DataColumn
Private columnContactTitle As DataColumn
Private columnAddress As DataColumn
Private columnCity As DataColumn
Private column_Region As DataColumn
Private columnPostalCode As DataColumn
Private columnCountry As DataColumn
Private columnPhone As DataColumn
Private columnFax As DataColumn
Friend Sub New()
MyBase.New("Customers")
Me.InitClass
End Sub
<System.ComponentModel.Browsable(false)> _
Public ReadOnly Property Count As Integer
Get
Return Me.Rows.Count
End Get
End Property
Friend ReadOnly Property CustomerIDColumn As DataColumn
Get
Return Me.columnCustomerID
End Get
End Property
Friend ReadOnly Property CompanyNameColumn As DataColumn
Get
Return Me.columnCompanyName
End Get
End Property
Friend ReadOnly Property ContactNameColumn As DataColumn
Get
Return Me.columnContactName
End Get
End Property
Friend ReadOnly Property ContactTitleColumn As DataColumn
Get
Return Me.columnContactTitle
End Get
End Property
Friend ReadOnly Property AddressColumn As DataColumn
Get
Return Me.columnAddress
End Get
End Property
Friend ReadOnly Property CityColumn As DataColumn
Get
Return Me.columnCity
End Get
End Property
Friend ReadOnly Property _RegionColumn As DataColumn
Get
Return Me.column_Region
End Get
End Property
Friend ReadOnly Property PostalCodeColumn As DataColumn
Get
Return Me.columnPostalCode
End Get
End Property
Friend ReadOnly Property CountryColumn As DataColumn
Get
Return Me.columnCountry
End Get
End Property
Friend ReadOnly Property PhoneColumn As DataColumn
Get
Return Me.columnPhone
End Get
End Property
Friend ReadOnly Property FaxColumn As DataColumn
Get
Return Me.columnFax
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As CustomersRow
Get
Return CType(Me.Rows(index),CustomersRow)
End Get
End Property
Public Event CustomersRowChanged As CustomersRowChangeEventHandler
Public Event CustomersRowChanging As CustomersRowChangeEventHandler
Public Event CustomersRowDeleted As CustomersRowChangeEventHandler
Public Event CustomersRowDeleting As CustomersRowChangeEventHandler
Public Overloads Sub AddCustomersRow(ByVal row As CustomersRow)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddCustomersRow(ByVal CustomerID As String, ByVal CompanyName As String, ByVal ContactName As String, ByVal ContactTitle As String, ByVal Address As String, ByVal City As String, ByVal _Region As String, ByVal PostalCode As String, ByVal Country As String, ByVal Phone As String, ByVal Fax As String) As CustomersRow
Dim rowCustomersRow As CustomersRow = CType(Me.NewRow,CustomersRow)
rowCustomersRow.ItemArray = New Object() {CustomerID, CompanyName, ContactName, ContactTitle, Address, City, _Region, PostalCode, Country, Phone, Fax}
Me.Rows.Add(rowCustomersRow)
Return rowCustomersRow
End Function
Public Function FindByCustomerID(ByVal CustomerID As String) As CustomersRow
Public Sub New(ByVal row As CustomersRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As CustomersRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
Public Class OrdersDataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private columnOrderID As DataColumn
Private columnCustomerID As DataColumn
Private columnEmployeeID As DataColumn
Private columnOrderDate As DataColumn
Private columnRequiredDate As DataColumn
Private columnShippedDate As DataColumn
Private columnShipVia As DataColumn
Private columnFreight As DataColumn
Private columnShipName As DataColumn
Private columnShipAddress As DataColumn
Private columnShipCity As DataColumn
Private columnShipRegion As DataColumn
Private columnShipPostalCode As DataColumn
Private columnShipCountry As DataColumn
Friend Sub New()
MyBase.New("Orders")
Me.InitClass
End Sub
<System.ComponentModel.Browsable(false)> _
Public ReadOnly Property Count As Integer
Get
Return Me.Rows.Count
End Get
End Property
Friend ReadOnly Property OrderIDColumn As DataColumn
Get
Return Me.columnOrderID
End Get
End Property
Friend ReadOnly Property CustomerIDColumn As DataColumn
Get
Return Me.columnCustomerID
End Get
End Property
Friend ReadOnly Property EmployeeIDColumn As DataColumn
Get
Return Me.columnEmployeeID
End Get
End Property
Friend ReadOnly Property OrderDateColumn As DataColumn
Get
Return Me.columnOrderDate
End Get
End Property
Friend ReadOnly Property RequiredDateColumn As DataColumn
Get
Return Me.columnRequiredDate
End Get
End Property
Friend ReadOnly Property ShippedDateColumn As DataColumn
Get
Return Me.columnShippedDate
End Get
End Property
Friend ReadOnly Property ShipViaColumn As DataColumn
Get
Return Me.columnShipVia
End Get
End Property
Friend ReadOnly Property FreightColumn As DataColumn
Get
Return Me.columnFreight
End Get
End Property
Friend ReadOnly Property ShipNameColumn As DataColumn
Get
Return Me.columnShipName
End Get
End Property
Friend ReadOnly Property ShipAddressColumn As DataColumn
Get
Return Me.columnShipAddress
End Get
End Property
Friend ReadOnly Property ShipCityColumn As DataColumn
Get
Return Me.columnShipCity
End Get
End Property
Friend ReadOnly Property ShipRegionColumn As DataColumn
Get
Return Me.columnShipRegion
End Get
End Property
Friend ReadOnly Property ShipPostalCodeColumn As DataColumn
Get
Return Me.columnShipPostalCode
End Get
End Property
Friend ReadOnly Property ShipCountryColumn As DataColumn
Get
Return Me.columnShipCountry
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As OrdersRow
Get
Return CType(Me.Rows(index),OrdersRow)
End Get
End Property
Public Event OrdersRowChanged As OrdersRowChangeEventHandler
Public Event OrdersRowChanging As OrdersRowChangeEventHandler
Public Event OrdersRowDeleted As OrdersRowChangeEventHandler
Public Event OrdersRowDeleting As OrdersRowChangeEventHandler
Public Overloads Sub AddOrdersRow(ByVal row As OrdersRow)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddOrdersRow(ByVal parentCustomersRowByCustomersOrders As CustomersRow, ByVal EmployeeID As Integer, ByVal OrderDate As Date, ByVal RequiredDate As Date, ByVal ShippedDate As Date, ByVal ShipVia As Integer, ByVal Freight As Decimal, ByVal ShipName As String, ByVal ShipAddress As String, ByVal ShipCity As String, ByVal ShipRegion As String, ByVal ShipPostalCode As String, ByVal ShipCountry As String) As OrdersRow
Dim rowOrdersRow As OrdersRow = CType(Me.NewRow,OrdersRow)