Example #1
0
 public VenueController(
     IEntityService entityService,
     IImageProfileManager imageProfileManager)
     : base(entityService, imageProfileManager)
 {
     _entityService = entityService;
 }
Example #2
0
 public EventController(
     IEventService eventService,
     IImageProfileManager imageProfileManager)
 {
     _eventService        = eventService;
     _imageProfileManager = imageProfileManager;
     _validator           = new EventValidator(T);
 }
Example #3
0
 public HostController(
     IEntityService entityService,
     IOrchardServices orchardServices,
     IImageProfileManager imageProfileManager)
     : base(entityService, imageProfileManager)
 {
     _entityService = entityService;
     _authorizer    = orchardServices.Authorizer;
 }
 protected EntityBaseController(
     IEntityService entityService,
     IImageProfileManager imageProfileManager)
 {
     _entityService       = entityService;
     _imageProfileManager = imageProfileManager;
     // ReSharper disable once DoNotCallOverridableMethodsInConstructor
     _validator = new EntityValidator(_entityService, EntityType, T);
 }
Example #5
0
        public static void ResizePicture(IPicture pictureModel, PictureSize?size,
                                         IImageProfileManager imageProfileManager, ILogger logger = null)
        {
            if (pictureModel == null || size == null || size == PictureSize.Full)
            {
                return;
            }

            pictureModel.Picture = GetResizedPicture(pictureModel.Picture, size, imageProfileManager, logger);
        }
Example #6
0
        public static Entity CreateDataContract(
            EntityRecord record,
            string[] fields,
            IStorageProvider storageProvider,
            PictureSize?pictureSize,
            IImageProfileManager imageProfileManager)
        {
            var result = new Entity
            {
                Id = record.Id
            };

            if (fields != null)
            {
                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityType))
                {
                    result.Type = (EntityType)record.Type;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityName))
                {
                    result.Name = record.Name;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityDescription))
                {
                    result.Description = record.Description;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityPicture))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Picture = FileUtil.GetResizedPicture(picture, pictureSize, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityPictures))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Pictures = FileUtil.GetResizedPictures(picture, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityContacts))
                {
                    result.Contacts = record.ContactRecords.Select(CreateDataContract).ToArray();
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EntityAddresses))
                {
                    result.Addresses = record.AddressRecords.Select(CreateDataContract).ToArray();
                }
            }

            return(result);
        }
Example #7
0
        public static void ResizePictures(IEnumerable <IPicture> pictures, PictureSize?size,
                                          IImageProfileManager imageProfileManager, ILogger logger = null)
        {
            if (pictures == null || size == null || size == PictureSize.Full)
            {
                return;
            }

            foreach (var picture in pictures)
            {
                ResizePicture(picture, size, imageProfileManager, logger);
            }
        }
Example #8
0
        public static Pictures GetResizedPictures(string picture,
                                                  IImageProfileManager imageProfileManager, ILogger logger = null)
        {
            var result = default(Pictures);

            if (picture != null)
            {
                result = new Pictures
                {
                    Small  = GetResizedPicture(picture, PictureSize.Small, imageProfileManager, logger),
                    Medium = GetResizedPicture(picture, PictureSize.Medium, imageProfileManager, logger),
                    Full   = picture
                };
            }

            return(result);
        }
Example #9
0
 public TwitterPostDriver(IImageProfileManager imageProfileManager, IStorageProvider storageProvider, IOrchardServices orchardServices, ITwitterService TwitterService,
                          IProviderConfigurationService providerConfigurationService, ITokenizer tokenizer,
                          IHttpContextAccessor httpContextAccessor, IControllerContextAccessor controllerContextAccessor,
                          ShellSettings shellSettings, IContentManager contentManager)
 {
     _storageProvider           = storageProvider;
     _imageProfileManager       = imageProfileManager;
     _httpContextAccessor       = httpContextAccessor;
     _controllerContextAccessor = controllerContextAccessor;
     _tokenizer       = tokenizer;
     _orchardServices = orchardServices;
     _TwitterService  = TwitterService;
     _providerConfigurationService = providerConfigurationService;
     _shellSettings = shellSettings;
     Logger         = NullLogger.Instance;
     T = NullLocalizer.Instance;
     _contentManager = contentManager;
 }
