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

📄 dspr110.vb

📁 通用进销存-visual basic编写
💻 VB
📖 第 1 页 / 共 3 页
字号:
        
        Private tablePurchaseMaster As PurchaseMasterDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tablePurchaseMaster = CType(Me.Table,PurchaseMasterDataTable)
        End Sub
        
        Public Property PurchaseID As String
            Get
                Return CType(Me(Me.tablePurchaseMaster.PurchaseIDColumn),String)
            End Get
            Set
                Me(Me.tablePurchaseMaster.PurchaseIDColumn) = value
            End Set
        End Property
        
        Public Property PurchaseDate As Date
            Get
                Return CType(Me(Me.tablePurchaseMaster.PurchaseDateColumn),Date)
            End Get
            Set
                Me(Me.tablePurchaseMaster.PurchaseDateColumn) = value
            End Set
        End Property
        
        Public Property SupplierID As String
            Get
                Return CType(Me(Me.tablePurchaseMaster.SupplierIDColumn),String)
            End Get
            Set
                Me(Me.tablePurchaseMaster.SupplierIDColumn) = value
            End Set
        End Property
        
        Public Property PurchaseProperty As String
            Get
                Return CType(Me(Me.tablePurchaseMaster.PurchasePropertyColumn),String)
            End Get
            Set
                Me(Me.tablePurchaseMaster.PurchasePropertyColumn) = value
            End Set
        End Property
        
        Public Property InvoiceNo As String
            Get
                Try 
                    Return CType(Me(Me.tablePurchaseMaster.InvoiceNoColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePurchaseMaster.InvoiceNoColumn) = value
            End Set
        End Property
        
        Public Property SubTotal As Decimal
            Get
                Return CType(Me(Me.tablePurchaseMaster.SubTotalColumn),Decimal)
            End Get
            Set
                Me(Me.tablePurchaseMaster.SubTotalColumn) = value
            End Set
        End Property
        
        Public Property ValueAddTax As Decimal
            Get
                Return CType(Me(Me.tablePurchaseMaster.ValueAddTaxColumn),Decimal)
            End Get
            Set
                Me(Me.tablePurchaseMaster.ValueAddTaxColumn) = value
            End Set
        End Property
        
        Public Property Amount As Decimal
            Get
                Return CType(Me(Me.tablePurchaseMaster.AmountColumn),Decimal)
            End Get
            Set
                Me(Me.tablePurchaseMaster.AmountColumn) = value
            End Set
        End Property
        
        Public Property AccountPayable As Decimal
            Get
                Return CType(Me(Me.tablePurchaseMaster.AccountPayableColumn),Decimal)
            End Get
            Set
                Me(Me.tablePurchaseMaster.AccountPayableColumn) = value
            End Set
        End Property
        
        Public Property Paid As Decimal
            Get
                Return CType(Me(Me.tablePurchaseMaster.PaidColumn),Decimal)
            End Get
            Set
                Me(Me.tablePurchaseMaster.PaidColumn) = value
            End Set
        End Property
        
        Public Property LimitDate As Date
            Get
                Try 
                    Return CType(Me(Me.tablePurchaseMaster.LimitDateColumn),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePurchaseMaster.LimitDateColumn) = value
            End Set
        End Property
        
        Public Function IsInvoiceNoNull() As Boolean
            Return Me.IsNull(Me.tablePurchaseMaster.InvoiceNoColumn)
        End Function
        
        Public Sub SetInvoiceNoNull()
            Me(Me.tablePurchaseMaster.InvoiceNoColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsLimitDateNull() As Boolean
            Return Me.IsNull(Me.tablePurchaseMaster.LimitDateColumn)
        End Function
        
        Public Sub SetLimitDateNull()
            Me(Me.tablePurchaseMaster.LimitDateColumn) = System.Convert.DBNull
        End Sub
        
        Public Function GetPurchaseDetailRows() As PurchaseDetailRow()
            Return CType(Me.GetChildRows(Me.Table.ChildRelations("PurchaseMasterPurchaseDetail")),PurchaseDetailRow())
        End Function
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class PurchaseMasterRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As PurchaseMasterRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As PurchaseMasterRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As PurchaseMasterRow
            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 SupplierDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnSupplierID As DataColumn
        
        Private columnSupplierAttribName As DataColumn
        
        Friend Sub New()
            MyBase.New("Supplier")
            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 SupplierIDColumn As DataColumn
            Get
                Return Me.columnSupplierID
            End Get
        End Property
        
        Friend ReadOnly Property SupplierAttribNameColumn As DataColumn
            Get
                Return Me.columnSupplierAttribName
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As SupplierRow
            Get
                Return CType(Me.Rows(index),SupplierRow)
            End Get
        End Property
        
        Public Event SupplierRowChanged As SupplierRowChangeEventHandler
        
        Public Event SupplierRowChanging As SupplierRowChangeEventHandler
        
        Public Event SupplierRowDeleted As SupplierRowChangeEventHandler
        
        Public Event SupplierRowDeleting As SupplierRowChangeEventHandler
        
        Public Overloads Sub AddSupplierRow(ByVal row As SupplierRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddSupplierRow(ByVal SupplierID As String, ByVal SupplierAttribName As String) As SupplierRow
            Dim rowSupplierRow As SupplierRow = CType(Me.NewRow,SupplierRow)
            rowSupplierRow.ItemArray = New Object() {SupplierID, SupplierAttribName}
            Me.Rows.Add(rowSupplierRow)
            Return rowSupplierRow
        End Function
        
        Public Function FindBySupplierID(ByVal SupplierID As String) As SupplierRow
            Return CType(Me.Rows.Find(New Object() {SupplierID}),SupplierRow)
        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 SupplierDataTable = CType(MyBase.Clone,SupplierDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Friend Sub InitVars()
            Me.columnSupplierID = Me.Columns("SupplierID")
            Me.columnSupplierAttribName = Me.Columns("SupplierAttribName")
        End Sub
        
        Private Sub InitClass()
            Me.columnSupplierID = New DataColumn("SupplierID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnSupplierID)
            Me.columnSupplierAttribName = New DataColumn("SupplierAttribName", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnSupplierAttribName)
            Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnSupplierID}, true))
            Me.columnSupplierID.AllowDBNull = false
            Me.columnSupplierID.Unique = true
            Me.columnSupplierAttribName.AllowDBNull = false
        End Sub
        
        Public Function NewSupplierRow() As SupplierRow
            Return CType(Me.NewRow,SupplierRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New SupplierRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(SupplierRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.SupplierRowChangedEvent) Is Nothing) Then
                RaiseEvent SupplierRowChanged(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.SupplierRowChangingEvent) Is Nothing) Then
                RaiseEvent SupplierRowChanging(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.SupplierRowDeletedEvent) Is Nothing) Then
                RaiseEvent SupplierRowDeleted(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.SupplierRowDeletingEvent) Is Nothing) Then
                RaiseEvent SupplierRowDeleting(Me, New SupplierRowChangeEvent(CType(e.Row,SupplierRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveSupplierRow(ByVal row As SupplierRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class SupplierRow
        Inherits DataRow
        
        Private tableSupplier As SupplierDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableSupplier = CType(Me.Table,SupplierDataTable)
        End Sub
        
        Public Property SupplierID As String
            Get
                Return CType(Me(Me.tableSupplier.SupplierIDColumn),String)
            End Get
            Set
                Me(Me.tableSupplier.SupplierIDColumn) = value
            End Set
        End Property
        
        Public Property SupplierAttribName As String
            Get
                Return CType(Me(Me.tableSupplier.SupplierAttribNameColumn),String)
            End Get
            Set
                Me(Me.tableSupplier.SupplierAttribNameColumn) = value
            End Set
        End Property
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class SupplierRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As SupplierRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As SupplierRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As SupplierRow
            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 + -