Пример #1
0
        public Event GetEventObject(dynamic ev)
        {
            var e = new Event();
            e.Description = ev.snippet_text;
            e.Name = ev.name;
            e.Url = ev.url;
            e.MobileUrl = ev.mobile_url;
            e.ImageUrl = ev.image_url;
            e.UserReviewsCount = (uint) ev.review_count;
            e.UserRating = GetUserRating(ev.rating_img_url);

            if (ev.location != null)
            {
                var l = ev.location;
                var v = new Venue();
                v.City = l.city;
                v.StreetLine1 = l.address[0];
                if (l.coordinate != null)
                {
                    v.Lat = l.coordinate.latitude.ToString();
                    v.Lon = l.coordinate.longitude.ToString();

                }
                v.State = l.state_code;
                if (l.neighborhoods != null)
                v.Neighboorhood = l.neighborhoods[0];
            }
            return e;
        }
Пример #2
0
        public Event GetEventObject(dynamic deal)
        {
            var e = new Event();
            if (deal.redemptionLocations != null)
            {
                var location = deal.redemptionLocations[0];
                var v = new Venue();
                v.Lat = location.lat.ToString();
                v.Lon = location.lng.ToString();
                v.City = location.city;
                v.State = location.state;
                v.StreetLine1 = location.streetAddress1;
                v.StreetLine2 = location.streetAddress2;
                v.PhoneNumber = location.phoneNumber;
                v.PostalCode = location.postalCode;
                e.Venue = v;
            }
            e.Name = deal.title;
            e.Url = deal.dealUrl;
            e.ImageUrl = deal.mediumImageUrl;

            var tags = new List<string>();

            foreach (var t in deal.tags)
            {
                tags.Add(t.name);
            }
            // e.Tags = tags;
            dynamic options = deal.options;
            if (deal.options != null && options[0] != null)
            {
                e.Price = options[0].price.amount;
                e.Value = options[0].value.amount;
            }
            e.Source = "Groupon";
            return e;
        }
Пример #3
0
 public static Venue GetVenue(string venueName)
 {
     var v = new Venue()
     {
         Name = venueName,
         StreetLine1 = "",
         StreetLine2 = "",
         City = "Seattle",
         State = "WA",
         Country = Country.US
     };
     return v;
 }