📄 dsaccessory.vb
字号:
Get
Try
Return CType(Me(Me.tableaccessory.descriptColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.descriptColumn) = value
End Set
End Property
Public Property price As Decimal
Get
Try
Return CType(Me(Me.tableaccessory.priceColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.priceColumn) = value
End Set
End Property
Public Property stand As String
Get
Try
Return CType(Me(Me.tableaccessory.standColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.standColumn) = value
End Set
End Property
Public Function IsanoNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anoColumn)
End Function
Public Sub SetanoNull()
Me(Me.tableaccessory.anoColumn) = System.Convert.DBNull
End Sub
Public Function IsanameNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anameColumn)
End Function
Public Sub SetanameNull()
Me(Me.tableaccessory.anameColumn) = System.Convert.DBNull
End Sub
Public Function IsanountNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anountColumn)
End Function
Public Sub SetanountNull()
Me(Me.tableaccessory.anountColumn) = System.Convert.DBNull
End Sub
Public Function IsdescriptNull() As Boolean
Return Me.IsNull(Me.tableaccessory.descriptColumn)
End Function
Public Sub SetdescriptNull()
Me(Me.tableaccessory.descriptColumn) = System.Convert.DBNull
End Sub
Public Function IspriceNull() As Boolean
Return Me.IsNull(Me.tableaccessory.priceColumn)
End Function
Public Sub SetpriceNull()
Me(Me.tableaccessory.priceColumn) = System.Convert.DBNull
End Sub
Public Function IsstandNull() As Boolean
Return Me.IsNull(Me.tableaccessory.standColumn)
End Function
Public Sub SetstandNull()
Me(Me.tableaccessory.standColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class accessoryRowChangeEvent
Inherits EventArgs
Private eventRow As accessoryRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As accessoryRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As accessoryRow
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 workerDataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private columnwno As DataColumn
Private columnwname As DataColumn
Private columntitle As DataColumn
Private columnage As DataColumn
Friend Sub New()
MyBase.New("worker")
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 wnoColumn As DataColumn
Get
Return Me.columnwno
End Get
End Property
Friend ReadOnly Property wnameColumn As DataColumn
Get
Return Me.columnwname
End Get
End Property
Friend ReadOnly Property titleColumn As DataColumn
Get
Return Me.columntitle
End Get
End Property
Friend ReadOnly Property ageColumn As DataColumn
Get
Return Me.columnage
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As workerRow
Get
Return CType(Me.Rows(index),workerRow)
End Get
End Property
Public Event workerRowChanged As workerRowChangeEventHandler
Public Event workerRowChanging As workerRowChangeEventHandler
Public Event workerRowDeleted As workerRowChangeEventHandler
Public Event workerRowDeleting As workerRowChangeEventHandler
Public Overloads Sub AddworkerRow(ByVal row As workerRow)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddworkerRow(ByVal wno As String, ByVal wname As String, ByVal title As String, ByVal age As Integer) As workerRow
Dim rowworkerRow As workerRow = CType(Me.NewRow,workerRow)
rowworkerRow.ItemArray = New Object() {wno, wname, title, age}
Me.Rows.Add(rowworkerRow)
Return rowworkerRow
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 workerDataTable = CType(MyBase.Clone,workerDataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New workerDataTable
End Function
Friend Sub InitVars()
Me.columnwno = Me.Columns("wno")
Me.columnwname = Me.Columns("wname")
Me.columntitle = Me.Columns("title")
Me.columnage = Me.Columns("age")
End Sub
Private Sub InitClass()
Me.columnwno = New DataColumn("wno", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnwno)
Me.columnwname = New DataColumn("wname", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnwname)
Me.columntitle = New DataColumn("title", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columntitle)
Me.columnage = New DataColumn("age", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnage)
End Sub
Public Function NewworkerRow() As workerRow
Return CType(Me.NewRow,workerRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New workerRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(workerRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.workerRowChangedEvent) Is Nothing) Then
RaiseEvent workerRowChanged(Me, New workerRowChangeEvent(CType(e.Row,workerRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.workerRowChangingEvent) Is Nothing) Then
RaiseEvent workerRowChanging(Me, New workerRowChangeEvent(CType(e.Row,workerRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.workerRowDeletedEvent) Is Nothing) Then
RaiseEvent workerRowDeleted(Me, New workerRowChangeEvent(CType(e.Row,workerRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.workerRowDeletingEvent) Is Nothing) Then
RaiseEvent workerRowDeleting(Me, New workerRowChangeEvent(CType(e.Row,workerRow), e.Action))
End If
End Sub
Public Sub RemoveworkerRow(ByVal row As workerRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class workerRow
Inherits DataRow
Private tableworker As workerDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableworker = CType(Me.Table,workerDataTable)
End Sub
Public Property wno As String
Get
Try
Return CType(Me(Me.tableworker.wnoColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableworker.wnoColumn) = value
End Set
End Property
Public Property wname As String
Get
Try
Return CType(Me(Me.tableworker.wnameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableworker.wnameColumn) = value
End Set
End Property
Public Property title As String
Get
Try
Return CType(Me(Me.tableworker.titleColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableworker.titleColumn) = value
End Set
End Property
Public Property age As Integer
Get
Try
Return CType(Me(Me.tableworker.ageColumn),Integer)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableworker.ageColumn) = value
End Set
End Property
Public Function IswnoNull() As Boolean
Return Me.IsNull(Me.tableworker.wnoColumn)
End Function
Public Sub SetwnoNull()
Me(Me.tableworker.wnoColumn) = System.Convert.DBNull
End Sub
Public Function IswnameNull() As Boolean
Return Me.IsNull(Me.tableworker.wnameColumn)
End Function
Public Sub SetwnameNull()
Me(Me.tableworker.wnameColumn) = System.Convert.DBNull
End Sub
Public Function IstitleNull() As Boolean
Return Me.IsNull(Me.tableworker.titleColumn)
End Function
Public Sub SettitleNull()
Me(Me.tableworker.titleColumn) = System.Convert.DBNull
End Sub
Public Function IsageNull() As Boolean
Return Me.IsNull(Me.tableworker.ageColumn)
End Function
Public Sub SetageNull()
Me(Me.tableworker.ageColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class workerRowChangeEvent
Inherits EventArgs
Private eventRow As workerRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As workerRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As workerRow
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 + -