public void Can_Get_A_StoreSetting_By_Key()
        {
            //// Arrange
            var key      = Core.Constants.StoreSettingKeys.CurrencyCodeKey;
            var expected = "currencyCode";

            //// Act
            var storeSetting = _settingsService.GetByKey(key);

            //// Assert
            Assert.NotNull(storeSetting);
            Assert.AreEqual(expected, storeSetting.Name);
        }
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);

            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _parentCulture = _parent != null?_parent.GetCulture().Name : string.Empty;

            _defaultStoreLanguage = StringExtensions.IsNullOrWhiteSpace(this._parentCulture) ?
                                    _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value :
                                    _parentCulture;

            _detachedContentTypes = new Lazy <IEnumerable <IDetachedContentType> >(() => _detachedContentTypeService.GetAll().Where(x => x.ContentTypeKey != null));

            if (_allLanguages.Any())
            {
                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
예제 #3
0
        /// <summary>
        /// The set tax application setting.
        /// </summary>
        private void SetTaxApplicationSetting()
        {
            var setting = _storeSettingService.GetByKey(Core.Constants.StoreSettingKeys.GlobalTaxationApplicationKey);

            if (setting == null)
            {
                TaxationApplication = TaxationApplication.Invoice;
            }
            else
            {
                TaxationApplication taxApp;
                this.TaxationApplication = Enum.TryParse(setting.Value, true, out taxApp) ?
                                           taxApp :
                                           TaxationApplication.Invoice;
            }

            TaxApplicationInitialized = true;
        }
예제 #4
0
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);

            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _defaultStoreLanguage =
                _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value;

            if (_allLanguages.Any())
            {
                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
예제 #5
0
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var setting = _storeSettingService.GetByKey(Core.Constants.StoreSettingKeys.CurrencyCodeKey);

            _currency = _storeSettingService.GetCurrencyByCode(setting.Value);
        }