📄 wdaroles.vb
字号:
Public Class WDARoles
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 Role Functions "
Public Function AddRole(ByVal Role As DataSet) As Boolean
Try
MyBase.SQL = "usp_InsertRole"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@RoleID", _
SqlDbType.UniqueIdentifier, 16, _
Role.Tables("Role").Rows(0).Item("RoleID"))
MyBase.AddParameter("@RoleName", _
SqlDbType.VarChar, 50, _
Role.Tables("Role").Rows(0).Item("RoleName"))
MyBase.AddParameter("@RoleDescription", _
SqlDbType.Text, _
Role.Tables("Role").Rows(0).Item( _
"RoleDescription").ToString.Length, _
Role.Tables("Role").Rows(0).Item("RoleDescription"))
MyBase.AddParameter("@Ranking", _
SqlDbType.TinyInt, 1, _
Role.Tables("Role").Rows(0).Item("Ranking"))
'Execute the stored procedure
AddRole = ExecuteStoredProcedure()
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetRoles() As DataSet
Try
GetRoles = New DataSet
MyBase.SQL = "usp_SelectRoles"
'Fill the DataSet
MyBase.FillDataSet(GetRoles, "Roles")
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetRole(ByVal RoleID As Guid) As DataSet
Try
GetRole = New DataSet
MyBase.SQL = "usp_SelectRole"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@RoleID", SqlDbType.UniqueIdentifier, _
16, RoleID)
'Fill the DataSet
MyBase.FillDataSet(GetRole, "Role")
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function UpdateRole(ByVal Role As DataSet) As Boolean
Try
MyBase.SQL = "usp_UpdateRole"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@RoleID", _
SqlDbType.UniqueIdentifier, 16, _
Role.Tables("Role").Rows(0).Item("RoleID"))
MyBase.AddParameter("@RoleName", _
SqlDbType.VarChar, 50, _
Role.Tables("Role").Rows(0).Item("RoleName"))
MyBase.AddParameter("@RoleDescription", _
SqlDbType.Text, _
Role.Tables("Role").Rows(0).Item( _
"RoleDescription").ToString.Length, _
Role.Tables("Role").Rows(0).Item("RoleDescription"))
MyBase.AddParameter("@Ranking", _
SqlDbType.TinyInt, 1, _
Role.Tables("Role").Rows(0).Item("Ranking"))
'Execute the stored procedure
UpdateRole = ExecuteStoredProcedure()
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function DeleteRole(ByVal RoleID As Guid) As Boolean
Try
MyBase.SQL = "usp_DeleteRole"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@RoleID", _
SqlDbType.UniqueIdentifier, 16, RoleID)
'Execute the stored procedure
DeleteRole = 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 + -