예제 #1
0
 public String CreateLabel(String blogGuid, String title)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         LabelLINQ labelLinq;
         String    labelGuid;
         labelLinq = db.Labels.SingleOrDefault(p => p.BlogId == blogLinq.BlogId && p.LabelTitle == title);
         if (labelLinq != null)
         {
             labelGuid = labelLinq.LabelGuid;
         }
         else
         {
             labelLinq            = new LabelLINQ();
             labelLinq.LabelTitle = title;
             labelLinq.BlogId     = blogLinq.BlogId;
             labelLinq.LabelGuid  = Themelia.GuidCreator.GetNewGuid();
             db.Labels.InsertOnSubmit(labelLinq);
             //+
             db.SubmitChanges();
             labelGuid = labelLinq.LabelGuid;
         }
         //+
         return(labelGuid);
     }
 }
예제 #2
0
        public List <Comment> GetCommentList(String blogEntryGuid, Boolean showEveryComment)
        {
            String commentGuid = String.Empty;

            using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
            {
                //+ validate
                BlogEntryLINQ blogEntryLinq;
                Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
                //+
                Func <CommentLINQ, Boolean> commentStatus;
                if (showEveryComment)
                {
                    commentStatus = p => true;
                }
                else
                {
                    commentStatus = p => p.CommentModerated == false;
                }
                return(blogEntryLinq.Comments.Where(commentStatus)
                       .Select(p => new Comment
                {
                    Text = p.CommentText,
                    DateTime = p.CommentPostDate,
                    Website = p.CommentWebsite,
                    Guid = p.CommentGuid,
                    Email = p.CommentEmail,
                    Name = p.CommentAuthor
                }).ToList());
            }
        }
예제 #3
0
 public BlogMetaData GetBlogMetaData(String blogGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         return(new BlogMetaData
         {
             Description = blogLinq.BlogDescription,
             FeedTitle = blogLinq.BlogFeedTitle,
             FeedUri = new Uri(blogLinq.BlogFeedUrl),
             Guid = blogLinq.BlogGuid,
             Title = blogLinq.BlogTitle,
             Uri = new Uri(blogLinq.BlogPrimaryUrl),
             CreateDateTime = blogLinq.BlogCreateDate,
             LabelList = new List <Label>(
                 blogLinq.Labels.Select(p => new Label
             {
                 Guid = p.LabelGuid,
                 FriendlyTitle = p.LabelFriendlyTitle,
                 Title = p.LabelTitle
             })
                 )
         });
     }
 }
예제 #4
0
 //- $GetBlogEntryByUrlMapping -//
 private BlogEntryLINQ GetBlogEntryByUrlMapping(Int32 blogId, String link, DataContext db)
 {
     return((from be in db.BlogEntries
             join beum in db.BlogEntryUrlMappings on be.BlogEntryId equals beum.BlogEntryId
             where beum.BlogEntryUrlMappingName == link.ToLower() && be.BlogId == blogId
             select be).FirstOrDefault());
 }
예제 #5
0
 //- @GetBlogEntryListByDateRange -//
 public List <BlogEntry> GetBlogEntryListByDateRange(String blogGuid, DateTime startDateTime, DateTime endDateTime, Boolean ignoreFooter, Boolean metaDataOnly)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         Func <BlogEntryLINQ, BlogEntry> blogEntryTransformation = be => new BlogEntry
         {
             Title              = be.BlogEntryTitle,
             Content            = metaDataOnly ? 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    = new List <String>(
                 be.BlogEntryUrlMappings.Select(p => p.BlogEntryUrlMappingName)
                 ),
             LabelList = new List <Label>(
                 be.LabelBlogEntries.Select(p => new Label
             {
                 Guid          = p.Label.LabelGuid,
                 FriendlyTitle = p.Label.LabelFriendlyTitle,
                 Title         = p.Label.LabelTitle
             })
                 ),
             AuthorList = new List <Author>(
                 be.BlogEntryAuthors.Select(p => new Author
             {
                 Name  = p.Author.AuthorName,
                 Email = p.Author.AuthorEmail
             })
                 ),
             CommentList = metaDataOnly ? 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
             })
                 )
         };
         //+
         Func <BlogEntryLINQ, Boolean> blogEntryListInRange = be => be.BlogId == blogLinq.BlogId && (be.BlogEntryStatusId == 1 || be.BlogEntryStatusId == 4) && (be.BlogEntryPostDateTime >= startDateTime && be.BlogEntryPostDateTime <= endDateTime);
         //+
         return(db.BlogEntries.Where(blogEntryListInRange)
                .Select(blogEntryTransformation)
                .OrderByDescending(be => be.PostDateTime)
                .ToList());
     }
 }
