To implement the IPushPipe interface, you must implement the PushData method.
To implement the PushData method, add the following method in file FacebookEventsOutboundPipe.cs:
public
void
PushData( IList<PublishingSystemEventInfo> items )
{
foreach
( var item
in
items )
{
var wrapperObject = GetConvertedItemsForMapping( item ).First();
if
(
this
.pipeSettings.LanguageIds.Count > 0 && !
this
.pipeSettings.LanguageIds.Contains( item.Language ) )
{
continue
;
}
var nameField = PublishingConstants.FieldTitle;
var locationField = PublishingConstants.FieldLink;
var eventStartField = PublishingConstants.FieldEventStart;
var eventEndField = PublishingConstants.FieldEventEnd;
string
name =
string
.Empty;
string
location =
string
.Empty;
DateTime eventStart = DateTime.Now;
DateTime eventEnd = DateTime.Now;
if
( wrapperObject.HasProperty( nameField ) )
{
name = wrapperObject.GetProperty( nameField ).ToString();
}
if
( wrapperObject.HasProperty( locationField ) )
{
location = wrapperObject.GetProperty( locationField ).ToString();
}
if
( wrapperObject.HasProperty( eventStartField ) )
{
eventStart = DateTime.Parse( wrapperObject.GetProperty( eventStartField ).ToString() );
}
if
( wrapperObject.HasProperty( eventEndField ) )
{
eventEnd = DateTime.Parse( wrapperObject.GetProperty( eventEndField ).ToString() );
}
switch
( item.ItemAction )
{
case
RelatedActionsConstants.SystemObjectDeleted:
this
.DeleteEvent( name );
break
;
case
RelatedActionsConstants.SystemObjectAdded:
this
.CreateEvent( name, location, eventStart, eventEnd );
break
;
case
RelatedActionsConstants.SystemObjectModified:
this
.DeleteEvent( name );
this
.CreateEvent( name, location, eventStart, eventEnd );
break
;
}
}
}
First, you get all properties from the wrapped event. Then, based on the action, perform one of the following: