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

📄 dsin210.vb

📁 通用进销存-visual basic编写
💻 VB
📖 第 1 页 / 共 2 页
字号:
        
        Public Event IN210RowChanging As IN210RowChangeEventHandler
        
        Public Event IN210RowDeleted As IN210RowChangeEventHandler
        
        Public Event IN210RowDeleting As IN210RowChangeEventHandler
        
        Public Overloads Sub AddIN210Row(ByVal row As IN210Row)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddIN210Row(ByVal ProductID As String, ByVal ProductName As String, ByVal SafeStock As Decimal, ByVal Quantity As Decimal) As IN210Row
            Dim rowIN210Row As IN210Row = CType(Me.NewRow,IN210Row)
            rowIN210Row.ItemArray = New Object() {ProductID, ProductName, SafeStock, Quantity}
            Me.Rows.Add(rowIN210Row)
            Return rowIN210Row
        End Function
        
        Public Function FindByProductID(ByVal ProductID As String) As IN210Row
            Return CType(Me.Rows.Find(New Object() {ProductID}),IN210Row)
        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 IN210DataTable = CType(MyBase.Clone,IN210DataTable)
            cln.InitVars
            Return cln
        End Function
        
        Friend Sub InitVars()
            Me.columnProductID = Me.Columns("ProductID")
            Me.columnProductName = Me.Columns("ProductName")
            Me.columnSafeStock = Me.Columns("SafeStock")
            Me.columnQuantity = Me.Columns("Quantity")
        End Sub
        
        Private Sub InitClass()
            Me.columnProductID = New DataColumn("ProductID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnProductID)
            Me.columnProductName = New DataColumn("ProductName", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnProductName)
            Me.columnSafeStock = New DataColumn("SafeStock", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnSafeStock)
            Me.columnQuantity = New DataColumn("Quantity", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnQuantity)
            Me.Constraints.Add(New UniqueConstraint("dsIN210Key1", New DataColumn() {Me.columnProductID}, true))
            Me.columnProductID.AllowDBNull = false
            Me.columnProductID.Unique = true
        End Sub
        
        Public Function NewIN210Row() As IN210Row
            Return CType(Me.NewRow,IN210Row)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New IN210Row(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(IN210Row)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.IN210RowChangedEvent) Is Nothing) Then
                RaiseEvent IN210RowChanged(Me, New IN210RowChangeEvent(CType(e.Row,IN210Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.IN210RowChangingEvent) Is Nothing) Then
                RaiseEvent IN210RowChanging(Me, New IN210RowChangeEvent(CType(e.Row,IN210Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.IN210RowDeletedEvent) Is Nothing) Then
                RaiseEvent IN210RowDeleted(Me, New IN210RowChangeEvent(CType(e.Row,IN210Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.IN210RowDeletingEvent) Is Nothing) Then
                RaiseEvent IN210RowDeleting(Me, New IN210RowChangeEvent(CType(e.Row,IN210Row), e.Action))
            End If
        End Sub
        
        Public Sub RemoveIN210Row(ByVal row As IN210Row)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class IN210Row
        Inherits DataRow
        
        Private tableIN210 As IN210DataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableIN210 = CType(Me.Table,IN210DataTable)
        End Sub
        
        Public Property ProductID As String
            Get
                Return CType(Me(Me.tableIN210.ProductIDColumn),String)
            End Get
            Set
                Me(Me.tableIN210.ProductIDColumn) = value
            End Set
        End Property
        
        Public Property ProductName As String
            Get
                Try 
                    Return CType(Me(Me.tableIN210.ProductNameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN210.ProductNameColumn) = value
            End Set
        End Property
        
        Public Property SafeStock As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableIN210.SafeStockColumn),Decimal)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN210.SafeStockColumn) = value
            End Set
        End Property
        
        Public Property Quantity As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableIN210.QuantityColumn),Decimal)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN210.QuantityColumn) = value
            End Set
        End Property
        
        Public Function IsProductNameNull() As Boolean
            Return Me.IsNull(Me.tableIN210.ProductNameColumn)
        End Function
        
        Public Sub SetProductNameNull()
            Me(Me.tableIN210.ProductNameColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsSafeStockNull() As Boolean
            Return Me.IsNull(Me.tableIN210.SafeStockColumn)
        End Function
        
        Public Sub SetSafeStockNull()
            Me(Me.tableIN210.SafeStockColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsQuantityNull() As Boolean
            Return Me.IsNull(Me.tableIN210.QuantityColumn)
        End Function
        
        Public Sub SetQuantityNull()
            Me(Me.tableIN210.QuantityColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class IN210RowChangeEvent
        Inherits EventArgs
        
        Private eventRow As IN210Row
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As IN210Row, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As IN210Row
            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 + -