예제 #1
0
        public IActionResult Index()
        {
            User user = new User();

            user = authProvider.GetCurrentUser();

            Event eventItem = new Event();

            eventItem.Podcast       = new Podcast();
            eventItem.Podcast.Genre = new Genre();


            SearchViewModel model = new SearchViewModel
            {
                Event         = eventItem,
                VenueList     = GetVenueList(),
                GenreList     = GetGenreList(),
                TicketList    = GetTicketList(),
                PodcastList   = GetPodcastList(),
                TimeOfDayList = GetTimeOfDay(),
                User          = user,
                UserFav       = new Dictionary <int, bool>()
            };

            model.EventList = eventSqlDal.GetFutureEvents(eventItem, user);


            foreach (Event item in model.EventList)
            {
                item.Venue         = venueSqlDal.GetVenue(item.VenueID);
                item.Podcast       = podcastSqlDal.GetPodcast(item.PodcastID);
                item.Podcast.Genre = genreSqlDal.GetGenreEventID(item.EventID);
                item.Ticket        = ticketSqlDal.GetTicket(item.TicketLevel);
            }

            model.ArchivedEventList = eventSqlDal.GetPastEvents(eventItem, user);
            foreach (Event item in model.ArchivedEventList)
            {
                item.Venue         = venueSqlDal.GetVenue(item.VenueID);
                item.Podcast       = podcastSqlDal.GetPodcast(item.PodcastID);
                item.Podcast.Genre = genreSqlDal.GetGenreEventID(item.EventID);
                item.Ticket        = ticketSqlDal.GetTicket(item.TicketLevel);
            }

            model.EventListByDay = model.EventList
                                   .GroupBy(p => p.Beginning.Date)
                                   .Select(g => g.ToList())
                                   .ToList();

            List <Event> userEvents = eventSqlDal.GetUserEvents(user);

            foreach (Event item in userEvents)
            {
                model.UserFav.Add(item.EventID, true);
            }

            return(View(model));
        }
        public IActionResult Index()
        {
            List <Event> eventList = eventSqlDal.GetAllEvents();

            eventList.ForEach(e =>
            {
                e.Podcast       = podcastDal.GetPodcast(e.PodcastID);
                e.Venue         = venueSqlDal.GetVenue(e.VenueID);
                e.Podcast.Genre = genreSqlDal.GetGenre(e.Podcast.GenreID);
                e.Ticket        = ticketSqlDal.GetTicket(e.TicketLevel);
            });



            return(View(eventList));
        }
        //    public string GenerateGoogleCal(int eventID)
        //    {
        //        Event eventItem = eventSqlDal.GetEvent(eventID);
        //        eventItem.Podcast = podcastDal.GetPodcast(eventItem.PodcastID);
        //        eventItem.Venue = venueSqlDal.GetVenue(eventItem.VenueID);
        //        eventItem.Podcast.Genre = genreSqlDal.GetGenre(eventItem.Podcast.GenreID);
        //        eventItem.Ticket = ticketSqlDal.GetTicket(eventItem.TicketLevel);
        //        eventItem.GoogleURL = GenerateGoogleCal(eventItem.EventID);

        //        string googleURLstart = "https://calendar.google.com/calendar/render?action=TEMPLATE&text=";
        //        string eventName = eventItem.EventName;
        //        string googledates = @"&dates=";
        //        string beginning = eventItem.Beginning.ToString("yyyyMMddTHHmmssZ");
        //        string googelSlash = @"/";
        //        string ending = eventItem.Ending.ToString("yyyyMMddTHHmmssZ");
        //        string googleDetails = @"&details = For + details,+link + here:+";
        //        string url = (eventItem.Podcast.URL == null) ? "" : eventItem.Podcast.URL;
        //        string googleLocation = "&location = ";
        //        string venue = System.Web.HttpUtility.UrlEncode(eventItem.Venue.DisplayName + "," +
        //                eventItem.Venue.Address1 + "," +
        //                eventItem.Venue.City + "," +
        //                eventItem.Venue.State + "," +
        //                eventItem.Venue.ZipCode);
        //        string googleOut = @"& sf = true & output = xml";
        //        string googleURL = googleURLstart + eventName + googledates + beginning + googelSlash + ending + googleDetails + url + googleLocation + venue + googleOut;
        //        return Uri.EscapeUriString(googleURL);

        //    }

        //}

        //https://calendar.google.com/calendar/render?action=TEMPLATE&text=Birthday&dates=20180201T090000/20180201T180000&sprop=&sprop=name:
        //    https://www.google.com/calendar   +301+Park+Ave+,+New+York,+NY+10022&sf=true&output=xml


        private Event PopulateEventDetails(int id)

        {
            Event eventItem = eventSqlDal.GetEvent(id);



            if (eventItem.PodcastID != null)
            {
                eventItem.Podcast       = podcastDal.GetPodcast(eventItem.PodcastID);
                eventItem.Podcast.Genre = genreSqlDal.GetGenre(eventItem.Podcast.GenreID);
            }

            if (eventItem.VenueID != null)
            {
                eventItem.Venue = venueSqlDal.GetVenue(eventItem.VenueID);
            }

            if (eventItem.TicketLevel != null)
            {
                eventItem.Ticket = ticketSqlDal.GetTicket(eventItem.TicketLevel);
            }

            return(eventItem);
        }
        public IActionResult Index()
        {
            List <User> users = userSqlDal.GetAllUsersByRole();

            users.ForEach(user =>
            {
                if (!String.IsNullOrEmpty(user.TicketLevel))
                {
                    user.Ticket = ticketSqlDal.GetTicket(user.TicketLevel);
                }
            });



            return(View(users));
        }