示例#1
0
 public SitemapGenerator(
     ICategoryService categoryService,
     IProductService productService,
     IManufacturerService manufacturerService,
     ITopicService topicService,
     IBlogService blogService,
     IPictureService pictureService,
     IKnowledgebaseService knowledgebaseService,
     IWebHelper webHelper,
     CommonSettings commonSettings,
     BlogSettings blogSettings,
     KnowledgebaseSettings knowledgebaseSettings,
     NewsSettings newsSettings,
     ForumSettings forumSettings)
 {
     _categoryService       = categoryService;
     _productService        = productService;
     _manufacturerService   = manufacturerService;
     _topicService          = topicService;
     _blogService           = blogService;
     _pictureService        = pictureService;
     _webHelper             = webHelper;
     _commonSettings        = commonSettings;
     _knowledgebaseService  = knowledgebaseService;
     _knowledgebaseSettings = knowledgebaseSettings;
     _newsSettings          = newsSettings;
     _forumSettings         = forumSettings;
     _blogSettings          = blogSettings;
 }
示例#2
0
        /// <summary>
        /// Get category breadcrumb
        /// </summary>
        /// <param name="category">Category</param>
        /// <param name="categoryService">Category service</param>
        /// <param name="aclService">ACL service</param>
        /// <param name="storeMappingService">Store mapping service</param>
        /// <param name="showHidden">A value indicating whether to load hidden records</param>
        /// <returns>Category breadcrumb </returns>
        public static IList <KnowledgebaseCategory> GetCategoryBreadCrumb(this KnowledgebaseCategory category,
                                                                          IKnowledgebaseService knowledgebaseService,
                                                                          IAclService aclService,
                                                                          IStoreMappingService storeMappingService,
                                                                          bool showHidden = false)
        {
            if (category == null)
            {
                throw new ArgumentNullException("category");
            }

            var result = new List <KnowledgebaseCategory>();

            //used to prevent circular references
            var alreadyProcessedCategoryIds = new List <string>();

            while (category != null &&                                        //not null
                   (showHidden || category.Published) &&                      //published
                   (showHidden || aclService.Authorize(category)) &&          //ACL
                   (showHidden || storeMappingService.Authorize(category)) && //Store mapping
                   !alreadyProcessedCategoryIds.Contains(category.Id))        //prevent circular references
            {
                result.Add(category);

                alreadyProcessedCategoryIds.Add(category.Id);

                category = knowledgebaseService.GetKnowledgebaseCategory(category.ParentCategoryId);
            }

            result.Reverse();
            return(result);
        }
示例#3
0
        public GetSitemapHandler(ICacheManager cacheManager,
                                 ICategoryService categoryService,
                                 IManufacturerService manufacturerService,
                                 IProductService productService,
                                 ITopicService topicService,
                                 IBlogService blogService,
                                 IKnowledgebaseService knowledgebaseService,
                                 CommonSettings commonSettings,
                                 BlogSettings blogSettings,
                                 ForumSettings forumSettings,
                                 NewsSettings newsSettings,
                                 KnowledgebaseSettings knowledgebaseSettings)
        {
            _cacheManager         = cacheManager;
            _categoryService      = categoryService;
            _manufacturerService  = manufacturerService;
            _productService       = productService;
            _topicService         = topicService;
            _blogService          = blogService;
            _knowledgebaseService = knowledgebaseService;

            _commonSettings        = commonSettings;
            _blogSettings          = blogSettings;
            _forumSettings         = forumSettings;
            _newsSettings          = newsSettings;
            _knowledgebaseSettings = knowledgebaseSettings;
        }
示例#4
0
        public GetSitemapHandler(ICacheBase cacheBase,
                                 ICategoryService categoryService,
                                 IBrandService brandService,
                                 IProductService productService,
                                 IPageService pageService,
                                 IBlogService blogService,
                                 IKnowledgebaseService knowledgebaseService,
                                 CommonSettings commonSettings,
                                 BlogSettings blogSettings,
                                 NewsSettings newsSettings,
                                 KnowledgebaseSettings knowledgebaseSettings)
        {
            _cacheBase            = cacheBase;
            _categoryService      = categoryService;
            _brandService         = brandService;
            _productService       = productService;
            _pageService          = pageService;
            _blogService          = blogService;
            _knowledgebaseService = knowledgebaseService;

            _commonSettings        = commonSettings;
            _blogSettings          = blogSettings;
            _newsSettings          = newsSettings;
            _knowledgebaseSettings = knowledgebaseSettings;
        }
