Beispiel #1
0
        public void DeleteUnpublishedOldStories(int days)
        {
            Web.Write("<p><strong>Deleting unpublished stories older than " + days + " days</strong></p>");

            string sql = @" DELETE FROM FeedStory
											WHERE DATEADD(DAY, -"                                             + days + @", GETDATE()) > DateAdded AND
														Status != 'published' AND
														Status != 'auto-published'"                                                        ;

            int rows = 0;

            try {
                rows = new Sql().AddRawSqlString(sql).Execute();
                Web.Write("<p>" + Fmt.Plural(rows, "story") + " deleted</p>");
            } catch (Exception ex) {
                Web.Write("<p><strong style='color:red'>Error! </strong>" + ex.Message + "</p>");
            }

            Web.Write("<hr/>");
        }