public void CreateFacebookEvent() { var e = new Event() { Description = "desc test", Name = "name test", StartDateTime = DateTime.UtcNow.AddDays(5), EndDateTime = DateTime.UtcNow.AddDays(6), Venue = new Venue() { StreetLine1 = "Univerisity St. 10", StreetLine2 = string.Empty, City = "Seattle", State = "Washington", Country = Country.US, Lat = 1.123f, Lon = 12.123f } }; Mock<IRepository> mockRepo = new Mock<IRepository>(); var oauth = new OAuthHandler(); oauth.Token = ""; //var fbAcct = new FacebookAccount(mockRepo.Object, oauth); //fbAcct.CreateFacebookEvent(actv); }
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; }
public Event GetEventObject(dynamic ev) { var e = new Event(); e.Name = ev.title; e.Description = ev.description; e.Url = ev.url; e.StartDateTime = DateTime.Parse(ev.start_time); e.EndDateTime = !String.IsNullOrEmpty(ev.stop_time) ? DateTime.Parse(ev.stop_time) : default(DateTime); if (ev.image != null){ if (ev.image.medium != null) { e.ImageUrl = ev.image.medium.url; } else if (ev.image.small != null) { e.ImageUrl = ev.image.small.url; } } e.Venue = new Venue() { StreetLine1 = ev.venue_address, City = ev.city_name, State = ev.region_name, Country = ev.country_name, Lon = ev.longitude, Lat = ev.latitude, Name = ev.venue_name }; e.Source = "Eventful"; return e; }
private void AssertEventPopulated(Event e) { Assert.IsTrue(!string.IsNullOrEmpty(e.Name), "name should not be empty"); Assert.IsTrue(!string.IsNullOrEmpty(e.ImageUrl), "imageurl should not be empty"); Assert.IsTrue(e.UserReviewsCount > 0, "review count should be > 0"); Assert.IsTrue(e.UserRating > 0, "rating should be > 0"); }
public Promotion(Business business, Event ev, IList<Deal> deals, int available, byte maxReferal) { this.Business = business; this.Event = ev; this.Deals = deals; this.Available = available; this.MaxReferal = maxReferal; }
public static void PostToWall(Event e) { FacebookClient fc = new FacebookClient(FacebookWebContext.Current.AccessToken); dynamic parameters = PopulateParametersForEvent(e); parameters.actions = new { name = "View on Popr.ly", link = "http://popr.ly/Event/View/?event="+e.Id }; SetPrivacy(parameters, e.Privacy); dynamic result = fc.Post("me/feed", parameters); }
public static ConnectionType GetConnection(this Account a, Event evt, IDataService ds) { ConnectionType ct = ConnectionType.NoConnection; if (evt.Organizers.Contains(a)) ct |= ConnectionType.Owner; else if (evt.IsOrganizedByFriend(a, ds)) ct |= ConnectionType.Friend; else if (evt.IsOrganizedByFriendOfFriend(a, ds)) ct |= ConnectionType.FriendOfFriend; // TODO: is invited return ct; }
public static Event GetEvent(string eventName, string venueName) { var rand = new Random(eventName.GetHashCode()); var e = new Event() { Name = eventName, Description = String.Format("Join us to the exciting {0}.", eventName), StartDateTime = DateTime.Today.AddDays(rand.Next(1, 3)).AddHours(15), EndDateTime = DateTime.Today.AddDays(rand.Next(3, 5)).AddHours(18), Price = 50, Value = 50, Source = "Seed", Privacy = PraLoup.DataAccess.Enums.Privacy.Public, Venue = GetVenue(venueName) }; return e; }
public ActionResult Create(Event e) { this.AccountBase.SetupActionAccount(); try { if (ModelState.IsValid) { this.AccountBase.EventActions.SaveEvent(e); return RedirectToAction("Index"); } else { // TODO: create a page that says events is added succesfully return RedirectToAction("Index"); } } catch { return View(); } }
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; }
public Promotion(Business business, Event ev, Deal deal, int available, byte maxReferal) : this(business, ev, new Deal[] { deal }, available, maxReferal) { }
public bool IsSelected(Event e) { // TODO: only return true if we want this lets look at the tags return true; }
public static Permission GetPermissions(Event e, ConnectionType connection) { var p = new Permission(e); if (connection.HasFlag(ConnectionType.Owner)) { p.value |= PermissionEnum.Copy; p.value |= PermissionEnum.Delete; p.value |= PermissionEnum.Edit; } switch (e.Privacy) { // public event can be viewed, shared and accpeted by everyone case DataAccess.Enums.Privacy.Public: p.value |= PermissionEnum.View; p.value |= PermissionEnum.Share; p.value |= PermissionEnum.Accept; break; // friend only event can be viewed and accpeted by friends and owner only case DataAccess.Enums.Privacy.Friends: if (connection.HasFlag(ConnectionType.Friend) || connection.HasFlag(ConnectionType.Owner)) { p.value |= PermissionEnum.View; p.value |= PermissionEnum.Accept; } break; // friend of friend can view and accept case DataAccess.Enums.Privacy.FriendsOfFriend: if (connection.HasFlag(ConnectionType.FriendOfFriend) || connection.HasFlag(ConnectionType.Friend) || connection.HasFlag(ConnectionType.Owner)) { p.value |= PermissionEnum.View; p.value |= PermissionEnum.Accept; } break; // private means that only the owner can view and and accept // Todo: how about people that are invited explicitly? case DataAccess.Enums.Privacy.Private: if (connection.HasFlag(ConnectionType.Owner)) { p.value |= PermissionEnum.View; p.value |= PermissionEnum.Accept; } break; } if (p.value != PermissionEnum.EmptyMask) { p.value |= PermissionEnum.View; } return p; }
public Event SendUpdate(Event ev) { return ev; }
public bool IsSelected(Event e) { throw new NotImplementedException(); }
public static Promotion GetPromo(Business b, Event ev, Deal d) { return new Promotion(b, ev, d, 100, 5); }
public Event SendReminder(Event ev) { return ev; }
protected static dynamic PopulateParametersForEvent(Event e) { dynamic parameters = new ExpandoObject(); parameters.message = e.Venue; parameters.link = e.Url; parameters.picture = ""; parameters.name = e.Name; parameters.caption = e.Description; parameters.description = e.Description; parameters.targeting = new { countries = "US", regions = "6,53", locales = "6", }; return parameters; }