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

📄 dsba220.vb

📁 通用进销存-visual basic编写
💻 VB
📖 第 1 页 / 共 4 页
字号:
            End Get
        End Property
        
        Friend ReadOnly Property PayDaysColumn As DataColumn
            Get
                Return Me.columnPayDays
            End Get
        End Property
        
        Friend ReadOnly Property CreditLineColumn As DataColumn
            Get
                Return Me.columnCreditLine
            End Get
        End Property
        
        Friend ReadOnly Property CreditBalanceColumn As DataColumn
            Get
                Return Me.columnCreditBalance
            End Get
        End Property
        
        Friend ReadOnly Property LastDeliveryDateColumn As DataColumn
            Get
                Return Me.columnLastDeliveryDate
            End Get
        End Property
        
        Friend ReadOnly Property AdvanceColumn As DataColumn
            Get
                Return Me.columnAdvance
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As CustomerRow
            Get
                Return CType(Me.Rows(index),CustomerRow)
            End Get
        End Property
        
        Public Event CustomerRowChanged As CustomerRowChangeEventHandler
        
        Public Event CustomerRowChanging As CustomerRowChangeEventHandler
        
        Public Event CustomerRowDeleted As CustomerRowChangeEventHandler
        
        Public Event CustomerRowDeleting As CustomerRowChangeEventHandler
        
        Public Overloads Sub AddCustomerRow(ByVal row As CustomerRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddCustomerRow( _
                    ByVal CustomerID As String,  _
                    ByVal CustomerAttribName As String,  _
                    ByVal CustomerName As String,  _
                    ByVal InvoiceNo As String,  _
                    ByVal Owner As String,  _
                    ByVal RocID As String,  _
                    ByVal ContactMan1 As String,  _
                    ByVal ContactMan2 As String,  _
                    ByVal ContactPhone1 As String,  _
                    ByVal ContactPhone2 As String,  _
                    ByVal Fax As String,  _
                    ByVal SalesManID As String,  _
                    ByVal CustomerAddress As String,  _
                    ByVal DeliveryAddress As String,  _
                    ByVal InvoiceAddress As String,  _
                    ByVal PayDays As Decimal,  _
                    ByVal CreditLine As Decimal,  _
                    ByVal CreditBalance As Decimal,  _
                    ByVal LastDeliveryDate As Date,  _
                    ByVal Advance As Decimal) As CustomerRow
            Dim rowCustomerRow As CustomerRow = CType(Me.NewRow,CustomerRow)
            rowCustomerRow.ItemArray = New Object() {CustomerID, CustomerAttribName, CustomerName, InvoiceNo, Owner, RocID, ContactMan1, ContactMan2, ContactPhone1, ContactPhone2, Fax, SalesManID, CustomerAddress, DeliveryAddress, InvoiceAddress, PayDays, CreditLine, CreditBalance, LastDeliveryDate, Advance}
            Me.Rows.Add(rowCustomerRow)
            Return rowCustomerRow
        End Function
        
        Public Function FindByCustomerID(ByVal CustomerID As String) As CustomerRow
            Return CType(Me.Rows.Find(New Object() {CustomerID}),CustomerRow)
        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 CustomerDataTable = CType(MyBase.Clone,CustomerDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Friend Sub InitVars()
            Me.columnCustomerID = Me.Columns("CustomerID")
            Me.columnCustomerAttribName = Me.Columns("CustomerAttribName")
            Me.columnCustomerName = Me.Columns("CustomerName")
            Me.columnInvoiceNo = Me.Columns("InvoiceNo")
            Me.columnOwner = Me.Columns("Owner")
            Me.columnRocID = Me.Columns("RocID")
            Me.columnContactMan1 = Me.Columns("ContactMan1")
            Me.columnContactMan2 = Me.Columns("ContactMan2")
            Me.columnContactPhone1 = Me.Columns("ContactPhone1")
            Me.columnContactPhone2 = Me.Columns("ContactPhone2")
            Me.columnFax = Me.Columns("Fax")
            Me.columnSalesManID = Me.Columns("SalesManID")
            Me.columnCustomerAddress = Me.Columns("CustomerAddress")
            Me.columnDeliveryAddress = Me.Columns("DeliveryAddress")
            Me.columnInvoiceAddress = Me.Columns("InvoiceAddress")
            Me.columnPayDays = Me.Columns("PayDays")
            Me.columnCreditLine = Me.Columns("CreditLine")
            Me.columnCreditBalance = Me.Columns("CreditBalance")
            Me.columnLastDeliveryDate = Me.Columns("LastDeliveryDate")
            Me.columnAdvance = Me.Columns("Advance")
        End Sub
        
        Private Sub InitClass()
            Me.columnCustomerID = New DataColumn("CustomerID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCustomerID)
            Me.columnCustomerAttribName = New DataColumn("CustomerAttribName", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCustomerAttribName)
            Me.columnCustomerName = New DataColumn("CustomerName", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCustomerName)
            Me.columnInvoiceNo = New DataColumn("InvoiceNo", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnInvoiceNo)
            Me.columnOwner = New DataColumn("Owner", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnOwner)
            Me.columnRocID = New DataColumn("RocID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnRocID)
            Me.columnContactMan1 = New DataColumn("ContactMan1", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnContactMan1)
            Me.columnContactMan2 = New DataColumn("ContactMan2", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnContactMan2)
            Me.columnContactPhone1 = New DataColumn("ContactPhone1", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnContactPhone1)
            Me.columnContactPhone2 = New DataColumn("ContactPhone2", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnContactPhone2)
            Me.columnFax = New DataColumn("Fax", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnFax)
            Me.columnSalesManID = New DataColumn("SalesManID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnSalesManID)
            Me.columnCustomerAddress = New DataColumn("CustomerAddress", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCustomerAddress)
            Me.columnDeliveryAddress = New DataColumn("DeliveryAddress", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnDeliveryAddress)
            Me.columnInvoiceAddress = New DataColumn("InvoiceAddress", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnInvoiceAddress)
            Me.columnPayDays = New DataColumn("PayDays", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnPayDays)
            Me.columnCreditLine = New DataColumn("CreditLine", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCreditLine)
            Me.columnCreditBalance = New DataColumn("CreditBalance", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCreditBalance)
            Me.columnLastDeliveryDate = New DataColumn("LastDeliveryDate", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnLastDeliveryDate)
            Me.columnAdvance = New DataColumn("Advance", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnAdvance)
            Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnCustomerID}, true))
            Me.columnCustomerID.AllowDBNull = false
            Me.columnCustomerID.Unique = true
            Me.columnCustomerAttribName.AllowDBNull = false
            Me.columnSalesManID.AllowDBNull = false
            Me.columnPayDays.AllowDBNull = false
            Me.columnCreditLine.AllowDBNull = false
        End Sub
        
        Public Function NewCustomerRow() As CustomerRow
            Return CType(Me.NewRow,CustomerRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New CustomerRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(CustomerRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.CustomerRowChangedEvent) Is Nothing) Then
                RaiseEvent CustomerRowChanged(Me, New CustomerRowChangeEvent(CType(e.Row,CustomerRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.CustomerRowChangingEvent) Is Nothing) Then
                RaiseEvent CustomerRowChanging(Me, New CustomerRowChangeEvent(CType(e.Row,CustomerRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.CustomerRowDeletedEvent) Is Nothing) Then
                RaiseEvent CustomerRowDeleted(Me, New CustomerRowChangeEvent(CType(e.Row,CustomerRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.CustomerRowDeletingEvent) Is Nothing) Then
                RaiseEvent CustomerRowDeleting(Me, New CustomerRowChangeEvent(CType(e.Row,CustomerRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveCustomerRow(ByVal row As CustomerRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class CustomerRow
        Inherits DataRow
        
        Private tableCustomer As CustomerDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableCustomer = CType(Me.Table,CustomerDataTable)
        End Sub
        
        Public Property CustomerID As String
            Get
                Return CType(Me(Me.tableCustomer.CustomerIDColumn),String)
            End Get
            Set
                Me(Me.tableCustomer.CustomerIDColumn) = value
            End Set
        End Property
        
        Public Property CustomerAttribName As String
            Get
                Return CType(Me(Me.tableCustomer.CustomerAttribNameColumn),String)
            End Get
            Set
                Me(Me.tableCustomer.CustomerAttribNameColumn) = value
            End Set
        End Property
        
        Public Property CustomerName As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.CustomerNameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.CustomerNameColumn) = value
            End Set
        End Property
        
        Public Property InvoiceNo As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.InvoiceNoColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.InvoiceNoColumn) = value
            End Set
        End Property
        
        Public Property Owner As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.OwnerColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.OwnerColumn) = value
            End Set
        End Property
        
        Public Property RocID As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.RocIDColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.RocIDColumn) = value
            End Set
        End Property
        
        Public Property ContactMan1 As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.ContactMan1Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.ContactMan1Column) = value
            End Set
        End Property
        
        Public Property ContactMan2 As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.ContactMan2Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomer.ContactMan2Column) = value
            End Set
        End Property
        
        Public Property ContactPhone1 As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomer.ContactPhone1Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("無法取得值,因為它是 DBNull。", e)
                End Try
            End Get
            Set

⌨️ 快捷键说明

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