///<summary>Get a list of calendar events from a single node</summary> ///<param name="date">Event date</param> ///<param name="propertyType">Alias of the property holding the Datatype KS.Umbraco7.Calendar</param> ///<param name="nodeId">Id of the event node</param> ///<param name="splitNoneRecurring">Optional: Split none recurring events by day, true by default</param> ///<returns>An ordered List with CalendarEvents ordered by date</returns> public static List <CalendarEvent> getNodeEvents(DateTime date, int nodeId, string propertyType, bool splitNoneRecurring = true) { List <CalendarEvent> events = new List <CalendarEvent>(); try { var node = new DynamicPublishedContent(new UmbracoHelper(UmbracoContext.Current).Content(nodeId)); DynamicPublishedContentList nodes = new DynamicPublishedContentList(); nodes.Add(node); return(getEventList(date.Date, date.Date.AddDays(1).AddMilliseconds(-1), propertyType, nodes, splitNoneRecurring)); } catch (Exception ex) { //LogHelper.Error<CalendarEvent>("getNodeEvents", ex); } return(events); }
public static bool Where(this IPublishedContent doc, string predicate) { if (doc == null) { throw new ArgumentNullException("doc"); } //Totally gonna cheat here var dynamicDocumentList = new DynamicPublishedContentList(); dynamicDocumentList.Add(doc.AsDynamicPublishedContent()); var filtered = dynamicDocumentList.Where <DynamicPublishedContent>(predicate); if (Queryable.Count(filtered) == 1) { //this node matches the predicate return(true); } return(false); }
public static bool Where(this IPublishedContent doc, string predicate) { if (doc == null) throw new ArgumentNullException("doc"); //Totally gonna cheat here var dynamicDocumentList = new DynamicPublishedContentList(); dynamicDocumentList.Add(doc.AsDynamicPublishedContent()); var filtered = dynamicDocumentList.Where<DynamicPublishedContent>(predicate); if (Queryable.Count(filtered) == 1) { //this node matches the predicate return true; } return false; }
public bool Where(string predicate) { //Totally gonna cheat here var dynamicDocumentList = new DynamicPublishedContentList(); dynamicDocumentList.Add(this); var filtered = dynamicDocumentList.Where<DynamicPublishedContent>(predicate); if (Queryable.Count(filtered) == 1) { //this node matches the predicate return true; } return false; }