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); }
public SeoUrlKeyword(ObjectModel.SeoUrlKeyword originalKeyword) { this.InjectFrom(originalKeyword); IsChanged = false; }
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 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; }