PocketPlanner Programmer's Guide

Item.CopyOccurrence Method

See Also

Called by the recurrence whenever a new occurrence is being generated in order to populate the fields of the instance from the master item.

Namespace: MindFusion.Scheduling
Assembly: PocketPlanner

 Syntax

C#

protected virtual void CopyOccurrence (
    Item master
)

Visual Basic

Protected Overridable Sub CopyOccurrence ( _
    master As Item _
)

 Parameters

master
A reference to the master to copy from.

 Remarks

This method is usually overridden in classes which derive from Item or Appointment in order to copy the custom fields from the master item to a particular occurrence. If the method is not overridden, the custom fields for all occurrences will have their default values and not the value of the master item.

 Example

The following example illustrates how to override CopyOccurrence in a class deriving from Appointment and how to copy the custom fields from the master item.

C#

class CustomAppointment : Appointment
{
    protected override void CopyOccurrence(Item master)
    {
        _customField = (master as CustomAppointment)._customField;
        base.CopyOccurrence(master);
    }

    private int _customField;
}

Visual Basic

Class CustomAppointment
    Inherits Appointment

    Protected Overrides Sub CopyOccurrence(ByVal master As Item)

        _customField = CType(master, CustomAppointment)._customField
        MyBase.CopyOccurrence(master)

    End Sub

    Private _customField As Integer

End Class

 See Also