Features > Task Management > Resources |
GanttView supports three kinds of resources namely work resource, material resource, and cost resource described further as follows:
Resource Type | Description |
Work Resource | Refers to the people and equipment required to accomplish a set of tasks defined in a project. |
Material Resource | Refers to the exhaustible raw material and goods required to accomplish a set of task in a project |
Cost Resource | Refers to the financial cost associated to a task that needs to be accounted for in a project such as expenditures on travel, entertainment, and other overheads. |
The following image shows a resource assigned to a task in GanttView.
GanttView provides the Resource class for handling resources. To create and manage resources, you need to create an instance of the Resource class and set its name and cost using the Name and Cost properties, respectively. The ResourceType property can be set to specify the type of resource. The ResourceType property accepts the following values from the ResourceType enumeration:
The TaskResources class also provides the Add method to add the resources to a locally-defined resource dictionary. However, simply creating a resource is of no use until it is assigned to a task for which the control provides the ResourceRef class. You need to create an object of the ResourceRef class, set its Resource property, and add the same to the task using the Add method.
The following code example illustrates creating, adding, and assigning resource to a task. This example uses the sample created in the Quick Start.
'Creating a resource Dim r As New Resource() r.ResourceType = ResourceType.Work r.Name = "Gary" r.Cost = 300D 'Adding the resource to gantt view gv.TaskResources.Add(r, "Gary") 'Assigning the resource to task 't1' Dim t1 As Task = gv.Tasks.Search("Requirement Gathering") If t1 IsNot Nothing AndAlso t1.ResourceRefs.Count = 0 Then Dim rRef As New ResourceRef() rRef.Resource = r rRef.Amount = 0.5 t1.ResourceRefs.Add(rRef) End If
//Creating a resource Resource r = new Resource(); r.ResourceType = ResourceType.Work; r.Name = "Gary"; r.Cost = 300m; //Adding the resource to gantt view gv.TaskResources.Add(r, "Gary"); //Assigning the resource to task 't1' Task t1 = gv.Tasks.Search("Requirement Gathering"); if (t1 != null && t1.ResourceRefs.Count == 0) { ResourceRef rRef = new ResourceRef(); rRef.Resource = r; rRef.Amount = 0.5; t1.ResourceRefs.Add(rRef); }