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

📄 dsin250.vb

📁 通用进销存-visual basic编写
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Public Overloads Function AddIN250Row(ByVal ProductID As String, ByVal ProductName As String, ByVal LastDeliveryDate As Date, ByVal SubtractDays As Decimal, ByVal Quantity As Decimal) As IN250Row
            Dim rowIN250Row As IN250Row = CType(Me.NewRow,IN250Row)
            rowIN250Row.ItemArray = New Object() {ProductID, ProductName, LastDeliveryDate, SubtractDays, Quantity}
            Me.Rows.Add(rowIN250Row)
            Return rowIN250Row
        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 IN250DataTable = CType(MyBase.Clone,IN250DataTable)
            cln.InitVars
            Return cln
        End Function
        
        Friend Sub InitVars()
            Me.columnProductID = Me.Columns("ProductID")
            Me.columnProductName = Me.Columns("ProductName")
            Me.columnLastDeliveryDate = Me.Columns("LastDeliveryDate")
            Me.columnSubtractDays = Me.Columns("SubtractDays")
            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.columnLastDeliveryDate = New DataColumn("LastDeliveryDate", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnLastDeliveryDate)
            Me.columnSubtractDays = New DataColumn("SubtractDays", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnSubtractDays)
            Me.columnQuantity = New DataColumn("Quantity", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnQuantity)
        End Sub
        
        Public Function NewIN250Row() As IN250Row
            Return CType(Me.NewRow,IN250Row)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New IN250Row(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(IN250Row)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.IN250RowChangedEvent) Is Nothing) Then
                RaiseEvent IN250RowChanged(Me, New IN250RowChangeEvent(CType(e.Row,IN250Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.IN250RowChangingEvent) Is Nothing) Then
                RaiseEvent IN250RowChanging(Me, New IN250RowChangeEvent(CType(e.Row,IN250Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.IN250RowDeletedEvent) Is Nothing) Then
                RaiseEvent IN250RowDeleted(Me, New IN250RowChangeEvent(CType(e.Row,IN250Row), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.IN250RowDeletingEvent) Is Nothing) Then
                RaiseEvent IN250RowDeleting(Me, New IN250RowChangeEvent(CType(e.Row,IN250Row), e.Action))
            End If
        End Sub
        
        Public Sub RemoveIN250Row(ByVal row As IN250Row)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class IN250Row
        Inherits DataRow
        
        Private tableIN250 As IN250DataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableIN250 = CType(Me.Table,IN250DataTable)
        End Sub
        
        Public Property ProductID As String
            Get
                Try 
                    Return CType(Me(Me.tableIN250.ProductIDColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN250.ProductIDColumn) = value
            End Set
        End Property
        
        Public Property ProductName As String
            Get
                Try 
                    Return CType(Me(Me.tableIN250.ProductNameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN250.ProductNameColumn) = value
            End Set
        End Property
        
        Public Property LastDeliveryDate As Date
            Get
                Try 
                    Return CType(Me(Me.tableIN250.LastDeliveryDateColumn),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN250.LastDeliveryDateColumn) = value
            End Set
        End Property
        
        Public Property SubtractDays As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableIN250.SubtractDaysColumn),Decimal)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN250.SubtractDaysColumn) = value
            End Set
        End Property
        
        Public Property Quantity As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableIN250.QuantityColumn),Decimal)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableIN250.QuantityColumn) = value
            End Set
        End Property
        
        Public Function IsProductIDNull() As Boolean
            Return Me.IsNull(Me.tableIN250.ProductIDColumn)
        End Function
        
        Public Sub SetProductIDNull()
            Me(Me.tableIN250.ProductIDColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsProductNameNull() As Boolean
            Return Me.IsNull(Me.tableIN250.ProductNameColumn)
        End Function
        
        Public Sub SetProductNameNull()
            Me(Me.tableIN250.ProductNameColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsLastDeliveryDateNull() As Boolean
            Return Me.IsNull(Me.tableIN250.LastDeliveryDateColumn)
        End Function
        
        Public Sub SetLastDeliveryDateNull()
            Me(Me.tableIN250.LastDeliveryDateColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsSubtractDaysNull() As Boolean
            Return Me.IsNull(Me.tableIN250.SubtractDaysColumn)
        End Function
        
        Public Sub SetSubtractDaysNull()
            Me(Me.tableIN250.SubtractDaysColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsQuantityNull() As Boolean
            Return Me.IsNull(Me.tableIN250.QuantityColumn)
        End Function
        
        Public Sub SetQuantityNull()
            Me(Me.tableIN250.QuantityColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class IN250RowChangeEvent
        Inherits EventArgs
        
        Private eventRow As IN250Row
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As IN250Row, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As IN250Row
            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 + -