Esempio n. 1
0
        public static string ParseEventTitle(EventListing listing)
        {
            var result = string.Join(" ", listing.Titles);

            if (!string.IsNullOrWhiteSpace(listing.Venue))
            {
                result += " at " + listing.Venue;
            }
            return(result);
        }
Esempio n. 2
0
 public EventViewModel(EventListing listing)
 {
     this.Listing              = listing;
     this.Id                   = listing.Id.ToString();
     this.Date                 = listing.Date.HasValue ? listing.Date.Value.ToString("d") : null;
     this.Type                 = listing.EventType.ToString();
     this.TitleFormatted       = DisplayHelper.ParseEventTitle(listing);
     this.ContactFormatted     = DisplayHelper.ParseListingContact(listing.Contact);
     this.DescriptionFormatted = DisplayHelper.ParseListingDescription(listing.Descriptions);
     this.LocationFormatted    = DisplayHelper.ParseListingLocation(listing.Location);
     this.Brag                 = listing.Brag;
     this.AdmissionInfo        = listing.AdmissionInfo;
     this.Price                = listing.Price;
     this.LongDescription      = listing.LongDescription;
 }
Esempio n. 3
0
        private EventViewModel populateModel(EventListing listingModel)
        {
            var model = new EventViewModel(listingModel);

            //model.Listing = listingModel;
            switch (listingModel.EventType)
            {
            case EventType.Gig:
                model.FormData = formsRepo.GetByName("GigCreate");
                break;

            case EventType.ArtistIndividual:
                model.FormData = formsRepo.GetByName("ArtistIndividualCreate");
                break;

            case EventType.ArtistMultiple:
                model.FormData = formsRepo.GetByName("ArtistMultipleCreate");
                break;

            case EventType.Concert:
                model.FormData = formsRepo.GetByName("ConcertCreate");
                break;

            case EventType.Orchestra:
                model.FormData = formsRepo.GetByName("OrchestraCreate");
                break;

            case EventType.Benefit:
                model.FormData = formsRepo.GetByName("BenefitCreate");
                break;

            case EventType.Series:
                model.FormData = formsRepo.GetByName("SeriesCreate");
                break;

            case EventType.Exhibit:
                model.FormData = formsRepo.GetByName("ExhibitCreate");
                break;

            default:
                model.FormData = formsRepo.GetByName("OtherCreate");
                break;
            }
            model.Listing.Initialize();
            return(model);
        }
Esempio n. 4
0
        public static Attachment CreateHeroCard(this EventListing eventListing)
        {
            var cardImages1 = new List <CardImage> {
                new CardImage(eventListing.Image)
            };
            var cardButtons = new List <CardAction>();

            if (eventListing.RegistrationSupported)
            {
                var plButton = new CardAction(ActionTypes.PostBack, $"Register",
                                              value: $"cmd://register/{eventListing.Id}");
                cardButtons.Add(plButton);
            }

            var plCard1 = new HeroCard {
                Title = eventListing.Title, Subtitle = eventListing.Subtitle, Text = eventListing.Summary, Images = cardImages1, Buttons = cardButtons
            };

            return(plCard1.ToAttachment());
        }
Esempio n. 5
0
        public void GeoSpatialTest()
        {
            using (var store = GetDocumentStore())
            {
                new EventsBySimpleLocation().Execute(store);
                using (var session = store.OpenSession())
                {
                    var venue = new EventVenue()
                    {
                        Name         = "TechHub",
                        AddressLine1 = "Sofia House",
                        City         = "London",
                        PostalCode   = "EC1Y 2BJ",
                        GeoLocation  = new GeoLocation(38.9690000, -77.3862000)
                    };
                    session.Store(venue);
                    var eventListing = new EventListing("Some event")
                    {
                        Cost      = "free",
                        EventType = EventType.Conference,
                        VenueId   = venue.Id,
                    };
                    session.Store(eventListing);
                    session.SaveChanges();
                }

                WaitForIndexing(store);

                using (var session = store.OpenSession())
                {
                    var matchingEvents = session.Advanced.DocumentQuery <EventWithLocation, EventsBySimpleLocation>()
                                         .WaitForNonStaleResults(TimeSpan.FromMinutes(5))
                                         .ToList();
                    Assert.Equal(1, matchingEvents.Count);
                    Assert.Equal("Some event", matchingEvents.First().EventName);
                    Assert.Equal("TechHub", matchingEvents.First().VenueName);
                }
            }
        }
        public override async Task <IEnumerable <EventListing> > GetEventListingsAsync(DateTime fromDate, DateTime toDate)
        {
            using (var httpClient = new HttpClient())
            {
                var uriBuilder = new UriBuilder("https", "api.meetup.com", 443, $"{_groupUrlName}/events",
                                                $"?fields=group_key_photo&&key={_key}");

                var response = await httpClient.GetStringAsync(uriBuilder.Uri);

                var result = new List <EventListing>();
                foreach (var evt in JArray.Parse(response))
                {
                    var date = DateTime.ParseExact(evt.SelectToken("$.local_date")?.Value <string>(), "yyyy-MM-dd", new DateTimeFormatInfo());
                    if (date >= fromDate && date <= toDate)
                    {
                        (var registrationSupported, var registrationSupportedReason) = IsRegistrationSupported(evt);

                        var listing = new EventListing();

                        //var rsvpLimit = evt.SelectToken("$.rsvp_limit")?.Value<int>();
                        //var yesRsvpCount = evt.SelectToken("$.yes_rsvp_count")?.Value<int>();

                        //var rspvs = rsvpLimit != null ? $"{yesRsvpCount}/{rsvpLimit}" : $"{yesRsvpCount}";
                        //listing.Subtitle = $"({rspvs})";
                        listing.Summary = $"{evt.SelectToken("$.description")?.Value<string>()?.StripHtml()}";
                        listing.Id      = evt.SelectToken("$.id")?.Value <string>();
                        listing.Title   = evt.SelectToken("$.name")?.Value <string>();
                        listing.Image   = evt.SelectToken("$.group.key_photo.photo_link")?.Value <string>();
                        listing.RegistrationSupported = registrationSupported;
                        result.Add(listing);
                    }
                }

                return(result);
            }
        }
