/// <summary>
 /// Creates a new instance of the <see cref="DefaultNancyContextFactory"/> class.
 /// </summary>
 /// <param name="cultureService">An <see cref="ICultureService"/> instance.</param>
 /// <param name="requestTraceFactory">An <see cref="IRequestTraceFactory"/> instance.</param>
 /// <param name="textResource">An <see cref="ITextResource"/> instance.</param>
 /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
 public DefaultNancyContextFactory(ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource, INancyEnvironment environment)
 {
     this.cultureService      = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.textResource        = textResource;
     this.environment         = environment;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultNancyContextFactory"/> class.
 /// </summary>
 /// <param name="cultureService">An <see cref="ICultureService"/> instance.</param>
 /// <param name="requestTraceFactory">An <see cref="IRequestTraceFactory"/> instance.</param>
 /// <param name="textResource">An <see cref="ITextResource"/> instance.</param>
 /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
 public DefaultNancyContextFactory(ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource, INancyEnvironment environment)
 {
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.textResource = textResource;
     this.environment = environment;
 }
Пример #3
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();



            UnityServiceLocator serviceLocator  = new UnityServiceLocator(UnityConfig.GetConfiguredContainer());
            ICultureService     cultureService  = serviceLocator.GetInstance <ICultureService>();
            ISettingsService    settingsService = serviceLocator.GetInstance <ISettingsService>();

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);



            RouteConfig.RegisterRoutes(RouteTable.Routes, cultureService);
            BundleConfig.RegisterBundles(BundleTable.Bundles);



            IMigrationRunner migrationRunner = serviceLocator.GetInstance <IMigrationRunner>();

            migrationRunner.Update();
        }
Пример #4
0
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultDiagnostics"/> class.
 /// </summary>
 /// <param name="diagnosticProviders"></param>
 /// <param name="rootPathProvider"></param>
 /// <param name="requestTracing"></param>
 /// <param name="configuration"></param>
 /// <param name="modelBinderLocator"></param>
 /// <param name="responseProcessors"></param>
 /// <param name="routeSegmentConstraints"></param>
 /// <param name="cultureService"></param>
 /// <param name="requestTraceFactory"></param>
 /// <param name="routeMetadataProviders"></param>
 /// <param name="textResource"></param>
 public DefaultDiagnostics(
     IEnumerable <IDiagnosticsProvider> diagnosticProviders,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable <IResponseProcessor> responseProcessors,
     IEnumerable <IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable <IRouteMetadataProvider> routeMetadataProviders,
     ITextResource textResource,
     INancyEnvironment environment)
 {
     this.diagnosticProviders     = diagnosticProviders;
     this.rootPathProvider        = rootPathProvider;
     this.requestTracing          = requestTracing;
     this.configuration           = configuration;
     this.modelBinderLocator      = modelBinderLocator;
     this.responseProcessors      = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService          = cultureService;
     this.requestTraceFactory     = requestTraceFactory;
     this.routeMetadataProviders  = routeMetadataProviders;
     this.textResource            = textResource;
     this.environment             = environment;
 }
        public CustomerViewService(
            IViewModelMapper viewModelMapper,
            ICustomerRepository customerRepository,
            ICultureService cultureService,
            ILocalizationProvider localizationProvider)
        {
            if (viewModelMapper == null)
            {
                throw new ArgumentNullException("viewModelMapper");
            }
            if (customerRepository == null)
            {
                throw new ArgumentNullException("customerRepository");
            }
            if (cultureService == null)
            {
                throw new ArgumentNullException("cultureService");
            }
            if (localizationProvider == null)
            {
                throw new ArgumentNullException("localizationProvider");
            }

            ViewModelMapper      = viewModelMapper;
            CustomerRepository   = customerRepository;
            CultureService       = cultureService;
            LocalizationProvider = localizationProvider;
        }
Пример #6
0
 public FakeDiagnostics(
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable <IResponseProcessor> responseProcessors,
     IEnumerable <IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable <IRouteMetadataProvider> routeMetadataProviders,
     ITextResource textResource,
     INancyEnvironment environment,
     ITypeCatalog typeCatalog)
 {
     this.diagnosticProviders     = (new IDiagnosticsProvider[] { new FakeDiagnosticsProvider() }).ToArray();
     this.rootPathProvider        = rootPathProvider;
     this.requestTracing          = requestTracing;
     this.configuration           = configuration;
     this.modelBinderLocator      = modelBinderLocator;
     this.responseProcessors      = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService          = cultureService;
     this.requestTraceFactory     = requestTraceFactory;
     this.routeMetadataProviders  = routeMetadataProviders;
     this.textResource            = textResource;
     this.environment             = environment;
     this.typeCatalog             = typeCatalog;
 }
Пример #7
0
        public CultureAlternatesFactory(ICultureService cultureService, IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            _cultureService      = cultureService;
            _HomePageAlternates  = new Lazy <string>(() => {
                var httpContext = _httpContextAccessor.Current();

                if (httpContext == null)
                {
                    return(null);
                }

                var request = httpContext.Request;

                if (request == null)
                {
                    return(null);
                }
                string culture = _cultureService.GetCurrentCulture();
                // extract each segment of the url
                var urlSegments = VirtualPathUtility.ToAppRelative(request.Path.ToLower())
                                  .Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Skip(1) // ignore the heading ~ segment
                                  .ToArray();
                int cnt = urlSegments.Count();
                if (cnt == 0 || ((cnt == 1) && string.Equals(urlSegments[0], culture, StringComparison.InvariantCultureIgnoreCase)))
                {
                    return("__CultureHomepage");
                }

                return(null);
            });
        }
 public PactAwareContextFactory(IMockContextService mockContextService, ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource)
 {
     _mockContextService = mockContextService;
     _cultureService = cultureService;
     _requestTraceFactory = requestTraceFactory;
     _textResource = textResource;
 }
Пример #9
0
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultDiagnostics"/> class.
 /// </summary>
 /// <param name="diagnosticProviders"></param>
 /// <param name="rootPathProvider"></param>
 /// <param name="requestTracing"></param>
 /// <param name="configuration"></param>
 /// <param name="modelBinderLocator"></param>
 /// <param name="responseProcessors"></param>
 /// <param name="routeSegmentConstraints"></param>
 /// <param name="cultureService"></param>
 /// <param name="requestTraceFactory"></param>
 /// <param name="routeMetadataProviders"></param>
 /// <param name="textResource"></param>
 /// <param name="environment"></param>
 /// <param name="typeCatalog"></param>
 public DefaultDiagnostics(
     IEnumerable<IDiagnosticsProvider> diagnosticProviders,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable<IRouteMetadataProvider> routeMetadataProviders,
     ITextResource textResource,
     INancyEnvironment environment,
     ITypeCatalog typeCatalog)
 {
     this.diagnosticProviders = diagnosticProviders;
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.routeMetadataProviders = routeMetadataProviders;
     this.textResource = textResource;
     this.environment = environment;
     this.typeCatalog = typeCatalog;
 }
Пример #10
0
 public PactAwareContextFactory(IMockContextService mockContextService, ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource)
 {
     _mockContextService  = mockContextService;
     _cultureService      = cultureService;
     _requestTraceFactory = requestTraceFactory;
     _textResource        = textResource;
 }
Пример #11
0
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultDiagnostics"/> class.
 /// </summary>
 /// <param name="diagnosticsConfiguration"></param>
 /// <param name="diagnosticProviders"></param>
 /// <param name="rootPathProvider"></param>
 /// <param name="requestTracing"></param>
 /// <param name="configuration"></param>
 /// <param name="modelBinderLocator"></param>
 /// <param name="responseProcessors"></param>
 /// <param name="routeSegmentConstraints"></param>
 /// <param name="cultureService"></param>
 /// <param name="requestTraceFactory"></param>
 public DefaultDiagnostics(
     DiagnosticsConfiguration diagnosticsConfiguration,
     IEnumerable<IDiagnosticsProvider> diagnosticProviders,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable<IRouteMetadataProvider> routeMetadataProviders)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders = diagnosticProviders;
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.routeMetadataProviders = routeMetadataProviders;
 }
