📄 wblgroups.vb
字号:
Public Class WBLGroups
Implements IDisposable
'Private variables and objects
Private objWDAGroups As WroxDataAccess.WDAGroups
Private disposed As Boolean = False
#Region " Constructor and Destructor "
Public Sub New(ByVal Company As String, ByVal Application As String)
objWDAGroups = New WroxDataAccess.WDAGroups(Company, Application)
End Sub
' IDisposable
Private Overloads Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposed Then
If disposing Then
' TODO: put code to dispose managed resources
End If
objWDAGroups.Dispose()
objWDAGroups = Nothing
End If
Me.disposed = True
End Sub
#End Region
#Region " IDisposable Support "
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Overloads Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Protected Overrides Sub Finalize()
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(False)
MyBase.Finalize()
End Sub
#End Region
#Region " Public Group Functions "
Public Function GetGroups() As DataSet
Try
'Call the data component to get all groups
GetGroups = objWDAGroups.GetGroups
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetGroup(ByVal GroupID As Guid) As DataSet
Try
'Call the data component to get a specific group
GetGroup = objWDAGroups.GetGroup(GroupID)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetNewGroupDS() As DataSet
Try
'Instantiate a new DataSet object
GetNewGroupDS = New DataSet
'Create a DataTable object
Dim objDataTable As DataTable = GetNewGroupDS.Tables.Add("Group")
'Create a DataColumn object
Dim objDataColumn As DataColumn
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("GroupID", _
Type.GetType("System.Guid"))
objDataColumn.AllowDBNull = False
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("GroupName", _
Type.GetType("System.String"))
objDataColumn.AllowDBNull = False
objDataColumn.MaxLength = 50
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("GroupDescription", _
Type.GetType("System.String"))
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function AddGroup(ByVal Group As DataSet) As Boolean
Try
'Call the data component to add the new group
Return objWDAGroups.AddGroup(Group)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function UpdateGroup(ByVal Group As DataSet) As Boolean
Try
'Call the data component to update the group
Return objWDAGroups.UpdateGroup(Group)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function DeleteGroup(ByVal GroupID As Guid) As Boolean
Try
'Call the data component to delete the group
Return objWDAGroups.DeleteGroup(GroupID)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
#End Region
#Region " Public Group Projects Functions "
Public Function GetGroupProjects(ByVal GroupID As Guid) As DataSet
Try
'Call the data component to get all group projects
GetGroupProjects = objWDAGroups.GetGroupProjects(GroupID)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetNewGroupProjectsDS() As DataSet
Try
'Instantiate a new DataSet object
GetNewGroupProjectsDS = New DataSet
'Create a DataTable object
Dim objDataTable As DataTable = _
GetNewGroupProjectsDS.Tables.Add("GroupProjects")
'Create a DataColumn object
Dim objDataColumn As DataColumn
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("GroupProjectID", _
Type.GetType("System.Guid"))
objDataColumn.AllowDBNull = False
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("GroupID", _
Type.GetType("System.Guid"))
objDataColumn.AllowDBNull = False
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
'Instantiate a new DataColumn and set its properties
objDataColumn = New DataColumn("ProjectID", _
Type.GetType("System.Guid"))
objDataColumn.AllowDBNull = False
'Add the column to the table
objDataTable.Columns.Add(objDataColumn)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function AddGroupProjects(ByVal GroupProjects As DataSet) As Boolean
Try
'Call the data component to add the group projects
Return objWDAGroups.AddGroupProjects(GroupProjects)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function DeleteGroupProjects(ByVal GroupID As Guid) As Boolean
Try
'Call the data component to delete the group projects
Return objWDAGroups.DeleteGroupProjects(GroupID)
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -