internal MessengerUser(FB_User user) : base(user) { IsFriend = user.is_friend; Url = user.url; FirstName = user.first_name; LastName = user.last_name; Nickname = user.nickname; OwnNickname = user.own_nickname; Gender = user.gender; }
public static string GetUser(string author) { FB_User result = users.FirstOrDefault(user => user.uid.Equals(author)); if (result == null) { return(author); } else { return(result.first_name == null ? result.last_name : result.first_name); } }
private MessengerUser GetUser(FB_User author) { if (author == null) { return(null); } var user = GetUser(author.uid); if (user == null) { user = new MessengerUser(author); users.Add(user); } return(user); }
public async Task <FB_User> Get_FBUserDetails(string Key) { string resultKey = string.Empty; FB_User reustFB_User = null; try { var objUserDailyLogin = (await firebase.Child("User").OnceAsync <FB_User>()).Where(item => item.Key == Key).SingleOrDefault(); if (objUserDailyLogin != null) { reustFB_User = objUserDailyLogin.Object; } } catch (Exception ex) { } return(reustFB_User); }
protected void LoadFacebookSearch(string name) { try { Panel1.Visible = true; List<FB_User> ListOfUsers = new List<FB_User>(); Sage.Platform.Application.Services.IUserOptionsService userOption = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.Services.IUserOptionsService>(); string token = userOption.GetCommonOption("AccessToken", "Facebook"); Facebook.FacebookAPI api = new Facebook.FacebookAPI(token); if (ddlSearchType.SelectedValue == "Public") { Dictionary<string, string> param = new Dictionary<string, string>(); param.Add("q", name.ToLower()); param.Add("type", "user"); if (!string.IsNullOrEmpty(ddlLimit.SelectedValue)) { param.Add("limit", ddlLimit.SelectedValue); } else { param.Add("limit", "100"); } if (!string.IsNullOrEmpty(ddlOffSet.SelectedValue)) { param.Add("offset", ddlOffSet.SelectedValue); } JSONObject result = api.Get("/search", param); if (result.Dictionary["data"].Array.Length > 0) { foreach (JSONObject j in result.Dictionary["data"].Array) { FB_User user = new FB_User(); user.Name = j.Dictionary["name"].String; user.Id = j.Dictionary["id"].String; user.ImageURL = String.Format("http://graph.facebook.com/{0}/picture", j.Dictionary["id"].String); ListOfUsers.Add(user); } } } else if (ddlSearchType.SelectedValue == "Friends") { JSONObject result = api.Get("/me/friends"); if (result.Dictionary["data"].Array.Length > 0) { foreach (JSONObject j in result.Dictionary["data"].Array) { if (j.Dictionary["name"].String.Contains(txtSearch.Text)) { FB_User user = new FB_User(); user.Name = j.Dictionary["name"].String; user.Id = j.Dictionary["id"].String; if (ddImgSize.SelectedValue == "Small") { user.ImageURL = String.Format("http://graph.facebook.com/{0}/picture", j.Dictionary["id"].String); } else { user.ImageURL = String.Format("http://graph.facebook.com/{0}/picture?type=large", j.Dictionary["id"].String); } ListOfUsers.Add(user); } } } } rptUserList.DataSource = ListOfUsers; rptUserList.DataBind(); } catch (Exception) { } }
protected void LoadFacebookSearch(string name) { try { Sage.Platform.Application.Services.IUserOptionsService userOption = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.Services.IUserOptionsService>(); string token = userOption.GetCommonOption("AccessToken", "Facebook"); Facebook.FacebookAPI api = new Facebook.FacebookAPI(token); JSONObject result = api.Get("/me/friends"); JSONObject data = result.Dictionary["data"]; List<FB_User> friendsList = new List<FB_User>(); if (result.Dictionary["data"].Array.Length > 0) { foreach (JSONObject j in result.Dictionary["data"].Array) { if (j.Dictionary["name"].String.Contains(txtSearch.Text)) { FB_User user = new FB_User(); user.Name = j.Dictionary["name"].String; user.Id = j.Dictionary["id"].String; user.ImageURL = String.Format("http://graph.facebook.com/{0}/picture", j.Dictionary["id"].String); friendsList.Add(user); } } } GridView1.DataSource = friendsList; GridView1.DataBind(); } catch (Exception) { } }