Пример #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="authenticationService">The <see cref="AuthenticationService"/></param>
 /// <param name="pluginsService">The <see cref="Core.Services.PluginsService"/></param>
 /// <param name="cultureService">The <see cref="Core.Services.CultureService"/></param>
 /// <param name="formsAuthentication">The <see cref="FormsAuthentication"/> wrapper</param>
 public LoginController(IAuthenticationService authenticationService, IPluginsService pluginsService, ICultureService cultureService, IFormsAuthentication formsAuthentication)
 {
     this.authenticationService = authenticationService;
     this.pluginsService = pluginsService;
     this.cultureService = cultureService;
     this.formsAuthentication = formsAuthentication;
 }
 public FakeDiagnostics(
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable<IRouteMetadataProvider> routeMetadataProviders,
     ITextResource textResource,
     INancyEnvironment environment,
     IRuntimeEnvironmentInformation runtimeEnvironmentInformation)
 {
     this.diagnosticProviders = (new IDiagnosticsProvider[] { new FakeDiagnosticsProvider() }).ToArray();
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.routeMetadataProviders = routeMetadataProviders;
     this.textResource = textResource;
     this.environment = environment;
     this.runtimeEnvironmentInformation = runtimeEnvironmentInformation;
 }
        public CategoryPageService(
            ICategoryRepository categoryRepository,
            IScopeProvider scopeProvider,
            ILocalizationProvider localizationProvider,
            ICultureService cultureService)
        {
            if (categoryRepository == null)
            {
                throw new ArgumentNullException("categoryRepository");
            }
            if (scopeProvider == null)
            {
                throw new ArgumentNullException("scopeProvider");
            }
            if (localizationProvider == null)
            {
                throw new ArgumentNullException("localizationProvider");
            }
            if (cultureService == null)
            {
                throw new ArgumentNullException("cultureService");
            }

            ScopeProvider        = scopeProvider;
            LocalizationProvider = localizationProvider;
            CategoryRepository   = categoryRepository;
            CultureService       = cultureService;

            RootPageId = (Guid)CategoriesConfiguration.CategoriesSyncConfiguration["RootPageId"];
        }
Пример #15
0
 public HomeController(
     ICultureService cultureService,
     IObjectSetFactory objectSetFactory)
 {
     _cultureService   = cultureService;
     _objectSetFactory = objectSetFactory;
 }
Пример #16
0
 public TextService(ApplicationDbContext context,
                    IDbLogService dbLogService,
                    IPrincipal principal,
                    ICultureService cultureService) : base(context, dbLogService, principal)
 {
     _cultureService = cultureService;
 }
