public string FindTwitterProfiles(string searchText) { try { //Process authorization if (!ProcessAuthorization(HttpContext.Current)) { AccessDenied(HttpContext.Current); return null; } TwitterDataProvider provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); List<TwitterUserInfo> users = provider.FindUsers(searchText); /*List<TwitterUserInfo> users = new List<TwitterUserInfo>(); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 }); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 }); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 });*/ string result = JsonConvert.SerializeObject(users); return result; } catch (Exception ex) { throw ProcessError(ex, "FindTwitterProfiles"); } }
public List<TwitterUserInfo> FindTwitterProfiles(string searchText) { try { TwitterApiInfo apiInfo = TwitterApiHelper.GetTwitterApiInfoForCurrentUser(); if (apiInfo == null) throw new SocialMediaAccountNotFound(SocialMediaResource.SocialMediaAccountNotFoundTwitter); TwitterDataProvider provider = new TwitterDataProvider(apiInfo); List<TwitterUserInfo> users = provider.FindUsers(searchText); /*List<TwitterUserInfo> users = new List<TwitterUserInfo>(); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 }); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 }); users.Add(new TwitterUserInfo { Description = "I'm a cool user", SmallImageUrl = "http://localhost/TeamLab/products/crm/data/0/photos/00/00/10/contact_10_50_50.jpg", UserName = "******", ScreenName = "user", UserID = 1 });*/ return users; } catch (Exception ex) { throw new SocialMediaUI().ProcessError(ex, "ASC.Api.CRM.CRMApi.FindTwitterProfiles"); } }
public string FindUsers(string searchText, string socialNetwork) { try { //Process authorization if (!ProcessAuthorization(HttpContext.Current)) { AccessDenied(HttpContext.Current); return null; } if (socialNetwork.ToLower() == "twitter") { TwitterDataProvider provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); List<TwitterUserInfo> users = provider.FindUsers(searchText); return GetTwitterUserListPage(users); } if (socialNetwork.ToLower() == "facebook") { FacebookApiInfo apiInfo = FacebookApiHelper.GetFacebookApiInfoForCurrentUser(); if (apiInfo == null) throw new SocialMediaAccountNotFound(SocialMediaResource.SocialMediaAccountNotFoundFacebook); FacebookDataProvider facebookProvider = new FacebookDataProvider(apiInfo); List<FacebookUserInfo> users = facebookProvider.FindUsers(searchText); return GetFacebookUserListPage(users); } return null; } catch (Exception ex) { throw ProcessError(ex, "FindUsers"); } }