Ejemplo n.º 1
0
        private void DeleteExistedMailTemplates()
        {
            var mailTemplateFolderXpath = XPathHelper.GetXpath(
                _documentTypeAliasProvider.GetDataFolder(),
                _documentTypeAliasProvider.GetMailTemplateFolder());

            var publishedContent = _umbracoHelper.TypedContentSingleAtXPath(mailTemplateFolderXpath);

            if (publishedContent == null)
            {
                return;
            }

            bool IsForRemove(IPublishedContent content)
            {
                var templateType = content.GetPropertyValue <NotificationTypeEnum>(UmbracoContentMigrationConstants.MailTemplate.EmailTypePropName);

                return(templateType.In(NotificationTypeEnum.CommentLikeAdded, NotificationTypeEnum.MonthlyMail));
            }

            var publishedContentToRemove = publishedContent.Children.Where(IsForRemove);
            var contentToRemove          = _contentService.GetByIds(publishedContentToRemove.Select(c => c.Id)).ToList();

            contentToRemove.ForEach(c => _contentService.Delete(c));
        }
        public ExecutionResult Execute()
        {
            var mailTemplateXpath = XPathHelper.GetXpath(
                _documentTypeAliasProvider.GetDataFolder(),
                _documentTypeAliasProvider.GetMailTemplateFolder(),
                _documentTypeAliasProvider.GetMailTemplate());

            var templates = _umbracoHelper.TypedContentAtXPath(mailTemplateXpath);

            var mailTemplateFolderXpath = XPathHelper.GetXpath(_documentTypeAliasProvider.GetDataFolder(), _documentTypeAliasProvider.GetMailTemplateFolder());

            if (!templates.Any())
            {
                var folder = _umbracoHelper.TypedContentSingleAtXPath(mailTemplateFolderXpath);
                if (folder != null)
                {
                    var folderContent = _contentService.GetById(folder.Id);
                    _contentService.Delete(folderContent);
                }
            }

            return(ExecutionResult.Success);
        }
        public NavigationController(
            ILeftSideNavigationModelBuilder leftSideNavigationModelBuilder,
            ISubNavigationModelBuilder subNavigationModelBuilder,
            ITopNavigationModelBuilder topNavigationModelBuilder,
            ICentralFeedContentService centralFeedContentService,
            ISystemLinksModelBuilder systemLinksModelBuilder,
            IDocumentTypeAliasProvider documentTypeAliasProvider,
            IGroupService groupService,
            IGroupFeedContentService groupFeedContentService,
            IIntranetUserService <IntranetUser> intranetUserService,
            IGroupLinkProvider groupLinkProvider,
            IGroupContentProvider groupContentProvider,
            IGroupHelper groupHelper,
            ICentralFeedHelper centralFeedHelper,
            IProfileLinkProvider profileLinkProvider,
            IPermissionsService permissionsService,
            IUserService userService,
            IGroupContentProvider contentProvider)
            : base(
                leftSideNavigationModelBuilder,
                subNavigationModelBuilder,
                topNavigationModelBuilder,
                systemLinksModelBuilder,
                intranetUserService,
                profileLinkProvider,
                permissionsService,
                userService)
        {
            _documentTypeAliasProvider = documentTypeAliasProvider;
            _groupService              = groupService;
            _groupFeedContentService   = groupFeedContentService;
            _intranetUserService       = intranetUserService;
            _groupLinkProvider         = groupLinkProvider;
            _groupContentProvider      = groupContentProvider;
            _subNavigationModelBuilder = subNavigationModelBuilder;
            _groupHelper       = groupHelper;
            _centralFeedHelper = centralFeedHelper;

            SystemLinksContentXPath = $"root/{_documentTypeAliasProvider.GetDataFolder()}[@isDoc]/{_documentTypeAliasProvider.GetSystemLinkFolder()}[@isDoc]/{_documentTypeAliasProvider.GetSystemLink()}[@isDoc]";
        }
        private IEnumerable <IPublishedContent> GetMailTemplates()
        {
            var mailTemplateXpath = XPathHelper.GetXpath(_documentTypeAliasProvider.GetDataFolder(), _documentTypeAliasProvider.GetMailTemplateFolder(), _documentTypeAliasProvider.GetMailTemplate());

            return(_umbracoHelper.TypedContentAtXPath(mailTemplateXpath));
        }