ResourceAssignment.MakeTPs

ResourceAssignment.MakeTPs method

Generates a list of time phased data.

public DateTime MakeTPs(DateTime start, TimeSpan time, Calendar calendar, 
    List<TimephasedData> list, bool isWorking, int type)
ParameterTypeDescription
startDateTimeThe specified start date.
timeTimeSpanThe specified working time.
calendarCalendarThe specified working calendar.
listList`1The list of time phased data.
isWorkingBooleanThe specified flag which specifies whether time-phased data is working or not.
typeInt32The specified time-phased data type.

Return Value

A maximum date from list or start date if list is empty.

Examples

Shows how to generate TPs by parameters.

var project = new Project();

var task = project.RootTask.Children.Add("Task");
task.Set(Tsk.Start, new DateTime(2020, 3, 30, 8, 0, 0));
var resource = project.Resources.Add("Resource");
var assignment = project.ResourceAssignments.Add(task, resource);
assignment.Set(Asn.Start, new DateTime(2020, 4, 1, 8, 0, 0));

var tps = new List<TimephasedData>();
var lastDate = assignment.MakeTPs(
    assignment.Get(Asn.Start),
    TimeSpan.FromHours(32),
    project.Calendars.GetByName("Standard"),
    tps,
    true,
    (int)TimephasedDataType.AssignmentRemainingWork);

foreach (var data in tps)
{
    Console.WriteLine("Start: " + data.Start);
    Console.WriteLine("Finish: " + data.Finish);
    Console.WriteLine("TimephasedDataType: " + data.TimephasedDataType);
    Console.WriteLine();
}

See Also