📄 de.vb
字号:
Public Event 住宿统计RowDeleting As 住宿统计RowChangeEventHandler
Public Overloads Sub Add住宿统计Row(ByVal row As 住宿统计Row)
Me.Rows.Add(row)
End Sub
Public Overloads Function Add住宿统计Row(ByVal 栋号 As String, ByVal 房号 As String, ByVal 总床位 As Integer, ByVal 已住床位 As Integer, ByVal 剩余床位 As Integer) As 住宿统计Row
Dim row住宿统计Row As 住宿统计Row = CType(Me.NewRow,住宿统计Row)
row住宿统计Row.ItemArray = New Object() {栋号, 房号, 总床位, 已住床位, 剩余床位}
Me.Rows.Add(row住宿统计Row)
Return row住宿统计Row
End Function
Public Function FindBy栋号房号(ByVal 栋号 As String, ByVal 房号 As String) As 住宿统计Row
Return CType(Me.Rows.Find(New Object() {栋号, 房号}),住宿统计Row)
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 住宿统计DataTable = CType(MyBase.Clone,住宿统计DataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New 住宿统计DataTable
End Function
Friend Sub InitVars()
Me.column栋号 = Me.Columns("栋号")
Me.column房号 = Me.Columns("房号")
Me.column总床位 = Me.Columns("总床位")
Me.column已住床位 = Me.Columns("已住床位")
Me.column剩余床位 = Me.Columns("剩余床位")
End Sub
Private Sub InitClass()
Me.column栋号 = New DataColumn("栋号", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column栋号)
Me.column房号 = New DataColumn("房号", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column房号)
Me.column总床位 = New DataColumn("总床位", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column总床位)
Me.column已住床位 = New DataColumn("已住床位", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column已住床位)
Me.column剩余床位 = New DataColumn("剩余床位", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column剩余床位)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.column栋号, Me.column房号}, true))
Me.column栋号.AllowDBNull = false
Me.column房号.AllowDBNull = false
End Sub
Public Function New住宿统计Row() As 住宿统计Row
Return CType(Me.NewRow,住宿统计Row)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New 住宿统计Row(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(住宿统计Row)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.住宿统计RowChangedEvent) Is Nothing) Then
RaiseEvent 住宿统计RowChanged(Me, New 住宿统计RowChangeEvent(CType(e.Row,住宿统计Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.住宿统计RowChangingEvent) Is Nothing) Then
RaiseEvent 住宿统计RowChanging(Me, New 住宿统计RowChangeEvent(CType(e.Row,住宿统计Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.住宿统计RowDeletedEvent) Is Nothing) Then
RaiseEvent 住宿统计RowDeleted(Me, New 住宿统计RowChangeEvent(CType(e.Row,住宿统计Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.住宿统计RowDeletingEvent) Is Nothing) Then
RaiseEvent 住宿统计RowDeleting(Me, New 住宿统计RowChangeEvent(CType(e.Row,住宿统计Row), e.Action))
End If
End Sub
Public Sub Remove住宿统计Row(ByVal row As 住宿统计Row)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class 住宿统计Row
Inherits DataRow
Private table住宿统计 As 住宿统计DataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.table住宿统计 = CType(Me.Table,住宿统计DataTable)
End Sub
Public Property 栋号 As String
Get
Return CType(Me(Me.table住宿统计.栋号Column),String)
End Get
Set
Me(Me.table住宿统计.栋号Column) = value
End Set
End Property
Public Property 房号 As String
Get
Return CType(Me(Me.table住宿统计.房号Column),String)
End Get
Set
Me(Me.table住宿统计.房号Column) = value
End Set
End Property
Public Property 总床位 As Integer
Get
Try
Return CType(Me(Me.table住宿统计.总床位Column),Integer)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table住宿统计.总床位Column) = value
End Set
End Property
Public Property 已住床位 As Integer
Get
Try
Return CType(Me(Me.table住宿统计.已住床位Column),Integer)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table住宿统计.已住床位Column) = value
End Set
End Property
Public Property 剩余床位 As Integer
Get
Try
Return CType(Me(Me.table住宿统计.剩余床位Column),Integer)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table住宿统计.剩余床位Column) = value
End Set
End Property
Public Function Is总床位Null() As Boolean
Return Me.IsNull(Me.table住宿统计.总床位Column)
End Function
Public Sub Set总床位Null()
Me(Me.table住宿统计.总床位Column) = System.Convert.DBNull
End Sub
Public Function Is已住床位Null() As Boolean
Return Me.IsNull(Me.table住宿统计.已住床位Column)
End Function
Public Sub Set已住床位Null()
Me(Me.table住宿统计.已住床位Column) = System.Convert.DBNull
End Sub
Public Function Is剩余床位Null() As Boolean
Return Me.IsNull(Me.table住宿统计.剩余床位Column)
End Function
Public Sub Set剩余床位Null()
Me(Me.table住宿统计.剩余床位Column) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class 住宿统计RowChangeEvent
Inherits EventArgs
Private eventRow As 住宿统计Row
Private eventAction As DataRowAction
Public Sub New(ByVal row As 住宿统计Row, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As 住宿统计Row
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 + -