示例#5
0
 public KnowledgebaseController(
     KnowledgebaseSettings knowledgebaseSettings,
     IKnowledgebaseService knowledgebaseService,
     IWorkContext workContext,
     ICacheBase cacheBase,
     IAclService aclService,
     ITranslationService translationService,
     IMessageProviderService messageProviderService,
     ICustomerActivityService customerActivityService,
     IDateTimeService dateTimeService,
     IPermissionService permissionService,
     CustomerSettings customerSettings,
     CaptchaSettings captchaSettings,
     LanguageSettings languageSettings)
 {
     _knowledgebaseSettings   = knowledgebaseSettings;
     _knowledgebaseService    = knowledgebaseService;
     _workContext             = workContext;
     _cacheBase               = cacheBase;
     _aclService              = aclService;
     _translationService      = translationService;
     _captchaSettings         = captchaSettings;
     _languageSettings        = languageSettings;
     _messageProviderService  = messageProviderService;
     _customerActivityService = customerActivityService;
     _dateTimeService         = dateTimeService;
     _customerSettings        = customerSettings;
     _permissionService       = permissionService;
 }
示例#6
0
 public GetSitemapXMLCommandHandler(
     ICategoryService categoryService,
     IProductService productService,
     IBrandService brandService,
     IPageService pageService,
     IBlogService blogService,
     IPictureService pictureService,
     IKnowledgebaseService knowledgebaseService,
     CommonSettings commonSettings,
     BlogSettings blogSettings,
     KnowledgebaseSettings knowledgebaseSettings,
     NewsSettings newsSettings,
     LinkGenerator linkGenerator,
     AppConfig appConfig)
 {
     _categoryService       = categoryService;
     _productService        = productService;
     _brandService          = brandService;
     _pageService           = pageService;
     _blogService           = blogService;
     _pictureService        = pictureService;
     _commonSettings        = commonSettings;
     _knowledgebaseService  = knowledgebaseService;
     _knowledgebaseSettings = knowledgebaseSettings;
     _newsSettings          = newsSettings;
     _blogSettings          = blogSettings;
     _linkGenerator         = linkGenerator;
     _appConfig             = appConfig;
 }
 public KnowledgebaseController(
     KnowledgebaseSettings knowledgebaseSettings,
     IKnowledgebaseService knowledgebaseService,
     IWorkContext workContext,
     IStoreContext storeContext,
     ICacheBase cacheManager,
     IAclService aclService,
     IStoreMappingService storeMappingService,
     ILocalizationService localizationService,
     CaptchaSettings captchaSettings,
     LocalizationSettings localizationSettings,
     IWorkflowMessageService workflowMessageService,
     ICustomerActivityService customerActivityService,
     IDateTimeHelper dateTimeHelper,
     CustomerSettings customerSettings,
     IPermissionService permissionService)
 {
     _knowledgebaseSettings   = knowledgebaseSettings;
     _knowledgebaseService    = knowledgebaseService;
     _workContext             = workContext;
     _storeContext            = storeContext;
     _cacheBase               = cacheManager;
     _aclService              = aclService;
     _storeMappingService     = storeMappingService;
     _localizationService     = localizationService;
     _captchaSettings         = captchaSettings;
     _localizationSettings    = localizationSettings;
     _workflowMessageService  = workflowMessageService;
     _customerActivityService = customerActivityService;
     _dateTimeHelper          = dateTimeHelper;
     _customerSettings        = customerSettings;
     _permissionService       = permissionService;
 }
示例#8
0
        public KnowledgebaseCategoryModelValidator(
            IEnumerable <IValidatorConsumer <KnowledgebaseCategoryModel> > validators,
            ITranslationService translationService, IKnowledgebaseService knowledgebaseService)
            : base(validators)
        {
            RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Content.Knowledgebase.KnowledgebaseCategory.Fields.Name.Required"));
            RuleFor(x => x.ParentCategoryId).MustAsync(async(x, y, context) =>
            {
                var category = await knowledgebaseService.GetKnowledgebaseCategory(x.ParentCategoryId);
                if (category != null || string.IsNullOrEmpty(x.ParentCategoryId))
                {
                    return(true);
                }
                else
                {
                    var categories = await knowledgebaseService.GetKnowledgebaseCategories();
                    if (!categories.Any())
                    {
                        return(true);
                    }
                }

                return(false);
            }).WithMessage(translationService.GetResource("Admin.Content.Knowledgebase.KnowledgebaseCategory.Fields.ParentCategoryId.MustExist"));
        }