Esempio n. 7
0
        private static List <EventListing> GetSeedEventListings()
        {
            var result  = new List <EventListing>();
            var bondGig = new EventListing();

            bondGig.Titles.Add("Bond Rockers");
            bondGig.Venue = "Pepsi Center";
            bondGig.Descriptions.Add("rock & roll");
            bondGig.Descriptions.Add("one night only");
            bondGig.Descriptions.Add("doors open at 7:30pm");
            bondGig.Contact.Add("www.bondrockers.com");
            bondGig.Contact.Add("www.pepsicenter.com");
            bondGig.AdmissionInfo   = "www.ticketmaster.com";
            bondGig.Brag            = "Best rock show in town";
            bondGig.Date            = DateTime.Now.AddDays(10).Date;
            bondGig.EventType       = EventType.Gig;
            bondGig.Price           = "FREE!";
            bondGig.LongDescription = "We put on the best rock show you will ever see. Come to hear the face melting guitar solos of new and classic rock hits!";
            bondGig.Location        = new List <string>()
            {
                "CO", "Denver", "Denver", "HiLo", "101 E Colfax", "Downtown", "By the river"
            };
            result.Add(bondGig);

            var gig2 = new EventListing();

            gig2.Titles.Add("Jake Miller plus guests");
            gig2.Venue = "Rex Theater";
            gig2.Descriptions.Add("pop rap");
            gig2.Descriptions.Add("one night only");
            gig2.Descriptions.Add("8 pm");
            gig2.Contact.Add("jakemiller.com");
            gig2.Contact.Add("greyandaprod.com");
            gig2.AdmissionInfo = "tickets at Druskyent.com or call 877-4-FLY-Tix";
            gig2.Brag          = "Newest album: 2:00 AM inLA";
            gig2.Date          = DateTime.Parse("09/16/2017");
            gig2.EventType     = EventType.Gig;
            result.Add(gig2);

            var gig3 = new EventListing();

            gig3.Titles.Add("3Teeth with Morpheus Laughing & God Hates Unicorns");
            gig3.Venue = "Rex Theater";
            gig3.Descriptions.Add("eclectic");
            gig3.Descriptions.Add("one night only");
            gig3.Descriptions.Add("7:30 pm");
            gig3.Contact.Add("greyareaprod.com");
            gig3.AdmissionInfo = "tickets at Druskyent.com or call 877-4-FLY-Tix";
            gig3.Date          = DateTime.Parse("07/15/2017");
            gig3.EventType     = EventType.Gig;
            result.Add(gig3);

            var gig4 = new EventListing();

            gig4.Titles.Add("Shelf Life String Band");
            gig4.Venue = "The Park House";
            gig4.Descriptions.Add("bluegrass & new grass");
            gig4.Descriptions.Add("every Wednesday night");
            gig4.Descriptions.Add("around 8 pm");
            gig4.Contact.Add("shelflifestringband.com");
            gig4.Contact.Add("parkhousepgh.com");
            gig4.Price     = "FREE!";
            gig4.Brag      = "'this ain't your pappy's bluegrass'";
            gig4.Date      = DateTime.Parse("07/26/2017");
            gig4.EventType = EventType.Gig;
            gig4.Location  = new List <string>()
            {
                "PA", "Allegheny", "Pittsburgh", "North Side", "405 East Ohio Street", "north", "just of Cedar Ave by the park"
            };
            result.Add(gig4);

            var gig5 = new EventListing();

            gig5.Titles.Add("Bond Unplugged");
            gig5.Venue = "Red Rocks";
            gig5.Descriptions.Add("classic rock");
            gig5.Descriptions.Add("one night only");
            gig5.Descriptions.Add("doors open at 6:15");
            gig5.Contact.Add("www.bondmusic.com");
            gig5.Contact.Add("www.redrocks.com");
            gig5.Price     = "$50";
            gig5.Brag      = "best classic rock covers";
            gig5.Date      = DateTime.Parse("08/15/2017");
            gig5.EventType = EventType.Gig;
            gig5.Location  = new List <string>()
            {
                "CO", "Jefferson", "Denver", "Morrison", "101 Main Street", "West", "just off E-470"
            };
            result.Add(gig5);

            return(result);
        }
 public EventListingPage()
 {
     Hero    = new Hero();
     Listing = new EventListing();
 }
Esempio n. 9
0
 private void ScrollToEnd()
 {
     EventListing.ScrollIntoView(EventListing.Items[EventListing.Items.Count - 1]);
     EventListing.SelectedIndex = -1;
 }
Esempio n. 10
0
 public EventViewModel(EventListing listing, EventFormData formData) : this(listing)
 {
     this.FormData = formData;
 }