TimephasedData Class |
Namespace: Aspose.Tasks
The TimephasedData type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | TimephasedData |
Initializes a new instance of the TimephasedData class.
|
Name | Description | |
---|---|---|
![]() ![]() | Finish |
Gets or sets the finish date of a time phased data period.
|
![]() ![]() | Start |
Gets or sets the start date of a time phased data period.
|
![]() ![]() | TimephasedDataType |
Gets or sets the type of a time phased data.
|
![]() ![]() | Uid |
Gets or sets the unique identifier of a time phased data
|
![]() ![]() | Unit |
Gets or sets the time unit of a time phased data period.
|
![]() ![]() | Value |
Gets or sets the value per unit of time for a time phased data period.
|
![]() ![]() | ValueToCost |
Gets Double instance which represents string value of this object.
|
![]() ![]() | ValueToDuration |
Gets TimeSpan instance which represents string value of this object.
|
![]() ![]() | ValueToUnits |
Gets Double instance which represents string value of this object for unit-based time phased data.
|
Name | Description | |
---|---|---|
![]() ![]() ![]() | CreateCostTimephased |
Creates and initializes a new instance of the TimephasedData class for cost-based time phased data.
|
![]() ![]() ![]() | CreateUnitTimephased |
Creates and initializes a new instance of the TimephasedData class for unit-based time phased data of an assignment of a material resource.
|
![]() ![]() ![]() | CreateWorkTimephased |
Creates and initializes a new instance of the TimephasedData class for work-based time phased data.
|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
var project = new Project(DataDir + "Project1.mpp") { CalculationMode = CalculationMode.None }; var workResource = project.Resources.Add("Work Resource"); workResource.Set(Rsc.Type, ResourceType.Work); var costResource = project.Resources.Add("Cost Resource"); costResource.Set(Rsc.Type, ResourceType.Cost); var task = project.RootTask.Children.Add("Task"); task.Set(Tsk.Start, new DateTime(2018, 1, 1, 8, 0, 0)); task.Set(Tsk.Duration, project.GetDuration(1, TimeUnitType.Day)); var workAssignment = project.ResourceAssignments.Add(task, workResource); workAssignment.Set(Asn.WorkContour, WorkContourType.Contoured); var costAssignment = project.ResourceAssignments.Add(task, costResource); costAssignment.Set(Asn.WorkContour, WorkContourType.Contoured); // lets add custom timephased tds workAssignment.TimephasedData.Clear(); // add work days var td1 = TimephasedData.CreateWorkTimephased( workAssignment.Get(Asn.Uid), new DateTime(2018, 1, 2, 8, 0, 0), new DateTime(2018, 1, 5, 17, 0, 0), TimeSpan.FromHours(40), TimeUnitType.Hour, TimephasedDataType.AssignmentRemainingWork); // add weekend var td2 = TimephasedData.CreateWorkTimephased( workAssignment.Get(Asn.Uid), new DateTime(2018, 1, 6, 8, 0, 0), new DateTime(2018, 1, 8, 8, 0, 0), TimeSpan.Zero, TimeUnitType.Hour, TimephasedDataType.AssignmentRemainingWork); workAssignment.TimephasedData.Add(td1); workAssignment.TimephasedData.Add(td2); costAssignment.TimephasedData.Clear(); // add work days var td11 = TimephasedData.CreateCostTimephased( costAssignment.Get(Asn.Uid), new DateTime(2018, 1, 2, 8, 0, 0), new DateTime(2018, 1, 5, 17, 0, 0), 1, TimeUnitType.Hour, TimephasedDataType.AssignmentCost); // add weekend var td22 = TimephasedData.CreateCostTimephased( costAssignment.Get(Asn.Uid), new DateTime(2018, 1, 6, 8, 0, 0), new DateTime(2018, 1, 8, 8, 0, 0), 0, TimeUnitType.Hour, TimephasedDataType.AssignmentCost); costAssignment.TimephasedData.Add(td11); costAssignment.TimephasedData.Add(td22); Console.WriteLine("Print assignment timephased data:"); foreach (var assignment in project.ResourceAssignments) { Console.WriteLine("Assignment UID: " + assignment.Get(Asn.Uid)); foreach (var tds in assignment.TimephasedData) { Console.WriteLine(" Uid: " + tds.Uid); Console.WriteLine(" Start: " + tds.Start); Console.WriteLine(" Finish: " + tds.Finish); Console.WriteLine(" Type: " + tds.TimephasedDataType); Console.WriteLine(" Unit: " + tds.Unit); Console.WriteLine(" Value: " + tds.Value); Console.WriteLine(" ValueToCost: " + tds.ValueToCost); Console.WriteLine(" ValueToDuration: " + tds.ValueToDuration); Console.WriteLine(" ValueToUnits: " + tds.ValueToUnits); Console.WriteLine(); } } project.Recalculate();