If you use the Framework API, the WebEventData
class has a property called IsAllDay
. You could use this to trigger the display change. For example, you might not want to display start/end times at all if it's an All Day event and just show the date.
If you do need to have particular start/end times for all day events, you can easily extend the Ektron WebEventData
object with extension methods.
public static class WebEventExtensions
{
public static DateTime GetDisplayStartDate(this WebEventData webEvent)
{
if (!webEvent.IsAllDay)
return webEvent.EventStart;
return new DateTime(webEvent.EventStart.Year, webEvent.EventStart.Month, webEvent.EventStart.Day);
}
public static DateTime GetDisplayEndDate(this WebEventData webEvent)
{
if (!webEvent.IsAllDay)
return webEvent.EventEnd;
return new DateTime(webEvent.EventEnd.Year, webEvent.EventEnd.Month, webEvent.EventEnd.Day, 23, 59, 59);
}
}
Then those methods will appear on the object.
var eventManager = new WebEventManager();
WebEventData webEvent = eventManager.GetItem(730);
if (webEvent.IsAllDay)
{
// do all-day stuff...
}
var start = webEvent.GetDisplayStartDate();
var end = webEvent.GetDisplayEndDate();