Пример #17
0
        public static void Enable(DiagnosticsConfiguration diagnosticsConfiguration, IPipelines pipelines, IEnumerable<IDiagnosticsProvider> providers, IRootPathProvider rootPathProvider, IEnumerable<ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
        {
            var keyGenerator = new DefaultModuleKeyGenerator();
            var diagnosticsModuleCatalog = new DiagnosticsModuleCatalog(keyGenerator, providers, rootPathProvider, requestTracing, configuration, diagnosticsConfiguration);

            var diagnosticsRouteCache = new RouteCache(diagnosticsModuleCatalog, keyGenerator, new DefaultNancyContextFactory(cultureService), new DefaultRouteSegmentExtractor(), new DefaultRouteDescriptionProvider(), cultureService);

            var diagnosticsRouteResolver = new DefaultRouteResolver(
                diagnosticsModuleCatalog,
                new DefaultRoutePatternMatcher(),
                new DiagnosticsModuleBuilder(rootPathProvider, serializers, modelBinderLocator),
                diagnosticsRouteCache,
                responseProcessors);

            var serializer = new DefaultObjectSerializer();

            pipelines.BeforeRequest.AddItemToStartOfPipeline(
                new PipelineItem<Func<NancyContext, Response>>(
                    PipelineKey,
                    ctx =>
                    {
                        if (!ctx.ControlPanelEnabled)
                        {
                            return null;
                        }

                        if (!ctx.Request.Path.StartsWith(diagnosticsConfiguration.Path, StringComparison.OrdinalIgnoreCase))
                        {
                            return null;
                        }

                        ctx.Items[ItemsKey] = true;

                        var resourcePrefix =
                            string.Concat(diagnosticsConfiguration.Path, "/Resources/");

                        if (ctx.Request.Path.StartsWith(resourcePrefix, StringComparison.OrdinalIgnoreCase))
                        {
                            var resourceNamespace = "Nancy.Diagnostics.Resources";

                            var path = Path.GetDirectoryName(ctx.Request.Url.Path.Replace(resourcePrefix, string.Empty)) ?? string.Empty;
                            if (!string.IsNullOrEmpty(path))
                            {
                                resourceNamespace += string.Format(".{0}", path.Replace('\\', '.'));
                            }

                            return new EmbeddedFileResponse(
                                typeof(DiagnosticsHook).Assembly,
                                resourceNamespace,
                                Path.GetFileName(ctx.Request.Url.Path));
                        }

                        RewriteDiagnosticsUrl(diagnosticsConfiguration, ctx);

                        return diagnosticsConfiguration.Valid
                                   ? ExecuteDiagnostics(ctx, diagnosticsRouteResolver, diagnosticsConfiguration, serializer)
                                   : GetDiagnosticsHelpView(ctx);
                    }));
        }
 public AdminTranslationTextController(ICountryService countryService, ICultureService cultureService, IRepository<CultureRecord> cultureRepository, IWorkContextAccessor wca, IOrchardServices services)
 {
     _countryService = countryService;
     _cultureService = cultureService;
     _cultureRepository = cultureRepository;
     _wca = wca;
     Services = services;
 }
Пример #19
0
 public AdminTranslationTextController(ICountryService countryService, ICultureService cultureService, IRepository <CultureRecord> cultureRepository, IWorkContextAccessor wca, IOrchardServices services)
 {
     _countryService    = countryService;
     _cultureService    = cultureService;
     _cultureRepository = cultureRepository;
     _wca     = wca;
     Services = services;
 }
Пример #20
0
 public BusinessDependencies(ISiteContextService siteContextService, ICompanyRepository companyRepository, ISocialLinkRepository socialLinkRepository, ICultureService cultureService, IMenuRepository menuRepository)
 {
     SiteContextService   = siteContextService;
     CompanyRepository    = companyRepository;
     SocialLinkRepository = socialLinkRepository;
     CultureService       = cultureService;
     MenuRepository       = menuRepository;
 }
Пример #21
0
 public LookupsController(UserManager <AppUser> userManager,
                          ICultureService cultureService,
                          ICategoryService categoryService)
 {
     _userManager     = userManager;
     _cultureService  = cultureService;
     _categoryService = categoryService;
 }
Пример #22
0
 public MenuCulturePickerDriver(ICultureService cultureService
                                //, IBrowserCultureService browserCultureService
                                , ICookieCultureService cookieCultureService)
 {
     _cultureService = cultureService;
     //_browserCultureService  = browserCultureService;
     _cookieCultureService = cookieCultureService;
 }
 public AdminLocalizationControllerService(
     ICultureService cultureService,
     ILocalizationService localizationService
     )
 {
     _cultureService      = cultureService;
     _localizationService = localizationService;
 }
Пример #24
0
        public LanguageSwitchViewService(ICultureService cultureService)
        {
            if (cultureService == null)
            {
                throw new ArgumentNullException("cultureService");
            }

            CultureService = cultureService;
        }
 public CultureApiController(ICultureService service)
 {
     _cultures = new Collection<KeyValuePair<string, string>>();
     _cultures.Add(new KeyValuePair<string, string>("de-DE", "German"));
     _cultures.Add(new KeyValuePair<string, string>("en-GB", "English GB"));
     _cultures.Add(new KeyValuePair<string, string>("en-US", "English US"));
     _cultures.Add(new KeyValuePair<string, string>("fr-FR", "French"));
     _service = service;
 }
Пример #26
0
        public void AddEnglishCultureServiceMock()
        {
            var mock = new Mock <ICultureService>(MockBehavior.Loose);

            mock.Setup(x => x.GetCurrentLanguage()).Returns(Language.En);
            ICultureService cultureService = mock.Object;

            _dependencyMap[typeof(ICultureService)] = cultureService;
        }
 public ServicesViewModel(IAssemblyService assemblyService, ICultureService cultureService, IAsciiConverterService converter)
 {
     Items = new ObservableCollection <IMyService>(new List <IMyService>
     {
         //assemblyService,
         //cultureService,
         converter,
     });
 }
Пример #28
0
 public CultureViewModel(ICultureService service)
 {
     _service       = service;
     OnCultureClick = new DelegateCommand(OnCultureClick_Execute);
     _Cultures      = new List <CultureInfo>()
     {
         new CultureInfo("de-DE"),
         new CultureInfo("en-US")
     };
 }
Пример #29
0
 public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable <IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable <IResponseProcessor> responseProcessors, ICultureService cultureService)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders      = diagnosticProviders;
     this.rootPathProvider         = rootPathProvider;
     this.requestTracing           = requestTracing;
     this.configuration            = configuration;
     this.modelBinderLocator       = modelBinderLocator;
     this.responseProcessors       = responseProcessors;
     this.cultureService           = cultureService;
 }
