Exemplo n.º 1
0
 public static BlogEntry GetFakeBlogEntry(int blogConfigId, int blogUserId)
 {
     var blogEntry = new BlogEntry()
     {
         BlogAuthorId = blogUserId,
         BlogConfigId = blogConfigId,
         CreateDate = DateTime.Now,
         EntryName = "Test",
         Keywords = "test",
         FeedbackCount = 0,
         LastUpdateDate = DateTime.Now,
         PostType = 1,
         PublishDate = DateTime.Now,
         Short = "test",
         Text = "test",
         Title = "test"
     };
     return blogEntry;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the BlogEntries EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBlogEntries(BlogEntry blogEntry)
 {
     base.AddObject("BlogEntries", blogEntry);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new BlogEntry object.
 /// </summary>
 /// <param name="blogEntryId">Initial value of the BlogEntryId property.</param>
 /// <param name="blogAuthorId">Initial value of the BlogAuthorId property.</param>
 /// <param name="blogConfigId">Initial value of the BlogConfigId property.</param>
 /// <param name="entryName">Initial value of the EntryName property.</param>
 /// <param name="feedbackCount">Initial value of the FeedbackCount property.</param>
 /// <param name="postType">Initial value of the PostType property.</param>
 /// <param name="publishDate">Initial value of the PublishDate property.</param>
 /// <param name="text">Initial value of the Text property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 /// <param name="lastUpdateDate">Initial value of the LastUpdateDate property.</param>
 public static BlogEntry CreateBlogEntry(global::System.Int64 blogEntryId, global::System.Int32 blogAuthorId, global::System.Int32 blogConfigId, global::System.String entryName, global::System.Int32 feedbackCount, global::System.Int32 postType, global::System.DateTime publishDate, global::System.String text, global::System.String title, global::System.DateTime createDate, global::System.DateTime lastUpdateDate)
 {
     BlogEntry blogEntry = new BlogEntry();
     blogEntry.BlogEntryId = blogEntryId;
     blogEntry.BlogAuthorId = blogAuthorId;
     blogEntry.BlogConfigId = blogConfigId;
     blogEntry.EntryName = entryName;
     blogEntry.FeedbackCount = feedbackCount;
     blogEntry.PostType = postType;
     blogEntry.PublishDate = publishDate;
     blogEntry.Text = text;
     blogEntry.Title = title;
     blogEntry.CreateDate = createDate;
     blogEntry.LastUpdateDate = lastUpdateDate;
     return blogEntry;
 }
Exemplo n.º 4
0
        string IMetaWeblog.AddPost(string blogid, string username, string password,
            Post post, bool publish)
        {
            if (ValidateUser(username, password))
            {
                string id = string.Empty;

                //using (VeritasDataContext con = new VeritasDataContext())
                VeritasRepository repo = VeritasRepository.GetInstance();

                BlogUser user = repo.GetBlogUserByUserName(CacheHandler.BlogConfigId, username);

                //Check to see if the entry name exists:
                //if (repo.DoesEntryTitleExist(post.title, post.title.Replace(";", "-").Replace(" ", "-").Replace(".", "-").Replace("?", "-").Replace("%", "-"), CacheAccessor.GetBlogConfigID()))
                if (repo.DoesEntryTitleExist(CacheHandler.BlogConfigId, post.title, HttpUtility.HtmlEncode(post.title)))
                {
                    throw new XmlRpcFaultException(0, "The title you have tried already exists for this blog.");
                }

                BlogEntry entry = new BlogEntry();
                entry.BlogConfigId = CacheHandler.BlogConfigId;
                entry.BlogAuthorId = user.BlogUserId;

                entry.EntryName = EntryTitleLogic.GetEntryNameFromTitle(HttpUtility.HtmlDecode(post.title));

                entry.FeedbackCount = 0;
                entry.PostType = publish ? (int)PostType.Published : (int)PostType.Draft;
                if (post.dateCreated.Year > 0001)
                    entry.PublishDate = post.dateCreated;
                else
                    entry.PublishDate = DateTime.Now;
                //entry.Text = post.description;
                entry.Text = HighSlideHandler.UpdateLiveWriterImagesWithHighslide(post.description);
                entry.Title = HttpUtility.HtmlDecode(post.title);
                entry.LastUpdateDate = DateTime.Now;
                entry.CreateDate = DateTime.Now;
                //id = con.SaveBlogEntry(entry).ToString();
                repo.Add(entry);
                repo.Save();
                id = entry.BlogEntryId.ToString();
                BlogConfig config = repo.GetBlogConfigByBlogConfigId(entry.BlogConfigId);
                config.PostCount++;
                repo.Save();

                BlogEntryCategory entCat = new BlogEntryCategory();
                repo.SaveEntryCategoryAssociation(entry.BlogConfigId, entry.BlogEntryId, post.categories);

                //Save Blog Entry View
                var existingViewCount = repo.GetBlogEntryViewCountByEntryId(entry.BlogEntryId);
                if (existingViewCount == null)
                {
                    BlogEntryViewCount entryViewCount = new BlogEntryViewCount()
                    {
                        BlogConfigId = entry.BlogConfigId,
                        BlogEntryId = entry.BlogEntryId,
                        WebCount = 0,
                        WebLastUpdated = DateTime.Now
                    };
                    repo.Add(entryViewCount);
                    repo.Save();
                }

                return id;
            }
            throw new XmlRpcFaultException(0, "User is not valid!");
        }
Exemplo n.º 5
0
 public void Add(BlogEntry blogEntry)
 {
     db.BlogEntries.AddObject(blogEntry);
 }
Exemplo n.º 6
0
 public void Delete(BlogEntry blogEntry)
 {
     db.BlogEntries.DeleteObject(blogEntry);
 }
Exemplo n.º 7
0
        public void GetRecentEntriesTest()
        {
            var blogEntry = new BlogEntry()
            {
                BlogConfigId = TestBlogConfig.BlogConfigId,
                BlogAuthorId = TestBlogUser.BlogUserId,
                CreateDate = DateTime.Now,
                EntryName = "Test2",
                FeedbackCount = 0,
                Keywords = "",
                LastUpdateDate = DateTime.Now,
                PostType = (int) PostType.Published,
                PublishDate = DateTime.Now,
                Short = "Test2",
                Text = "Test2",
                Title = "Test2"
            };
            repo.Add(blogEntry);
            repo.Save();

            var recentEntries = repo.GetRecentEntries(TestBlogConfig.BlogConfigId, 1).ToArray();
            Assert.IsNotNull(recentEntries);
            Assert.IsTrue(recentEntries.Length == 1);
            var recentEntries2 = repo.GetRecentEntries(TestBlogConfig.BlogConfigId, 2).ToArray();
            Assert.IsNotNull(recentEntries2);
            Assert.IsTrue(recentEntries2.Length == 2);
        }