示例#9
0
 public KnowledgebaseController(IKnowledgebaseViewModelService knowledgebaseViewModelService, ILocalizationService localizationService,
                                IKnowledgebaseService knowledgebaseService, ILanguageService languageService,
                                ICustomerService customerService, IStoreService storeService)
 {
     this._knowledgebaseViewModelService = knowledgebaseViewModelService;
     this._localizationService           = localizationService;
     this._knowledgebaseService          = knowledgebaseService;
     this._languageService = languageService;
     this._customerService = customerService;
     this._storeService    = storeService;
 }
示例#10
0
 public KnowledgebaseViewModelService(ILocalizationService localizationService,
                                      IKnowledgebaseService knowledgebaseService, ICustomerActivityService customerActivityService,
                                      ICustomerService customerService, IDateTimeHelper dateTimeHelper, IUrlRecordService urlRecordService)
 {
     _localizationService     = localizationService;
     _knowledgebaseService    = knowledgebaseService;
     _customerActivityService = customerActivityService;
     _customerService         = customerService;
     _dateTimeHelper          = dateTimeHelper;
     _urlRecordService        = urlRecordService;
 }
 public ActivityLogViewModelService(ICustomerActivityService customerActivityService,
                                    IDateTimeHelper dateTimeHelper, ICustomerService customerService,
                                    ICategoryService categoryService, IManufacturerService manufacturerService,
                                    IProductService productService, IKnowledgebaseService knowledgebaseService)
 {
     _customerActivityService = customerActivityService;
     _dateTimeHelper          = dateTimeHelper;
     _customerService         = customerService;
     _categoryService         = categoryService;
     _manufacturerService     = manufacturerService;
     _productService          = productService;
     _knowledgebaseService    = knowledgebaseService;
 }
示例#12
0
 public ActivityLogViewModelService(ICustomerActivityService customerActivityService,
                                    IDateTimeService dateTimeService, ICustomerService customerService,
                                    ICategoryService categoryService, ICollectionService collectionService,
                                    IProductService productService, IKnowledgebaseService knowledgebaseService)
 {
     _customerActivityService = customerActivityService;
     _dateTimeService         = dateTimeService;
     _customerService         = customerService;
     _categoryService         = categoryService;
     _collectionService       = collectionService;
     _productService          = productService;
     _knowledgebaseService    = knowledgebaseService;
 }
示例#13
0
 public KnowledgebaseViewModelService(ITranslationService translationService,
                                      IKnowledgebaseService knowledgebaseService, ICustomerActivityService customerActivityService,
                                      ICustomerService customerService, IDateTimeService dateTimeService, ISlugService slugService,
                                      ILanguageService languageService, SeoSettings seoSettings)
 {
     _translationService      = translationService;
     _knowledgebaseService    = knowledgebaseService;
     _customerActivityService = customerActivityService;
     _customerService         = customerService;
     _dateTimeService         = dateTimeService;
     _slugService             = slugService;
     _languageService         = languageService;
     _seoSettings             = seoSettings;
 }
 public KnowledgebaseViewModelService(ILocalizationService localizationService,
                                      IKnowledgebaseService knowledgebaseService, ICustomerActivityService customerActivityService,
                                      ICustomerService customerService, IDateTimeHelper dateTimeHelper, IUrlRecordService urlRecordService,
                                      ILanguageService languageService, SeoSettings seoSettings)
 {
     _localizationService     = localizationService;
     _knowledgebaseService    = knowledgebaseService;
     _customerActivityService = customerActivityService;
     _customerService         = customerService;
     _dateTimeHelper          = dateTimeHelper;
     _urlRecordService        = urlRecordService;
     _languageService         = languageService;
     _seoSettings             = seoSettings;
 }
示例#15
0
 public KnowledgebaseController(IKnowledgebaseViewModelService knowledgebaseViewModelService,
                                ITranslationService translationService,
                                IKnowledgebaseService knowledgebaseService,
                                ILanguageService languageService,
                                IGroupService groupService,
                                IStoreService storeService)
 {
     _knowledgebaseViewModelService = knowledgebaseViewModelService;
     _translationService            = translationService;
     _knowledgebaseService          = knowledgebaseService;
     _languageService = languageService;
     _groupService    = groupService;
     _storeService    = storeService;
 }
