/// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service, bool publishedOnly)
     : base(obj)
 {
     Content = content;
     Service = service;
     PublishedOnly = publishedOnly;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service, bool publishedOnly)
     : base(obj)
 {
     Content       = content;
     Service       = service;
     PublishedOnly = publishedOnly;
 }
Beispiel #3
0
 public StartPageViewModelFactory(IUmbracoMapper umbracoMapper, IUmbracoService umbracoService,
                                  IBlogPostService blogPostService, IUmbracoHelper umbracoHelper) : base(umbracoMapper, umbracoHelper)
 {
     _umbracoMapper   = umbracoMapper;
     _umbracoService  = umbracoService;
     _blogPostService = blogPostService;
 }
        public void UmbracoUserControlTestSetup()
        {
            passWordResetModel    = new PasswordResetModel();
            passWordResetModelOut = new PasswordResetModel();

            umbracoUserModel        = new UmbracoUserModel();
            umbracoUserModelListOut = new List <UmbracoUserModel>();

            findUserModel = new FindUserModel();

            contentTreeViewModel        = new ContentTreeViewModel();
            contentTreeViewModelListOut = new List <ContentTreeViewModel>();

            permissionsModel         = new PermissionsModel();
            permissionsModelsListOut = new List <PermissionsModel>();

            mockPermissionsControlService = new Mock <IPermissionsControlService>().Object;
            mockEmailService = new Mock <IEmailService>().Object;

            var userControlServiceMock = new Mock <IUserControlService>();

            userControlServiceMock.Setup(x => x.LookupUserById(2))
            .Returns(contentTreeViewModel);

            mockUserControlService = userControlServiceMock.Object;

            var umbracoServiceMock = new Mock <IUmbracoService>();

            umbracoServiceMock.Setup(x => x.GetAllUsersByEmail("Email"))
            .Returns(umbracoUserModelListOut);
            umbracoServiceMock.Setup(x => x.GetAllUsersByUsername("Username"))
            .Returns(umbracoUserModelListOut);
            umbracoServiceMock.Setup(x => x.GetContentRoot())
            .Returns(contentTreeViewModelListOut);
            umbracoServiceMock.Setup(x => x.GetContentChild(1))
            .Returns(contentTreeViewModelListOut);
            umbracoServiceMock.Setup(x => x.SetContentPermissions(permissionsModel))
            .Returns(true);

            mockUmbracoService = umbracoServiceMock.Object;

            var databaseServiceMock = new Mock <IDatabaseService>();

            databaseServiceMock.Setup(x => x.GetResetDetails(passWordResetModel))
            .Returns(passWordResetModelOut);
            //databaseServiceMock.Setup(x => x.CheckUserPermissions(1))
            //    .Returns(permissionsModelsListOut);

            mockDatabaseService = databaseServiceMock.Object;

            timelimit = DateTime.Now;

            //umbracoService = new UmbracoService();
            //databaseService = new DatabaseService();
            //emailService = new EmailService(mockDatabaseService);
            //userControlService = new UserControlService(mockDatabaseService, mockUmbracoService, mockEmailService);
            //permissionsControlService = new PermissionsControlService(mockDatabaseService, mockUmbracoService, mockUserControlService);
        }
