⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dataset3.vb

📁 食堂消费刷卡系统
💻 VB
📖 第 1 页 / 共 2 页
字号:
        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 IC卡号 As String, ByVal 姓名 As String, ByVal 余额 As Double, ByVal 用户类型 As String) As 食堂Row
            Dim row食堂Row As 食堂Row = CType(Me.NewRow,食堂Row)
            row食堂Row.ItemArray = New Object() {IC卡号, 姓名, 余额, 用户类型}
            Me.Rows.Add(row食堂Row)
            Return row食堂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.columnIC卡号 = Me.Columns("IC卡号")
            Me.column姓名 = Me.Columns("姓名")
            Me.column余额 = Me.Columns("余额")
            Me.column用户类型 = Me.Columns("用户类型")
        End Sub
        
        Private Sub InitClass()
            Me.columnIC卡号 = New DataColumn("IC卡号", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnIC卡号)
            Me.column姓名 = New DataColumn("姓名", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column姓名)
            Me.column余额 = New DataColumn("余额", GetType(System.Double), 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用户类型)
        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 IC卡号 As String
            Get
                Try 
                    Return CType(Me(Me.table食堂.IC卡号Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.table食堂.IC卡号Column) = value
            End Set
        End Property
        
        Public Property 姓名 As String
            Get
                Try 
                    Return CType(Me(Me.table食堂.姓名Column),String)
                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 Double
            Get
                Try 
                    Return CType(Me(Me.table食堂.余额Column),Double)
                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 String
            Get
                Try 
                    Return CType(Me(Me.table食堂.用户类型Column),String)
                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 IsIC卡号Null() As Boolean
            Return Me.IsNull(Me.table食堂.IC卡号Column)
        End Function
        
        Public Sub SetIC卡号Null()
            Me(Me.table食堂.IC卡号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
        
        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 + -