コード例 #1
0
ファイル: profile.ascx.cs プロジェクト: RichardBer/ParkCMS
        /// <summary>
        /// The lnk_ add buddy.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void lnk_AddBuddy([NotNull] object sender, [NotNull] CommandEventArgs e)
        {
            if (e.CommandArgument.ToString() == "addbuddy")
            {
                string[] strBuddyRequest = YafBuddies.AddBuddyRequest(this.UserId);

                var linkButton = (LinkButton)this.AboutTab.FindControl("lnkBuddy");

                linkButton.Visible = false;

                if (Convert.ToBoolean(strBuddyRequest[1]))
                {
                    this.PageContext.AddLoadMessage(
                        this.PageContext.Localization.GetText("NOTIFICATION_BUDDYAPPROVED_MUTUAL").FormatWith(strBuddyRequest[0]));
                }
                else
                {
                    var literal = (Literal)this.AboutTab.FindControl("ltrApproval");
                    literal.Visible = true;
                    this.PageContext.AddLoadMessage(this.PageContext.Localization.GetText("NOTIFICATION_BUDDYREQUEST"));
                }
            }
            else
            {
                this.PageContext.AddLoadMessage(
                    this.PageContext.Localization.GetText("REMOVEBUDDY_NOTIFICATION").FormatWith(
                        YafBuddies.RemoveBuddy(this.UserId)));
            }

            this.BindData();
        }
コード例 #2
0
        /// <summary>
        /// The pop menu 1_ item click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void PopMenu1_ItemClick([NotNull] object sender, [NotNull] PopEventArgs e)
        {
            switch (e.Item)
            {
            case "userprofile":
                YafBuildLink.Redirect(ForumPages.profile, "u={0}", this.PostData.UserId);
                break;

            case "lastposts":
                YafBuildLink.Redirect(ForumPages.search, "postedby={0}", this.PostData.UserProfile.UserName);
                break;

            case "addbuddy":
                var strBuddyRequest = new string[2];
                this.PopMenu1.RemovePostBackItem("addbuddy");
                strBuddyRequest = YafBuddies.AddBuddyRequest(this.PostData.UserId);
                if (Convert.ToBoolean(strBuddyRequest[1]))
                {
                    this.PageContext.AddLoadMessage(
                        this.PageContext.Localization.GetText("NOTIFICATION_BUDDYAPPROVED_MUTUAL").FormatWith(strBuddyRequest[0]));
                    this.PopMenu1.AddClientScriptItemWithPostback(
                        this.PageContext.Localization.GetText("BUDDY", "REMOVEBUDDY"),
                        "removebuddy",
                        "if (confirm('{0}')) {1}".FormatWith(this.PageContext.Localization.GetText("CP_EDITBUDDIES", "NOTIFICATION_REMOVE"), "{postbackcode}"));
                }
                else
                {
                    this.PageContext.AddLoadMessage(this.PageContext.Localization.GetText("NOTIFICATION_BUDDYREQUEST"));
                }

                break;

            case "removebuddy":
            {
                this.PopMenu1.RemovePostBackItem("removebuddy");
                this.PopMenu1.AddPostBackItem("addbuddy", this.PageContext.Localization.GetText("BUDDY", "ADDBUDDY"));
                this.PageContext.AddLoadMessage(
                    this.PageContext.Localization.GetText("REMOVEBUDDY_NOTIFICATION").FormatWith(
                        YafBuddies.RemoveBuddy(this.PostData.UserId)));
                break;
            }

            case "edituser":
                YafBuildLink.Redirect(ForumPages.admin_edituser, "u={0}", this.PostData.UserId);
                break;

            case "toggleuserposts_show":
                this.Get <YafUserIgnored>().RemoveIgnored(this.PostData.UserId);
                this.Response.Redirect(this.Request.RawUrl);
                break;

            case "toggleuserposts_hide":
                this.Get <YafUserIgnored>().AddIgnored(this.PostData.UserId);
                this.Response.Redirect(this.Request.RawUrl);
                break;

            case "viewthanks":
                YafBuildLink.Redirect(ForumPages.viewthanks, "u={0}", this.PostData.UserId);
                break;
            }
        }