示例#1
0
        public void UserList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "edit":
                YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.admin_edituser, "u={0}", e.CommandArgument);
                break;

            case "delete":
                UserMembershipHelper.DeleteUser(Convert.ToInt32(e.CommandArgument));
                BindData();
                break;

            case "approve":
                UserMembershipHelper.ApproveUser(Convert.ToInt32(e.CommandArgument));
                BindData();
                break;

            case "deleteall":
                UserMembershipHelper.DeleteAllUnapproved(DateTime.Now.AddDays(-14));
                //YAF.Classes.Data.DB.user_deleteold( PageContext.PageBoardID );
                BindData();
                break;

            case "approveall":
                UserMembershipHelper.ApproveAll();
                //YAF.Classes.Data.DB.user_approveall( PageContext.PageBoardID );
                BindData();
                break;
            }
        }
示例#2
0
        /// <summary>
        /// The user list_ item command.
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        public void UserList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "edit":
                YafBuildLink.Redirect(ForumPages.admin_edituser, "u={0}", e.CommandArgument);
                break;

            case "delete":
                string daysValue = ControlHelper.FindControlRecursiveAs <TextBox>(PageContext.CurrentForumPage, "DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValue))
                {
                    this.PageContext.AddLoadMessage("You should enter a valid integer value for days.");
                    return;
                }
                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteUser(Convert.ToInt32(e.CommandArgument));
                }

                YAF.Classes.Data.DB.user_delete(e.CommandArgument);
                BindData();
                break;

            case "approve":
                UserMembershipHelper.ApproveUser(Convert.ToInt32(e.CommandArgument));
                BindData();
                break;

            case "deleteall":
                // vzrus: Should not delete the whole providers portal data? Under investigation.
                string daysValueAll = ControlHelper.FindControlRecursiveAs <TextBox>(PageContext.CurrentForumPage, "DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValueAll))
                {
                    this.PageContext.AddLoadMessage("You should enter a valid integer value for days.");
                    return;
                }
                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteAllUnapproved(DateTime.UtcNow.AddDays(-Convert.ToInt32(daysValueAll)));
                }

                YAF.Classes.Data.DB.user_deleteold(PageContext.PageBoardID, Convert.ToInt32(daysValueAll));
                BindData();
                break;

            case "approveall":
                UserMembershipHelper.ApproveAll();
                // vzrus: Should delete users from send email list
                YAF.Classes.Data.DB.user_approveall(PageContext.PageBoardID);
                BindData();
                break;
            }
        }
