/// <summary> /// Adds the specified new_blog. /// </summary> /// <param name="new_blog">The new_blog.</param> public void Add(BlogEntry new_blog) { Entries.Add(new_blog); return; }
/// <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); } } } } }