/// <summary> /// Update our blog entry's view count /// </summary> public void UpdateEntryViewCount() { if (this.BlogEntryScreen != null && this.BlogEntryScreen.BlogEntry != null) { var blogEntryViewCount = this.BlogEntryScreen.BlogEntry.BlogEntryViewCounts.FirstOrDefault(); if (blogEntryViewCount == null) { blogEntryViewCount = new BlogEntryViewCount() { BlogConfigId = this.blogConfig.BlogConfigId, BlogEntryId = this.BlogEntryScreen.BlogEntry.BlogEntryId, WebCount = 0, WebLastUpdated = DateTime.Now }; repo.Add(blogEntryViewCount); } blogEntryViewCount.WebCount++; repo.Save(); } }
/// <summary> /// Create a new BlogEntryViewCount object. /// </summary> /// <param name="blogEntryViewCountId">Initial value of the BlogEntryViewCountId property.</param> /// <param name="blogConfigId">Initial value of the BlogConfigId property.</param> /// <param name="blogEntryId">Initial value of the BlogEntryId property.</param> /// <param name="webCount">Initial value of the WebCount property.</param> /// <param name="webLastUpdated">Initial value of the WebLastUpdated property.</param> public static BlogEntryViewCount CreateBlogEntryViewCount(global::System.Int64 blogEntryViewCountId, global::System.Int32 blogConfigId, global::System.Int64 blogEntryId, global::System.Int32 webCount, global::System.DateTime webLastUpdated) { BlogEntryViewCount blogEntryViewCount = new BlogEntryViewCount(); blogEntryViewCount.BlogEntryViewCountId = blogEntryViewCountId; blogEntryViewCount.BlogConfigId = blogConfigId; blogEntryViewCount.BlogEntryId = blogEntryId; blogEntryViewCount.WebCount = webCount; blogEntryViewCount.WebLastUpdated = webLastUpdated; return blogEntryViewCount; }
/// <summary> /// Deprecated Method for adding a new object to the BlogEntryViewCounts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBlogEntryViewCounts(BlogEntryViewCount blogEntryViewCount) { base.AddObject("BlogEntryViewCounts", blogEntryViewCount); }
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!"); }
public static BlogEntryViewCount GetFakeBlogEntryViewCount(int blogConfigId, long blogEntryId) { var blogEntryViewCount = new BlogEntryViewCount() { BlogConfigId = blogConfigId, BlogEntryId = blogEntryId, WebCount = 0, WebLastUpdated = DateTime.Now }; return blogEntryViewCount; }
public void UpdateEntryViewCountForWeb(int blogConfigId, long blogEntryId) { BlogEntryViewCount evc = db.BlogEntryViewCounts.SingleOrDefault(p => p.BlogEntryId == blogEntryId); if (evc != null) { evc.WebCount++; evc.WebLastUpdated = DateTime.Now; } else { evc = new BlogEntryViewCount(); evc.BlogEntryId = blogEntryId; evc.BlogConfigId = blogConfigId; evc.WebCount = 1; evc.WebLastUpdated = DateTime.Now; this.Add(evc); } this.Save(); }
public void Delete(BlogEntryViewCount blogEntryViewCount) { db.BlogEntryViewCounts.DeleteObject(blogEntryViewCount); }
public void Add(BlogEntryViewCount blogEntryViewCount) { db.BlogEntryViewCounts.AddObject(blogEntryViewCount); }