Read Write Rate Scale Information
Contents
[
Hide
Show
]Read/Write RateScale Information for Resource Assignment
Aspose.Tasks for .NET API allows to read as well as write Rate Scale information for a Resource Assignment. The Asn.RateScale property can be specified to achieve this as shown in the following code sample.
1Project project = new Project("New Project.mpp");
2
3Task task = project.RootTask.Children.Add("t1");
4
5Resource materialResource = project.Resources.Add("materialResource");
6materialResource.Set(Rsc.Type, ResourceType.Material);
7
8Resource nonMaterialResource = project.Resources.Add("nonMaterialResource");
9nonMaterialResource.Set(Rsc.Type, ResourceType.Work);
10
11ResourceAssignment materialResourceAssignment = project.ResourceAssignments.Add(task, materialResource);
12materialResourceAssignment.Set(Asn.RateScale, RateScaleType.Week);
13
14ResourceAssignment nonMaterialResourceAssignment = project.ResourceAssignments.Add(task, nonMaterialResource);
15nonMaterialResourceAssignment.Set(Asn.RateScale, RateScaleType.Week);
16
17project.Save("output.mpp", SaveFileFormat.MPP);
18
19project = new Project("output.mpp");
20
21ResourceAssignment materialResourceAssignment2 = project.ResourceAssignments.GetByUid(1);
22Console.WriteLine(materialResourceAssignment2.Get(Asn.RateScale));
23
24// only material resource assignments can have non-zero rate scale value.
25ResourceAssignment nonMaterialResourceAssignment2 = project.ResourceAssignments.GetByUid(2);