예제 #6
0
 public BlogEntry GetSingleBlogEntryByLink(String blogGuid, String link, Boolean ignoreFooter, Boolean metaDataOnly)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog entry exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         BlogEntryLINQ blogEntryLinq = this.GetBlogEntryByUrlMapping(blogLinq.BlogId, link, db);
         if (blogEntryLinq != null)
         {
             return(new BlogEntry
             {
                 Title = blogEntryLinq.BlogEntryTitle,
                 Content = metaDataOnly ? String.Empty : CheckFooter(ignoreFooter, blogEntryLinq.BlogEntryText),
                 Guid = blogEntryLinq.BlogEntryGuid,
                 Status = blogEntryLinq.BlogEntryStatusId,
                 BlogEntryTypeGuid = blogEntryLinq.BlogEntryType.BlogEntryTypeGuid,
                 AllowCommentStatus = (AllowCommentStatus)blogEntryLinq.BlogEntryCommentAllowStatusId,
                 PostDateTime = blogEntryLinq.BlogEntryPostDateTime,
                 ModifyDateTime = blogEntryLinq.BlogEntryModifyDateTime,
                 MappingNameList = new List <String>(
                     blogEntryLinq.BlogEntryUrlMappings.Select(p => p.BlogEntryUrlMappingName)
                     ),
                 LabelList = new List <Label>(
                     blogEntryLinq.LabelBlogEntries.Select(p => new Label
                 {
                     Guid = p.Label.LabelGuid,
                     FriendlyTitle = p.Label.LabelFriendlyTitle,
                     Title = p.Label.LabelTitle
                 })
                     ),
                 AuthorList = new List <Author>(
                     blogEntryLinq.BlogEntryAuthors.Select(p => new Author
                 {
                     Name = p.Author.AuthorName,
                     Email = p.Author.AuthorEmail
                 })
                     ),
                 CommentList = metaDataOnly ? new List <Comment>() : new List <Comment>(
                     blogEntryLinq.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
                 })
                     )
             });
         }
         //+
         return(null);
     }
 }
예제 #7
0
 public void PingTechnorati(String blogGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog entry exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         TechnoratiNotifier.Ping(blogLinq.BlogTitle, new Uri(blogLinq.BlogPrimaryUrl));
     }
 }
예제 #8
0
 public void UpdateLabel(String labelGuid, String title)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure label exists
         LabelLINQ labelLinq;
         Validator.EnsureLabelExists(labelGuid, out labelLinq, db);
         //+
         labelLinq.LabelTitle = title;
         //+
         db.SubmitChanges();
     }
 }
예제 #9
0
 public void DeleteComment(String commentGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         CommentLINQ commentLinq;
         Validator.EnsureCommentExists(commentGuid, out commentLinq, db);
         //+
         db.Comments.DeleteOnSubmit(commentLinq);
         //+
         db.SubmitChanges();
     }
 }
예제 #10
0
 public void DisableBlogEntry(String blogEntryGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog entry exists
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         //+
         blogEntryLinq.BlogEntryStatusId = 2;
         //+
         db.SubmitChanges();
     }
 }
예제 #11
0
 public void AuthorizeComment(String commentGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         CommentLINQ commentLinq;
         Validator.EnsureCommentExists(commentGuid, out commentLinq, db);
         //+
         commentLinq.CommentModerated = false;
         //+
         db.SubmitChanges();
     }
 }
예제 #12
0
 public void UpdateAuthor(String authorEmail, String authorName)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure author exists
         AuthorLINQ authorLinq;
         Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
         //+
         authorLinq.AuthorName = authorName;
         //+
         db.SubmitChanges();
     }
 }
예제 #13
0
 //- ~ByLabelGuid -//
 internal static String ByLabelGuid(String labelGuid)
 {
     using (MinimaServiceLINQDataContext db = new MinimaServiceLINQDataContext(ServiceConfiguration.ConnectionString))
     {
         DataLoadOptions options = new DataLoadOptions();
         options.LoadWith <LabelLINQ>(p => p.Blog);
         db.LoadOptions = options;
         //+ ensure blog exists
         LabelLINQ labelLinq;
         Validator.EnsureLabelExists(labelGuid, out labelLinq, db);
         //+
         return(labelLinq.Blog.BlogGuid);
     }
 }
