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

📄 dsba140.vb

📁 通用进销存-visual basic编写
💻 VB
📖 第 1 页 / 共 4 页
字号:
            Me.Columns.Add(Me.columnQuantity)
            Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnProductID}, true))
            Me.columnProductID.AllowDBNull = false
            Me.columnProductID.Unique = true
            Me.columnProductName.AllowDBNull = false
            Me.columnSafeStock.AllowDBNull = false
            Me.columnQuantity.AllowDBNull = false
        End Sub
        
        Public Function NewProductRow() As ProductRow
            Return CType(Me.NewRow,ProductRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New ProductRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(ProductRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.ProductRowChangedEvent) Is Nothing) Then
                RaiseEvent ProductRowChanged(Me, New ProductRowChangeEvent(CType(e.Row,ProductRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.ProductRowChangingEvent) Is Nothing) Then
                RaiseEvent ProductRowChanging(Me, New ProductRowChangeEvent(CType(e.Row,ProductRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.ProductRowDeletedEvent) Is Nothing) Then
                RaiseEvent ProductRowDeleted(Me, New ProductRowChangeEvent(CType(e.Row,ProductRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.ProductRowDeletingEvent) Is Nothing) Then
                RaiseEvent ProductRowDeleting(Me, New ProductRowChangeEvent(CType(e.Row,ProductRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveProductRow(ByVal row As ProductRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class ProductRow
        Inherits DataRow
        
        Private tableProduct As ProductDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableProduct = CType(Me.Table,ProductDataTable)
        End Sub
        
        Public Property ProductID As String
            Get
                Return CType(Me(Me.tableProduct.ProductIDColumn),String)
            End Get
            Set
                Me(Me.tableProduct.ProductIDColumn) = value
            End Set
        End Property
        
        Public Property ProductName As String
            Get
                Return CType(Me(Me.tableProduct.ProductNameColumn),String)
            End Get
            Set
                Me(Me.tableProduct.ProductNameColumn) = value
            End Set
        End Property
        
        Public Property SafeStock As Decimal
            Get
                Return CType(Me(Me.tableProduct.SafeStockColumn),Decimal)
            End Get
            Set
                Me(Me.tableProduct.SafeStockColumn) = value
            End Set
        End Property
        
        Public Property LastPurchaseDate As Date
            Get
                Try 
                    Return CType(Me(Me.tableProduct.LastPurchaseDateColumn),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableProduct.LastPurchaseDateColumn) = value
            End Set
        End Property
        
        Public Property LastDeliveryDate As Date
            Get
                Try 
                    Return CType(Me(Me.tableProduct.LastDeliveryDateColumn),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableProduct.LastDeliveryDateColumn) = value
            End Set
        End Property
        
        Public Property Quantity As Decimal
            Get
                Return CType(Me(Me.tableProduct.QuantityColumn),Decimal)
            End Get
            Set
                Me(Me.tableProduct.QuantityColumn) = value
            End Set
        End Property
        
        Public Function IsLastPurchaseDateNull() As Boolean
            Return Me.IsNull(Me.tableProduct.LastPurchaseDateColumn)
        End Function
        
        Public Sub SetLastPurchaseDateNull()
            Me(Me.tableProduct.LastPurchaseDateColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsLastDeliveryDateNull() As Boolean
            Return Me.IsNull(Me.tableProduct.LastDeliveryDateColumn)
        End Function
        
        Public Sub SetLastDeliveryDateNull()
            Me(Me.tableProduct.LastDeliveryDateColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class ProductRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As ProductRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As ProductRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As ProductRow
            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 CustomerDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnCustomerID As DataColumn
        
        Private columnCustomerAttribName As DataColumn
        
        Private columnCustomerName As DataColumn
        
        Private columnInvoiceNo As DataColumn
        
        Private columnOwner As DataColumn
        
        Private columnRocID As DataColumn
        
        Private columnContactMan1 As DataColumn
        
        Private columnContactMan2 As DataColumn
        
        Private columnContactPhone1 As DataColumn
        
        Private columnContactPhone2 As DataColumn
        
        Private columnFax As DataColumn
        
        Private columnSalesManID As DataColumn
        
        Private columnCustomerAddress As DataColumn
        
        Private columnDeliveryAddress As DataColumn
        
        Private columnInvoiceAddress As DataColumn
        
        Private columnPayDays As DataColumn
        
        Private columnCreditLine As DataColumn
        
        Private columnCreditBalance As DataColumn
        
        Private columnLastDeliveryDate As DataColumn
        
        Private columnAdvance As DataColumn
        
        Friend Sub New()
            MyBase.New("Customer")
            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 CustomerIDColumn As DataColumn
            Get
                Return Me.columnCustomerID
            End Get
        End Property
        
        Friend ReadOnly Property CustomerAttribNameColumn As DataColumn
            Get
                Return Me.columnCustomerAttribName
            End Get
        End Property
        
        Friend ReadOnly Property CustomerNameColumn As DataColumn
            Get
                Return Me.columnCustomerName
            End Get
        End Property
        
        Friend ReadOnly Property InvoiceNoColumn As DataColumn
            Get
                Return Me.columnInvoiceNo
            End Get
        End Property
        
        Friend ReadOnly Property OwnerColumn As DataColumn
            Get
                Return Me.columnOwner
            End Get
        End Property
        
        Friend ReadOnly Property RocIDColumn As DataColumn
            Get
                Return Me.columnRocID
            End Get
        End Property
        
        Friend ReadOnly Property ContactMan1Column As DataColumn
            Get
                Return Me.columnContactMan1
            End Get
        End Property
        
        Friend ReadOnly Property ContactMan2Column As DataColumn
            Get
                Return Me.columnContactMan2
            End Get
        End Property
        
        Friend ReadOnly Property ContactPhone1Column As DataColumn
            Get
                Return Me.columnContactPhone1
            End Get
        End Property
        
        Friend ReadOnly Property ContactPhone2Column As DataColumn
            Get
                Return Me.columnContactPhone2
            End Get
        End Property
        
        Friend ReadOnly Property FaxColumn As DataColumn
            Get
                Return Me.columnFax

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -