예제 #1
0
        /// <summary>
        /// Creates a blog post with specified publication date.
        /// </summary>
        /// <param name="blogPostTitle">The blog post title.</param>
        /// <param name="blogId">The blog id.</param>
        /// <param name="publicationDate">The blog post publication date.</param>
        /// <returns></returns>
        public Guid CreateBlogPostSpecificPublicationDate(string blogPostTitle, Guid blogId, DateTime publicationDate)
        {
            BlogsManager blogsManager = new BlogsManager();

            var blog = blogsManager.GetBlog(blogId);
            var post = blogsManager.CreateBlogPost();
            post.Parent = blog;
            post.Title = blogPostTitle;
            post.UrlName = ServerArrangementUtilities.GetFormatedUrlName(blogPostTitle);

            Guid blogPostId = post.Id;

            post.SetWorkflowStatus(blogsManager.Provider.ApplicationName, "Published");
            blogsManager.RecompileAndValidateUrls(blog);
            blogsManager.Lifecycle.PublishWithSpecificDate(post, publicationDate);

            blogsManager.SaveChanges();

            return blogPostId;
        }
        private void migrateBlogPost(BlogsManager blogsManager, Blog blog, Entry post, Feed feed)
        {
            BlogPost blogPost = blogsManager.CreateBlogPost();
            blogPost.Parent = blog;

            blogPost.Content = post.Content;
            blogPost.Title = post.Title;
            blogPost.DateCreated = post.Published;
            blogPost.PublicationDate = post.Published;
            blogPost.LastModified = post.Updated;
            blogPost.ItemDefaultUrl = "2012/06/net-guy-velocityconf-2012-day-1.html";
            blogsManager.SaveChanges();
            var bag = new Dictionary<string, string>();
            bag.Add("ContentType", typeof(BlogPost).FullName);
            WorkflowManager.MessageWorkflow(blogPost.Id, typeof(BlogPost), null, "Publish", false, bag);

            migrateComments(blogPost, blogsManager, post, feed);

            migrateTags(post, blogPost, blogsManager);
        }
예제 #3
0
        /// <summary>
        /// Creates a blog post with specified publication date.
        /// </summary>
        /// <param name="blogPostTitle">The blog post title.</param>
        /// <param name="blogId">The blog id.</param>
        /// <param name="publicationDate">The blog post publication date.</param>
        /// <returns></returns>
        public Guid CreateBlogPostSpecificPublicationDate(string blogPostTitle, Guid blogId, DateTime publicationDate)
        {
            BlogsManager blogsManager = new BlogsManager();

            var blog = blogsManager.GetBlog(blogId);
            var post = blogsManager.CreateBlogPost();

            post.Parent  = blog;
            post.Title   = blogPostTitle;
            post.UrlName = ServerArrangementUtilities.GetFormatedUrlName(blogPostTitle);

            Guid blogPostId = post.Id;

            post.SetWorkflowStatus(blogsManager.Provider.ApplicationName, "Published");
            blogsManager.RecompileAndValidateUrls(blog);
            blogsManager.Lifecycle.PublishWithSpecificDate(post, publicationDate);

            blogsManager.SaveChanges();

            return(blogPostId);
        }
예제 #4
0
        private void migrateBlogPost(BlogsManager blogsManager, Blog blog, Entry post, Feed feed)
        {
            BlogPost blogPost = blogsManager.CreateBlogPost();

            blogPost.Parent = blog;

            blogPost.Content         = post.Content;
            blogPost.Title           = post.Title;
            blogPost.DateCreated     = post.Published;
            blogPost.PublicationDate = post.Published;
            blogPost.LastModified    = post.Updated;
            blogPost.ItemDefaultUrl  = "2012/06/net-guy-velocityconf-2012-day-1.html";
            blogsManager.SaveChanges();
            var bag = new Dictionary <string, string>();

            bag.Add("ContentType", typeof(BlogPost).FullName);
            WorkflowManager.MessageWorkflow(blogPost.Id, typeof(BlogPost), null, "Publish", false, bag);

            migrateComments(blogPost, blogsManager, post, feed);

            migrateTags(post, blogPost, blogsManager);
        }