当前位置: 首页>>代码示例>>C#>>正文


C# YafTemplateEmail.ProcessTemplate方法代码示例

本文整理汇总了C#中YAF.Core.Services.YafTemplateEmail.ProcessTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# YafTemplateEmail.ProcessTemplate方法的具体用法?C# YafTemplateEmail.ProcessTemplate怎么用?C# YafTemplateEmail.ProcessTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在YAF.Core.Services.YafTemplateEmail的用法示例。


在下文中一共展示了YafTemplateEmail.ProcessTemplate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    /// <summary>
    /// The page_ load.
    /// </summary>
    /// <param name="sender">
    /// The sender.
    /// </param>
    /// <param name="e">
    /// The e.
    /// </param>
    protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
    {
      if (this.Get<HttpRequestBase>().QueryString["t"] == null || !this.PageContext.ForumReadAccess ||
          !this.PageContext.BoardSettings.AllowEmailTopic)
      {
        YafBuildLink.AccessDenied();
      }

      if (!this.IsPostBack)
      {
        if (this.PageContext.Settings.LockedForum == 0)
        {
          this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
          this.PageLinks.AddLink(
            this.PageContext.PageCategoryName, 
            YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID));
        }

        this.PageLinks.AddForumLinks(this.PageContext.PageForumID);
        this.PageLinks.AddLink(
          this.PageContext.PageTopicName, YafBuildLink.GetLink(ForumPages.posts, "t={0}", this.PageContext.PageTopicID));

        this.SendEmail.Text = this.GetText("send");

        this.Subject.Text = this.PageContext.PageTopicName;

        var emailTopic = new YafTemplateEmail();

        emailTopic.TemplateParams["{link}"] = YafBuildLink.GetLinkNotEscaped(
          ForumPages.posts, true, "t={0}", this.PageContext.PageTopicID);
        emailTopic.TemplateParams["{user}"] = this.PageContext.PageUserName;

        this.Message.Text = emailTopic.ProcessTemplate("EMAILTOPIC");
      }
    }
开发者ID:vzrus,项目名称:VZF,代码行数:44,代码来源:emailtopic.ascx.cs

示例2: SendSpamBotNotificationToAdmins

        /// <summary>
        /// Sends a spam bot notification to admins.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userId">The user id.</param>
        private void SendSpamBotNotificationToAdmins([NotNull] MembershipUser user, int userId)
        {
            // Get Admin Group ID
            var adminGroupID = 1;

            foreach (DataRow dataRow in
                LegacyDb.group_list(this.PageContext.PageBoardID, null)
                    .Rows.Cast<DataRow>()
                    .Where(
                        dataRow =>
                        !dataRow["Name"].IsNullOrEmptyDBField() && dataRow.Field<string>("Name") == "Administrators"))
            {
                adminGroupID = dataRow["GroupID"].ToType<int>();
                break;
            }

            using (DataTable dt = LegacyDb.user_emails(this.PageContext.PageBoardID, adminGroupID))
            {
                foreach (DataRow row in dt.Rows)
                {
                    var emailAddress = row.Field<string>("Email");

                    if (!emailAddress.IsSet())
                    {
                        continue;
                    }

                    var notifyAdmin = new YafTemplateEmail();

                    string subject =
                        this.GetText("COMMON", "NOTIFICATION_ON_BOT_USER_REGISTER_EMAIL_SUBJECT")
                            .FormatWith(this.Get<YafBoardSettings>().Name);

                    notifyAdmin.TemplateParams["{adminlink}"] = YafBuildLink.GetLinkNotEscaped(
                        ForumPages.admin_edituser,
                        true,
                        "u={0}",
                        userId);
                    notifyAdmin.TemplateParams["{user}"] = user.UserName;
                    notifyAdmin.TemplateParams["{email}"] = user.Email;
                    notifyAdmin.TemplateParams["{forumname}"] = this.Get<YafBoardSettings>().Name;

                    string emailBody = notifyAdmin.ProcessTemplate("NOTIFICATION_ON_BOT_USER_REGISTER");

                    this.GetRepository<Mail>()
                        .Create(this.Get<YafBoardSettings>().ForumEmail, emailAddress, subject, emailBody);
                }
            }
        }
开发者ID:JP58,项目名称:YAFNET,代码行数:54,代码来源:register.ascx.cs

