Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Blogs"/> class.
 /// </summary>
 /// <param name="site">The site.</param>
 public Blogs(Site site)
 {
     using(SqlConnection cn = Site.CreateConnection(true, true)) {
         cn.Open();
         using(SqlCommand cmd = new SqlCommand("dbo.getBlogCategories", cn)) {
             using(SqlDataReader blog_list = cmd.ExecuteReader()) {
                 while(blog_list.Read()) {
                     Counter++;
                     if(!(CurrentId == blog_list.GetGuid(19))) {
                         CurrentId = blog_list.GetGuid(19);
                         B = new Blog(
                             blog_list.GetGuid(19),
                             blog_list.GetString(20),
                             blog_list.GetBoolean(21),
                             blog_list.GetInt32(22),
                             blog_list.GetBoolean(23),
                             blog_list.GetString(24),
                             site
                         );
                         List.Add(B);
                     }
                     BlogEntry e = new BlogEntry(
                         blog_list.GetGuid(0),
                         blog_list.GetString(1),
                         blog_list.GetString(2),
                         blog_list.GetString(3),
                         blog_list.GetString(4),
                         blog_list.GetInt32(5),
                         blog_list.GetInt32(6),
                         blog_list.GetDateTime(7),
                         blog_list.GetDateTime(8),
                         blog_list.GetInt32(9),
                         blog_list.GetString(10),
                         blog_list.GetBoolean(11),
                         blog_list.GetBoolean(12),
                         blog_list.GetBoolean(13),
                         blog_list.GetBoolean(14),
                         blog_list.GetString(15),
                         blog_list.GetBoolean(16),
                         blog_list.GetInt32(17),
                         blog_list.GetBoolean(18),
                         blog_list.GetGuid(25),
                         B,
                         site
                     );
                     B.Add(e);
                     AllEntries.Add(e);
                 }
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlogEntry"/> class.
 /// </summary>
 /// <param name="f_id">The f_id.</param>
 /// <param name="f_subject">The f_subject.</param>
 /// <param name="f_message">The f_message.</param>
 /// <param name="f_comments">The f_comments.</param>
 /// <param name="f_tags">The f_tags.</param>
 /// <param name="f_editor">The f_editor.</param>
 /// <param name="f_author">The f_author.</param>
 /// <param name="f_addDate">The f_add date.</param>
 /// <param name="f_dateChanged">The f_date changed.</param>
 /// <param name="f_lastEditor">The f_last editor.</param>
 /// <param name="f_annotations">The f_annotations.</param>
 /// <param name="f_enabled">if set to <c>true</c> [f_enabled].</param>
 /// <param name="f_auditComments">if set to <c>true</c> [f_audit comments].</param>
 /// <param name="f_allowComments">if set to <c>true</c> [f_allow comments].</param>
 /// <param name="f_emailUpdates">if set to <c>true</c> [f_email updates].</param>
 /// <param name="f_blogImage">The f_blog image.</param>
 /// <param name="f_publicBlog">if set to <c>true</c> [f_public Blog].</param>
 /// <param name="f_listOrder">The f_list order.</param>
 /// <param name="f_archive">if set to <c>true</c> [f_archive].</param>
 /// <param name="f_galleryId">The f_gallery id.</param>
 /// <param name="_blog">The _blog.</param>
 /// <param name="site">The site.</param>
 public BlogEntry(Guid f_id, string f_subject, string f_message, string f_comments, string f_tags, int f_editor, int f_author, DateTime f_addDate,
     DateTime f_dateChanged, int f_lastEditor, string f_annotations, bool f_enabled, bool f_auditComments, bool f_allowComments,
     bool f_emailUpdates, string f_blogImage, bool f_publicBlog, int f_listOrder, bool f_archive, Guid f_galleryId, Blog _blog, Site site)
 {
     Id = f_id;
     Subject = f_subject.Trim();
     Message = f_message;
     Comments = f_comments;
     Tags = f_tags.Trim();
     EditorId = f_editor;
     AuthorId = f_author;
     AddDate = f_addDate;
     DateChanged = f_dateChanged;
     LastEditor = f_lastEditor;
     Annotations = f_annotations;
     Enabled = f_enabled;
     AuditComments = f_auditComments;
     AllowComments = f_allowComments;
     EmailUpdates = f_emailUpdates;
     BlogImage = f_blogImage;
     PublicBlog = f_publicBlog;
     ListOrder = f_listOrder;
     Archive = f_archive;
     Blog = _blog;
     GalleryId = f_galleryId;
     Gallery = BlogPlugin.Galleries.List.Find(delegate(Gallery gal) {
         return gal.Id == GalleryId;
     });
     Replies = Commerce.Reply.All.FindAll(delegate(Rendition.Commerce.Reply reply) {
         return (reply.ParentId == f_id)
         && ((reply.FlaggedInappropriate < site.inappropriateHideThreshold) || reply.FlaggedOk);
     });
     Author = Commerce.User.All.Find(delegate(Commerce.User u) {
         return u.UserId == f_author;
     });
     Editor = Commerce.User.All.Find(delegate(Commerce.User u) {
         return u.UserId == f_editor;
     });
     Introduction = Message;
     if(Message.Contains("<h6")) {
         HasIntroduction = true;
         string i = Message.Substring(0, Message.IndexOf("<h6") - 4);
         i = Regex.Replace(i, "(<h6>)|(</h6>)", "", RegexOptions.IgnoreCase);
         Introduction = i;
         Message = Regex.Replace(Message, "(<h6>)|(</h6>)", "", RegexOptions.IgnoreCase);
     }
 }