Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _CalendarAbsPath = MapPath("~/Calendars");

        if (!IsPostBack)
        {
            // Load our list of available calendars
            CalendarList.DataSource = LoadCalendarList();
            CalendarList.DataBind();

            // Select all calendars in the list by default
            foreach (ListItem li in CalendarList.Items)
            {
                li.Selected = true;
            }
        }

        // Get a list of todays events and upcoming events
        List <Occurrence> todaysEvents   = GetTodaysEvents();
        List <Occurrence> upcomingEvents = GetUpcomingEvents();

        // Bind our list to the repeater that will display the events.
        TodaysEvents.DataSource = todaysEvents;
        TodaysEvents.DataBind();

        // Bind our list to the repeater that will display the events.
        UpcomingEvents.DataSource = upcomingEvents;
        UpcomingEvents.DataBind();
    }
        public async Task <IActionResult> Edit(int id, [Bind("UpcomingEventsID,Title,EventSummary,EventPrice,EventDate")] UpcomingEvents upcomingEvents)
        {
            if (id != upcomingEvents.UpcomingEventsID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(upcomingEvents);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UpcomingEventsExists(upcomingEvents.UpcomingEventsID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(upcomingEvents));
        }
Пример #3
0
        public List <UpcomingEvents> CreateUpcomingEvents()
        {
            var upcomingEvents = new List <UpcomingEvents>();

            foreach (var config in _dataService.EnableConfigurations)
            {
                var details = new UpcomingEvents
                {
                    ConfigurationId   = config.ConfigurationId,
                    ConfigurationName = config.Name,
                };

                var enableMatches = _dataService.FilterDisabledMatches(config.ConfigurationId)
                                    .Where(t => t.MatchDate < DateTime.Now.AddDays(1))
                                    .ToList();
                var upcomingEventsList = new List <UpcomingEventsItem>(enableMatches.Count);
                foreach (var match in enableMatches)
                {
                    var eventDetailsItem = new UpcomingEventsItem()
                    {
                        MatchName = match.Name,
                        MatchDate = match.MatchDate
                    };
                    upcomingEventsList.Add(eventDetailsItem);
                }

                details.UpcomingEventsList = upcomingEventsList;
                upcomingEvents.Add(details);
            }


            return(upcomingEvents);
        }
        public ActionResult Create(HttpPostedFileBase file, UpcomingEvents upcomingEvents)
        {
            if (ModelState.IsValid)
            {
                if (file != null && file.ContentLength > 0)
                {
                    var fileName   = "";
                    var randomFile = "";
                    var uploadDir  = "~/Content/Images/UpcomingEvents";

                    System.IO.Directory.CreateDirectory(Server.MapPath(uploadDir));

                    fileName = file.FileName;
                    string extension = Path.GetExtension(file.FileName);
                    randomFile = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + Guid.NewGuid().ToString("N") + extension;

                    var filePath = Path.Combine(Server.MapPath(uploadDir), randomFile);
                    file.SaveAs(filePath);

                    upcomingEvents.Images    = randomFile;
                    upcomingEvents.CreatedBy = User.Identity.GetUserId();
                    upcomingEvents.CreatedOn = DateTime.UtcNow.AddHours(5);

                    db.UpcomingEvents.Add(upcomingEvents);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(upcomingEvents));
        }
Пример #5
0
        public void Update(bool force = false)
        {
            _notificationCallback.OnRefresh();

            Task.Run(() =>
            {
                try
                {
                    if (force || DateTime.Now > LastFetch.Add(_exchangeUpdateInterval))
                    {
                        FetchCalendarEntries();
                    }

                    // We realistically care more about events about to start (or just started) vs. already ending events,
                    // and this is done in a way where we don't need to query Exchange every time we update the list.
                    UpcomingEvents = UpcomingEvents
                                     .Where(x => x.End > DateTime.Now.AddMinutes(-5))
                                     .ToList()
                                     .AsReadOnly();

                    LastUpdate = DateTime.Now;
                    _notificationCallback.OnUpdate(UpcomingEvents, StickyEvents);
                }
                catch (Exception e)
                {
                    _notificationCallback.OnError(e);
                }
            });
        }
        public ActionResult DeleteConfirmed(long id)
        {
            UpcomingEvents upcomingEvents = db.UpcomingEvents.Find(id);

            db.UpcomingEvents.Remove(upcomingEvents);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dataAdapter = new WebsiteEventDataAdapter(new Adxstudio.Xrm.Cms.PortalContextDataAdapterDependencies(Portal));
            var now         = DateTime.UtcNow;

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

            UpcomingEvents.DataSource = dataAdapter.SelectEventOccurrences(now, now.Add(future)).Take(Html.IntegerSetting("Home Event Count").GetValueOrDefault(3));
            UpcomingEvents.DataBind();
        }
 public ActionResult Edit(UpcomingEvents upcomingEvents)
 {
     if (ModelState.IsValid)
     {
         db.Entry(upcomingEvents).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(upcomingEvents));
 }
 public MainCenter_InitClasses(IWebDriver driver)
 {
     liveEvents     = new LiveEvents();
     topEvents      = new TopEvents();
     upcomingEvents = new UpcomingEvents();
     PageFactory.InitElements(driver, this);
     PageFactory.InitElements(driver, liveEvents);
     PageFactory.InitElements(driver, topEvents);
     PageFactory.InitElements(driver, upcomingEvents);
 }
        public async Task <IActionResult> Create([Bind("UpcomingEventsID,Title,EventSummary,EventPrice,EventDate")] UpcomingEvents upcomingEvents)
        {
            if (ModelState.IsValid)
            {
                _context.Add(upcomingEvents);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(upcomingEvents));
        }
 private IEnumerable <RaceEventModel> MapRaceEvents(UpcomingEvents upcommingEvents)
 {
     return(upcommingEvents.Items.Select(item => new RaceEventModel
     {
         Id = int.Parse(item.ID),
         Name = item.Name, Distance = double.Parse(item.Distance),
         EventDate = DateTime.Parse(item.EventTime),
         FinishTime = DateTime.Parse(item.FinishTime),
         EventNumber = int.Parse(item.EventNumber),
         Entries = MapEntries(item.Entry)
     }));
 }
Пример #12
0
        protected void Page_Load(object sender, EventArgs args)
        {
            var dataAdapter = new ConferenceEventDataAdapter(new PortalContextDataAdapterDependencies(Portal, PortalName), PortalConference);

            var occurrences = dataAdapter.SelectEventOccurrences(
                PortalConference.GetAttributeValue <DateTime?>("adx_startingdate").GetValueOrDefault(DateTime.MinValue),
                PortalConference.GetAttributeValue <DateTime?>("adx_enddate").GetValueOrDefault(DateTime.MaxValue)).ToArray();

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

            UpcomingEvents.DataBind();
        }
Пример #13
0
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UpcomingEvents upcomingEvents = db.UpcomingEvents.Find(id);

            if (upcomingEvents == null)
            {
                return(HttpNotFound());
            }
            return(View(upcomingEvents));
        }
        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();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                HtmlLink link = Page.Master.FindControl("layoutStyleSheet") as HtmlLink;
                link.Href = "css/secondary.css";
            }
            myDAL     objmyDAl = new myDAL();
            DataTable DT       = new DataTable();
            int       found;

            found = objmyDAl.Upcoming_DAL(ref DT);
            if (found == 1)
            {
                UpcomingEvents.DataSource = DT;
                UpcomingEvents.DataBind();
            }
        }
Пример #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _CalendarAbsPath = MapPath("~/Calendars");

        if (!IsPostBack)
        {
            // Load our list of available calendars
            CalendarList.DataSource = LoadCalendarList();
            CalendarList.DataBind();

            // Select all calendars in the list by default
            foreach (ListItem li in CalendarList.Items)
            {
                li.Selected = true;
            }
        }

        // Create an object that will sort our events by date
        EventDateSorter eventDateSorter = new EventDateSorter();

        // Build a list of today's events
        List <Event> todaysEvents = new List <Event>(GetTodaysEvents());

        // Sort our list by start date
        todaysEvents.Sort(eventDateSorter);

        // Bind our list to the repeater that will display the events.
        TodaysEvents.DataSource = todaysEvents;
        TodaysEvents.DataBind();

        // Build a list of upcoming events
        List <Event> upcomingEvents = new List <Event>(GetUpcomingEvents());

        // Sort that list by start date
        upcomingEvents.Sort(eventDateSorter);

        // Bind our list to the repeater that will display the events.
        UpcomingEvents.DataSource = upcomingEvents;
        UpcomingEvents.DataBind();
    }