示例#1
0
        protected void Menu_Click(object sender, EventArgs e)
        {
            var now = DateTime.UtcNow.Floor(RoundTo.Minute);

            switch (EventListFilter.SelectedValue)
            {
            case "RecentlyAdded":
                EventsRepeater.DataSource = Campaigns.Where(c => c.CreatedOn > now.AddDays(-7));
                break;

            case "Upcoming":
                EventsRepeater.DataSource = Campaigns.Where(c => c.MSA_StartDateTime > now);
                break;

            case "Past":
                EventsRepeater.DataSource = Campaigns.Where(c => c.MSA_StartDateTime < now);
                break;

            default:
                EventsRepeater.DataSource = Campaigns.Where(c => c.MSA_FeaturedEvent == true && c.MSA_StartDateTime > now);
                break;
            }

            EventsRepeater.DataBind();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            var now = DateTime.UtcNow.Floor(RoundTo.Minute);

            EventsRepeater.DataSource = Campaigns.Where(c => c.MSA_FeaturedEvent == true && c.MSA_StartDateTime > now);
            EventsRepeater.DataBind();
        }