示例#3
0
        /// <summary>
        /// Handles the ItemCommand event of the UserList control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
        public void UserListItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "edit":
                YafBuildLink.Redirect(ForumPages.admin_edituser, "u={0}", e.CommandArgument);
                break;

            case "resendEmail":
                var commandArgument = e.CommandArgument.ToString().Split(';');

                var checkMail = this.GetRepository <CheckEmail>().ListTyped(commandArgument[0]).FirstOrDefault();

                if (checkMail != null)
                {
                    var verifyEmail = new YafTemplateEmail("VERIFYEMAIL");

                    var subject = this.Get <ILocalization>()
                                  .GetTextFormatted("VERIFICATION_EMAIL_SUBJECT", this.Get <YafBoardSettings>().Name);

                    verifyEmail.TemplateParams["{link}"] = YafBuildLink.GetLinkNotEscaped(
                        ForumPages.approve,
                        true,
                        "k={0}",
                        checkMail.Hash);
                    verifyEmail.TemplateParams["{key}"]       = checkMail.Hash;
                    verifyEmail.TemplateParams["{forumname}"] = this.Get <YafBoardSettings>().Name;
                    verifyEmail.TemplateParams["{forumlink}"] = YafForumInfo.ForumURL;

                    verifyEmail.SendEmail(new MailAddress(checkMail.Email, commandArgument[1]), subject, true);

                    this.PageContext.AddLoadMessage(this.GetText("ADMIN_ADMIN", "MSG_MESSAGE_SEND"));
                }
                else
                {
                    var userFound = this.Get <IUserDisplayName>().Find(commandArgument[1]).FirstOrDefault();

                    var user = this.Get <MembershipProvider>().GetUser(userFound.Value, false);

                    this.Get <ISendNotification>().SendVerificationEmail(user, commandArgument[0], userFound.Key);
                }

                break;

            case "delete":
                var daysValue =
                    this.PageContext.CurrentForumPage.FindControlRecursiveAs <TextBox>("DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValue))
                {
                    this.PageContext.AddLoadMessage(this.GetText("ADMIN_ADMIN", "MSG_VALID_DAYS"));
                    return;
                }

                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteUser(e.CommandArgument.ToType <int>());
                }

                this.GetRepository <User>().Delete(e.CommandArgument.ToType <int>());

                this.BindData();
                break;

            case "approve":
                UserMembershipHelper.ApproveUser(e.CommandArgument.ToType <int>());
                this.BindData();
                break;

            case "deleteall":

                // vzrus: Should not delete the whole providers portal data? Under investigation.
                var daysValueAll =
                    this.PageContext.CurrentForumPage.FindControlRecursiveAs <TextBox>("DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValueAll))
                {
                    this.PageContext.AddLoadMessage(this.GetText("ADMIN_ADMIN", "MSG_VALID_DAYS"));
                    return;
                }

                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteAllUnapproved(DateTime.UtcNow.AddDays(-daysValueAll.ToType <int>()));
                }

                this.GetRepository <User>().DeleteOld(this.PageContext.PageBoardID, daysValueAll.ToType <int>());
                this.BindData();
                break;

            case "approveall":
                UserMembershipHelper.ApproveAll();

                // vzrus: Should delete users from send email list
                this.GetRepository <User>().ApproveAll(this.PageContext.PageBoardID);
                this.BindData();
                break;
            }
        }
示例#4
0
        /// <summary>
        /// Handles the ItemCommand event of the UserList control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
        public void UserList_ItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "edit":
                YafBuildLink.Redirect(ForumPages.admin_edituser, "u={0}", e.CommandArgument);
                break;

            case "delete":
                string daysValue =
                    this.PageContext.CurrentForumPage.FindControlRecursiveAs <TextBox>("DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValue))
                {
                    this.PageContext.AddLoadMessage(this.GetText("ADMIN_ADMIN", "MSG_VALID_DAYS"));
                    return;
                }

                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteUser(e.CommandArgument.ToType <int>());
                }

                LegacyDb.user_delete(e.CommandArgument);
                this.Get <ILogger>()
                .Log(
                    this.PageContext.PageUserID,
                    "YAF.Pages.Admin.admin",
                    "User {0} was deleted by {1}.".FormatWith(e.CommandArgument.ToType <int>(), this.PageContext.PageUserID),
                    EventLogTypes.UserDeleted);
                this.BindData();
                break;

            case "approve":
                UserMembershipHelper.ApproveUser(e.CommandArgument.ToType <int>());
                this.BindData();
                break;

            case "deleteall":

                // vzrus: Should not delete the whole providers portal data? Under investigation.
                string daysValueAll =
                    this.PageContext.CurrentForumPage.FindControlRecursiveAs <TextBox>("DaysOld").Text.Trim();
                if (!ValidationHelper.IsValidInt(daysValueAll))
                {
                    this.PageContext.AddLoadMessage(this.GetText("ADMIN_ADMIN", "MSG_VALID_DAYS"));
                    return;
                }

                if (!Config.IsAnyPortal)
                {
                    UserMembershipHelper.DeleteAllUnapproved(DateTime.UtcNow.AddDays(-daysValueAll.ToType <int>()));
                }

                LegacyDb.user_deleteold(this.PageContext.PageBoardID, daysValueAll.ToType <int>());
                this.BindData();
                break;

            case "approveall":
                UserMembershipHelper.ApproveAll();

                // vzrus: Should delete users from send email list
                LegacyDb.user_approveall(this.PageContext.PageBoardID);
                this.BindData();
                break;
            }
        }