/// <summary> /// The details. /// </summary> /// <param name="id"> /// The id. /// </param> ©o©a ©ola /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult EventDetails(string id) { var eventDetails = EventServices.GetEventById(id); PagedAttendees attendees = AttendeesService.GetAttendeesByEventId(id); EventViewModel viewModel = new EventViewModel(eventDetails, attendees); return(this.View(viewModel)); }
public ActionResult Details(int id) { var @event = EventServices.GetEventById(id, Constants.ValidEventTypesForCed); if (@event == null) { return(View("NotFound")); } if (!IsDirectorAuthorizedOnEvent(@event.EventId)) { return(View("Unauthorized")); } var model = Mapper.Map <EventEntity, EventListModel>(@event); return(View(model)); }
public ActionResult Index(int?id = null) { var anyEventSelected = id.HasValue; if (id.HasValue) { if (!IsDirectorAuthorizedOnEvent(id.Value)) { return(View("Unauthorized")); } } var pastEvents = EventServices.GetPastEventsByDirector( CurrentCedUser.CurrentUser.Email, WebConfigHelper.MinFinancialYear, Constants.DefaultValidEditionStatusesForCed, Constants.ValidEventTypesForCed, 3, 20) .OrderBy(x => x.MasterName).ToList(); foreach (var @event in pastEvents) { @event.DisplayDate = DateHelper.GetDisplayDate(@event.StartDate, @event.EndDate); } if (!pastEvents.Any()) { var allEvents = EventServices.GetEventLightsByDirector( CurrentCedUser.CurrentUser.Email, Constants.ValidEventTypesForCed, WebConfigHelper.MinFinancialYear) .ToList(); if (allEvents.Any()) { id = allEvents.First().EventId; } else { return(View("Unauthorized")); } } if (id == null) { id = pastEvents.First().EventId; } var selectedEvent = EventServices.GetEventById(id.Value); if (selectedEvent == null) { return(View("NotFound")); } var lastEdition = EditionServices.GetLastFinishedEdition(selectedEvent.EventId); if (lastEdition == null) { var nextEdition = EditionServices.GetClosestEdition(selectedEvent.EventId, Constants.ValidEventTypesForCed); if (nextEdition == null) { return(View("Error", new ErrorModel { Message = $"Next edition not found for {selectedEvent.EventId} | {selectedEvent.MasterName}!" })); } return(View(new IndexModel { EventId = selectedEvent.EventId, EventName = selectedEvent.MasterName, EventType = selectedEvent.EventTypeCode.ToEnumFromDescription <EventType>(), EventDisplayDate = selectedEvent.DisplayDate, SelectedEditionId = nextEdition.EditionId, SelectedEditionName = nextEdition.EditionName, NextEditionStartDate = nextEdition.StartDate, EventEditionList = pastEvents })); } selectedEvent.DisplayDate = DateHelper.GetDisplayDate(lastEdition.StartDate, lastEdition.EndDate); var lastEditionTranslation = EditionTranslationServices.GetEditionTranslationLight(lastEdition.EditionId, LanguageHelper.GetBaseLanguageCultureName()); var internationalExhibitorPavilionCounts = StatisticServices.GetInternationalExhibitorPavilionCounts(selectedEvent.EventId, 3); var exhibitorCountryCounts = StatisticServices.GetExhibitorCountryCounts(selectedEvent.EventId, 3); var visitorCountryCounts = StatisticServices.GetVisitorCountryCounts(selectedEvent.EventId, 3); var localExhibitorRetentionRates = StatisticServices.GetExhibitorRetentionRatesLocal(selectedEvent.EventId, 3); var internationalExhibitorRetentionRates = StatisticServices.GetExhibitorRetentionRatesInternational(selectedEvent.EventId, 3); var editionCountriesExhibitor = EditionCountryServices.GetEditionCountriesByEdition(lastEdition.EditionId, EditionCountryRelationType.Exhibitor); var editionCountriesVisitor = EditionCountryServices.GetEditionCountriesByEdition(lastEdition.EditionId, EditionCountryRelationType.Visitor); var exhibitorCountryNames = Countries.Where(c => editionCountriesExhibitor.Any(ec => ec.CountryCode == c.CountryCode)) .Select(c => c.CountryName) .ToList(); var visitorCountryNames = Countries.Where(c => editionCountriesVisitor.Any(ec => ec.CountryCode == c.CountryCode)) .Select(c => c.CountryName) .ToList(); var delegateCountryNames = new List <string>(); var lastEditionEvent = lastEdition.Event ?? EventServices.GetEventById(lastEdition.EventId); if (Constants.ConferenceEventTypes.Contains(lastEditionEvent.EventTypeCode)) { var editionCountriesDelegate = EditionCountryServices.GetEditionCountriesByEdition(lastEdition.EditionId, EditionCountryRelationType.Delegate); delegateCountryNames = editionCountriesDelegate.Any() ? Countries.Where(c => editionCountriesExhibitor.Any(ec => ec.CountryCode == c.CountryCode)) .Select(c => c.CountryName) .ToList() : new List <string>(); } var model = new IndexModel { EventId = selectedEvent.EventId, EventName = selectedEvent.MasterName, EventType = selectedEvent.EventTypeCode.ToEnumFromDescription <EventType>(), EventDisplayDate = selectedEvent.DisplayDate, SelectedEditionId = lastEdition.EditionId, SelectedEditionName = lastEdition.EditionName, EventEditionList = pastEvents, EditionStatModel = new EditionStatModel { ExhibitorCountries = exhibitorCountryNames, VisitorCountries = visitorCountryNames, DelegateCountries = delegateCountryNames, LocalExhibitorRetentionRates = localExhibitorRetentionRates, InternationalExhibitorRetentionRates = internationalExhibitorRetentionRates, NumberOfInternationalPavilions = internationalExhibitorPavilionCounts, NumberOfExhibitorCountries = exhibitorCountryCounts, NumberOfVisitorCountries = visitorCountryCounts, BookAStandUrl = lastEditionTranslation.BookStandUrl, VisitorETicketUrl = lastEditionTranslation.OnlineInvitationUrl } }; // Additions to LOG object if (TempData["Log"] is LogEntity log) { if (log.EntityId == null || log.EntityId == 0) { log.EntityId = selectedEvent.EventId; log.EntityName = selectedEvent.MasterName; log.EventId = selectedEvent.EventId; log.EventName = selectedEvent.MasterName; } if (anyEventSelected) // If an event selected intentionally. { log.AdditionalInfo = "{ 'WebLogoFileName': '" + lastEditionTranslation.WebLogoFileName + "' }"; } } return(View(model)); }