Пример #30
0
 public LocalizationPartDriver(ICultureService cultureService
                               , ICultureManager cultureManager,
                               ILocalizationService localizationService,
                               IContentManager contentManager)
 {
     _cultureService      = cultureService;
     _cultureManager      = cultureManager;
     _localizationService = localizationService;
     _contentManager      = contentManager;
     _orgDriver           = new Orchard.Localization.Drivers.LocalizationPartDriver(cultureManager, localizationService, contentManager);
 }
Пример #31
0
 public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable<IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders = diagnosticProviders;
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.cultureService = cultureService;
 }
Пример #32
0
 public CountryService(
     IRepository<CountryRecord> countryRepository,
     IRepository<LinkCountryCultureRecord> linkCountryCultureRecord,
     ICultureService cultureService,
     IRepository<LinkCountryCurrencyRecord> linkCountryCurrencyRecord)
 {
     _countryRepository = countryRepository;
     _linkCountryCultureRecord = linkCountryCultureRecord;
     _cultureService = cultureService;
     _linkCountryCurrencyRecord = linkCountryCurrencyRecord;
 }
 public CustomerViewService(
     IViewModelMapper viewModelMapper,
     ICustomerRepository customerRepository,
     ICultureService cultureService,
     ILocalizationProvider localizationProvider)
 {
     ViewModelMapper      = viewModelMapper ?? throw new ArgumentNullException(nameof(viewModelMapper));
     CustomerRepository   = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository));
     CultureService       = cultureService ?? throw new ArgumentNullException(nameof(cultureService));
     LocalizationProvider = localizationProvider ?? throw new ArgumentNullException(nameof(localizationProvider));
 }
