Exemplo n.º 1
0
 public DeleteImageCommand(ObjectRepository repository, string galleryDirectoryPath, Image image, string imageTitle)
 {
     GalleryDirectoryPath = galleryDirectoryPath;
     _targetName = "Image";
     itemTitle = imageTitle;
     Image = image;
 }
Exemplo n.º 2
0
 public DeleteCategoryCommand(ObjectRepository repository, int categoryID, string categoryTitle)
 {
     _targetName = "Category";
     _targetID = categoryID;
     itemTitle = categoryTitle;
     Repository = repository;
 }
Exemplo n.º 3
0
 public DeletePostCommand(ObjectRepository repository, int postID, ISearchEngineService searchEngineService)
 {
     _targetName = "Post";
     _targetID = postID;
     Repository = repository;
     SearchEngine = searchEngineService;
 }
Exemplo n.º 4
0
 public ImportLinksCommand(ObjectRepository repository, OpmlItemCollection links, int catID)
     : this()
 {
     _linksToImport = links;
     _categoryID = catID;
     Repository = repository;
 }
Exemplo n.º 5
0
 public DeleteKeyWordCommand(ObjectRepository repository, int keyWordId, string word)
 {
     AutoRedirect = true;
     _targetName = "KeyWord";
     _targetID = keyWordId;
     itemTitle = word;
     _repository = repository;
 }
Exemplo n.º 6
0
 public DeleteGalleryCommand(ObjectRepository repository, HttpServerUtilityBase server, string galleryDirectoryPath, int galleryId, string galleryTitle)
 {
     _server = server;
     _targetID = galleryId;
     itemTitle = galleryTitle;
     GalleryDirectoryPath = galleryDirectoryPath;
     Repository = repository;
 }
Exemplo n.º 7
0
 public DeleteLinkCommand(ObjectRepository repository, int linkId, string linkTitle)
 {
     AutoRedirect = true;
     _targetName = "Link";
     _targetID = linkId;
     itemTitle = linkTitle;
     Repository = repository;
 }
Exemplo 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;
 }
Exemplo n.º 9
0
 public KeywordExpander(ObjectRepository repository)
 {
     _repository = repository;
 }
Exemplo n.º 10
0
 public BlogLookupService(ObjectRepository repository, LazyNotNull<HostInfo> hostInfo)
 {
     Repository = repository;
     _hostInfo = hostInfo;
 }
Exemplo 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);
 }
Exemplo 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
     });
 }
Exemplo n.º 13
0
 public AjaxServices(ObjectRepository repository)
 {
     Repository = repository;
 }
Exemplo n.º 14
0
 public HostAccountService(HostInfo hostInfo, ISubtextContext context)
     : base(context)
 {
     _repository = context.Repository;
     _hostInfo = hostInfo;
 }
Exemplo 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);
        }
Exemplo n.º 16
0
 public SlugGenerator(FriendlyUrlSettings slugSettings, ObjectRepository repository)
 {
     SlugSettings = slugSettings ?? DefaultSettings;
     Repository = repository;
 }
Exemplo 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;
     }
 }
Exemplo 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;
 }
Exemplo n.º 19
0
 public DeleteImageCommand(ObjectRepository repository, Image image, string galleryDirectoryPath)
     : this(repository, galleryDirectoryPath, image, "Image " + image.ImageID.ToString(CultureInfo.InvariantCulture))
 {
 }
Exemplo n.º 20
0
 public static Mock<ISubtextContext> SetupRepository(this Mock<ISubtextContext> context,
     ObjectRepository repository)
 {
     context.Setup(c => c.Repository).Returns(repository);
     return context;
 }
Exemplo 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;
 }
Exemplo n.º 22
0
 public BlogImportSetup(Blog blog, ObjectRepository repository)
 {
     Blog = blog;
     Repository = repository;
     SetupBlogForImport();
 }
Exemplo 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;
 }
Exemplo 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;
 }
Exemplo n.º 25
0
 public IPagedCollection<BlogAlias> GetBlogAliases(ObjectRepository repository, int pageIndex, int pageSize)
 {
     return repository.GetPagedBlogDomainAlias(this, pageIndex, pageSize);
 }