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

📄 invschema.vb

📁 vb.net MCP课程的英文讲义,70-310课程,值得一读
💻 VB
📖 第 1 页 / 共 2 页
字号:
            Get
                Return Me.Rows.Count
            End Get
        End Property
        
        Friend ReadOnly Property InvoiceIDColumn As DataColumn
            Get
                Return Me.columnInvoiceID
            End Get
        End Property
        
        Friend ReadOnly Property AmountColumn As DataColumn
            Get
                Return Me.columnAmount
            End Get
        End Property
        
        Friend ReadOnly Property CurrencyNameColumn As DataColumn
            Get
                Return Me.columnCurrencyName
            End Get
        End Property
        
        Friend ReadOnly Property CustomerIDColumn As DataColumn
            Get
                Return Me.columnCustomerID
            End Get
        End Property
        
        Friend ReadOnly Property DeliveryIDColumn As DataColumn
            Get
                Return Me.columnDeliveryID
            End Get
        End Property
        
        Friend ReadOnly Property DueDateColumn As DataColumn
            Get
                Return Me.columnDueDate
            End Get
        End Property
        
        Friend ReadOnly Property PaymentIDColumn As DataColumn
            Get
                Return Me.columnPaymentID
            End Get
        End Property
        
        Friend ReadOnly Property Document_IdColumn As DataColumn
            Get
                Return Me.columnDocument_Id
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As InvoicesRow
            Get
                Return CType(Me.Rows(index),InvoicesRow)
            End Get
        End Property
        
        Public Event InvoicesRowChanged As InvoicesRowChangeEventHandler
        
        Public Event InvoicesRowChanging As InvoicesRowChangeEventHandler
        
        Public Event InvoicesRowDeleted As InvoicesRowChangeEventHandler
        
        Public Event InvoicesRowDeleting As InvoicesRowChangeEventHandler
        
        Public Overloads Sub AddInvoicesRow(ByVal row As InvoicesRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddInvoicesRow(ByVal Amount As Decimal, ByVal CurrencyName As String, ByVal CustomerID As Integer, ByVal DeliveryID As Integer, ByVal DueDate As Date, ByVal PaymentID As Integer, ByVal parentDocumentRowByDocument_Invoices As DocumentRow) As InvoicesRow
            Dim rowInvoicesRow As InvoicesRow = CType(Me.NewRow,InvoicesRow)
            rowInvoicesRow.ItemArray = New Object() {Nothing, Amount, CurrencyName, CustomerID, DeliveryID, DueDate, PaymentID, parentDocumentRowByDocument_Invoices(0)}
            Me.Rows.Add(rowInvoicesRow)
            Return rowInvoicesRow
        End Function
        
        Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        Private Sub InitClass()
            Me.columnInvoiceID = New DataColumn("InvoiceID", GetType(System.Int32), "", System.Data.MappingType.Element)
            Me.columnInvoiceID.AutoIncrement = true
            Me.columnInvoiceID.AllowDBNull = false
            Me.columnInvoiceID.ReadOnly = true
            Me.Columns.Add(Me.columnInvoiceID)
            Me.columnAmount = New DataColumn("Amount", GetType(System.Decimal), "", System.Data.MappingType.Element)
            Me.columnAmount.AllowDBNull = false
            Me.Columns.Add(Me.columnAmount)
            Me.columnCurrencyName = New DataColumn("CurrencyName", GetType(System.String), "", System.Data.MappingType.Element)
            Me.columnCurrencyName.AllowDBNull = false
            Me.Columns.Add(Me.columnCurrencyName)
            Me.columnCustomerID = New DataColumn("CustomerID", GetType(System.Int32), "", System.Data.MappingType.Element)
            Me.columnCustomerID.AllowDBNull = false
            Me.Columns.Add(Me.columnCustomerID)
            Me.columnDeliveryID = New DataColumn("DeliveryID", GetType(System.Int32), "", System.Data.MappingType.Element)
            Me.columnDeliveryID.AllowDBNull = false
            Me.Columns.Add(Me.columnDeliveryID)
            Me.columnDueDate = New DataColumn("DueDate", GetType(System.DateTime), "", System.Data.MappingType.Element)
            Me.columnDueDate.AllowDBNull = false
            Me.Columns.Add(Me.columnDueDate)
            Me.columnPaymentID = New DataColumn("PaymentID", GetType(System.Int32), "", System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnPaymentID)
            Me.columnDocument_Id = New DataColumn("Document_Id", GetType(System.Int32), "", System.Data.MappingType.Hidden)
            Me.Columns.Add(Me.columnDocument_Id)
        End Sub
        
        Public Function NewInvoicesRow() As InvoicesRow
            Return CType(Me.NewRow,InvoicesRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            'We need to ensure that all Rows in the tabled are typed rows.
            'Table calls newRow whenever it needs to create a row.
            'So the following conditions are covered by Row newRow(Record record)
            '* Cursor calls table.addRecord(record) 
            '* table.addRow(object[] values) calls newRow(record)    
            Return New InvoicesRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(InvoicesRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.InvoicesRowChangedEvent) Is Nothing) Then
                RaiseEvent InvoicesRowChanged(Me, New InvoicesRowChangeEvent(CType(e.Row,InvoicesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.InvoicesRowChangingEvent) Is Nothing) Then
                RaiseEvent InvoicesRowChanging(Me, New InvoicesRowChangeEvent(CType(e.Row,InvoicesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.InvoicesRowDeletedEvent) Is Nothing) Then
                RaiseEvent InvoicesRowDeleted(Me, New InvoicesRowChangeEvent(CType(e.Row,InvoicesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.InvoicesRowDeletingEvent) Is Nothing) Then
                RaiseEvent InvoicesRowDeleting(Me, New InvoicesRowChangeEvent(CType(e.Row,InvoicesRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveInvoicesRow(ByVal row As InvoicesRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    Public Class InvoicesRow
        Inherits DataRow
        
        Private tableInvoices As InvoicesDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableInvoices = CType(Me.Table,InvoicesDataTable)
        End Sub
        
        Public Property InvoiceID As Integer
            Get
                Return CType(Me(Me.tableInvoices.InvoiceIDColumn),Integer)
            End Get
            Set
                Me(Me.tableInvoices.InvoiceIDColumn) = value
            End Set
        End Property
        
        Public Property Amount As Decimal
            Get
                Return CType(Me(Me.tableInvoices.AmountColumn),Decimal)
            End Get
            Set
                Me(Me.tableInvoices.AmountColumn) = value
            End Set
        End Property
        
        Public Property CurrencyName As String
            Get
                Return CType(Me(Me.tableInvoices.CurrencyNameColumn),String)
            End Get
            Set
                Me(Me.tableInvoices.CurrencyNameColumn) = value
            End Set
        End Property
        
        Public Property CustomerID As Integer
            Get
                Return CType(Me(Me.tableInvoices.CustomerIDColumn),Integer)
            End Get
            Set
                Me(Me.tableInvoices.CustomerIDColumn) = value
            End Set
        End Property
        
        Public Property DeliveryID As Integer
            Get
                Return CType(Me(Me.tableInvoices.DeliveryIDColumn),Integer)
            End Get
            Set
                Me(Me.tableInvoices.DeliveryIDColumn) = value
            End Set
        End Property
        
        Public Property DueDate As Date
            Get
                Return CType(Me(Me.tableInvoices.DueDateColumn),Date)
            End Get
            Set
                Me(Me.tableInvoices.DueDateColumn) = value
            End Set
        End Property
        
        Public Property PaymentID As Integer
            Get
                Try 
                    Return CType(Me(Me.tableInvoices.PaymentIDColumn),Integer)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableInvoices.PaymentIDColumn) = value
            End Set
        End Property
        
        Public Property DocumentRow As DocumentRow
            Get
                Return CType(Me.GetParentRow(Me.Table.ParentRelations("Document_Invoices")),DocumentRow)
            End Get
            Set
                Me.SetParentRow(value, Me.Table.ParentRelations("Document_Invoices"))
            End Set
        End Property
        
        Public Function IsPaymentIDNull() As Boolean
            Return Me.IsNull(Me.tableInvoices.PaymentIDColumn)
        End Function
        
        Public Sub SetPaymentIDNull()
            Me(Me.tableInvoices.PaymentIDColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    Public Class InvoicesRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As InvoicesRow
        
        Private eventAction As System.Data.DataRowAction
        
        Public Sub New(ByVal row As InvoicesRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As InvoicesRow
            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 + -