示例#16
0
 public KnowledgebaseController(ILocalizationService localizationService, IPermissionService permissionService,
                                IKnowledgebaseService knowledgebaseService, ILanguageService languageService, ICustomerActivityService customerActivityService,
                                ICustomerService customerService, IDateTimeHelper dateTimeHelper, IUrlRecordService urlRecordService, IStoreService storeService)
 {
     this._localizationService     = localizationService;
     this._permissionService       = permissionService;
     this._knowledgebaseService    = knowledgebaseService;
     this._languageService         = languageService;
     this._customerActivityService = customerActivityService;
     this._customerService         = customerService;
     this._dateTimeHelper          = dateTimeHelper;
     this._urlRecordService        = urlRecordService;
     this._storeService            = storeService;
 }
 public ActivityLogController(ICustomerActivityService customerActivityService,
                              IDateTimeHelper dateTimeHelper, ILocalizationService localizationService,
                              IPermissionService permissionService, ICustomerService customerService,
                              ICategoryService categoryService, IManufacturerService manufacturerService,
                              IProductService productService, IKnowledgebaseService knowledgebaseService)
 {
     this._customerActivityService = customerActivityService;
     this._dateTimeHelper          = dateTimeHelper;
     this._localizationService     = localizationService;
     this._permissionService       = permissionService;
     this._customerService         = customerService;
     this._categoryService         = categoryService;
     this._manufacturerService     = manufacturerService;
     this._productService          = productService;
     this._knowledgebaseService    = knowledgebaseService;
 }