Пример #34
0
 public CookieCulturePickerDriver(IOrchardServices orchardServices
                                  , ICultureService cultureService
                                  , IHomePageService homePageService
                                  , IBrowserCultureService browserCultureService
                                  , ICookieCultureService cookieCultureService)
 {
     _orchardServices       = orchardServices;
     _cultureService        = cultureService;
     _homePageService       = homePageService;
     _browserCultureService = browserCultureService;
     _cookieCultureService  = cookieCultureService;
 }
        public ECommerceModule(ICommerceService commerceService, ICatalogueViewService catatalogueService, ICommerceDao dao, IExtCommonDao commonDao, IBasketRules rules, ICatalogueModificationService editService, IAccountService accountService, IOrderService orderService, IEmailSender emailSender, IDeliveryService deliveryService, ICultureService cultureService, IUserService userService)
            : base(catatalogueService, commerceService, editService, accountService, orderService, emailSender, deliveryService, cultureService, userService) {

            _dao = dao;
            _commonDao = commonDao;
            _rules = rules; 
            
            //we now get payment providers from the DB to make it more user friendly
            //PaymentProviders = CommerceService.GetEnabledPaymentProviders();
           

        }
 public HomeController(
     IApplicationSettings applicationSettings,
     ICultureService cultureService,
     IServiceBus serviceBus,
     ITranslationService translationService
 )
 {
     _applicationSettings = applicationSettings;
     _cultureService = cultureService;
     _serviceBus = serviceBus;
     _translationService = translationService;
 }
 public AbstractCultureController(
     ApiSettings settings,
     ILogger <AbstractCultureController> logger,
     ITransactionCoordinator transactionCoordinator,
     ICultureService cultureService,
     IApiCultureModelMapper cultureModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.CultureService     = cultureService;
     this.CultureModelMapper = cultureModelMapper;
 }
 public FakeDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable <IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IEnumerable <ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable <IResponseProcessor> responseProcessors, ICultureService cultureService)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders      = (new IDiagnosticsProvider[] { new FakeDiagnosticsProvider() }).ToArray();
     this.rootPathProvider         = rootPathProvider;
     this.serializers        = serializers;
     this.requestTracing     = requestTracing;
     this.configuration      = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.cultureService     = cultureService;
 }
 public CatalogueViewModule(ICatalogueViewService catatalogueService, ICommerceService commerceService, ICatalogueModificationService editService, IAccountService accountService, IOrderService orderService, IEmailSender emailSender, IDeliveryService deliveryService, ICultureService cultureService, IUserService userService) {
     _catalogueService = catatalogueService;
     _commerceService = commerceService;
     _editService = editService;
     _accountService = accountService;
     _orderService = orderService;
     _emailSender = emailSender;
     _deliveryService = deliveryService;
     _cultureService = cultureService;
     _userService = userService;
     ParsePathInfo();
 }
Пример #40
0
 public HomeController(
     IApplicationSettings applicationSettings,
     ICultureService cultureService,
     IServiceBus serviceBus,
     ITranslationService translationService
     )
 {
     _applicationSettings = applicationSettings;
     _cultureService      = cultureService;
     _serviceBus          = serviceBus;
     _translationService  = translationService;
 }
Пример #41
0
 public CountryService(
     IRepository <CountryRecord> countryRepository,
     IRepository <LinkCountryCultureRecord> linkCountryCultureRecord,
     ICultureService cultureService,
     IRepository <LinkCountryCurrencyRecord> linkCountryCurrencyRecord,
     IRepository <CurrencyRecord> currencyRecord)
 {
     _countryRepository         = countryRepository;
     _linkCountryCultureRecord  = linkCountryCultureRecord;
     _cultureService            = cultureService;
     _linkCountryCurrencyRecord = linkCountryCurrencyRecord;
     _currencyRecord            = currencyRecord;
 }
Пример #42
0
        public CategoryPageService(
            ICategoryRepository categoryRepository,
            IScopeProvider scopeProvider,
            ILocalizationProvider localizationProvider,
            ICultureService cultureService)
        {
            ScopeProvider        = scopeProvider ?? throw new ArgumentNullException(nameof(scopeProvider));
            LocalizationProvider = localizationProvider ?? throw new ArgumentNullException(nameof(localizationProvider));
            CategoryRepository   = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
            CultureService       = cultureService ?? throw new ArgumentNullException(nameof(cultureService));

            RootPageId = (Guid)CategoriesConfiguration.CategoriesSyncConfiguration["RootPageId"];
        }
        public override void SetUp()
        {
            base.SetUp();

            authenticationService = mockery.DynamicMock<IAuthenticationService>();
            pluginsService = mockery.DynamicMock<IPluginsService>();
            formsAuthentication = mockery.Stub<IFormsAuthentication>();
            cultureService = mockery.DynamicMock<ICultureService>();
            controller = new LoginController(authenticationService, pluginsService, cultureService, formsAuthentication);

            ConfigurationManager.AppSettings["plugins.path"] = PLUGINPATH;

            PrepareController(controller);
        }
