コード例 #1
0
ファイル: BlogService.cs プロジェクト: davidbetz/minima
        public List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 maxEntryCount, Boolean activeOnly, Boolean ignoreFooter, BlogEntryRetreivalType blogEntryRetreivalType)
        {
            List <BlogEntry> blogEntryList = null;

            using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
            {
                //+ ensure blog exists
                BlogLINQ blogLinq;
                Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
                //+ create filter for blog entry list
                Func <BlogEntryLINQ, Boolean> blogEntryInBlog;
                if (activeOnly)
                {
                    blogEntryInBlog = x => x.BlogId == blogLinq.BlogId && (x.BlogEntryStatusId == 1 || x.BlogEntryStatusId == 4);
                }
                else
                {
                    blogEntryInBlog = x => x.BlogId == blogLinq.BlogId;
                }
                //+ get blog entry list
                if (maxEntryCount == 0)
                {
                    maxEntryCount = Int32.MaxValue;
                }
                Int32 blogEntryRetreivalTypeInt32 = (Int32)blogEntryRetreivalType;
                blogEntryList = db.BlogEntries.Where(blogEntryInBlog)
                                .Select(be => new BlogEntry
                {
                    Title              = be.BlogEntryTitle,
                    Content            = (blogEntryRetreivalType == BlogEntryRetreivalType.Full) ? String.Empty : CheckFooter(ignoreFooter, be.BlogEntryText),
                    Guid               = be.BlogEntryGuid,
                    Status             = be.BlogEntryStatusId,
                    BlogEntryTypeGuid  = be.BlogEntryType.BlogEntryTypeGuid,
                    AllowCommentStatus = (AllowCommentStatus)be.BlogEntryCommentAllowStatusId,
                    PostDateTime       = be.BlogEntryPostDateTime,
                    ModifyDateTime     = be.BlogEntryModifyDateTime,
                    MappingNameList    = (blogEntryRetreivalTypeInt32 < 1) ? new List <String>() : new List <String>(
                        be.BlogEntryUrlMappings.Select(p => p.BlogEntryUrlMappingName)
                        ),
                    LabelList = (blogEntryRetreivalTypeInt32 < 1) ? new List <Label>() : new List <Label>(
                        be.LabelBlogEntries.Select(p => new Label
                    {
                        Guid          = p.Label.LabelGuid,
                        FriendlyTitle = p.Label.LabelFriendlyTitle,
                        Title         = p.Label.LabelTitle
                    })
                        ),
                    AuthorList = (blogEntryRetreivalTypeInt32 < 1) ? new List <Author>() : new List <Author>(
                        be.BlogEntryAuthors.Select(p => new Author
                    {
                        Name  = p.Author.AuthorName,
                        Email = p.Author.AuthorEmail
                    })
                        ),
                    CommentList = (blogEntryRetreivalType == BlogEntryRetreivalType.Full) ? new List <Comment>() : new List <Comment>(
                        be.Comments.Where(p => p.CommentModerated == false)
                        .Select(p => new Comment
                    {
                        Text     = p.CommentText,
                        DateTime = p.CommentPostDate,
                        Website  = p.CommentWebsite,
                        Guid     = p.CommentGuid,
                        Email    = p.CommentEmail,
                        Name     = p.CommentAuthor
                    })
                        ),
                })
                                .OrderByDescending(be => be.PostDateTime)
                                .Take(maxEntryCount)
                                .ToList();
            }
            //+
            return(blogEntryList);
        }
コード例 #2
0
 public static List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 maxEntryCount, Boolean ignoreFooter, BlogEntryRetreivalType blogEntryRetreivalType, String username, String password)
 {
     using (BlogClient blogClient = new BlogClient(BlogSection.GetConfigSection().Service.Endpoint.Blog))
     {
         blogClient.ClientCredentials.UserName.UserName = username;
         blogClient.ClientCredentials.UserName.Password = password;
         //+
         return(blogClient.GetBlogEntryList(blogGuid, maxEntryCount, true, ignoreFooter, blogEntryRetreivalType));
     }
 }
コード例 #3
0
 //- @GetBlogEntryList -//
 public static List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 maxEntryCount, Boolean ignoreFooter, BlogEntryRetreivalType blogEntryRetreivalType)
 {
     return(GetBlogEntryList(blogGuid, maxEntryCount, ignoreFooter, blogEntryRetreivalType, BlogSection.GetConfigSection().Service.Authentication.DefaultUserName, BlogSection.GetConfigSection().Service.Authentication.DefaultPassword));
 }
コード例 #4
0
ファイル: BlogAgent.cs プロジェクト: davidbetz/minima
 //- @GetBlogEntryList -//
 public static List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 maxEntryCount, BlogEntryRetreivalType blogEntryRetreivalType)
 {
     return(GetBlogEntryList(blogGuid, maxEntryCount, blogEntryRetreivalType, MinimaConfiguration.DefaultServiceUserName, MinimaConfiguration.DefaultServicePassword));
 }
コード例 #5
0
ファイル: BlogAgent.cs プロジェクト: davidbetz/minima
 public static List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 maxEntryCount, BlogEntryRetreivalType blogEntryRetreivalType, String username, String password)
 {
     using (BlogClient blogClient = new BlogClient(MinimaConfiguration.ActiveBlogServiceEndpoint))
     {
         blogClient.ClientCredentials.UserName.UserName = username;
         blogClient.ClientCredentials.UserName.Password = password;
         //+
         return(blogClient.GetBlogEntryList(blogGuid, maxEntryCount, true, blogEntryRetreivalType));
     }
 }
コード例 #6
0
 public List <BlogEntry> GetBlogEntryList(String blogGuid, Int32 count, Boolean activeOnly, Boolean ignoreFooter, BlogEntryRetreivalType blogEntryRetreivalType)
 {
     using (OperationContextScope scope = new OperationContextScope(this.InnerChannel))
     {
         AddGuidToMessageHeader(MinimaMessageHeaderType.BlogGuid, blogGuid);
         //+
         return(base.Channel.GetBlogEntryList(blogGuid, count, activeOnly, ignoreFooter, blogEntryRetreivalType));
     }
 }