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

📄 dsborrow.vb

📁 ASP.NET+sql开发的图书管理系统
💻 VB
📖 第 1 页 / 共 2 页
字号:
            Me.column书名 = Me.Columns("书名")
            Me.column作者 = Me.Columns("作者")
            Me.column出版社 = Me.Columns("出版社")
            Me.column单价 = Me.Columns("单价")
            Me.column页码 = Me.Columns("页码")
            Me.column出版日期 = Me.Columns("出版日期")
            Me.column借阅日期 = Me.Columns("借阅日期")
            Me.column应还日期 = Me.Columns("应还日期")
        End Sub
        
        Private Sub InitClass()
            Me.column图书编号 = New DataColumn("图书编号", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column图书编号)
            Me.column书名 = New DataColumn("书名", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column书名)
            Me.column作者 = New DataColumn("作者", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column作者)
            Me.column出版社 = New DataColumn("出版社", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column出版社)
            Me.column单价 = New DataColumn("单价", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column单价)
            Me.column页码 = New DataColumn("页码", GetType(System.Int16), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column页码)
            Me.column出版日期 = New DataColumn("出版日期", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column出版日期)
            Me.column借阅日期 = New DataColumn("借阅日期", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column借阅日期)
            Me.column应还日期 = New DataColumn("应还日期", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column应还日期)
            Me.column图书编号.AllowDBNull = false
            Me.column书名.AllowDBNull = false
            Me.column应还日期.ReadOnly = true
        End Sub
        
        Public Function NewBorrowRow() As BorrowRow
            Return CType(Me.NewRow,BorrowRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New BorrowRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(BorrowRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.BorrowRowChangedEvent) Is Nothing) Then
                RaiseEvent BorrowRowChanged(Me, New BorrowRowChangeEvent(CType(e.Row,BorrowRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.BorrowRowChangingEvent) Is Nothing) Then
                RaiseEvent BorrowRowChanging(Me, New BorrowRowChangeEvent(CType(e.Row,BorrowRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.BorrowRowDeletedEvent) Is Nothing) Then
                RaiseEvent BorrowRowDeleted(Me, New BorrowRowChangeEvent(CType(e.Row,BorrowRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.BorrowRowDeletingEvent) Is Nothing) Then
                RaiseEvent BorrowRowDeleting(Me, New BorrowRowChangeEvent(CType(e.Row,BorrowRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveBorrowRow(ByVal row As BorrowRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class BorrowRow
        Inherits DataRow
        
        Private tableBorrow As BorrowDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableBorrow = CType(Me.Table,BorrowDataTable)
        End Sub
        
        Public Property 图书编号 As String
            Get
                Return CType(Me(Me.tableBorrow.图书编号Column),String)
            End Get
            Set
                Me(Me.tableBorrow.图书编号Column) = value
            End Set
        End Property
        
        Public Property 书名 As String
            Get
                Return CType(Me(Me.tableBorrow.书名Column),String)
            End Get
            Set
                Me(Me.tableBorrow.书名Column) = value
            End Set
        End Property
        
        Public Property 作者 As String
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.作者Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.作者Column) = value
            End Set
        End Property
        
        Public Property 出版社 As String
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.出版社Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.出版社Column) = value
            End Set
        End Property
        
        Public Property 单价 As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.单价Column),Decimal)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.单价Column) = value
            End Set
        End Property
        
        Public Property 页码 As Short
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.页码Column),Short)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.页码Column) = value
            End Set
        End Property
        
        Public Property 出版日期 As Date
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.出版日期Column),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.出版日期Column) = value
            End Set
        End Property
        
        Public Property 借阅日期 As Date
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.借阅日期Column),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.借阅日期Column) = value
            End Set
        End Property
        
        Public Property 应还日期 As Date
            Get
                Try 
                    Return CType(Me(Me.tableBorrow.应还日期Column),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableBorrow.应还日期Column) = value
            End Set
        End Property
        
        Public Function Is作者Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.作者Column)
        End Function
        
        Public Sub Set作者Null()
            Me(Me.tableBorrow.作者Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is出版社Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.出版社Column)
        End Function
        
        Public Sub Set出版社Null()
            Me(Me.tableBorrow.出版社Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is单价Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.单价Column)
        End Function
        
        Public Sub Set单价Null()
            Me(Me.tableBorrow.单价Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is页码Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.页码Column)
        End Function
        
        Public Sub Set页码Null()
            Me(Me.tableBorrow.页码Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is出版日期Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.出版日期Column)
        End Function
        
        Public Sub Set出版日期Null()
            Me(Me.tableBorrow.出版日期Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is借阅日期Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.借阅日期Column)
        End Function
        
        Public Sub Set借阅日期Null()
            Me(Me.tableBorrow.借阅日期Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is应还日期Null() As Boolean
            Return Me.IsNull(Me.tableBorrow.应还日期Column)
        End Function
        
        Public Sub Set应还日期Null()
            Me(Me.tableBorrow.应还日期Column) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class BorrowRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As BorrowRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As BorrowRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As BorrowRow
            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 + -