📄 dspr230.vb
字号:
Public Event PR230RowChanging As PR230RowChangeEventHandler
Public Event PR230RowDeleted As PR230RowChangeEventHandler
Public Event PR230RowDeleting As PR230RowChangeEventHandler
Public Overloads Sub AddPR230Row(ByVal row As PR230Row)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddPR230Row(ByVal Seq As Long, ByVal SupplierID As String, ByVal SupplierAttribName As String, ByVal PurchaseQuantity As Decimal, ByVal PurchaseAmount As Decimal) As PR230Row
Dim rowPR230Row As PR230Row = CType(Me.NewRow,PR230Row)
rowPR230Row.ItemArray = New Object() {Seq, SupplierID, SupplierAttribName, PurchaseQuantity, PurchaseAmount}
Me.Rows.Add(rowPR230Row)
Return rowPR230Row
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 PR230DataTable = CType(MyBase.Clone,PR230DataTable)
cln.InitVars
Return cln
End Function
Friend Sub InitVars()
Me.columnSeq = Me.Columns("Seq")
Me.columnSupplierID = Me.Columns("SupplierID")
Me.columnSupplierAttribName = Me.Columns("SupplierAttribName")
Me.columnPurchaseQuantity = Me.Columns("PurchaseQuantity")
Me.columnPurchaseAmount = Me.Columns("PurchaseAmount")
End Sub
Private Sub InitClass()
Me.columnSeq = New DataColumn("Seq", GetType(System.Int64), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnSeq)
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.columnPurchaseQuantity = New DataColumn("PurchaseQuantity", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnPurchaseQuantity)
Me.columnPurchaseAmount = New DataColumn("PurchaseAmount", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnPurchaseAmount)
Me.Constraints.Add(New UniqueConstraint("dsPR230Key1", New DataColumn() {Me.columnSeq, Me.columnSupplierID}, false))
Me.columnSeq.AllowDBNull = false
Me.columnSupplierID.AllowDBNull = false
End Sub
Public Function NewPR230Row() As PR230Row
Return CType(Me.NewRow,PR230Row)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New PR230Row(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(PR230Row)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.PR230RowChangedEvent) Is Nothing) Then
RaiseEvent PR230RowChanged(Me, New PR230RowChangeEvent(CType(e.Row,PR230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.PR230RowChangingEvent) Is Nothing) Then
RaiseEvent PR230RowChanging(Me, New PR230RowChangeEvent(CType(e.Row,PR230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.PR230RowDeletedEvent) Is Nothing) Then
RaiseEvent PR230RowDeleted(Me, New PR230RowChangeEvent(CType(e.Row,PR230Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.PR230RowDeletingEvent) Is Nothing) Then
RaiseEvent PR230RowDeleting(Me, New PR230RowChangeEvent(CType(e.Row,PR230Row), e.Action))
End If
End Sub
Public Sub RemovePR230Row(ByVal row As PR230Row)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class PR230Row
Inherits DataRow
Private tablePR230 As PR230DataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tablePR230 = CType(Me.Table,PR230DataTable)
End Sub
Public Property Seq As Long
Get
Return CType(Me(Me.tablePR230.SeqColumn),Long)
End Get
Set
Me(Me.tablePR230.SeqColumn) = value
End Set
End Property
Public Property SupplierID As String
Get
Return CType(Me(Me.tablePR230.SupplierIDColumn),String)
End Get
Set
Me(Me.tablePR230.SupplierIDColumn) = value
End Set
End Property
Public Property SupplierAttribName As String
Get
Try
Return CType(Me(Me.tablePR230.SupplierAttribNameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tablePR230.SupplierAttribNameColumn) = value
End Set
End Property
Public Property PurchaseQuantity As Decimal
Get
Try
Return CType(Me(Me.tablePR230.PurchaseQuantityColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tablePR230.PurchaseQuantityColumn) = value
End Set
End Property
Public Property PurchaseAmount As Decimal
Get
Try
Return CType(Me(Me.tablePR230.PurchaseAmountColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tablePR230.PurchaseAmountColumn) = value
End Set
End Property
Public Function IsSupplierAttribNameNull() As Boolean
Return Me.IsNull(Me.tablePR230.SupplierAttribNameColumn)
End Function
Public Sub SetSupplierAttribNameNull()
Me(Me.tablePR230.SupplierAttribNameColumn) = System.Convert.DBNull
End Sub
Public Function IsPurchaseQuantityNull() As Boolean
Return Me.IsNull(Me.tablePR230.PurchaseQuantityColumn)
End Function
Public Sub SetPurchaseQuantityNull()
Me(Me.tablePR230.PurchaseQuantityColumn) = System.Convert.DBNull
End Sub
Public Function IsPurchaseAmountNull() As Boolean
Return Me.IsNull(Me.tablePR230.PurchaseAmountColumn)
End Function
Public Sub SetPurchaseAmountNull()
Me(Me.tablePR230.PurchaseAmountColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class PR230RowChangeEvent
Inherits EventArgs
Private eventRow As PR230Row
Private eventAction As DataRowAction
Public Sub New(ByVal row As PR230Row, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As PR230Row
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 + -