📄 dsdl230.vb
字号:
Public Event DL230RowChanging As DL230RowChangeEventHandler
Public Event DL230RowDeleted As DL230RowChangeEventHandler
Public Event DL230RowDeleting As DL230RowChangeEventHandler
Public Overloads Sub AddDL230Row(ByVal row As DL230Row)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddDL230Row(ByVal Seq As Long, ByVal CustomerID As String, ByVal CustomerAttribName As String, ByVal SalesQuantity As Decimal, ByVal SalesAmount As Decimal) As DL230Row
Dim rowDL230Row As DL230Row = CType(Me.NewRow,DL230Row)
rowDL230Row.ItemArray = New Object() {Seq, CustomerID, CustomerAttribName, SalesQuantity, SalesAmount}
Me.Rows.Add(rowDL230Row)
Return rowDL230Row
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 DL230DataTable = CType(MyBase.Clone,DL230DataTable)
cln.InitVars
Return cln
End Function
Friend Sub InitVars()
Me.columnSeq = Me.Columns("Seq")
Me.columnCustomerID = Me.Columns("CustomerID")
Me.columnCustomerAttribName = Me.Columns("CustomerAttribName")
Me.columnSalesQuantity = Me.Columns("SalesQuantity")
Me.columnSalesAmount = Me.Columns("SalesAmount")
End Sub
Private Sub InitClass()
Me.columnSeq = New DataColumn("Seq", GetType(System.Int64), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSeq)
Me.columnCustomerID = New DataColumn("CustomerID", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnCustomerID)
Me.columnCustomerAttribName = New DataColumn("CustomerAttribName", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnCustomerAttribName)
Me.columnSalesQuantity = New DataColumn("SalesQuantity", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSalesQuantity)
Me.columnSalesAmount = New DataColumn("SalesAmount", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSalesAmount)
Me.Constraints.Add(New UniqueConstraint("dsDL230Key1", New DataColumn() {Me.columnSeq, Me.columnCustomerID}, false))
Me.columnSeq.AllowDBNull = false
Me.columnCustomerID.AllowDBNull = false
End Sub
Public Function NewDL230Row() As DL230Row
Return CType(Me.NewRow,DL230Row)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New DL230Row(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(DL230Row)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.DL230RowChangedEvent) Is Nothing) Then
RaiseEvent DL230RowChanged(Me, New DL230RowChangeEvent(CType(e.Row,DL230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.DL230RowChangingEvent) Is Nothing) Then
RaiseEvent DL230RowChanging(Me, New DL230RowChangeEvent(CType(e.Row,DL230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.DL230RowDeletedEvent) Is Nothing) Then
RaiseEvent DL230RowDeleted(Me, New DL230RowChangeEvent(CType(e.Row,DL230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.DL230RowDeletingEvent) Is Nothing) Then
RaiseEvent DL230RowDeleting(Me, New DL230RowChangeEvent(CType(e.Row,DL230Row), e.Action))
End If
End Sub
Public Sub RemoveDL230Row(ByVal row As DL230Row)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class DL230Row
Inherits DataRow
Private tableDL230 As DL230DataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableDL230 = CType(Me.Table,DL230DataTable)
End Sub
Public Property Seq As Long
Get
Return CType(Me(Me.tableDL230.SeqColumn),Long)
End Get
Set
Me(Me.tableDL230.SeqColumn) = value
End Set
End Property
Public Property CustomerID As String
Get
Return CType(Me(Me.tableDL230.CustomerIDColumn),String)
End Get
Set
Me(Me.tableDL230.CustomerIDColumn) = value
End Set
End Property
Public Property CustomerAttribName As String
Get
Try
Return CType(Me(Me.tableDL230.CustomerAttribNameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableDL230.CustomerAttribNameColumn) = value
End Set
End Property
Public Property SalesQuantity As Decimal
Get
Try
Return CType(Me(Me.tableDL230.SalesQuantityColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableDL230.SalesQuantityColumn) = value
End Set
End Property
Public Property SalesAmount As Decimal
Get
Try
Return CType(Me(Me.tableDL230.SalesAmountColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableDL230.SalesAmountColumn) = value
End Set
End Property
Public Function IsCustomerAttribNameNull() As Boolean
Return Me.IsNull(Me.tableDL230.CustomerAttribNameColumn)
End Function
Public Sub SetCustomerAttribNameNull()
Me(Me.tableDL230.CustomerAttribNameColumn) = System.Convert.DBNull
End Sub
Public Function IsSalesQuantityNull() As Boolean
Return Me.IsNull(Me.tableDL230.SalesQuantityColumn)
End Function
Public Sub SetSalesQuantityNull()
Me(Me.tableDL230.SalesQuantityColumn) = System.Convert.DBNull
End Sub
Public Function IsSalesAmountNull() As Boolean
Return Me.IsNull(Me.tableDL230.SalesAmountColumn)
End Function
Public Sub SetSalesAmountNull()
Me(Me.tableDL230.SalesAmountColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class DL230RowChangeEvent
Inherits EventArgs
Private eventRow As DL230Row
Private eventAction As DataRowAction
Public Sub New(ByVal row As DL230Row, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As DL230Row
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 + -