Beispiel #5
0
        private HttpResponseMessage GetExpiringNodesByUser()
        {
            GetConfigSettings();

            _umbracoService = new UmbracoService();
            _emailService   = new EmailService();

            var users = _umbracoService.GetExpiringPagesByUser(_noOfDaysFrom);

            // For each user:
            foreach (var user in users)
            {
                if (user.Pages.Any())
                {
                    try
                    {
                        SendEmail(user);
                    }
                    catch (Exception ex)
                    {
                        new Exception(ex.ToString()).ToExceptionless().Submit();
                    }
                }
            }

            // Check for pages expiring soon and email Web Staff
            var warningList = new List <UserPageModel>();
            var soonDate    = DateTime.Now.AddDays(_emailWebStaffAtDays + 1);

            var expiringSoon = users.Where(u => u.Pages.Any(p => p.ExpiryDate <= soonDate));

            foreach (var expiring in expiringSoon)
            {
                // Add the specific pages that will expire soon ... not all of them!
                foreach (var expiringPage in expiring.Pages.Where(p => p.ExpiryDate <= soonDate))
                {
                    // Check we haven't already added this page to the list
                    if (warningList.All(n => n.PageId != expiringPage.PageId))
                    {
                        warningList.Add(expiringPage);
                    }
                }
            }

            if (warningList.Any())
            {
                SendWarningEmail(warningList.OrderBy(o => o.ExpiryDate).ToList());
            }
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LazyContentEnumerable{T}"/> class.
        /// </summary>
        /// <param name="getItems">The get items.</param>
        /// <param name="isLazy">if set to <c>true</c> [is lazy].</param>
        /// <param name="inferType">if set to <c>true</c> [infer type].</param>
        /// <param name="service">The service.</param>
        public LazyContentEnumerable(
            Func <IEnumerable <IContent> > getItems,
            bool isLazy,
            bool inferType,
            IUmbracoService service
            )
        {
            _getItems  = getItems;
            _type      = typeof(T);
            _isLazy    = isLazy;
            _inferType = inferType;
            _service   = service;

            _lazyItemList = new Lazy <IList <T> >(() => ProcessItems().ToList());
        }
 public DictionaryHttpHandler(IUmbracoService umbracoService, IVueI18NConfiguration configuration)
 {
     _umbracoService = umbracoService;
     _configuration  = configuration;
 }
 public IntegrationService(IUmbracoService _umbracoService)
 {
     umbracoService = _umbracoService;
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service)
     : base(obj)
 {
     Content = content;
     Service = service;
 }
Beispiel #10
0
 public RouteController(IUmbracoService umbracoService)
 {
     _umbracoService = umbracoService;
 }
Beispiel #11
0
 /// <summary>
 /// Casts and item to a strongly typed. .
 /// </summary>
 /// <typeparam name="T">Type to return</typeparam>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 /// <param name="isLazy">if set to <c>true</c> [is lazy].</param>
 /// <param name="inferType">if set to <c>true</c> [infer type].</param>
 /// <returns>
 /// A strongly typed class representation of the item
 /// </returns>
 public static T GlassCast <T>(this IContent content, IUmbracoService service, bool isLazy = false, bool inferType = false) where T : class
 {
     return(service.CreateType <T>(content, isLazy, inferType));
 }
Beispiel #12
0
 public ExpiringPagesApiController(IUmbracoService umbracoService, IEmailService emailService)
 {
     _umbracoService = umbracoService;
     _emailService   = emailService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GlassViewPage{T}"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 public GlassViewPage(IUmbracoService service)
 {
     _umbracoService = service;
 }
Beispiel #14
0
 public SiteMapPageController(IUmbracoMapper umbracoMapper, IBaseContentPageViewModelFactory <Features.SiteMapPage.SiteMapPage> viewModelFactory, IUmbracoService umbracoService) : base(umbracoMapper, viewModelFactory)
 {
     _umbracoMapper  = umbracoMapper;
     _umbracoService = umbracoService;
 }
 public UserControlService(IDatabaseService databaseService, IUmbracoService umbracoService, IEmailService emailService)
 {
     _databaseService = databaseService;
     _umbracoService  = umbracoService;
     _emailService    = emailService;
 }
 public InboundLinkCheckerController(IUmbracoService umbracoService)
 {
     _umbracoService = umbracoService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service)
     : base(obj)
 {
     Content = content;
     Service = service;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GlassTemplatePage{T}"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 public GlassTemplatePage(IUmbracoService service)
 {
     _umbracoService = service;
 }
 public PermissionsControlService(IDatabaseService databaseService, IUmbracoService umbracoService, IUserControlService userControlService)
 {
     _databaseService    = databaseService;
     _umbracoService     = umbracoService;
     _userControlService = userControlService;
 }
 public WebEditorsController(IUmbracoService umbracoService)
 {
     _umbracoService = umbracoService;
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GlassTemplatePage{T}"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 public GlassTemplatePage(IUmbracoService service)
 {
     _umbracoService = service;
 }
 public ToolsController(IPermissionsControlService permissionsControlService, IUmbracoService umbracoService)
 {
     _permissionsControlService = permissionsControlService;
     _umbracoService            = umbracoService;
 }
 public ContentController(IUmbracoService umbracoService)
 {
     _umbracoService = umbracoService;
 }
 public ModelsGenerator(IUmbracoService umbracoService, IDictionaryBuilderConfiguration config)
 {
     _umbracoService = umbracoService;
     _config         = config;
 }