public SkinsAdminService(
     IPathService pathService,
     IOptionsMonitor <SkinsOptions> fileLoadingOptions,
     ConfigurationAdminService configurationAdminService,
     DataBaseConnection db) : base(db)
 {
     this.configurationAdminService = configurationAdminService;
     SkinsPath             = pathService.GetPath(PathNames.SkinsDirName);
     PartialSkinsPath      = pathService.GetPath(PathNames.PartialSkinsDirName);
     MaxArchiveSize        = fileLoadingOptions.CurrentValue.MaxArchiveSizeKb * 1024;
     MaxExtractArchiveSize = fileLoadingOptions.CurrentValue.MaxExtractArchiveSizeKb * 1024;
     WwwRootPath           = pathService.WwwRootDir;
 }
Exemple #2
0
        public PipelineExecutionResult Execute(InitializeArgs subject)
        {
            //Find the virtual path to the Ucommerce root folder   
            string webpathToUCommerceRoot = _pathService.GetPath();

            //Map to the physical path
            string physicalPathToUCommerce = HostingEnvironment.MapPath(webpathToUCommerceRoot);

            //Join the sub folder where our migration scripts are located
            string pathToApp = Path.Combine(physicalPathToUCommerce, @"Apps\Ka-ching\Database");

            //Use MigrationLoader to get the migrations
            IList <UCommerce.Installer.Migration> migrations = new UCommerce.Installer.MigrationLoader().GetDatabaseMigrations(new DirectoryInfo(pathToApp));

            //Create a new instance of the database installer
            var appsDatabaseInstaller = new UCommerce.Installer.AppsDatabaseInstaller(
                _connectionStringLocator,
                migrations,
                new InstallerLoggingServiceAdapter(_loggingService)
                );

            //Run the actual migration scripts
            appsDatabaseInstaller.InstallDatabase();

            return(PipelineExecutionResult.Success);
        }
 public ImageCleanerAdminService(
     DataBaseConnection dataBaseConnection,
     IPathService pathService)
 {
     this.dataBaseConnection = dataBaseConnection;
     uploadDirectory         = pathService.GetPath(PathNames.UploadImagesDirName);
     htmlParser = new HtmlParser();
 }
Exemple #4
0
        public void CheckOrCreateUploadImages()
        {
            var uploadImagesPath = pathService.GetPath(PathNames.UploadImagesDirName);

            if (!Directory.Exists(uploadImagesPath))
            {
                Directory.CreateDirectory(uploadImagesPath);
            }
        }
 public ImagesService(
     IOptionsMonitor <ImagesOptions> imagesOptions,
     IPathService pathService,
     IImagesNamesService imagesNamesService)
 {
     this.imagesOptions      = imagesOptions;
     this.imagesNamesService = imagesNamesService;
     UploadImagesDir         = pathService.GetPath(PathNames.UploadImagesDirName);
 }
        public AlbumDetails UpdateAlbumDetails(string hash, AlbumDetails details)
        {
            var path = _pathService.GetPath(hash);

            if (path == null)
            {
                throw new HashNotFoundException();
            }
            return(Album.UpdateDetails(path, details));
        }
 public MailTemplatesCache(IPathService pathService, IOptionsMonitor <GlobalOptions> globalOptions)
 {
     MailTemplatesDir = pathService.GetPath(PathNames.MailTemplatesDirName);
     if (!Directory.Exists(MailTemplatesDir))
     {
         Directory.CreateDirectory(MailTemplatesDir);
     }
     SiteName = globalOptions.CurrentValue.SiteName;
     Initialize();
 }
Exemple #8
0
        public CaptchaService(
            IPathService pathService,
            CaptchaCacheService captchaCacheService)
        {
            this.captchaCacheService = captchaCacheService;
            // Init Font (font name: Gunny Rewritten)
            FontCollection fontCollection = new FontCollection();
            var            resourcesDir   = pathService.GetPath(PathNames.ResourcesDirName);

            fontCollection.Install(Path.Combine(resourcesDir, "gunnyrewritten.ttf"));
            font = fontCollection.Families.First().CreateFont(46);
        }
Exemple #9
0
        private void SeedRoles()
        {
            Console.WriteLine("Roles");

            string pathToUserGroupsConfig = Path.Combine(configInitDir, SeederPathsNames.RolesJsonFile);
            string resourcesPath          = pathService.GetPath(PathNames.ResourcesDirName);
            string pathToUserGroupsSchema = Path.Combine(resourcesPath, SeederPathsNames.RolesSchemaJsonFile);

            JsonSchema schema = JsonSchema.FromFileAsync(pathToUserGroupsSchema).GetAwaiter().GetResult();

            RolesFromJsonLoader fromJsonLoader =
                new RolesFromJsonLoader(dataContainer.Categories.ToDictionary(x => x.Name),
                                        dataContainer.OperationKeys.ToDictionary(x => x.Name), schema);

            var json = File.ReadAllText(pathToUserGroupsConfig);

            fromJsonLoader.Seed(json);

            dataContainer.Roles                     = fromJsonLoader.roles;
            dataContainer.CategoryAccesses          = fromJsonLoader.categoryAccesses;
            dataContainer.CategoryOperationAccesses = fromJsonLoader.categoryOperationAccesses;
        }
Exemple #10
0
        public ImageButton CreateClientSideButton()
        {
            var clientSideButton = new ImageButton();

            clientSideButton.ImageUrl         = string.Format("{0}/Apps/SampleApp/Media/uCommerce-logo-symbol-small.png", _pathService.GetPath());
            clientSideButton.CausesValidation = false;

            //The client side command which executes on right click.
            var translatedConfirmText = _resourceManager.GetLocalizedText("SampleApp", "confirmClientSideButton");

            clientSideButton.Attributes.Add("onclick", "if (confirm('" + translatedConfirmText + "')) { window.location.replace('/'); } return false;");

            return(clientSideButton);
        }
 public string GetPath()
 {
     return(_pathService.GetPath());
 }