Пример #44
0
 public BusinessDependencies(
     ICultureService cultureService,
     ISiteContextService siteContextService,
     //ICacheService cacheDependencyService,
     IErrorHelperService errorHelperService,
     ILocalizationService localizationService
     )
 {
     CultureService     = cultureService;
     SiteContextService = siteContextService;
     //CacheService = cacheDependencyService;
     ErrorHelperService  = errorHelperService;
     LocalizationService = localizationService;
 }
Пример #45
0
        public async Task InvokeAsync(HttpContext context, ICultureService cultureService)
        {
            var currentCulture = cultureService.GetCurrentCulture();

            if (!string.IsNullOrWhiteSpace(currentCulture))
            {
                var langCulture = new CultureInfo(currentCulture);
                var culture     = CultureInfo.CreateSpecificCulture(langCulture.Name);
                culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
                CultureInfo.CurrentCulture   = culture;
                CultureInfo.CurrentUICulture = culture;
            }
            await _next(context);
        }
 public LocalizedHomeController(IOrchardServices orchardServices, ICultureService cultureService, IWorkContextAccessor workContextAccessor)
 {
     _cultureService = cultureService;
     _orchardServices = orchardServices;
     _workContextAccessor = workContextAccessor;
 }
 public CookieCultureController(ICookieCultureService cookieCultureService, ICultureService cultureService)
 {
     _cookieCultureService = cookieCultureService;
     _cultureService = cultureService;
 }
 public AdminMenu(ICultureService cultureService, IWorkContextAccessor workContextAccessor)
 {
     _cultureService = cultureService;
     _workContextAccessor = workContextAccessor;
     T = NullLocalizer.Instance;
 }
 public CultureController(ICultureService cultureService, IExcelService excelService, IRightService rightService)
 {
     _cultureService = cultureService;
     _excelService = excelService;
     _rightService = rightService;
 }
Пример #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CulturesController" /> class.
 /// </summary>
 /// <param name="cultureService">The cultureService.</param>
 public CulturesController(ICultureService cultureService)
 {
     this.cultureService = cultureService;
 }
Пример #51
0
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultNancyContextFactory"/> class.
 /// </summary>
 /// <param name="cultureService">An <see cref="ICultureService"/> instance.</param>
 /// <param name="requestTraceFactory">An <see cref="IRequestTraceFactory"/> instance.</param>
 public DefaultNancyContextFactory(ICultureService cultureService, IRequestTraceFactory requestTraceFactory)
 {
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
 }
 public FakeDiagnostics(
     DiagnosticsConfiguration diagnosticsConfiguration,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders = (new IDiagnosticsProvider[] { new FakeDiagnosticsProvider() }).ToArray();
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
 }
