protected void Page_Load(object sender, EventArgs args)
        {
            var dataAdapter = new WebsiteEventDataAdapter(new PortalContextDataAdapterDependencies(Portal, PortalName));
            var now         = DateTime.UtcNow;

            var past   = Html.TimeSpanSetting("Events/DisplayTimeSpan/Past").GetValueOrDefault(TimeSpan.FromDays(90));
            var future = Html.TimeSpanSetting("Events/DisplayTimeSpan/Future").GetValueOrDefault(TimeSpan.FromDays(90));

            var occurrences = dataAdapter.SelectEventOccurrences(now.Subtract(past), now.Add(future)).ToArray();

            UpcomingEvents.DataSource = occurrences.Where(e => e.Start >= now).OrderBy(e => e.Start);
            UpcomingEvents.DataBind();

            PastEvents.DataSource = occurrences.Where(e => e.Start < now).OrderByDescending(e => e.Start);
            PastEvents.DataBind();
        }
Exemplo n.º 2
0
        void AddEvent(HistoryEvent historyEvent, bool isNewEvent)
        {
            if (IsDuplicateEvent(historyEvent))
            {
                return;
            }

            Events.Add(historyEvent);

            if (isNewEvent)
            {
                NewEvents.Add(historyEvent);
            }
            else
            {
                PastEvents.Add(historyEvent);
            }

            SetMarkerEvents(historyEvent);
        }