示例3: SendRegistrationNotificationEmail

        /// <summary>
        /// The send registration notification email.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userId">The user id.</param>
        private void SendRegistrationNotificationEmail([NotNull] MembershipUser user, int userId)
        {
            string[] emails = this.Get<YafBoardSettings>().NotificationOnUserRegisterEmailList.Split(';');

            var notifyAdmin = new YafTemplateEmail();

            string subject =
                this.GetText("COMMON", "NOTIFICATION_ON_USER_REGISTER_EMAIL_SUBJECT")
                    .FormatWith(this.Get<YafBoardSettings>().Name);

            notifyAdmin.TemplateParams["{adminlink}"] = YafBuildLink.GetLinkNotEscaped(
                ForumPages.admin_edituser,
                true,
                "u={0}",
                userId);

            notifyAdmin.TemplateParams["{user}"] = user.UserName;
            notifyAdmin.TemplateParams["{email}"] = user.Email;
            notifyAdmin.TemplateParams["{forumname}"] = this.Get<YafBoardSettings>().Name;

            string emailBody = notifyAdmin.ProcessTemplate("NOTIFICATION_ON_USER_REGISTER");

            foreach (string email in emails.Where(email => email.Trim().IsSet()))
            {
                this.GetRepository<Mail>()
                    .Create(this.Get<YafBoardSettings>().ForumEmail, email.Trim(), subject, emailBody);
            }
        }
开发者ID:JP58,项目名称:YAFNET,代码行数:33,代码来源:register.ascx.cs

示例4: SendUserSuspensionEndedNotification

        /// <summary>
        /// Sends the user a suspension notification.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="userName">Name of the user.</param>
        public void SendUserSuspensionEndedNotification([NotNull] string email, [NotNull] string userName)
        {
            var notifyUser = new YafTemplateEmail();

            var subject =
                this.Get<ILocalization>()
                    .GetText("COMMON", "NOTIFICATION_ON_SUSPENDING_USER_SUBJECT")
                    .FormatWith(this.BoardSettings.Name);

            notifyUser.TemplateParams["{user}"] = userName;

            notifyUser.TemplateParams["{forumname}"] = this.BoardSettings.Name;
            notifyUser.TemplateParams["{forumurl}"] = YafForumInfo.ForumURL;

            var emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_SUSPENDING_ENDED_USER");

            this.GetRepository<Mail>()
                    .Create(
                        email,
                        userName,
                        subject,
                        emailBody);
        }
开发者ID:viniciustodesco,项目名称:YAFNET,代码行数:28,代码来源:YafSendNotification.cs

示例5: SendUserWelcomeNotification

        /// <summary>
        /// Sends the user welcome notification.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userId">The user identifier.</param>
        public void SendUserWelcomeNotification([NotNull] MembershipUser user, int? userId)
        {
            if (this.BoardSettings.SendWelcomeNotificationAfterRegister.Equals(0))
            {
                return;
            }

            var notifyUser = new YafTemplateEmail();

            var subject =
                this.Get<ILocalization>()
                    .GetText("COMMON", "NOTIFICATION_ON_WELCOME_USER_SUBJECT")
                    .FormatWith(this.BoardSettings.Name);

            notifyUser.TemplateParams["{user}"] = user.UserName;

            notifyUser.TemplateParams["{forumname}"] = this.BoardSettings.Name;
            notifyUser.TemplateParams["{forumurl}"] = YafForumInfo.ForumURL;

            var emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_WELCOME_USER");

            var messageFlags = new MessageFlags { IsHtml = false, IsBBCode = true };

            if (this.BoardSettings.AllowPrivateMessages
                && this.BoardSettings.SendWelcomeNotificationAfterRegister.Equals(2))
            {
                var users = LegacyDb.UserList(YafContext.Current.PageBoardID, null, true, null, null, null).ToList();

                var hostUser = users.FirstOrDefault(u => u.IsHostAdmin > 0);

                LegacyDb.pmessage_save(hostUser.UserID.Value, userId, subject, emailBody, messageFlags.BitValue, -1);
            }
            else
            {
                this.GetRepository<Mail>()
                    .Create(
                        user.Email,
                        user.UserName,
                        subject,
                        emailBody);
            }
        }
开发者ID:viniciustodesco,项目名称:YAFNET,代码行数:47,代码来源:YafSendNotification.cs

