Hi,
Hi Purnima,
Hi,
Hi Purnima,
Project proj = new Project();
DateTime projectstartdate = Convert.ToDateTime(“2016,01,01”);
DateTime projectenddate = Convert.ToDateTime(“2016,12,31”);
proj.Set(Prj.StartDate, projectstartdate);
proj.Set(Prj.FinishDate, projectenddate);
Task tsk = proj.RootTask.Children.Add(“Task 1”);
tsk.Set(Tsk.Start, projectstartdate);
tsk.Set(Tsk.Finish, projectenddate);
Console.WriteLine("Before setting constraint = " + tsk.Get(Tsk.ConstraintType));
Console.WriteLine("Before setting constraint date = " + tsk.Get(Tsk.ConstraintDate));
tsk.Set(Tsk.ConstraintDate, projectstartdate);
tsk.Set(Tsk.ConstraintType, ConstraintType.AsSoonAsPossible);
Console.WriteLine("After setting constraint = " + tsk.Get(Tsk.ConstraintType));
Console.WriteLine("After setting constraint date = " + tsk.Get(Tsk.ConstraintDate));
proj.Save(“outputWithConstraintType.xml”, Aspose.Tasks.Saving.SaveFileFormat.XML);
Thank you for the code. But with the given sample code the start and finish dates of the task is 1/1/2016 and 1/1/2016. I want the task dates to show as 1/1/2016 and 31/12/2016
Hi Purnima,
Project proj = new Project();
DateTime projectstartdate = Convert.ToDateTime(“2016,01,01”);
DateTime projectenddate = Convert.ToDateTime(“2016,12,31”);
proj.Set(Prj.StartDate, projectstartdate);
proj.Set(Prj.FinishDate, projectenddate);
Task tsk = proj.RootTask.Children.Add(“Task 1”);
tsk.Set(Tsk.Start, projectstartdate);
tsk.Set(Tsk.Duration, proj.GetDuration(261,TimeUnitType.Day));
proj.Recalculate();
proj.Save(“outputWithConstraintType.xml”, Aspose.Tasks.Saving.SaveFileFormat.XML);
Hi,
Hi Purnima,
Project proj = new Project(@“Blank2010.mpp”);
Task task1 = proj.RootTask.Children.Add(“Task 1”);
task1.Set(Tsk.Start, new DateTime(2016, 1, 1));
ATasks.Calendar cal = proj.Get(Prj.Calendar);
double Days24Hrs = cal.GetWorkingHours(new DateTime(2016, 1, 1), new DateTime(2016, 12, 31)).WorkingHours.Days;
double Days08Hrs = Days24Hrs * 3;
// task1.Set(Tsk.Finish, new DateTime(2016, 12, 31));
task1.Set(Tsk.Duration, proj.GetDuration(Days08Hrs, TimeUnitType.Day));
proj.Save(path + “output.mpp”,SaveFileFormat.MPP);
With the given code, I am getting the following task created in the output mpp.
Hi Purnima,
Project proj = new Project(“sample.mpp”);
Task tsk1 = proj.RootTask.Children.Add(“Task 1”);
tsk1.Set(Tsk.IsManual, true);
I am not convinced with that, as when I give start and dates as 3 aug 2016 and 31 aug 2016, it turns out to be 3 aug 2016 and 26 aug 2016. 31aug 2016 is a wednesday and a working day.
Hi Purnima,
<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>
Hi,
Hi Purnima,
Thank you for the quick reply. Pls find attached solution.
Hi Purnima,