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 = new Topic(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();
                }
            }
        }
Esempio n. 2
0
        void TopicService_Created(object sender, uForum.TopicEventArgs e)
        {
            var ns = new NotificationService(ApplicationContext.Current.DatabaseContext);
            ns.SubscribeToForumTopic(e.Topic.Id, e.Topic.MemberId);

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

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

            not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewTopic", e.Topic, e.Topic.GetUrl(), memberName);
        }
        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();
                }

            }
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 6
0
        void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
        {
            InstantNotification not = new InstantNotification();

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