private void ShowHideContent() { EPanel.Visible = false; NewPostPlaceHolder.Visible = profileOwner.Id == Member.CurrentId; bool areFriends = Member.CurrentInCache.IsFriendsWith(profileOwner); MessageButton.Visible = areFriends && Member.CurrentId != profileOwner.Id; friendRequest = FriendshipRequest.Get(Member.CurrentId, profileOwner.Id); if (friendRequest != null) { RejectRequestButton.Visible = AcceptRequestButton.Visible = friendRequest.RecipientId == Member.CurrentId && friendRequest.Status == FriendshipRequestStatus.Pending; RequestSent.Visible = !areFriends && friendRequest.SenderId == Member.CurrentId; RequestSent.Text = string.Format("Friend request {0}", friendRequest.Status); BefriendButton.Visible = false; } else { RejectRequestButton.Visible = AcceptRequestButton.Visible = RequestSent.Visible = false; BefriendButton.Visible = !areFriends; } }
private void AddNode(Member member) { string rankName = LeadershipRank.GetRankName(member.GetRankId()); JObject properties = new JObject(); properties.Add(new JProperty("id", member.MatrixId.ToString())); properties.Add(new JProperty("userId", member.Id)); properties.Add(new JProperty("rank", rankName)); properties.Add(new JProperty("image", Page.ResolveUrl(member.AvatarUrl))); properties.Add(new JProperty("flag", Page.ResolveUrl(@"~/Images/Flags/" + member.CountryCode.ToLower() + ".png"))); properties.Add(new JProperty("countryName", member.Country)); properties.Add(new JProperty("name", member.Name)); properties.Add(new JProperty("status", "occupied")); string sponsor = Member.GetMemberUsername(member.ReferrerId); properties.Add(new JProperty("sponsor", string.IsNullOrWhiteSpace(sponsor) ? "-" : sponsor)); properties.Add(new JProperty("leftPoints", member.MatrixBonusMoneyFromLeftLeg.ToClearString())); properties.Add(new JProperty("rightPoints", member.MatrixBonusMoneyFromRightLeg.ToClearString())); FriendshipRequest friendRequest = FriendshipRequest.Get(Member.CurrentId, member.Id); bool areFriends = Member.CurrentInCache.IsFriendsWith(member) || (friendRequest != null && friendRequest.Status != FriendshipRequestStatus.Rejected); properties.Add(new JProperty("areNotFriends", AppSettings.TitanFeatures.SocialNetworkEnabled && !areFriends)); JObject node = new JObject( new JProperty("data", properties)); Nodes.Add(node); }