Example #10
0
        public QueryService(
            IRepository <EventMetadataRecord> eventMetadataRepository,
            ISessionLocator sessionLocator,
            ShellSettings shellSettings,
            IRepository <EntityRecord> entityRepository,
            IRepository <EventEntityDetailRecord> eventEntityDetailRepository,
            IRepository <ShowRecord> showRepository,
            IStorageProvider storageProvider,
            IImageProfileManager imageProfileManager)
        {
            _eventMetadataRepository     = eventMetadataRepository;
            _entityRepository            = entityRepository;
            _eventEntityDetailRepository = eventEntityDetailRepository;
            _showRepository      = showRepository;
            _storageProvider     = storageProvider;
            _imageProfileManager = imageProfileManager;

            _sessionLocator = sessionLocator;

            QueryContext.InstantiateContext(shellSettings);

            _migrations = new QueryMigrations();
        }
Example #11
0
        public static string GetResizedPicture(string picture, PictureSize?size,
                                               IImageProfileManager imageProfileManager, ILogger logger = null)
        {
            if (size == null || size == PictureSize.Full)
            {
                return(picture);
            }

            var result = picture;

            try
            {
                result = imageProfileManager.GetImageProfileUrl(picture, size.ToString());
            }
            catch (Exception e)
            {
                if (logger != null)
                {
                    logger.Debug("Exception '{0}' on attempt to build a thumbnail for '{1}'.", e.Message, picture);
                }
            }

            return(result);
        }
Example #12
0
        public static Show CreateDataContract(
            ShowRecord record,
            string[] fields,
            string[] storages,
            IStorageProvider storageProvider,
            PictureSize?pictureSize,
            IImageProfileManager imageProfileManager)
        {
            var result = new Show
            {
                Id = record.Id
            };

            if (fields != null)
            {
                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowVenue))
                {
                    result.Venue = GetEntityReferences(record.EntityRecord, storages);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowIsReference))
                {
                    result.IsReference = record.IsReference;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowTitle))
                {
                    result.Title = record.Title;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowDescription))
                {
                    result.Description = record.Description;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowStartTime))
                {
                    result.StartTime = record.StartTime;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowEndTime))
                {
                    result.EndTime = record.EndTime;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowPicture))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Picture = FileUtil.GetResizedPicture(picture, pictureSize, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowPictures))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Pictures = FileUtil.GetResizedPictures(picture, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.ShowDetailsUrl))
                {
                    result.DetailsUrl = record.DetailsUrl;
                }
            }

            return(result);
        }
Example #13
0
        public static EventMetadata CreateDataContract(
            EventMetadataRecord record,
            string[] fields,
            string[] storages,
            IStorageProvider storageProvider,
            PictureSize?pictureSize,
            IImageProfileManager imageProfileManager)
        {
            var result = new EventMetadata
            {
                Id = record.Id
            };

            if (fields != null)
            {
                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataHost) &&
                    record.EntityRecord != null)
                {
                    result.Host = GetEntityReferences(record.EntityRecord, storages);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataTitle))
                {
                    result.Title = record.Title;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataDescription))
                {
                    result.Description = record.Description;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataPicture))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Picture = FileUtil.GetResizedPicture(picture, pictureSize, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataPictures))
                {
                    var picture = FileUtil.GetPictureUrl(record.Picture, storageProvider);
                    result.Pictures = FileUtil.GetResizedPictures(picture, imageProfileManager);
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataStartTime))
                {
                    result.StartTime = record.StartTime;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataEndTime))
                {
                    result.EndTime = record.EndTime;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataLatitude))
                {
                    result.Latitude = record.Latitude;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataLongitude))
                {
                    result.Longitude = record.Longitude;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataCombineType))
                {
                    result.CombineType = (CombineType)record.CombineType;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataVenueOrderType))
                {
                    result.VenueOrderType = (VenueOrderType)record.VenueOrderType;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataVenueTitleFormatType))
                {
                    result.VenueTitleFormatType = (VenueTitleFormatType)record.VenueTitleFormatType;
                }

                if (fields.ContainsIgnoreCase(QueryContext.Instance.EventMetadataShows))
                {
                    result.Shows =
                        record.ShowRecords
                        .Where(s => !s.IsDeleted)
                        .Select(mr => new Reference
                    {
                        Id      = mr.Id,
                        Storage = StorageKeys.SmartWalk
                    })
                        .ToArray();
                }
            }

            return(result);
        }
Example #14
0
 //  public MediaTransformController(Work<IImageProfileManager> imageProfileManager, IOrchardServices orchardServices, IHttpContextAccessor httpContextAccessor) {
 public MediaTransformController(IImageProfileManager imageProfileManager, IOrchardServices orchardServices, IHttpContextAccessor httpContextAccessor)
 {
     _imageProfileManager = imageProfileManager;
     _orchardServices     = orchardServices;
     _httpContextAccessor = httpContextAccessor;
 }