    Imports System
    Imports System.Configuration
    Imports System.Data
    Imports ASPNET.StarterKit.TimeTracker.DataAccessLayer

    Namespace ASPNET.StarterKit.TimeTracker.BusinessLogicLayer

        '*********************************************************************
        '
        '    ProjectReportProject Class
        '
        '    This class represents project item in Project Report page
        '
        '*********************************************************************
        Public Class ProjectReportProject
            Private _actualHours As Decimal
            Private _estCompletionDate As DateTime
            Private _estHours As Decimal
            Private _projectID As Integer
            Private _projectName As String

            Public Sub New()
                _projectID = 0
                _projectName = String.Empty
                _estCompletionDate = DateTime.MinValue
                _estHours = 0D
                _actualHours = 0D
            End Sub 'New

            Public Property ActualHours() As Decimal
                Get
                    Return _actualHours
                End Get
                Set(ByVal Value As Decimal)
                    _actualHours = Value
                End Set
            End Property

            Public Property EstCompletionDate() As DateTime
                Get
                    Return _estCompletionDate
                End Get
                Set(ByVal Value As DateTime)
                    _estCompletionDate = Value
                End Set
            End Property

            Public Property EstHours() As Decimal
                Get
                    Return _estHours
                End Get
                Set(ByVal Value As Decimal)
                    _estHours = Value
                End Set
            End Property

            Public Property ProjectID() As Integer
                Get
                    Return _projectID
                End Get
                Set(ByVal Value As Integer)
                    _projectID = Value
                End Set
            End Property

            Public Property ProjectName() As String
                Get
                    Return _projectName
                End Get
                Set(ByVal Value As String)
                    _projectName = Value
                End Set
            End Property

            '*********************************************************************
            '
            '    GetProjectSummary returns multiple project summaries based on projectIdList parameter
            '    projectIdList is a comma delimited project IDs string (i.e. "1,2,3")
            '
            '*********************************************************************

            Public Shared Function GetProjectSummary(ByVal projectIdList As String, ByVal userID As Integer) As ProjectReportProjectCollection
                Dim dsProjects As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Web.Global.CfgKeyConnString), "TT_ListProjectsByIDs", projectIdList, userID)
                Dim projectList As New ProjectReportProjectCollection()

                ' Separate Data into a collection of ProjectReportProject
                Dim row As DataRow
                For Each row In dsProjects.Tables(0).Rows
                    Dim proj As New ProjectReportProject()
                    proj.ProjectID = Convert.ToInt32(row("ProjectID"))
                    proj.ProjectName = row("ProjectName").ToString()
                    proj.EstCompletionDate = Convert.ToDateTime(row("EstCompletionDate"))
                    proj.EstHours = Convert.ToDecimal(row("EstHours"))
                    proj.ActualHours = Convert.ToDecimal(row("ActualHours"))

                    projectList.Add(proj)
                Next row

                Return projectList
            End Function 'GetProjectSummary
        End Class 'ProjectReportProject
    End Namespace 'ASPNET.StarterKit.TimeTracker.BusinessLogicLayer