Exemplo n.º 1
0
        private void GetPostList()
        {
            Collection <Post> posts = Post.GetAllPosts(CommentType.All);

            postsRepeater.DataSource = posts;
            postsRepeater.DataBind();
        }
Exemplo n.º 2
0
        public static SyndicationFeed GetPostFeed()
        {
            SyndicationFeed postfeed = Feeds.GetFeed();

            postfeed.Title       = new TextSyndicationContent("Key Mapper Developer Blog");
            postfeed.Description = new TextSyndicationContent("Post feed for the Key Mapper Developer Blog");

            Collection <Post>      posts = Post.GetAllPosts(CommentType.Approved);
            List <SyndicationItem> items = new List <SyndicationItem>();

            foreach (Post p in posts)
            {
                SyndicationItem item = new SyndicationItem();
                item.Id      = p.Id.ToString();
                item.Title   = new TextSyndicationContent(p.Title);
                item.Content = new TextSyndicationContent(p.Body);

                SyndicationLink itemlink = new SyndicationLink();
                itemlink.Title = "Key Mapper Blog";
                itemlink.Uri   = new Uri("http://justkeepswimming.net/keymapper/default.aspx?p="
                                         + p.Id.ToString() + ".aspx");
                item.Links.Add(itemlink);

                SyndicationPerson person = new SyndicationPerson();
                person.Name  = "Stuart Dunkeld";
                person.Email = "*****@*****.**";
                item.Authors.Add(person);

                items.Add(item);
            }

            postfeed.Items = items;
            return(postfeed);
        }
Exemplo n.º 3
0
        private void GetPosts()
        {
            Collection <Post> posts;
            bool singlePost = false;

            // A request for a specific post overrides all other parameters
            int postId = this.IsQueryForSpecificPost();

            if (postId != 0)
            {
                Post post = Post.GetPostById(postId);
                posts = new Collection <Post>();
                posts.Add(post);
                singlePost = true;

                ////if (Request.Cookies["userDetails"] != null)
                ////{
                ////    editcomment.Name = Server.HtmlEncode(Request.Cookies["userDetails"]["Name"]);
                ////    editcomment.URL = Server.HtmlEncode(Request.Cookies["userDetails"]["URL"]);
                ////    chkRememberDetails.Checked = true;
                ////}
            }
            else
            {
                int      categoryId = this.GetCategoryFromQueryString();
                DateTime dateFrom, dateTo;
                this.GetDateRangeFromQueryString(out dateFrom, out dateTo);

                posts = Post.GetAllPosts(categoryId, dateFrom, dateTo, CommentType.Approved);
            }

            if (singlePost == false)
            {
                comments_inner.Style.Add("Display", "None");
            }
            else if (posts.Count != 0)
            {
                this.GetCommentsForPost(postId);
            }

            Collection <Category> catlist = Category.GetAllCategories();

            categoriesRepeater.DataSource = catlist;
            categoriesRepeater.DataBind();

            postsRepeater.DataSource = posts;
            postsRepeater.DataBind();

            this.PopulateArchive();
        }