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 override void InitializePropertiesForViewing() { using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance()) { SeoKeywords = _appConfigRepository.SeoUrlKeywords.Where( keyword => keyword.KeywordValue.Equals(InnerItem.Code) && keyword.KeywordType.Equals((int)SeoUrlKeywordTypes.Category)) .ToList(); } var innerItemCatalog = _parentCatalog as catalogModel.Catalog; if (innerItemCatalog == null) { using (var storeRepository = _storeRepositoryFactory.GetRepositoryInstance()) { var languages = storeRepository.Stores.Where(store => store.Catalog == _parentCatalog.CatalogId) .Expand(store => store.Languages).ToList(); var customComparer = new PropertyComparer <StoreLanguage>("LanguageCode"); var lang = languages.SelectMany(x => x.Languages).Distinct(customComparer); InnerItemCatalogLanguages = new List <string>(); if (lang.Any()) { foreach (var l in lang) { InnerItemCatalogLanguages.Add(l.LanguageCode); } } } } InnerItemCatalogLanguages.ForEach(locale => { if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale))) { SeoKeywords.Add(CreateSeoUrlKeyword(locale)); } }); // filter values by locale SeoLocalesFilterCommand.Execute(_parentCatalog.DefaultLanguage); }
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 = CreateSeoUrlKeyword(locale); SeoKeywords.Add(CurrentSeoKeyword); } //attach property changed CurrentSeoKeyword.PropertyChanged += CurrentSeoKeyword_PropertyChanged; FilterSeoLanguage = locale; }
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; }