Class AvailabilityPeriod
Contents
[
Hide
]AvailabilityPeriod class
Represents a period when a resource is available.
public class AvailabilityPeriod
Constructors
Name | Description |
---|---|
AvailabilityPeriod() | The default constructor. |
Properties
Name | Description |
---|---|
AvailableFrom { get; set; } | Gets or sets the date when a resource becomes available for the specified period. |
AvailableTo { get; set; } | Gets or sets the last date when a resource is available for the specified period. |
AvailableUnits { get; set; } | Gets or sets the percentage of a resource which is available during the specified period. |
Examples
Shows how to create availability periods for a resource.
public void WorkWithAvailabilityPeriod()
{
var project = new Project();
var resource = project.Resources.Add("Work Resource");
// Add availability periods to new resource
IEnumerable<AvailabilityPeriod> periods = this.GetPeriods();
foreach (var period in periods)
{
resource.AvailabilityPeriods.Add(period);
}
foreach (var period in resource.AvailabilityPeriods)
{
Console.WriteLine("Available From: " + period.AvailableFrom);
Console.WriteLine("Available To: " + period.AvailableTo);
Console.WriteLine("Available Units: " + period.AvailableUnits);
Console.WriteLine();
}
}
private IEnumerable<AvailabilityPeriod> GetPeriods()
{
var periods = new List<AvailabilityPeriod>(2);
var period = new AvailabilityPeriod { AvailableFrom = new DateTime(2011, 12, 12), AvailableTo = new DateTime(2013, 12, 12), AvailableUnits = 0.99 };
periods.Add(period);
var period2 = new AvailabilityPeriod { AvailableFrom = new DateTime(2013, 12, 12), AvailableTo = new DateTime(2015, 12, 12), AvailableUnits = 0.94 };
periods.Add(period2);
return periods;
}
See Also
- namespace Aspose.Tasks
- assembly Aspose.Tasks