Пример #53
0
        /// <summary>
        /// Enables the diagnostics dashboard and will intercept all requests that are passed to
        /// the condigured paths.
        /// </summary>
        public static void Enable(IPipelines pipelines, IEnumerable<IDiagnosticsProvider> providers, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints, ICultureService cultureService, IRequestTraceFactory requestTraceFactory, IEnumerable<IRouteMetadataProvider> routeMetadataProviders, ITextResource textResource, INancyEnvironment environment, ITypeCatalog typeCatalog)
        {
            var diagnosticsConfiguration =
                environment.GetValue<DiagnosticsConfiguration>();

            var diagnosticsEnvironment =
                GetDiagnosticsEnvironment();

            var diagnosticsModuleCatalog = new DiagnosticsModuleCatalog(providers, rootPathProvider, requestTracing, configuration, diagnosticsEnvironment, typeCatalog);

            var diagnosticsRouteCache = new RouteCache(
                diagnosticsModuleCatalog,
                new DefaultNancyContextFactory(cultureService, requestTraceFactory, textResource, environment),
                new DefaultRouteSegmentExtractor(),
                new DefaultRouteDescriptionProvider(),
                cultureService,
                routeMetadataProviders);

            var diagnosticsRouteResolver = new DefaultRouteResolver(
                diagnosticsModuleCatalog,
                new DiagnosticsModuleBuilder(rootPathProvider, modelBinderLocator, diagnosticsEnvironment, environment),
                diagnosticsRouteCache,
                new RouteResolverTrie(new TrieNodeFactory(routeSegmentConstraints)),
                environment);

            var serializer = new DefaultObjectSerializer();

            pipelines.BeforeRequest.AddItemToStartOfPipeline(
                new PipelineItem<Func<NancyContext, Response>>(
                    PipelineKey,
                    ctx =>
                    {
                        if (!ctx.ControlPanelEnabled)
                        {
                            return null;
                        }

                        if (!ctx.Request.Path.StartsWith(diagnosticsConfiguration.Path, StringComparison.OrdinalIgnoreCase))
                        {
                            return null;
                        }

                        if (!diagnosticsConfiguration.Enabled)
                        {
                            return HttpStatusCode.NotFound;
                        }

                        ctx.Items[ItemsKey] = true;

                        var resourcePrefix =
                            string.Concat(diagnosticsConfiguration.Path, "/Resources/");

                        if (ctx.Request.Path.StartsWith(resourcePrefix, StringComparison.OrdinalIgnoreCase))
                        {
                            var resourceNamespace = "Nancy.Diagnostics.Resources";

                            var path = Path.GetDirectoryName(ctx.Request.Url.Path.Replace(resourcePrefix, string.Empty)) ?? string.Empty;
                            if (!string.IsNullOrEmpty(path))
                            {
                                resourceNamespace += string.Format(".{0}", path.Replace(Path.DirectorySeparatorChar, '.'));
                            }

                            return new EmbeddedFileResponse(
                                typeof(DiagnosticsHook).Assembly,
                                resourceNamespace,
                                Path.GetFileName(ctx.Request.Url.Path));
                        }

                        RewriteDiagnosticsUrl(diagnosticsConfiguration, ctx);

                        return ValidateConfiguration(diagnosticsConfiguration)
                                   ? ExecuteDiagnostics(ctx, diagnosticsRouteResolver, diagnosticsConfiguration, serializer, diagnosticsEnvironment)
                                   : new DiagnosticsViewRenderer(ctx, environment)["help"];
                    }));
        }
Пример #54
0
 /// <summary>
 /// Creates a new instance of the <see cref="DefaultNancyContextFactory"/> class.
 /// </summary>
 /// <param name="cultureService">An <see cref="ICultureService"/> instance.</param>
 /// <param name="requestTraceFactory">An <see cref="IRequestTraceFactory"/> instance.</param>
 /// <param name="textResource">An <see cref="ITextResource"/> instance.</param>
 public DefaultNancyContextFactory(ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource)
 {
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.textResource = textResource;
 }
 public ECommerceModule(ICatalogueViewService catatalogueService, ICommerceService commerceService, ICatalogueModificationService editService, IAccountService accountService, IOrderService orderService, IEmailSender emailSender, IDeliveryService deliveryService, ICultureService cultureService, IUserService userService) : base(catatalogueService, commerceService, editService, accountService, orderService, emailSender, deliveryService, cultureService, userService) {
 }
Пример #56
0
 public DefaultNancyContextFactory(ICultureService cultureService)
 {
     this.cultureService = cultureService;
 }
Пример #57
0
 public HomeController(ICultureService cultureService)
 {
     _cultureService = cultureService;
 }