示例6: SendSpamBotNotificationToAdmins

        /// <summary>
        /// Sends a spam bot notification to admins.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userId">The user id.</param>
        public void SendSpamBotNotificationToAdmins([NotNull] MembershipUser user, int userId)
        {
            // Get Admin Group ID
            var adminGroupID =
                this.GetRepository<Group>()
                    .ListTyped(boardId: YafContext.Current.PageBoardID)
                    .Where(@group => @group.Name.Contains("Admin"))
                    .Select(@group => @group.ID)
                    .FirstOrDefault();

            if (adminGroupID <= 0)
            {
                return;
            }

            using (DataTable dt = LegacyDb.user_emails(YafContext.Current.PageBoardID, adminGroupID))
            {
                foreach (DataRow row in dt.Rows)
                {
                    var emailAddress = row.Field<string>("Email");

                    if (!emailAddress.IsSet())
                    {
                        continue;
                    }

                    var notifyAdmin = new YafTemplateEmail();

                    var subject =
                        this.Get<ILocalization>()
                            .GetText("COMMON", "NOTIFICATION_ON_BOT_USER_REGISTER_EMAIL_SUBJECT")
                            .FormatWith(this.BoardSettings.Name);

                    notifyAdmin.TemplateParams["{adminlink}"] = YafBuildLink.GetLinkNotEscaped(
                        ForumPages.admin_edituser,
                        true,
                        "u={0}",
                        userId);
                    notifyAdmin.TemplateParams["{user}"] = user.UserName;
                    notifyAdmin.TemplateParams["{email}"] = user.Email;
                    notifyAdmin.TemplateParams["{forumname}"] = this.BoardSettings.Name;

                    var emailBody = notifyAdmin.ProcessTemplate("NOTIFICATION_ON_BOT_USER_REGISTER");

                    this.GetRepository<Mail>()
                        .Create(
                            emailAddress,
                            null,
                            subject,
                            emailBody);
                }
            }
        }
开发者ID:viniciustodesco,项目名称:YAFNET,代码行数:58,代码来源:YafSendNotification.cs

示例7: SendRegistrationNotificationToUser

        /// <summary>
        /// Send an Email to the Newly Created User with
        /// his Account Info (Pass, Security Question and Answer)
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="pass">
        /// The pass.
        /// </param>
        /// <param name="securityAnswer">
        /// The security answer.
        /// </param>
        /// <param name="templateName">
        /// The template Name.
        /// </param>
        public void SendRegistrationNotificationToUser(
            [NotNull] MembershipUser user,
            [NotNull] string pass,
            [NotNull] string securityAnswer,
            string templateName)
        {
            var notifyUser = new YafTemplateEmail();

            var subject =
                this.Get<ILocalization>()
                    .GetText("COMMON", "NOTIFICATION_ON_NEW_FACEBOOK_USER_SUBJECT")
                    .FormatWith(this.BoardSettings.Name);

            notifyUser.TemplateParams["{user}"] = user.UserName;
            notifyUser.TemplateParams["{email}"] = user.Email;
            notifyUser.TemplateParams["{pass}"] = pass;
            notifyUser.TemplateParams["{answer}"] = securityAnswer;
            notifyUser.TemplateParams["{forumname}"] = this.BoardSettings.Name;

            var emailBody = notifyUser.ProcessTemplate(templateName);

            this.GetRepository<Mail>()
                .Create(
                    user.Email,
                    user.UserName,
                    subject,
                    emailBody);
        }
开发者ID:viniciustodesco,项目名称:YAFNET,代码行数:44,代码来源:YafSendNotification.cs

