// // GET: /Admin/Users public ActionResult Users(Guid?id, short count = 10) { if (id.HasValue && Guid.Empty != id.Value) { var profile = profileCore.SearchSingle <ProfileFull>(id.Value, null, null, true); if (null != profile) { if (!string.IsNullOrWhiteSpace(profile.FacebookAccessToken)) { var fbCore = new FacebookCore(); if (string.IsNullOrWhiteSpace(profile.Location)) { profile.Location = fbCore.Location(profile.FacebookAccessToken); if (!string.IsNullOrWhiteSpace(profile.Location)) { profileCore.Save(profile); } } var emails = fbCore.ImportFriends(profile); foreach (var email in emails) { emailCore.FriendSignedUp(email); } } } } return(View(this.adminCore.Profiles(count))); }
public override void Execute() { var facebook = new FacebookCore(); var profileCore = new ProfileCore(); var emailCore = new EmailCore(); var profiles = profileCore.Search(null, null, null, true, short.MaxValue, int.MaxValue); foreach (var profile in profiles) { try { var user = profileCore.SearchSingle <ProfileFull>(profile.Identifier, profile.Key, null, true); if (!string.IsNullOrWhiteSpace(user.FacebookAccessToken) && Guid.Empty != user.Identifier) { var emails = facebook.ImportFriends(user); foreach (var email in emails) { emailCore.NewFriend(email); } } Thread.Sleep(500); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } } }