wblprojects.vb

来自「Beginning VB.NET DatabasesAll_Code.rar」· VB 代码 · 共 81 行

VB
81
字号
Public Class WBLProjects
    Implements IDisposable

#Region " Class Level Variables "
    Private objWDAProject As WroxDataAccess.WDAProjects
#End Region

#Region " Constructor and Destructor "
    Public Sub New(ByVal Company As String, ByVal Application As String)
        objWDAProject = New WroxDataAccess.WDAProjects(Company, Application)
    End Sub

    Public Sub Dispose() Implements System.IDisposable.Dispose
        objWDAProject.Dispose()
        objWDAProject = Nothing
    End Sub
#End Region

#Region " Public Group Functions "
    Public Function GetProjects() As DataSet
        Try
            'Call the data component to get all projects
            GetProjects = objWDAProject.GetProjects
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function

    Public Function GetProject(ByVal ProjectID As Guid) As DataSet
        Try
            'Call the data component to get a specific project
            GetProject = objWDAProject.GetProject(ProjectID)
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function

    Public Function GetNewProjectDS() As DataSet
        Try
            'Return the Project schema as a DataSet
            GetNewProjectDS = New Project
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function

    Public Function AddProject(ByVal Project As DataSet) As Boolean
        Try
            'Call the data component to add the project
            Return objWDAProject.AddProject(Project)
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function

    Public Function UpdateProject(ByVal Project As DataSet) As Boolean
        Try
            'Call the data component to update the project
            Return objWDAProject.UpdateProject(Project)
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function

    Public Function DeleteProject(ByVal ProjectID As Guid) As Boolean
        Try
            'Call the data component to delete the project
            Return objWDAProject.DeleteProject(ProjectID)
        Catch ExceptionErr As Exception
            Throw New System.Exception(ExceptionErr.Message, _
                ExceptionErr.InnerException)
        End Try
    End Function
#End Region
End Class

⌨️ 快捷键说明

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