ResourceAssignment.TimephasedDataFromTaskDuration

ResourceAssignment.TimephasedDataFromTaskDuration method

Generates list of time phased data based on the task duration and the scheduled start date.

public void TimephasedDataFromTaskDuration(Calendar calendar)
ParameterTypeDescription
calendarCalendarThe calendar to generate time phased data from.

Examples

Shows how to add a split for a task.

var project = new Project();

// Get a standard calendar
var calendar = project.Get(Prj.Calendar);

// Set project's calendar settings
project.Set(Prj.StartDate, new DateTime(2000, 3, 15, 8, 0, 0));
project.Set(Prj.FinishDate, new DateTime(2000, 4, 21, 17, 0, 0));

// Add a new task to root task
var task = project.RootTask.Children.Add("Task1");
task.Set(Tsk.Duration, project.GetDuration(3));

// Create a new resource assignment and generate timephased data
var assignment = project.ResourceAssignments.Add(task, null);
assignment.TimephasedDataFromTaskDuration(calendar);

// Split the task into 3 parts.
// Provide start date and finish date arguments to SplitTask method which will be used for split
assignment.SplitTask(new DateTime(2000, 3, 16, 8, 0, 0), new DateTime(2000, 3, 16, 17, 0, 0), calendar);
assignment.SplitTask(new DateTime(2000, 3, 18, 8, 0, 0), new DateTime(2000, 3, 18, 17, 0, 0), calendar);
assignment.Set(Asn.WorkContour, WorkContourType.Contoured);

project.Save(OutDir + "CreateSplitTasks_out.xml", SaveFileFormat.Xml);

See Also