📄 wdagroups.vb
字号:
Public Class WDAGroups
Inherits WDABase
#Region " Constructor and Destructor "
Public Sub New(ByVal Company As String, ByVal Application As String)
MyBase.New(Company, Application)
End Sub
Public Shadows Sub Dispose()
MyBase.Dispose()
End Sub
#End Region
#Region " Public Group Functions "
Public Function GetGroups() As DataSet
Try
GetGroups = New DataSet
MyBase.SQL = "usp_SelectGroups"
'Fill the DataSet
MyBase.FillDataSet(GetGroups, "Groups")
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
GetGroup = New DataSet
MyBase.SQL = "usp_SelectGroup"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@GroupID", SqlDbType.UniqueIdentifier, _
16, GroupID)
'Fill the DataSet
MyBase.FillDataSet(GetGroup, "Group")
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
MyBase.SQL = "usp_InsertGroup"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, _
Group.Tables("Group").Rows(0).Item("GroupID"))
MyBase.AddParameter("@GroupName", _
SqlDbType.VarChar, 50, _
Group.Tables("Group").Rows(0).Item("GroupName"))
MyBase.AddParameter("@GroupDescription", _
SqlDbType.Text, _
Group.Tables("Group").Rows(0).Item( _
"GroupDescription").ToString.Length, _
Group.Tables("Group").Rows(0).Item("GroupDescription"))
'Execute the stored procedure
AddGroup = ExecuteStoredProcedure()
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
MyBase.SQL = "usp_UpdateGroup"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@GroupName", _
SqlDbType.VarChar, 50, _
Group.Tables("Group").Rows(0).Item("GroupName"))
MyBase.AddParameter("@GroupDescription", _
SqlDbType.Text, _
Group.Tables("Group").Rows(0).Item( _
"GroupDescription").ToString.Length, _
Group.Tables("Group").Rows(0).Item("GroupDescription"))
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, _
Group.Tables("Group").Rows(0).Item("GroupID"))
'Execute the stored procedure
UpdateGroup = ExecuteStoredProcedure()
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
MyBase.SQL = "usp_DeleteGroup"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, GroupID)
'Execute the stored procedure
DeleteGroup = ExecuteStoredProcedure()
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
GetGroupProjects = New DataSet
MyBase.SQL = "SELECT ProjectID, ProjectName " & _
"FROM vw_SelectGroupProjects " & _
"WHERE GroupID = @GroupID " & _
"ORDER BY SequenceNumber"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, GroupID)
'Fill the DataSet
MyBase.FillDataSet(GetGroupProjects, "GroupProjects")
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
MyBase.SQL = "usp_InsertGroupProject"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@GroupProjectID", _
SqlDbType.UniqueIdentifier, 16, Nothing)
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, Nothing)
MyBase.AddParameter("@ProjectID", _
SqlDbType.UniqueIdentifier, 16, Nothing)
'Process all rows in the table
For intIndex As Integer = 0 To _
GroupProjects.Tables("GroupProjects").Rows.Count - 1
MyBase.Command.Parameters.Item("@GroupProjectID").Value = _
GroupProjects.Tables("GroupProjects").Rows(intIndex).Item( _
"GroupProjectID")
MyBase.Command.Parameters.Item("@GroupID").Value = _
GroupProjects.Tables("GroupProjects").Rows(intIndex).Item( _
"GroupID")
MyBase.Command.Parameters.Item("@ProjectID").Value = _
GroupProjects.Tables("GroupProjects").Rows(intIndex).Item( _
"ProjectID")
'Execute the stored procedure
AddGroupProjects = ExecuteStoredProcedure()
Next
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
MyBase.SQL = "usp_DeleteGroupProjects"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@GroupID", _
SqlDbType.UniqueIdentifier, 16, GroupID)
'Execute the stored procedure
DeleteGroupProjects = ExecuteStoredProcedure()
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 + -