private void BindData() { BlogPost blogPost = BlogManager.GetBlogPostById(this.BlogPostId); if (blogPost != null) { CommonHelper.SelectListItem(this.ddlLanguage, blogPost.LanguageId); this.txtBlogPostTitle.Text = blogPost.BlogPostTitle; this.txtBlogPostBody.Content = blogPost.BlogPostBody; this.cbBlogPostAllowComments.Checked = blogPost.BlogPostAllowComments; this.pnlCreatedOn.Visible = true; this.lblCreatedOn.Text = DateTimeHelper.ConvertToUserTime(blogPost.CreatedOn).ToString(); BlogCommentCollection blogComments = blogPost.BlogComments; if (blogComments.Count > 0) { this.hlViewComments.Visible = true; this.hlViewComments.Text = string.Format(GetLocaleResourceString("Admin.BlogPostInfo.ViewComments"), blogComments.Count); this.hlViewComments.NavigateUrl = CommonHelper.GetStoreAdminLocation() + "BlogComments.aspx?BlogPostID=" + blogPost.BlogPostId; } else { this.hlViewComments.Visible = false; } } else { this.pnlCreatedOn.Visible = false; hlViewComments.Visible = false; } }
/// <summary> /// Gets all blog comments /// </summary> /// <returns>Blog comments</returns> public static BlogCommentCollection GetAllBlogComments() { DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetAllBlogComments(); BlogCommentCollection collection = DBMapping(dbCollection); return(collection); }
/// <summary> /// Gets a collection of blog comments by blog post identifier /// </summary> /// <param name="BlogPostID">Blog post identifier</param> /// <returns>A collection of blog comments</returns> public static BlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID) { DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetBlogCommentsByBlogPostID(BlogPostID); BlogCommentCollection collection = DBMapping(dbCollection); return(collection); }
private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection) { if (dbCollection == null) return null; BlogCommentCollection collection = new BlogCommentCollection(); foreach (DBBlogComment dbItem in dbCollection) { BlogComment item = DBMapping(dbItem); collection.Add(item); } return collection; }
protected void BindData() { BlogCommentCollection blogCommentCollection = null; if (this.BlogPostId > 0) { blogCommentCollection = BlogManager.GetBlogCommentsByBlogPostId(this.BlogPostId); } else { blogCommentCollection = BlogManager.GetAllBlogComments(); } lvBlogComments.DataSource = blogCommentCollection; lvBlogComments.DataBind(); }
private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new BlogCommentCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }
private void BindData() { pnlError.Visible = false; BlogPost blogPost = BlogManager.GetBlogPostByID(this.BlogPostID); if (blogPost != null) { this.lBlogPostTitle.Text = Server.HtmlEncode(blogPost.BlogPostTitle); this.lCreatedOn.Text = DateTimeHelper.ConvertToUserTime(blogPost.CreatedOn).ToString(); this.lBlogPostBody.Text = blogPost.BlogPostBody; if (blogPost.BlogPostAllowComments) { if (!BlogManager.AllowNotRegisteredUsersToLeaveComments && (NopContext.Current.User == null || NopContext.Current.User.IsGuest)) { lblLeaveYourComment.Text = GetLocaleResourceString("Blog.OnlyRegisteredUsersCanLeaveComments"); txtComment.Enabled = false; btnComment.Enabled = false; } else { lblLeaveYourComment.Text = GetLocaleResourceString("Blog.LeaveYourComment"); txtComment.Enabled = true; btnComment.Enabled = true; } BlogCommentCollection blogComments = blogPost.BlogComments; if (blogComments.Count > 0) { rptrComments.DataSource = blogComments; rptrComments.DataBind(); } } else { pnlComments.Visible = false; } } else { Response.Redirect("~/Default.aspx"); } }