コード例 #1
0
        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);
        }
コード例 #2
0
        private void SendProjectVoteReminders()
        {
            //Project vote

            using (SqlConnection conn = new SqlConnection(umbraco.GlobalSettings.DbDSN))
            {
                try
                {
                    string selectp = @"SELECT projectId, memberId
                                FROM [projectDownload] d
                                where memberId not in 
                                (select memberId from powersProject
                                where id = d.projectId and memberId = d.memberId)
                                and memberId != 0
                                and memberId not in
                                (select memberId from notificationVoteForProject
                                where projectId = d.projectId and memberId = d.memberId)
                                and timestamp < getdate() - 1
                                and timestamp > '2012-09-22 00:00:00'";


                    SqlCommand commp = new SqlCommand(
                        selectp, conn);

                    conn.Open();

                    SqlDataReader drp = commp.ExecuteReader();

                    while (drp.Read())
                    {
                        InstantNotification not = new InstantNotification();

                        int projectId = drp.GetInt32(0);
                        int memberId  = drp.GetInt32(1);

                        Document d = new Document(projectId);

                        not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "VoteForProjectReminderSingle", projectId, memberId, umbraco.library.NiceUrl(d.Id));
                    }
                }
                catch (Exception ex)
                {
                    umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications] " + ex.Message);
                }
                finally
                {
                    if (conn != null)
                    {
                        conn.Close();
                    }
                }
            }
        }
コード例 #3
0
        private void SendMarkAsSolutionReminders()
        {
            // Mark As Solution Reminder
            using (SqlConnection conn = new SqlConnection(umbraco.GlobalSettings.DbDSN))
            {
                try
                {
                    string select = @"select id, memberId from forumTopics where answer = 0
                                and created < getdate() - 7
                                and created > '2012-09-16 00:00:00'
                                and replies > 0
                                and id not in (select topicId from notificationMarkAsSolution)
                                order by created desc;";


                    SqlCommand comm = new SqlCommand(
                        select, conn);

                    conn.Open();

                    SqlDataReader dr = comm.ExecuteReader();

                    while (dr.Read())
                    {
                        InstantNotification not = new InstantNotification();

                        int topicId  = dr.GetInt32(0);
                        int memberId = dr.GetInt32(1);

                        Topic t = Topic.GetTopic(topicId);


                        not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "MarkAsSolutionReminderSingle", topicId, memberId, NiceTopicUrl(t));
                    }
                }
                catch (Exception ex)
                {
                    umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications] " + ex.Message);
                }
                finally
                {
                    if (conn != null)
                    {
                        conn.Close();
                    }
                }
            }
        }
コード例 #4
0
        void Comment_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e)
        {
            Comment c = (Comment)sender;

            //WB added to show these events are firing...
            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is starting");

            NotificationsWeb.BusinessLogic.ForumTopic.Subscribe
                (c.TopicId, c.MemberId);

            //send notifications
            InstantNotification not = new InstantNotification();

            Member m = new Member(c.MemberId);

            not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", c, NiceCommentUrl(c.TopicId, c, 10), m);

            //WB added to show these events are firing...
            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is finishing");
        }
コード例 #5
0
        void Topic_AfterCreate(object sender, CreateEventArgs e)
        {
            //subscribe topic created to notification
            Topic t = (Topic)sender;

            //WB added to show these events are firing...
            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is starting");

            NotificationsWeb.BusinessLogic.ForumTopic.Subscribe
                (t.Id, t.MemberId);

            Member m = new Member(t.MemberId);

            //send notification
            InstantNotification not = new InstantNotification();

            not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewTopic", t, NiceTopicUrl(t), m);

            //WB added to show these events are firing...
            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is finishing");
        }
コード例 #6
0
ファイル: Test.cs プロジェクト: lynnewritescode/OurUmbraco
        void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
        {
            InstantNotification not = new InstantNotification();

            not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", sender);
        }