示例#18
0
        public void TestInitialize()
        {
            _articleRepository        = new MongoDBRepositoryTest <KnowledgebaseArticle>();
            _categoryRepository       = new MongoDBRepositoryTest <KnowledgebaseCategory>();
            _articleCommentRepository = new MongoDBRepositoryTest <KnowledgebaseArticleComment>();

            var eventPublisher = new Mock <IMediator>();

            //eventPublisher.Setup(x => x.PublishAsync(new object()));
            _eventPublisher = eventPublisher.Object;

            var customer = new Customer()
            {
                Username = "******"
            };
            var tempWorkContext = new Mock <IWorkContext>();
            {
                _workContext = tempWorkContext.Object;
                tempWorkContext.Setup(x => x.CurrentCustomer).Returns(customer);
            }

            var store            = new Store();
            var tempStoreContext = new Mock <IStoreContext>();
            {
                _storeContext = tempStoreContext.Object;
                tempStoreContext.Setup(x => x.CurrentStore).Returns(store);
            }

            var catalogSettings = new Mock <CatalogSettings>();

            _catalogSettings = catalogSettings.Object;

            var commonSettings = new Mock <CommonSettings>();

            _commonSettings = commonSettings.Object;

            var permissionService = new Mock <IPermissionService>();

            _permissionService = permissionService.Object;

            var _cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);


            _knowledgebaseService = new KnowledgebaseService(_categoryRepository, _articleRepository, _articleCommentRepository, _eventPublisher,
                                                             _workContext, _cacheManager, _storeContext, _commonSettings, _catalogSettings);
        }
        public KnowledgebaseArticleModelValidator(
            IEnumerable <IValidatorConsumer <KnowledgebaseArticleModel> > validators,
            ILocalizationService localizationService, IKnowledgebaseService knowledgebaseService)
            : base(validators)
        {
            RuleFor(x => x.Name).NotEmpty().WithMessage(localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseArticle.Fields.Name.Required"));
            RuleFor(x => x.ParentCategoryId).NotEmpty().WithMessage(localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseArticle.Fields.ParentCategoryId.Required"));
            RuleFor(x => x.ParentCategoryId).Must(x =>
            {
                var category = knowledgebaseService.GetKnowledgebaseCategory(x);
                if (category != null)
                {
                    return(true);
                }

                return(false);
            }).WithMessage(localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseArticle.Fields.ParentCategoryId.MustExist"));
        }
 public KnowledgebaseController(KnowledgebaseSettings knowledgebaseSettings, IKnowledgebaseService knowledgebaseService, IWorkContext workContext,
                                IStoreContext storeContext, ICacheManager cacheManager, IAclService aclService, IStoreMappingService storeMappingService, ILocalizationService localizationService,
                                CaptchaSettings captchaSettings, LocalizationSettings localizationSettings, IWorkflowMessageService workflowMessageService,
                                ICustomerActivityService customerActivityService, IDateTimeHelper dateTimeHelper, CustomerSettings customerSettings,
                                MediaSettings mediaSettings, IPictureService pictureService)
 {
     this._knowledgebaseSettings   = knowledgebaseSettings;
     this._knowledgebaseService    = knowledgebaseService;
     this._workContext             = workContext;
     this._storeContext            = storeContext;
     this._cacheManager            = cacheManager;
     this._aclService              = aclService;
     this._storeMappingService     = storeMappingService;
     this._localizationService     = localizationService;
     this._captchaSettings         = captchaSettings;
     this._localizationSettings    = localizationSettings;
     this._workflowMessageService  = workflowMessageService;
     this._customerActivityService = customerActivityService;
     this._dateTimeHelper          = dateTimeHelper;
     this._customerSettings        = customerSettings;
     this._mediaSettings           = mediaSettings;
     this._pictureService          = pictureService;
 }
 public KnowledgebaseCategories(IKnowledgebaseService knowledgebaseService, KnowledgebaseSettings knowledgebaseSettings)
 {
     this._knowledgebaseService  = knowledgebaseService;
     this._knowledgebaseSettings = knowledgebaseSettings;
 }
 public IndexModel(IKnowledgebaseService knowledgebaseService)
 {
     _knowledgebaseService = knowledgebaseService;
 }
示例#23
0
 public KnowledgebaseHomepageArticles(IKnowledgebaseService knowledgebaseService, KnowledgebaseSettings knowledgebaseSettings)
 {
     this._knowledgebaseService  = knowledgebaseService;
     this._knowledgebaseSettings = knowledgebaseSettings;
 }
示例#24
0
 public KnowledgebaseHomepageArticles(IKnowledgebaseService knowledgebaseService, IWorkContext workContext, KnowledgebaseSettings knowledgebaseSettings)
 {
     _knowledgebaseService  = knowledgebaseService;
     _workContext           = workContext;
     _knowledgebaseSettings = knowledgebaseSettings;
 }
示例#25
0
        /// <summary>
        /// Get category breadcrumb
        /// </summary>
        /// <param name="category">Category</param>
        /// <param name="categoryService">Category service</param>
        /// <param name="aclService">ACL service</param>
        /// <param name="storeLinkService">Store link service</param>
        /// <param name="showHidden">A value indicating whether to load hidden records</param>
        /// <returns>Category breadcrumb </returns>
        public static async Task <IList <KnowledgebaseCategory> > GetCategoryBreadCrumb(this KnowledgebaseCategory category,
                                                                                        IKnowledgebaseService knowledgebaseService,
                                                                                        IAclService aclService,
                                                                                        IWorkContext workContext,
                                                                                        bool showHidden = false)
        {
            if (category == null)
            {
                throw new ArgumentNullException(nameof(category));
            }

            var result = new List <KnowledgebaseCategory>();

            //used to prevent circular references
            var alreadyProcessedCategoryIds = new List <string>();

            while (category != null &&                                                            //not null
                   (showHidden || category.Published) &&                                          //published
                   (showHidden || aclService.Authorize(category, workContext.CurrentCustomer)) && //ACL
                   (showHidden || aclService.Authorize(category, workContext.CurrentStore.Id)) && //Store acl
                   !alreadyProcessedCategoryIds.Contains(category.Id))                            //prevent circular references
            {
                result.Add(category);

                alreadyProcessedCategoryIds.Add(category.Id);

                category = await knowledgebaseService.GetKnowledgebaseCategory(category.ParentCategoryId);
            }

            result.Reverse();
            return(result);
        }
示例#26
0
        public KnowledgebaseCategoryModelValidator(ILocalizationService localizationService, IKnowledgebaseService knowledgebaseService)
        {
            RuleFor(x => x.Name).NotEmpty().WithMessage(localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseCategory.Fields.Name.Required"));
            RuleFor(x => x.ParentCategoryId).Must(x =>
            {
                var category = knowledgebaseService.GetKnowledgebaseCategory(x);
                if (category != null || string.IsNullOrEmpty(x))
                {
                    return(true);
                }
                else
                {
                    var categories = knowledgebaseService.GetKnowledgebaseCategories();
                    if (!categories.Any())
                    {
                        return(true);
                    }
                }

                return(false);
            }).WithMessage(localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseCategory.Fields.ParentCategoryId.MustExist"));
        }
示例#27
0
 public KnowledgebaseCategories(IKnowledgebaseService knowledgebaseService, IWorkContext workContext, KnowledgebaseSettings knowledgebaseSettings)
 {
     _knowledgebaseService  = knowledgebaseService;
     _workContext           = workContext;
     _knowledgebaseSettings = knowledgebaseSettings;
 }