How to add an allocation to a resource.
One you have a reference to a resource, call the AddSlot method to add an allocation.
var r: TssResource; a: TssResourceAllocation; begin r := RAC.FindResource('My Resource'); if Assigned(r) then begin RAC.BeginUpdate; try // add an allocation 1 hour long starting Now a := r.AddSlot(Now, Now + EncodeTime(1, 0, 0, 0); // check not nil, in case the allocation could not be added if Assigned(a) then // use the returned reference to the new allocation // in this example, we'll store the record ID in the Tag a.Tag := IntToStr(AllocationRecordID); finally RAC.EndUpdate; end; end; end;
Note: It is important to test that AddSlot did not return null. If the time span is already occupied, AddSlot will not add a new allocation and will return null.
Copyright © 2000-2010 Simon Armstrong. All Rights Reserved.


