📄 wdaprojects.vb
字号:
Public Class WDAProjects
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 Project Functions "
Public Function GetProjects() As DataSet
Try
GetProjects = New DataSet
MyBase.SQL = "usp_SelectProjects"
'Fill the DataSet
MyBase.FillDataSet(GetProjects, "Projects")
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
GetProject = New DataSet
MyBase.SQL = "usp_SelectProject"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@ProjectID", _
SqlDbType.UniqueIdentifier, 16, ProjectID)
'Fill the DataSet
MyBase.FillDataSet(GetProject, "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
MyBase.SQL = "usp_InsertProject"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@ProjectID", _
SqlDbType.UniqueIdentifier, 16, _
Project.Tables("Project").Rows(0).Item("ProjectID"))
MyBase.AddParameter("@ProjectName", _
SqlDbType.VarChar, 50, _
Project.Tables("Project").Rows(0).Item("ProjectName"))
MyBase.AddParameter("@ProjectDescription", _
SqlDbType.Text, _
Project.Tables("Project").Rows(0).Item( _
"ProjectDescription").ToString.Length, _
Project.Tables("Project").Rows(0).Item("ProjectDescription"))
MyBase.AddParameter("@SequenceNumber", _
SqlDbType.TinyInt, 1, _
Project.Tables("Project").Rows(0).Item("SequenceNumber"))
'Execute the stored procedure
AddProject = ExecuteStoredProcedure
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
MyBase.SQL = "usp_UpdateProject"
'Initialize the Command object
MyBase.InitializeCommand()
'Add the Parameters to the Parameters collection
MyBase.AddParameter("@ProjectName", _
SqlDbType.VarChar, 50, _
Project.Tables("Project").Rows(0).Item("ProjectName"))
MyBase.AddParameter("@ProjectDescription", _
SqlDbType.Text, _
Project.Tables("Project").Rows(0).Item( _
"ProjectDescription").ToString.Length, _
Project.Tables("Project").Rows(0).Item("ProjectDescription"))
MyBase.AddParameter("@SequenceNumber", _
SqlDbType.TinyInt, 1, _
Project.Tables("Project").Rows(0).Item("SequenceNumber"))
MyBase.AddParameter("@ProjectID", _
SqlDbType.UniqueIdentifier, 16, _
Project.Tables("Project").Rows(0).Item("ProjectID"))
'Execute the stored procedure
UpdateProject = ExecuteStoredProcedure
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
MyBase.SQL = "usp_DeleteProject"
'Initialize the Command object
MyBase.InitializeCommand()
'Add a Parameter to the Parameters collection
MyBase.AddParameter("@ProjectID", _
SqlDbType.UniqueIdentifier, 16, ProjectID)
'Execute the stored procedure
DeleteProject = 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 + -