/// <summary> /// Updates this instance. /// </summary> /// <returns></returns> private bool Update() { this.lastModUtc = DateTime.UtcNow; bool result = DBBlog.UpdateBlog( this.moduleID, this.itemID, this.userName, this.title, this.excerpt, this.description, this.startDate, this.isInNewsletter, this.includeInFeed, this.allowCommentsForDays, this.location, this.lastModUserGuid, this.lastModUtc, this.itemUrl, this.metaKeywords, this.metaDescription, this.compiledMeta, this.isPublished); //IndexHelper.IndexItem(this); ContentChangedEventArgs e = new ContentChangedEventArgs(); OnContentChanged(e); return(result); }
/// <summary> /// Gets the blogs. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="endDate">The end date.</param> /// <param name="categoryIds">categories specified</param> /// <returns></returns> public static IDataReader GetBlogs(int moduleId, DateTime beginDate, params int[] categoryIds) { if (categoryIds != null && categoryIds.Length > 0 && categoryIds[0] == -1) { return(DBBlog.GetBlogs(moduleId, beginDate, DateTime.UtcNow)); } return(DBBlog.GetBlogs(moduleId, beginDate, DateTime.UtcNow, categoryIds)); }
public static IDataReader GetPage( int moduleId, DateTime beginDate, int pageNumber, int pageSize, out int totalPages) { return(DBBlog.GetPage(moduleId, beginDate, DateTime.UtcNow, pageNumber, pageSize, out totalPages)); }
public bool Delete() { DBBlog.DeleteItemCategories(itemID); DBBlog.DeleteAllCommentsForBlog(itemID); DBBlog.UpdateCommentStats(this.moduleID); bool result = DBBlog.DeleteBlog(this.itemID); DBBlog.UpdateEntryStats(this.moduleID); ContentChangedEventArgs e = new ContentChangedEventArgs(); e.IsDeleted = true; OnContentChanged(e); return(result); }
public static bool AddBlogComment( int moduleId, int itemId, String name, String title, String url, String comment, DateTime dateCreated) { if (name == null) { name = "unknown"; } if (name.Length < 1) { name = "unknown"; } if ((title != null) && (url != null) && (comment != null)) { if (title.Length > 100) { title = title.Substring(0, 100); } if (name.Length > 100) { name = name.Substring(0, 100); } if (url.Length > 200) { url = url.Substring(0, 200); } return(DBBlog.AddBlogComment( moduleId, itemId, name, title, url, comment, dateCreated)); } return(false); }
/// <summary> /// Creates a new blog /// </summary> /// <returns>true if successful</returns> private bool Create() { int newID = 0; blogGuid = Guid.NewGuid(); createdUtc = DateTime.UtcNow; newID = DBBlog.AddBlog( this.blogGuid, this.moduleGuid, this.moduleID, this.userName, this.title, this.excerpt, this.description, this.startDate, this.isInNewsletter, this.includeInFeed, this.allowCommentsForDays, this.location, this.userGuid, this.createdUtc, this.itemUrl, this.metaKeywords, this.metaDescription, this.compiledMeta, this.isPublished); this.itemID = newID; bool result = (newID > 0); //IndexHelper.IndexItem(this); if (result) { ContentChangedEventArgs e = new ContentChangedEventArgs(); OnContentChanged(e); } return(result); }
public static DataTable GetBlogsByPage(int siteId, int pageId) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("ItemID", typeof(int)); dataTable.Columns.Add("ModuleID", typeof(int)); dataTable.Columns.Add("CommentCount", typeof(int)); dataTable.Columns.Add("ModuleTitle", typeof(string)); dataTable.Columns.Add("Title", typeof(string)); dataTable.Columns.Add("ItemUrl", typeof(string)); dataTable.Columns.Add("Description", typeof(string)); dataTable.Columns.Add("StartDate", typeof(DateTime)); dataTable.Columns.Add("MetaDescription", typeof(string)); dataTable.Columns.Add("MetaKeywords", typeof(string)); dataTable.Columns.Add("ViewRoles", typeof(string)); using (IDataReader reader = DBBlog.GetBlogsByPage(siteId, pageId)) { while (reader.Read()) { DataRow row = dataTable.NewRow(); row["ItemID"] = reader["ItemID"]; row["ModuleID"] = reader["ModuleID"]; row["CommentCount"] = reader["CommentCount"]; row["ModuleTitle"] = reader["ModuleTitle"]; row["Title"] = reader["Title"]; row["ItemUrl"] = reader["ItemUrl"]; row["Description"] = reader["Description"]; row["StartDate"] = Convert.ToDateTime(reader["StartDate"]); row["MetaDescription"] = reader["MetaDescription"]; row["MetaKeywords"] = reader["MetaKeywords"]; row["ViewRoles"] = reader["ViewRoles"]; dataTable.Rows.Add(row); } } return(dataTable); }
public static DataTable GetBlogCommentsTable(int moduleId, int itemId) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("Comment", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); using (IDataReader reader = DBBlog.GetBlogComments(moduleId, itemId)) { while (reader.Read()) { DataRow row = dataTable.NewRow(); row["Comment"] = reader["Comment"]; row["Name"] = reader["Name"]; dataTable.Rows.Add(row); } } return(dataTable); }
public static bool DeleteItemCategories(int itemId) { return(DBBlog.DeleteItemCategories(itemId)); }
public static IDataReader GetCategoriesList(int moduleId) { return(DBBlog.GetCategoriesList(moduleId)); }
public static int AddItemCategory( int itemId, int categoryId) { return(DBBlog.AddBlogItemCategory(itemId, categoryId)); }
public static bool UpdateBlogCategory( int categoryId, string category) { return(DBBlog.UpdateBlogCategory(categoryId, category)); }
public static bool DeleteCategory(int categoryId) { return(DBBlog.DeleteCategory(categoryId)); }
public static IDataReader GetCategory(int categoryId) { return(DBBlog.GetCategory(categoryId)); }
public static IDataReader GetBlogStats(int moduleId) { return(DBBlog.GetBlogStats(moduleId)); }
public static IDataReader GetBlogsForSiteMap(int siteId) { return(DBBlog.GetBlogsForSiteMap(siteId, DateTime.UtcNow)); }
public static bool DeleteBlogComment(int commentId) { return(DBBlog.DeleteBlogComment(commentId)); }
//public static bool DeleteBlog(int itemID) //{ // //TODO: make instance method to support ContentChanged event // Blog blog = new Blog(itemID); // bool result = dbBlog.Blog_DeleteBlog(itemID); // if (result) // { // result = dbBlog.Blog_DeleteItemCategories(itemID); // //IndexHelper.RemoveIndexItem(blog.ModuleID, itemID); // } // return result; //} public static IDataReader GetBlogComments(int moduleId, int itemId) { return(DBBlog.GetBlogComments(moduleId, itemId)); }
public static bool DeleteByModule(int moduleId) { return(DBBlog.DeleteByModule(moduleId)); }
public static IDataReader GetSingleBlog(int itemId) { return(DBBlog.GetSingleBlog(itemId, DateTime.UtcNow)); }
public static IDataReader GetBlogMonthArchive(int moduleId) { return(DBBlog.GetBlogMonthArchive(moduleId, DateTime.UtcNow)); }
public static IDataReader GetBlogEntriesByMonth(int month, int year, int moduleId) { return(DBBlog.GetBlogEntriesByMonth(month, year, moduleId, DateTime.UtcNow)); }
public static IDataReader GetItemCategories(int itemId) { return(DBBlog.GetBlogItemCategories(itemId)); }
public static int AddBlogCategory(int moduleId, string category) { return(DBBlog.AddBlogCategory(moduleId, category)); }
public static IDataReader GetEntriesByCategory(int moduleId, int categoryId) { return(DBBlog.GetEntriesByCategory(moduleId, categoryId, DateTime.UtcNow)); }
public static int AddBlogCategory(int moduleId, string category, int siteId, Guid siteGuid, Guid pageGuid, int pageId) { return(DBBlog.AddBlogCategory(moduleId, category, siteId, siteGuid, pageGuid, pageId)); }
/// <summary> /// Gets the blog. /// </summary> /// <param name="itemID">The item ID.</param> private void GetBlog(int itemId) { using (IDataReader reader = DBBlog.GetSingleBlog(itemId, DateTime.UtcNow)) { if (reader.Read()) { this.itemID = int.Parse(reader["ItemID"].ToString(), CultureInfo.InvariantCulture); this.moduleID = int.Parse(reader["ModuleID"].ToString(), CultureInfo.InvariantCulture); this.userName = reader["Name"].ToString(); this.title = reader["Heading"].ToString(); this.excerpt = reader["Abstract"].ToString(); this.description = reader["Description"].ToString(); this.metaKeywords = reader["MetaKeywords"].ToString(); this.metaDescription = reader["MetaDescription"].ToString(); this.startDate = Convert.ToDateTime(reader["StartDate"].ToString()); // this is to support dbs that don't have bit data type //string inNews = reader["IsInNewsletter"].ToString(); //this.isInNewsletter = (inNews == "True" || inNews == "1"); this.isInNewsletter = Convert.ToBoolean(reader["IsInNewsletter"]); //string inFeed = reader["IncludeInFeed"].ToString(); //this.includeInFeed = (inFeed == "True" || inFeed == "1"); this.includeInFeed = Convert.ToBoolean(reader["IncludeInFeed"]); if (reader["AllowCommentsForDays"] != DBNull.Value) { this.allowCommentsForDays = Convert.ToInt32(reader["AllowCommentsForDays"]); } this.blogGuid = new Guid(reader["BlogGuid"].ToString()); this.moduleGuid = new Guid(reader["ModuleGuid"].ToString()); this.location = reader["Location"].ToString(); this.compiledMeta = reader["CompiledMeta"].ToString(); if (reader["CreatedDate"] != DBNull.Value) { this.createdUtc = Convert.ToDateTime(reader["CreatedDate"]); } if (reader["LastModUtc"] != DBNull.Value) { this.lastModUtc = Convert.ToDateTime(reader["LastModUtc"]); } string var = reader["UserGuid"].ToString(); if (var.Length == 36) { this.userGuid = new Guid(var); } var = reader["LastModUserGuid"].ToString(); if (var.Length == 36) { this.lastModUserGuid = new Guid(var); } itemUrl = reader["ItemUrl"].ToString(); previousPostUrl = reader["PreviousPost"].ToString(); previousPostTitle = reader["PreviousPostTitle"].ToString(); nextPostUrl = reader["NextPost"].ToString(); nextPostTitle = reader["NextPostTitle"].ToString(); commentCount = Convert.ToInt32(reader["CommentCount"]); isPublished = Convert.ToBoolean(reader["IsPublished"]); } } }
public static bool DeleteBySite(int siteId) { return(DBBlog.DeleteBySite(siteId)); }