Example #1
0
    protected void TryAddNode(Member member)
    {
        if (!CurrentNodes.Contains(member.Name))
        {
            string rankName = LeadershipRank.GetRankName(member.GetRankId());

            JObject properties = new JObject();

            properties.Add(new JProperty("id", member.Name));
            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"));


            JObject node = new JObject(
                new JProperty("data", properties));

            Nodes.Add(node);

            CurrentNodes.Add(member.Name);
        }
    }
Example #2
0
    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);
    }