📄 dsap110.vb
字号:
Public Overloads Function AddBankRow(ByVal BankID As String, ByVal BankAttribName As String) As BankRow
Dim rowBankRow As BankRow = CType(Me.NewRow,BankRow)
rowBankRow.ItemArray = New Object() {BankID, BankAttribName}
Me.Rows.Add(rowBankRow)
Return rowBankRow
End Function
Public Function FindByBankID(ByVal BankID As String) As BankRow
Return CType(Me.Rows.Find(New Object() {BankID}),BankRow)
End Function
Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
Public Overrides Function Clone() As DataTable
Dim cln As BankDataTable = CType(MyBase.Clone,BankDataTable)
cln.InitVars
Return cln
End Function
Friend Sub InitVars()
Me.columnBankID = Me.Columns("BankID")
Me.columnBankAttribName = Me.Columns("BankAttribName")
End Sub
Private Sub InitClass()
Me.columnBankID = New DataColumn("BankID", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnBankID)
Me.columnBankAttribName = New DataColumn("BankAttribName", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnBankAttribName)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnBankID}, true))
Me.columnBankID.AllowDBNull = false
Me.columnBankID.Unique = true
Me.columnBankAttribName.AllowDBNull = false
End Sub
Public Function NewBankRow() As BankRow
Return CType(Me.NewRow,BankRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New BankRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(BankRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.BankRowChangedEvent) Is Nothing) Then
RaiseEvent BankRowChanged(Me, New BankRowChangeEvent(CType(e.Row,BankRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.BankRowChangingEvent) Is Nothing) Then
RaiseEvent BankRowChanging(Me, New BankRowChangeEvent(CType(e.Row,BankRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.BankRowDeletedEvent) Is Nothing) Then
RaiseEvent BankRowDeleted(Me, New BankRowChangeEvent(CType(e.Row,BankRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.BankRowDeletingEvent) Is Nothing) Then
RaiseEvent BankRowDeleting(Me, New BankRowChangeEvent(CType(e.Row,BankRow), e.Action))
End If
End Sub
Public Sub RemoveBankRow(ByVal row As BankRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class BankRow
Inherits DataRow
Private tableBank As BankDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableBank = CType(Me.Table,BankDataTable)
End Sub
Public Property BankID As String
Get
Return CType(Me(Me.tableBank.BankIDColumn),String)
End Get
Set
Me(Me.tableBank.BankIDColumn) = value
End Set
End Property
Public Property BankAttribName As String
Get
Return CType(Me(Me.tableBank.BankAttribNameColumn),String)
End Get
Set
Me(Me.tableBank.BankAttribNameColumn) = value
End Set
End Property
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class BankRowChangeEvent
Inherits EventArgs
Private eventRow As BankRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As BankRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As BankRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class SupplierDataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private columnSupplierID As DataColumn
Private columnSupplierAttribName As DataColumn
Friend Sub New()
MyBase.New("Supplier")
Me.InitClass
End Sub
Friend Sub New(ByVal table As DataTable)
MyBase.New(table.TableName)
If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
Me.CaseSensitive = table.CaseSensitive
End If
If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
Me.Locale = table.Locale
End If
If (table.Namespace <> table.DataSet.Namespace) Then
Me.Namespace = table.Namespace
End If
Me.Prefix = table.Prefix
Me.MinimumCapacity = table.MinimumCapacity
Me.DisplayExpression = table.DisplayExpression
End Sub
<System.ComponentModel.Browsable(false)> _
Public ReadOnly Property Count As Integer
Get
Return Me.Rows.Count
End Get
End Property
Friend ReadOnly Property SupplierIDColumn As DataColumn
Get
Return Me.columnSupplierID
End Get
End Property
Friend ReadOnly Property SupplierAttribNameColumn As DataColumn
Get
Return Me.columnSupplierAttribName
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As SupplierRow
Get
Return CType(Me.Rows(index),SupplierRow)
End Get
End Property
Public Event SupplierRowChanged As SupplierRowChangeEventHandler
Public Event SupplierRowChanging As SupplierRowChangeEventHandler
Public Event SupplierRowDeleted As SupplierRowChangeEventHandler
Public Event SupplierRowDeleting As SupplierRowChangeEventHandler
Public Overloads Sub AddSupplierRow(ByVal row As SupplierRow)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddSupplierRow(ByVal SupplierID As String, ByVal SupplierAttribName As String) As SupplierRow
Dim rowSupplierRow As SupplierRow = CType(Me.NewRow,SupplierRow)
rowSupplierRow.ItemArray = New Object() {SupplierID, SupplierAttribName}
Me.Rows.Add(rowSupplierRow)
Return rowSupplierRow
End Function
Public Function FindBySupplierID(ByVal SupplierID As String) As SupplierRow
Return CType(Me.Rows.Find(New Object() {SupplierID}),SupplierRow)
End Function
Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
Public Overrides Function Clone() As DataTable
Dim cln As SupplierDataTable = CType(MyBase.Clone,SupplierDataTable)
cln.InitVars
Return cln
End Function
Friend Sub InitVars()
Me.columnSupplierID = Me.Columns("SupplierID")
Me.columnSupplierAttribName = Me.Columns("SupplierAttribName")
End Sub
Private Sub InitClass()
Me.columnSupplierID = New DataColumn("SupplierID", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSupplierID)
Me.columnSupplierAttribName = New DataColumn("SupplierAttribName", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSupplierAttribName)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnSupplierID}, true))
Me.columnSupplierID.AllowDBNull = false
Me.columnSupplierID.Unique = true
Me.columnSupplierAttribName.AllowDBNull = false
End Sub
Public Function NewSupplierRow() As SupplierRow
Return CType(Me.NewRow,SupplierRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New SupplierRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(SupplierRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.SupplierRowChangedEvent) Is Nothing) Then
RaiseEvent SupplierRowChanged(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.SupplierRowChangingEvent) Is Nothing) Then
RaiseEvent SupplierRowChanging(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.SupplierRowDeletedEvent) Is Nothing) Then
RaiseEvent SupplierRowDeleted(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.SupplierRowDeletingEvent) Is Nothing) Then
RaiseEvent SupplierRowDeleting(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
End If
End Sub
Public Sub RemoveSupplierRow(ByVal row As SupplierRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class SupplierRow
Inherits DataRow
Private tableSupplier As SupplierDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableSupplier = CType(Me.Table,SupplierDataTable)
End Sub
Public Property SupplierID As String
Get
Return CType(Me(Me.tableSupplier.SupplierIDColumn),String)
End Get
Set
Me(Me.tableSupplier.SupplierIDColumn) = value
End Set
End Property
Public Property SupplierAttribName As String
Get
Return CType(Me(Me.tableSupplier.SupplierAttribNameColumn),String)
End Get
Set
Me(Me.tableSupplier.SupplierAttribNameColumn) = value
End Set
End Property
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class SupplierRowChangeEvent
Inherits EventArgs
Private eventRow As SupplierRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As SupplierRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As SupplierRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -