Beispiel #1
0
        protected override void InitializePropertiesForViewing()
        {
            using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance())
            {
                SeoKeywords =
                    _appConfigRepository.SeoUrlKeywords.Where(
                        keyword =>
                        keyword.KeywordValue.Equals(InnerItem.Code) && keyword.KeywordType.Equals((int)SeoUrlKeywordTypes.Item))
                    .ToList();
            }

            InnerItemCatalogLanguages.ForEach(locale =>
            {
                if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale)))
                {
                    var newSeoKeyword = new SeoUrlKeyword {
                        Language = locale, IsActive = true, KeywordType = (int)SeoUrlKeywordTypes.Item, KeywordValue = InnerItem.Code, Created = DateTime.UtcNow
                    };
                    SeoKeywords.Add(newSeoKeyword);
                }
            });

            // filter values by locale
            SeoLocalesFilterCommand.Execute(InnerItem.Catalog.DefaultLanguage);
        }
        protected virtual void InitializePropertiesForViewing()
        {
            SeoKeywords = new List <SeoUrlKeyword>();
            using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance())
            {
                _appConfigRepository.SeoUrlKeywords.Where(
                    keyword =>
                    keyword.KeywordValue.Equals(_keywordValue, StringComparison.InvariantCultureIgnoreCase) && keyword.KeywordType.Equals((int)_keywordType) && keyword.IsActive)
                .ToList().ForEach(seo =>
                {
                    var newSeo              = new SeoUrlKeyword(seo);
                    newSeo.BaseUrl          = BuildBaseUrl(newSeo);
                    newSeo.PropertyChanged += CurrentSeoKeyword_PropertyChanged;
                    SeoKeywords.Add(newSeo);
                });
            }

            _availableLanguages.ForEach(locale =>
            {
                if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var newSeoKeyword              = new SeoUrlKeyword(locale, (int)_keywordType, _keywordValue);
                    newSeoKeyword.BaseUrl          = BuildBaseUrl(newSeoKeyword);
                    newSeoKeyword.PropertyChanged += CurrentSeoKeyword_PropertyChanged;
                    SeoKeywords.Add(newSeoKeyword);
                }
            });

            SeoLocalesFilterCommand.Execute(SeoKeywords.FirstOrDefault(x => x.Language.Equals(_defaultLanguage, StringComparison.InvariantCultureIgnoreCase)));
        }
        private static SeoUrlKeyword InitializeItem(SeoUrlKeyword item, IEnumerable <ImportItem> systemValues)
        {
            if (item == null)
            {
                item = new AppConfigEntityFactory().CreateEntity <SeoUrlKeyword>();
            }
            var itemProperties = item.GetType().GetProperties();

            systemValues.ToList().ForEach(x => SetPropertyValue(item, itemProperties.FirstOrDefault(y => y.Name == x.Name), x.Value));
            item.IsActive = true;
            return(item);
        }
Beispiel #4
0
        private void RaiseSeoLocalesFilter(string locale)
        {
            //detach property changed
            if (CurrentSeoKeyword != null)
            {
                CurrentSeoKeyword.PropertyChanged -= CurrentSeoKeyword_PropertyChanged;
            }

            CurrentSeoKeyword =
                SeoKeywords.FirstOrDefault(keyword => keyword.Language.Equals(locale, StringComparison.InvariantCultureIgnoreCase) && keyword.IsActive);

            if (CurrentSeoKeyword == null)
            {
                CurrentSeoKeyword = new SeoUrlKeyword {
                    Language = locale, IsActive = true, KeywordType = (int)SeoUrlKeywordTypes.Item, KeywordValue = InnerItem.Code, Created = DateTime.UtcNow
                };
                SeoKeywords.Add(CurrentSeoKeyword);
            }

            FilterSeoLanguage = locale;

            //attach property changed
            CurrentSeoKeyword.PropertyChanged += CurrentSeoKeyword_PropertyChanged;
        }
		private void RaiseSeoLocaleChange(SeoUrlKeyword currentKeyword)
		{
			CurrentSeoKeyword = currentKeyword;
			RaiseUpateCustomProperties();
			OnPropertyChanged("NavigateUrl");
		}
		protected abstract string BuildBaseUrl(SeoUrlKeyword keyword);
		protected virtual void InitializePropertiesForViewing()
		{
			SeoKeywords = new List<SeoUrlKeyword>();
			using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance())
			{
				_appConfigRepository.SeoUrlKeywords.Where(
					keyword =>
					keyword.KeywordValue.Equals(_keywordValue, StringComparison.InvariantCultureIgnoreCase) && keyword.KeywordType.Equals((int)_keywordType) && keyword.IsActive)
									.ToList().ForEach(seo =>
									{
										var newSeo = new SeoUrlKeyword(seo);
										newSeo.BaseUrl = BuildBaseUrl(newSeo);
										newSeo.PropertyChanged += CurrentSeoKeyword_PropertyChanged;
										SeoKeywords.Add(newSeo);
									});
			}

			_availableLanguages.ForEach(locale =>
			{
				if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale, StringComparison.InvariantCultureIgnoreCase)))
				{
					var newSeoKeyword = new SeoUrlKeyword(locale, (int)_keywordType, _keywordValue);
					newSeoKeyword.BaseUrl = BuildBaseUrl(newSeoKeyword);
					newSeoKeyword.PropertyChanged += CurrentSeoKeyword_PropertyChanged;
					SeoKeywords.Add(newSeoKeyword);
				}
			});

			SeoLocalesFilterCommand.Execute(SeoKeywords.First(x => x.Language.Equals(_defaultLanguage, StringComparison.InvariantCultureIgnoreCase)));
		}
 private void RaiseSeoLocaleChange(SeoUrlKeyword currentKeyword)
 {
     CurrentSeoKeyword = currentKeyword;
     RaiseUpateCustomProperties();
     OnPropertyChanged("NavigateUrl");
 }
 protected abstract string BuildBaseUrl(SeoUrlKeyword keyword);