VERSION 1.0 CLASS
BEGIN
  MultiUse = -1    'True
END
Attribute VB_PredeclaredId = False
Attribute VB_Creatable = True
Attribute VB_Exposed = True
Attribute VB_GlobalNameSpace = True
Attribute VB_Name = "mpxTask"
' MPX-Task-X5.cls
' ===============

' Task class module

' Copyright (c) Mindjet LLC 2002, 2003  All Rights Reserved

Option Explicit
'#Uses "MPX-Tasks-X5.Cls" ' Tasks collection class

Dim i_TaskID As Long ' task ID
Dim i_TaskBranchID As Long ' Branch ID associated with this task, uses hashed Topic.Guid
Dim s_TaskBranchGuid As String ' Original branch Guid
Dim i_OutlineLevel As Integer ' Outline Level
Dim i_PercentComplete As Integer ' Percent complete
Dim s_TaskName As String ' task name
Dim s_TaskNotes As String ' task notes
Dim i_TaskStart As Date ' task start date
Dim i_TaskDeadline As Date ' task Deadline date
Dim i_TaskDuration As Integer ' task duration in whole hours
Dim b_TaskIsMilestone As Boolean ' task is a milestone (zero duration allowed)
Dim i_TaskPriority As Integer ' task priority level
Dim b_TaskHasResources As Boolean ' Task has resources assigned to it
Dim b_TaskIsSummary As Boolean ' Task is a summary of sub-tasks
Dim b_TaskRollup As Boolean ' Task is rolled up
Dim s_TaskWBS As String ' WBS numbering string
Dim s_Predecessors As String ' Predecessor task list
Dim s_Successors As String ' Successors task list

Private Sub Class_Initialize()
' Initialise a new instance of a task
	Call p_TaskInit()
End Sub

Private Sub p_TaskInit()

	i_TaskID = 0 ' Zero ID
	i_TaskBranchID = -1 ' undefined Branch ID
	s_TaskBranchGuid = "" ' no Guid
	s_TaskName = ""
	s_TaskNotes = ""
	i_TaskStart = 0 ' no start date
	i_TaskDeadline = 0 ' no Deadline date
	i_TaskDuration = 0
	b_TaskIsMilestone = False ' not a milestone
	i_TaskPriority = 0 ' no priority
	i_PercentComplete = 0
	b_TaskHasResources = False ' No resources by default
	b_TaskIsSummary = False ' Not a summary by default
	b_TaskRollup = False ' Not rolled up
	s_TaskWBS = "" ' no WBS info
	s_Predecessors = "" ' No Predecessor tasks
	s_Successors = "" ' No successor tasks

End Sub

Private Sub Class_Terminate()
' Destroy this task
	Call p_TaskInit()
End Sub

Property Get ID() As Long
	ID = i_TaskID
End Property

Property Let ID(ByVal i_Value As Long)
' Change Task ID
	i_TaskID = i_Value ' set TaskID
End Property

Property Get BranchID() As Long
	BranchID = i_TaskBranchID
End Property

Property Let BranchID(ByVal i_Value As Long)
	i_TaskBranchID = i_Value ' set branch ID associated with this task
End Property

Property Get BranchGuid() As String
	BranchGuid = s_TaskBranchGuid
End Property

Property Let BranchGuid(ByVal s_Value As String)
	s_TaskBranchGuid = s_Value
End Property

Property Get OutlineLevel() As Integer
	OutlineLevel = i_OutlineLevel
End Property

Property Let OutlineLevel(ByVal i_Value As Integer)
	If i_Value >= 0 Then i_OutlineLevel = i_Value
End Property

Property Get Name() As String
	Name = s_TaskName
End Property

Property Let Name(ByVal s_Value As String)
	s_TaskName = s_Value
End Property

Property Get PercentComplete() As Integer
	PercentComplete = i_PercentComplete
End Property

Property Let PercentComplete(ByVal i_Value As Integer)
	If (i_Value < 0) Then i_Value = 0 ' apply limits
	If (i_Value > 100) Then i_Value = 100
	i_PercentComplete = i_Value
End Property

Property Get Notes() As String
	Notes = s_TaskNotes
End Property

Property Let Notes(ByVal s_Value As String)
	s_TaskNotes = s_Value
End Property

Property Get StartDate() As Date
	StartDate = i_TaskStart
End Property

Property Let StartDate(ByVal i_Value As Date)
	i_TaskStart = i_Value
End Property

Property Get DeadlineDate() As Date
	DeadlineDate = i_TaskDeadline
End Property

Property Let DeadlineDate(ByVal i_Value As Date)
	i_TaskDeadline = i_Value
End Property

Property Get Duration() As Long
	Duration = i_TaskDuration
End Property

Property Let Duration(ByVal i_Value As Long)
	If i_Value >= 0 Then i_TaskDuration = i_Value
End Property

Property Let IsMilestone(ByVal b_value As Boolean)
	b_TaskIsMilestone = b_value
End Property

Property Get IsMilestone() As Boolean
	IsMilestone = b_TaskIsMilestone
End Property

Property Get Priority() As Integer
	Priority = i_TaskPriority
End Property

Property Let Priority(ByVal i_Value As Integer)
	If i_Value >= 0 Then i_TaskPriority = i_Value
End Property

Property Get HasResources() As Boolean
	HasResources = b_TaskHasResources
End Property

Property Let HasResources(ByVal b_value As Boolean)
	b_TaskHasResources = b_value
End Property

Property Get IsSummary() As Boolean
	IsSummary = b_TaskIsSummary
End Property

Property Let IsSummary(ByVal b_Value As Boolean)
	b_TaskIsSummary = b_Value
End Property

Property Get Rollup() As Boolean
	Rollup = b_TaskRollup
End Property

Property Let Rollup(ByVal b_Value As Boolean)
	b_TaskRollup = b_Value
End Property

Property Get WBS() As String
	WBS = s_TaskWBS
End Property

Property Let WBS(ByVal s_WBS As String)
	s_TaskWBS = s_WBS
End Property

Property Get Predecessors() As String
	Predecessors = s_Predecessors
End Property

Property Let Predecessors(ByVal s_value As String)
	s_Predecessors = s_value
End Property

Property Get Successors() As String
	Successors = s_Successors
End Property

Property Let Successors(ByVal s_value As String)
	s_Successors = s_value
End Property