예제 #14
0
 //- ~ByBlogImageGuid -//
 internal static String ByBlogImageGuid(String blogImageGuid)
 {
     using (MinimaServiceLINQDataContext db = new MinimaServiceLINQDataContext(ServiceConfiguration.ConnectionString))
     {
         DataLoadOptions options = new DataLoadOptions();
         options.LoadWith <BlogImageLINQ>(p => p.Blog);
         db.LoadOptions = options;
         //+ ensure blog exists
         BlogImageLINQ blogImageLinq;
         Validator.EnsureBlogImageExists(blogImageGuid, out blogImageLinq, db);
         //+
         return(blogImageLinq.Blog.BlogGuid);
     }
 }
예제 #15
0
 //- ~ValidateUserNameAndPassword -//
 internal static void ValidateUserNameAndPassword(String userName, String password)
 {
     using (MinimaServiceLINQDataContext db = new MinimaServiceLINQDataContext(ServiceConfiguration.ConnectionString))
     {
         String authorEmail = userName;
         //+ validate
         AuthorLINQ authorLinq;
         Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
         //+
         if (authorLinq == null || authorLinq.AuthorPassword != password)
         {
             throw new SecurityException(Message.Invalid);
         }
     }
 }
예제 #16
0
 public List <ArchiveCount> GetArchivedEntryList(String blogGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         return(db.GetArchivedEntryList(blogLinq.BlogId).Select(p => new ArchiveCount
         {
             ArchiveDate = DateTime.Parse(p.Month),
             Count = (Int32)p.Count
         }).ToList());
     }
 }
예제 #17
0
 //- ~ByCommentGuid -//
 internal static String ByCommentGuid(String commentGuid)
 {
     using (MinimaServiceLINQDataContext db = new MinimaServiceLINQDataContext(ServiceConfiguration.ConnectionString))
     {
         DataLoadOptions options = new DataLoadOptions();
         options.LoadWith <CommentLINQ>(p => p.BlogEntry);
         options.LoadWith <BlogEntryLINQ>(p => p.Blog);
         db.LoadOptions = options;
         //+
         CommentLINQ commentLinq;
         Validator.EnsureCommentExists(commentGuid, out commentLinq, db);
         //+
         return(commentLinq.BlogEntry.Blog.BlogGuid);
     }
 }
예제 #18
0
 public BlogImage GetImage(String blogImageGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog  image exists
         BlogImageLINQ blogImageLinq;
         Validator.EnsureBlogImageExists(blogImageGuid, out blogImageLinq, db);
         //+
         Binary imageBinary = blogImageLinq.BlogImageData;
         //+
         return(new BlogImage
         {
             ContentType = blogImageLinq.BlogImageContentType,
             Data = imageBinary.ToArray()
         });
     }
 }
예제 #19
0
 public void RemoveAuthor(String blogEntryGuid, String authorEmail)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         AuthorLINQ authorLinq;
         Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
         //+
         BlogEntryAuthorLINQ blogEntryAuthorLinq = db.BlogEntryAuthors.SingleOrDefault(p => p.AuthorId == authorLinq.AuthorId && p.BlogEntryId == blogEntryLinq.BlogEntryId);
         if (blogEntryAuthorLinq == null)
         {
             db.BlogEntryAuthors.DeleteOnSubmit(blogEntryAuthorLinq);
             db.SubmitChanges();
         }
     }
 }
예제 #20
0
 public List <Label> GetBlogEntryLabelList(String blogEntryGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         //+
         return(blogEntryLinq.LabelBlogEntries.Select(p => new Label
         {
             BlogEntryCount = -1,
             Title = p.Label.LabelTitle,
             Guid = p.Label.LabelGuid,
             BlogGuid = p.BlogEntry.Blog.BlogGuid,
             FriendlyTitle = p.Label.LabelFriendlyTitle
         }).ToList());
     }
 }
예제 #21
0
 public void RemoveLabel(String labelGuid, String blogEntryGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         LabelLINQ labelLinq;
         Validator.EnsureLabelExists(labelGuid, out labelLinq, db);
         //+
         LabelBlogEntryLINQ labelBlogEntryLinq = db.LabelBlogEntries.SingleOrDefault(p => p.LabelId == labelLinq.LabelId && p.BlogEntryId == blogEntryLinq.BlogEntryId);
         if (labelBlogEntryLinq != null)
         {
             db.LabelBlogEntries.DeleteOnSubmit(labelBlogEntryLinq);
             db.SubmitChanges();
         }
     }
 }
예제 #22
0
        //- ~ValidateSystemPermission -//
        internal static void ValidateSystemPermission(BlogPermission blogPermission)
        {
            Char databasePermissionCode = GetDatabasePermissionCode(blogPermission);

            //+
            using (MinimaServiceLINQDataContext db = new MinimaServiceLINQDataContext(ServiceConfiguration.ConnectionString))
            {
                String authorEmail = OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;
                //+ validate
                AuthorLINQ authorLinq;
                Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
                //+
                if (!authorLinq.UserRights.Any(ur => ur.UserRightLevel == PermissionLevel.System &&
                                               ur.UserRightType == databasePermissionCode))
                {
                    throw new SecurityException(Message.Invalid);
                }
            }
        }
예제 #23
0
        public String PostNewComment(String blogEntryGuid, String text, String author, String email, String website, DateTime dateTime, String emailBodyTemplate, String emailSubject)
        {
            String commentGuid    = String.Empty;
            String blogEntryTitle = String.Empty;

            using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
            {
                //+ validate
                BlogEntryLINQ blogEntryLinq;
                Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
                //+
                CommentLINQ commentLinq = new CommentLINQ();
                commentLinq.CommentEmail  = email;
                commentLinq.CommentAuthor = author;
                commentLinq.CommentText   = text;
                if (website.ToLower().StartsWith("http://") || website.ToLower().StartsWith("https://"))
                {
                    commentLinq.CommentWebsite = website;
                }
                commentLinq.CommentPostDate  = dateTime;
                commentLinq.CommentModerated = true;
                commentLinq.BlogEntryId      = blogEntryLinq.BlogEntryId;
                commentLinq.CommentGuid      = Themelia.GuidCreator.GetNewGuid();
                //+
                db.Comments.InsertOnSubmit(commentLinq);
                db.SubmitChanges();
                //+
                commentGuid = commentLinq.CommentGuid;
                //+
                blogEntryTitle = blogEntryLinq.BlogEntryTitle;
            }
            //+ email
            Themelia.Map map = new Themelia.Map();
            map.Add("BlogEntryTitle", blogEntryTitle);
            map.Add("CommentGuid", commentGuid);
            String body = new Themelia.Template(emailBodyTemplate).Interpolate(map);

            //+ this could be sent from the person, but those e-mails will more than likely be caught by a spam filter.
            Emailer.Send(MailConfiguration.GeneralFromEmailAddress, MailConfiguration.GeneralToEmailAddress, emailSubject, body, MailOptions.IsHtml);
            //+
            return(commentGuid);
        }
예제 #24
0
 public List <Label> GetBlogLabelList(String blogGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogLINQ blogLinq;
         Validator.EnsureBlogExists(blogGuid, out blogLinq, db);
         //+
         return(blogLinq.Labels
                .Where(p => p.BlogId == blogLinq.BlogId)
                .Select(p => new Label
         {
             BlogGuid = blogLinq.BlogGuid,
             Guid = p.LabelGuid,
             FriendlyTitle = p.LabelFriendlyTitle,
             Title = p.LabelTitle,
             BlogEntryCount = GetEntryCount(p, db)
         }).ToList());
     }
 }
예제 #25
0
 public void ApplyLabel(String blogEntryGuid, String labelGuid)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         LabelLINQ labelLinq;
         Validator.EnsureLabelExists(labelGuid, out labelLinq, db);
         //+
         if (!db.LabelBlogEntries.Any(p => p.LabelId == labelLinq.LabelId && p.BlogEntryId == blogEntryLinq.BlogEntryId))
         {
             LabelBlogEntryLINQ labelBlogEntryLinq = new LabelBlogEntryLINQ();
             labelBlogEntryLinq.BlogEntryId = blogEntryLinq.BlogEntryId;
             labelBlogEntryLinq.LabelId     = labelLinq.LabelId;
             //+
             db.LabelBlogEntries.InsertOnSubmit(labelBlogEntryLinq);
             db.SubmitChanges();
         }
     }
 }
예제 #26
0
 public void ApplyAuthor(String blogEntryGuid, String authorEmail)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ validate
         BlogEntryLINQ blogEntryLinq;
         Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db);
         AuthorLINQ authorLinq;
         Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
         //+
         if (!db.BlogEntryAuthors.Any(p => p.AuthorId == authorLinq.AuthorId && p.BlogEntryId == blogEntryLinq.BlogEntryId))
         {
             BlogEntryAuthorLINQ blogEntryAuthorLinq = new BlogEntryAuthorLINQ();
             blogEntryAuthorLinq.AuthorId    = authorLinq.AuthorId;
             blogEntryAuthorLinq.BlogEntryId = blogEntryLinq.BlogEntryId;
             //+
             db.BlogEntryAuthors.InsertOnSubmit(blogEntryAuthorLinq);
             db.SubmitChanges();
         }
     }
 }
예제 #27
0
 public String CreateAuthor(String authorEmail, String authorName)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         String authorGuid = String.Empty;
         if (!db.Authors.Any(p => p.AuthorEmail == authorEmail))
         {
             AuthorLINQ authorLinq = new AuthorLINQ();
             authorLinq.AuthorEmail      = authorEmail;
             authorLinq.AuthorName       = authorName;
             authorLinq.AuthorGuid       = Themelia.GuidCreator.GetNewGuid();
             authorLinq.AuthorCreateDate = DateTime.Now;
             //+
             db.Authors.InsertOnSubmit(authorLinq);
             db.SubmitChanges();
             //+
             authorGuid = authorLinq.AuthorGuid;
         }
         //+
         return(authorGuid);
     }
 }
예제 #28
0
 //- @GetBlogEntryTypeList -//
 public List <BlogEntryType> GetBlogEntryTypeList(String blogGuid, List <String> guidList)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         List <BlogEntryType> blogEntryTypeList = new List <BlogEntryType>();
         var blogEntryData = db.BlogEntryTypes.Select(p => p);
         foreach (BlogEntryTypeLINQ blogEntryTypeLinq in blogEntryData)
         {
             if (guidList.Contains(blogEntryTypeLinq.BlogEntryTypeGuid))
             {
                 blogEntryTypeList.Add(new BlogEntryType
                 {
                     Extra = blogEntryTypeLinq.BlogEntryTypeExtra,
                     Name  = blogEntryTypeLinq.BlogEntryTypeName,
                     Guid  = blogEntryTypeLinq.BlogEntryTypeGuid
                 });
             }
         }
         //+
         return(blogEntryTypeList);
     }
 }
예제 #29
0
 //- @GetLabelByNetTitle-//
 public Label GetLabelByNetTitle(String netTitle)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         DataLoadOptions options = new DataLoadOptions();
         options.LoadWith <LabelLINQ>(p => p.Blog);
         LabelLINQ labelLinq = db.Labels.SingleOrDefault(p => p.LabelNetTitle == netTitle);
         if (labelLinq == null)
         {
             return(null);
         }
         //+
         return(new Label
         {
             BlogGuid = labelLinq.Blog.BlogGuid,
             FriendlyTitle = labelLinq.LabelFriendlyTitle,
             Guid = labelLinq.LabelGuid,
             Title = labelLinq.LabelTitle,
             BlogEntryCount = GetEntryCount(labelLinq, db)
         });
     }
 }
예제 #30
0
 public List <BlogMetaData> GetBlogListForAssociatedAuthor(String authorEmail)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         //+ ensure blog exists
         AuthorLINQ authorLinq;
         Validator.EnsureAuthorExists(authorEmail, out authorLinq, db);
         //+
         List <Int32> blogEntryIdList = db.AuthorBlogAssociations
                                        .Where(p => p.AuthorId == authorLinq.AuthorId)
                                        .Select(p => p.BlogId)
                                        .ToList();
         List <BlogMetaData> blogMetaDataList = new List <BlogMetaData>();
         foreach (Int32 blogId in blogEntryIdList)
         {
             BlogMetaData blogMetaData = new BlogMetaData();
             BlogLINQ     blogLinq     = db.Blogs.Single(p => p.BlogId == blogId);
             blogMetaData.Description    = blogLinq.BlogDescription;
             blogMetaData.FeedTitle      = blogLinq.BlogFeedTitle;
             blogMetaData.FeedUri        = new Uri(blogLinq.BlogFeedUrl);
             blogMetaData.Guid           = blogLinq.BlogGuid;
             blogMetaData.Title          = blogLinq.BlogTitle;
             blogMetaData.Uri            = new Uri(blogLinq.BlogPrimaryUrl);
             blogMetaData.CreateDateTime = blogLinq.BlogCreateDate;
             blogMetaData.LabelList      = new List <Label>(
                 blogLinq.Labels.Select(p => new Label
             {
                 Guid          = p.LabelGuid,
                 FriendlyTitle = p.LabelFriendlyTitle,
                 Title         = p.LabelTitle
             })
                 );
             blogMetaDataList.Add(blogMetaData);
         }
         //+
         return(blogMetaDataList);
     }
 }