示例8: SendRegistrationNotificationToUser

        /// <summary>
        /// Send an Email to the Newly Created User with
        /// his Account Info (Pass, Security Question and Answer)
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="pass">
        /// The pass.
        /// </param>
        /// <param name="securityAnswer">
        /// The security answer.
        /// </param>
        private static void SendRegistrationNotificationToUser(
            [NotNull] MembershipUser user, [NotNull] string pass, [NotNull] string securityAnswer)
        {
            var notifyUser = new YafTemplateEmail();

            string subject =
                YafContext.Current.Get<ILocalization>().GetText("COMMON", "NOTIFICATION_ON_NEW_FACEBOOK_USER_SUBJECT").FormatWith(
                    YafContext.Current.Get<YafBoardSettings>().Name);

            notifyUser.TemplateParams["{user}"] = user.UserName;
            notifyUser.TemplateParams["{email}"] = user.Email;
            notifyUser.TemplateParams["{pass}"] = pass;
            notifyUser.TemplateParams["{answer}"] = securityAnswer;
            notifyUser.TemplateParams["{forumname}"] = YafContext.Current.Get<YafBoardSettings>().Name;

            string emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_FACEBOOK_REGISTER");

            YafContext.Current.Get<ISendMail>().Queue(YafContext.Current.Get<YafBoardSettings>().ForumEmail, user.Email, subject, emailBody);
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:32,代码来源:YafSingleSignOnUser.cs

示例9: SendRegistrationNotificationEmail

        /// <summary>
        /// The send registration notification email.
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        private static void SendRegistrationNotificationEmail([NotNull] MembershipUser user)
        {
            string[] emails = YafContext.Current.Get<YafBoardSettings>().NotificationOnUserRegisterEmailList.Split(';');

            var notifyAdmin = new YafTemplateEmail();

            string subject =
                YafContext.Current.Get<ILocalization>().GetText("COMMON", "NOTIFICATION_ON_USER_REGISTER_EMAIL_SUBJECT").FormatWith(
                    YafContext.Current.Get<YafBoardSettings>().Name);

            notifyAdmin.TemplateParams["{adminlink}"] = YafBuildLink.GetLinkNotEscaped(ForumPages.admin_admin, true);
            notifyAdmin.TemplateParams["{user}"] = user.UserName;
            notifyAdmin.TemplateParams["{email}"] = user.Email;
            notifyAdmin.TemplateParams["{forumname}"] = YafContext.Current.Get<YafBoardSettings>().Name;

            string emailBody = notifyAdmin.ProcessTemplate("NOTIFICATION_ON_USER_REGISTER");

            foreach (string email in emails.Where(email => email.Trim().IsSet()))
            {
                YafContext.Current.Get<ISendMail>().Queue(YafContext.Current.Get<YafBoardSettings>().ForumEmail, email.Trim(), subject, emailBody);
            }
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:28,代码来源:YafSingleSignOnUser.cs

示例10: SendRegistrationMessageToUser

        /// <summary>
        /// Send an Private Message to the Newly Created User with
        /// his Account Info (Pass, Security Question and Answer)
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="pass">
        /// The pass.
        /// </param>
        /// <param name="securityAnswer">
        /// The security answer.
        /// </param>
        /// <param name="userId">
        /// The user Id.
        /// </param>
        /// <param name="oAuth">
        /// The o Auth.
        /// </param>
        private static void SendRegistrationMessageToUser([NotNull] MembershipUser user, [NotNull] string pass, [NotNull] string securityAnswer, [NotNull] int userId, OAuthTwitter oAuth)
        {
            var notifyUser = new YafTemplateEmail();

            string subject =
                YafContext.Current.Get<ILocalization>().GetText("COMMON", "NOTIFICATION_ON_NEW_FACEBOOK_USER_SUBJECT").FormatWith(
                    YafContext.Current.Get<YafBoardSettings>().Name);

            notifyUser.TemplateParams["{user}"] = user.UserName;
            notifyUser.TemplateParams["{email}"] = user.Email;
            notifyUser.TemplateParams["{pass}"] = pass;
            notifyUser.TemplateParams["{answer}"] = securityAnswer;
            notifyUser.TemplateParams["{forumname}"] = YafContext.Current.Get<YafBoardSettings>().Name;

            string emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_FACEBOOK_REGISTER");

            var messageFlags = new MessageFlags { IsHtml = false, IsBBCode = true };

            // Send Message also as DM to Twitter.
            var tweetApi = new TweetAPI(oAuth);

            if (YafContext.Current.Get<YafBoardSettings>().AllowPrivateMessages)
            {
                LegacyDb.pmessage_save(2, userId, subject, emailBody, messageFlags.BitValue);

                string message = "{0}. {1}".FormatWith(
                subject, YafContext.Current.Get<ILocalization>().GetText("LOGIN", "TWITTER_DM"));

                tweetApi.SendDirectMessage(TweetAPI.ResponseFormat.json, user.UserName, message.Truncate(140));
            }
            else
            {
                string message = YafContext.Current.Get<ILocalization>().GetTextFormatted(
                    "LOGIN", "TWITTER_DM", YafContext.Current.Get<YafBoardSettings>().Name, user.UserName, pass);

                tweetApi.SendDirectMessage(TweetAPI.ResponseFormat.json, user.UserName, message.Truncate(140));
            }
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:57,代码来源:YafSingleSignOnUser.cs


注:本文中的YAF.Core.Services.YafTemplateEmail.ProcessTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。