Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ProfileUser != null)
            {
                // TODO: since we manage telligent users, we should be storing data on our member to avoid
                // unneeded api lookups
                var mm = new MembershipManager();
                _member = mm.GetMemberByScreenName(ProfileUser.Username);

                if (_member == null)
                {
                    return;
                }

                ProfileUrl         = MembershipHelper.GetPublicProfileUrl(ProfileUser.Username);
                ProfileActivityUrl = MembershipHelper.GetPublicProfileActivityUrl(ProfileUser.Username);

                BindEvents();
                PopulateContent();
            }
        }
        protected void btnConnect_Click(object sender, EventArgs e)
        {
            //Check community permissions
            //this.ProfileRedirect(Constants.UserPermission.CommunityUser);
            //Check status and perform appropriate action
            switch (Status)
            {
            case Constants.TelligentFriendStatus.NotSpecified:
                //call service to create connection
                if (TelligentService.CreateFriendRequest(CurrentMember.ScreenName, UserName, String.Format(DictionaryConstants.ConnectAction, UserName, "REPLACE")))
                {
                    //Change Text
                    Text = DictionaryConstants.RequestSent;

                    //TODO: send connection email
                }
                break;

            case Constants.TelligentFriendStatus.Recieved:
                //accept request
                if (TelligentService.UpdateFriendRequest(CurrentMember.ScreenName, UserName, "Approved"))
                {
                    Response.Redirect(Request.RawUrl, true);
                }
                break;

            case Constants.TelligentFriendStatus.Approved:
                //View user activity

                Response.Redirect(MembershipHelper.GetPublicProfileActivityUrl(UserName));

                break;

            case Constants.TelligentFriendStatus.Pending:     //Nothing to do but wait until friendship request approved
            default:
                break;
            }
        }