📄 reports.vb
字号:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
<WebService(Namespace:="http://www.wrox.com/TimeSheetsWS/Reports", _
Description:="This Web Service produces manager timesheet " & _
"reports for the Time Tracker application.")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class Reports
Inherits System.Web.Services.WebService
'Private variables and objects
Private strCompany As String = "Wrox"
Private strApplication As String = "Time Tracker Oracle"
Private objTimeSheets As WroxBusinessLogic.WBLTimeSheets
Private objTimeSheetDS As DataSet
Public Sub Service()
End Sub
<WebMethod(Description:="Timesheets Due report for the " & _
"employees of a specified manager and week ending date.")> _
Public Function TimeSheetsDue(ByVal ManagerID As Guid, _
ByVal WeekEndingDate As Date) As DataSet
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that are due
objTimeSheetDS = objTimeSheets.TimeSheetsDue(ManagerID, WeekEndingDate)
End Using
'Generate the report header
Call GenerateHeaderDataSet("Timesheets Due", ManagerID, WeekEndingDate)
'Return the TimeSheet DataSet
Return objTimeSheetDS
End Function
<WebMethod(Description:="Timesheets Submitted report for the " & _
"employees of a specified manager and week ending date.")> _
Public Function TimeSheetsSubmitted(ByVal ManagerID As Guid, _
ByVal WeekEndingDate As Date) As DataSet
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that have been submitted
objTimeSheetDS = objTimeSheets.TimeSheetsSubmitted( _
ManagerID, WeekEndingDate)
End Using
'Generate the report header
Call GenerateHeaderDataSet("Timesheets Submitted", _
ManagerID, WeekEndingDate)
'Return the TimeSheet DataSet
Return objTimeSheetDS
End Function
<WebMethod(Description:="Timesheets Month-to-Date report for " & _
"the employees of a specified manager.")> _
Public Function TimeSheetsMTD(ByVal ManagerID As Guid) As DataSet
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that have been submitted for the current month
objTimeSheetDS = objTimeSheets.TimeSheetsMTD(ManagerID)
End Using
'Generate the report header
Call GenerateHeaderDataSet("Timesheets Month-to-Date", ManagerID, Now)
'Return the TimeSheet DataSet
Return objTimeSheetDS
End Function
<WebMethod(Description:="Timesheets Quarter-to-Date report for " & _
"the employees of a specified manager.")> _
Public Function TimeSheetsQTD(ByVal ManagerID As Guid) As DataSet
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that have been submitted for the current quarter
objTimeSheetDS = objTimeSheets.TimeSheetsQTD(ManagerID)
End Using
'Generate the report header
Call GenerateHeaderDataSet("Timesheets Quarter-to-Date", ManagerID, Now)
'Return the TimeSheet DataSet
Return objTimeSheetDS
End Function
<WebMethod(Description:="Timesheets Year-to-Date report for " & _
"the employees of a specified manager.")> _
Public Function TimeSheetsYTD(ByVal ManagerID As Guid) As DataSet
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that have been submitted for the current year
objTimeSheetDS = objTimeSheets.TimeSheetsYTD(ManagerID)
End Using
'Generate the report header
Call GenerateHeaderDataSet("Timesheets Year-to-Date", ManagerID, Now)
'Return the TimeSheet DataSet
Return objTimeSheetDS
End Function
#Region " Private Functions "
Private Sub GenerateHeaderDataSet(ByVal ReportName As String, _
ByVal ManagerID As Guid, ByVal ReportDate As Date)
'Initialize a new instance of the business logic component
Using objTimeSheets As New WroxBusinessLogic.WBLTimeSheets( _
strCompany, strApplication)
'Get all timesheets that have been submitted for the current year
Dim strManagerName As String = objTimeSheets.GetManagerName(ManagerID)
'Declare a new DataTable
Dim objDataTable As New DataTable("ReportHeader")
'Declare a DataColumn
Dim objDataColumn As DataColumn
'Create the Title column
objDataColumn = New DataColumn
objDataColumn.DataType = System.Type.GetType("System.String")
objDataColumn.ColumnName = "Title"
'Add the column to the DataTable
objDataTable.Columns.Add(objDataColumn)
'Create the ManagerName column
objDataColumn = New DataColumn
objDataColumn.DataType = System.Type.GetType("System.String")
objDataColumn.ColumnName = "ManagerName"
'Add the column to the DataTable
objDataTable.Columns.Add(objDataColumn)
'Create the Date column
objDataColumn = New DataColumn
objDataColumn.DataType = System.Type.GetType("System.DateTime")
objDataColumn.ColumnName = "Date"
'Add the column to the DataTable
objDataTable.Columns.Add(objDataColumn)
'Create a new DataRow
Dim objDataRow As DataRow = objDataTable.NewRow
'Set the values in the columns
objDataRow.Item("Title") = ReportName
objDataRow.Item("ManagerName") = strManagerName
objDataRow.Item("Date") = ReportDate
'Add the row to the DataSet
objDataTable.Rows.Add(objDataRow)
'Add the DataTable to the DataSet
objTimeSheetDS.Tables.Add(objDataTable)
End Using
End Sub
#End Region
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -