Esempio n. 1
0
 public DeleteImageCommand(ObjectRepository repository, string galleryDirectoryPath, Image image, string imageTitle)
 {
     GalleryDirectoryPath = galleryDirectoryPath;
     _targetName = "Image";
     itemTitle = imageTitle;
     Image = image;
 }
Esempio n. 2
0
 public DeleteCategoryCommand(ObjectRepository repository, int categoryID, string categoryTitle)
 {
     _targetName = "Category";
     _targetID = categoryID;
     itemTitle = categoryTitle;
     Repository = repository;
 }
Esempio n. 3
0
 public DeletePostCommand(ObjectRepository repository, int postID, ISearchEngineService searchEngineService)
 {
     _targetName = "Post";
     _targetID = postID;
     Repository = repository;
     SearchEngine = searchEngineService;
 }
Esempio n. 4
0
 public ImportLinksCommand(ObjectRepository repository, OpmlItemCollection links, int catID)
     : this()
 {
     _linksToImport = links;
     _categoryID = catID;
     Repository = repository;
 }
Esempio n. 5
0
 public DeleteKeyWordCommand(ObjectRepository repository, int keyWordId, string word)
 {
     AutoRedirect = true;
     _targetName = "KeyWord";
     _targetID = keyWordId;
     itemTitle = word;
     _repository = repository;
 }
 public DeleteGalleryCommand(ObjectRepository repository, HttpServerUtilityBase server, string galleryDirectoryPath, int galleryId, string galleryTitle)
 {
     _server = server;
     _targetID = galleryId;
     itemTitle = galleryTitle;
     GalleryDirectoryPath = galleryDirectoryPath;
     Repository = repository;
 }
Esempio n. 7
0
 public DeleteLinkCommand(ObjectRepository repository, int linkId, string linkTitle)
 {
     AutoRedirect = true;
     _targetName = "Link";
     _targetID = linkId;
     itemTitle = linkTitle;
     Repository = repository;
 }
Esempio n. 8
0
 public SubtextContext(Blog blog, RequestContext requestContext, BlogUrlHelper urlHelper, ObjectRepository repository,
                       IPrincipal user, ICache cache, IDependencyResolver serviceLocator)
 {
     Blog = blog;
     RequestContext = requestContext;
     UrlHelper = urlHelper;
     Repository = repository;
     User = user ?? requestContext.HttpContext.User;
     Cache = cache ?? new SubtextCache(requestContext.HttpContext.Cache);
     ServiceLocator = serviceLocator;
 }
Esempio n. 9
0
 public KeywordExpander(ObjectRepository repository)
 {
     _repository = repository;
 }
Esempio n. 10
0
 public BlogLookupService(ObjectRepository repository, LazyNotNull<HostInfo> hostInfo)
 {
     Repository = repository;
     _hostInfo = hostInfo;
 }
Esempio n. 11
0
 private static void CreateWelcomeComment(ObjectRepository repository, AdminUrlHelper adminUrlHelper, Entry entry)
 {
     string commentBody = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeComment.htm");
     string feedbackUrl = adminUrlHelper.FeedbackList();
     commentBody = string.Format(commentBody, feedbackUrl);
     var comment = new FeedbackItem(FeedbackType.Comment)
     {
         Title = "re: Welcome to Subtext!",
         Entry = entry,
         Author = "Subtext",
         Approved = true,
         Body = commentBody
     };
     repository.Create(comment);
 }
Esempio n. 12
0
 private static void CreateWelcomeCategories(ObjectRepository repository, Blog blog)
 {
     repository.CreateLinkCategory(new LinkCategory
     {
         Title = "Programming",
         Description = "Blog posts related to programming",
         BlogId = blog.Id,
         IsActive = true,
         CategoryType = CategoryType.PostCollection,
     });
     repository.CreateLinkCategory(new LinkCategory
     {
         Title = "Personal",
         Description = "Personal musings, random thoughts.",
         BlogId = blog.Id,
         IsActive = true,
         CategoryType = CategoryType.PostCollection
     });
 }
Esempio n. 13
0
 public AjaxServices(ObjectRepository repository)
 {
     Repository = repository;
 }
Esempio n. 14
0
 public HostAccountService(HostInfo hostInfo, ISubtextContext context)
     : base(context)
 {
     _repository = context.Repository;
     _hostInfo = hostInfo;
 }
Esempio n. 15
0
        /// <summary>
        /// Creates the host in the persistent store.
        /// </summary>
        /// <returns></returns>
        public static bool CreateHost(ObjectRepository repository, string hostUserName, string hostPassword, string email)
        {
            if (_instance.Value != null)
            {
                throw new InvalidOperationException(Resources.InvalidOperation_HostRecordAlreadyExists);
            }

            var host = new HostInfo(ConfigurationManager.AppSettings) { HostUserName = hostUserName, Email = email };

            SetHostPassword(host, hostPassword);
            return repository.UpdateHost(host);
        }
Esempio n. 16
0
 public SlugGenerator(FriendlyUrlSettings slugSettings, ObjectRepository repository)
 {
     SlugSettings = slugSettings ?? DefaultSettings;
     Repository = repository;
 }
Esempio n. 17
0
 public static HostInfo LoadHostInfoFromDatabase(ObjectRepository repository, bool suppressException)
 {
     try
     {
         return repository.LoadHostInfo(new HostInfo(ConfigurationManager.AppSettings));
     }
     catch (SqlException e)
     {
         // LoadHostInfo now executes the stored proc subtext_GetHost, instead of checking the table subtext_Host
         if (e.Message.IndexOf("Invalid object name 'subtext_Host'") >= 0
             || e.Message.IndexOf("Could not find stored procedure 'subtext_GetHost'") >= 0)
         {
             if (suppressException)
             {
                 return null;
             }
             throw new HostDataDoesNotExistException();
         }
         throw;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Updates the host in the persistent store.
 /// </summary>
 /// <param name="host">Host.</param>
 /// <returns></returns>
 public static bool UpdateHost(ObjectRepository repository, HostInfo host)
 {
     if (repository.UpdateHost(host))
     {
         return true;
     }
     return false;
 }
Esempio n. 19
0
 public DeleteImageCommand(ObjectRepository repository, Image image, string galleryDirectoryPath)
     : this(repository, galleryDirectoryPath, image, "Image " + image.ImageID.ToString(CultureInfo.InvariantCulture))
 {
 }
Esempio n. 20
0
 public static Mock<ISubtextContext> SetupRepository(this Mock<ISubtextContext> context,
     ObjectRepository repository)
 {
     context.Setup(c => c.Repository).Returns(repository);
     return context;
 }
Esempio n. 21
0
 static Link CreateLink(ObjectRepository repository, string title, int? categoryId, int? postId)
 {
     var link = new Link();
     link.IsActive = true;
     link.BlogId = Config.CurrentBlog.Id;
     if (categoryId != null)
     {
         link.CategoryId = (int)categoryId;
     }
     link.Title = title;
     if (postId != null)
     {
         link.PostId = (int)postId;
     }
     int linkId = repository.CreateLink(link);
     Assert.AreEqual(linkId, link.Id);
     return link;
 }
Esempio n. 22
0
 public BlogImportSetup(Blog blog, ObjectRepository repository)
 {
     Blog = blog;
     Repository = repository;
     SetupBlogForImport();
 }
Esempio n. 23
0
 static int[] CreateSomePostCategories(ObjectRepository repository)
 {
     var categoryIds = new int[3];
     categoryIds[0] =
         repository.CreateLinkCategory(CreateCategory("My Favorite Feeds", "Some of my favorite RSS feeds",
                                                 CategoryType.PostCollection, true));
     categoryIds[1] =
         repository.CreateLinkCategory(CreateCategory("Google Blogs", "My favorite Google blogs",
                                                 CategoryType.PostCollection, true));
     categoryIds[2] =
         repository.CreateLinkCategory(CreateCategory("Microsoft Blogs", "My favorite Microsoft blogs",
                                                 CategoryType.PostCollection, false));
     return categoryIds;
 }
Esempio n. 24
0
 /// <summary>
 /// Updates the host in the persistent store.
 /// </summary>
 /// <param name="host">Host.</param>
 /// <returns></returns>
 public static bool UpdateHost(ObjectRepository repository, HostInfo host)
 {
     if (repository.UpdateHost(host))
     {
         _instance = new Lazy<HostInfo>(() => host);
         return true;
     }
     return false;
 }
Esempio n. 25
0
 public IPagedCollection<BlogAlias> GetBlogAliases(ObjectRepository repository, int pageIndex, int pageSize)
 {
     return repository.GetPagedBlogDomainAlias(this, pageIndex, pageSize);
 }