コード例 #1
0
        void CommentService_Created(object sender, CommentEventArgs e)
        {
            if (e.Comment != null && e.Comment.MemberId > 0)
            {
                var ms = ApplicationContext.Current.Services.MemberService;
                var member = ms.GetById(e.Comment.MemberId);
                member.IncreaseForumPostCount();
                ms.Save(member);

                Action a = new Action("NewComment");
                a.Perform(member.Id, e.Comment.Id, "New comment created");
            }
        }
コード例 #2
0
ファイル: Forum.cs プロジェクト: umbraco/OurUmbraco
        void CommentService_Created(object sender, CommentEventArgs e)
        {
            var ts = new TopicService(ApplicationContext.Current.DatabaseContext);

            //Subscribe to topic
               var ns = new NotificationService(ApplicationContext.Current.DatabaseContext);
            ns.SubscribeToForumTopic(e.Comment.TopicId, e.Comment.MemberId);

            //data for notification:
            var membershipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current);
            var member = membershipHelper.GetById(e.Comment.MemberId);
            var memberName = string.Empty;
            if (member != null)
                memberName = member.Name;
            var topic = ts.GetById(e.Comment.TopicId);

            //send notifications
            InstantNotification not = new InstantNotification();
            not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", e.Comment, topic, topic.GetUrl(), memberName);
        }