public void AddCurrencies() { // create Setting from factory var entityFactory = new AppConfigEntityFactory(); var setting = entityFactory.CreateEntity <Setting>(); setting.Name = "Currencies"; setting.SettingValueType = "ShortText"; setting.IsMultiValue = true; setting.IsSystem = true; // add currencies var id = setting.SettingId; setting.SettingValues.Add(new SettingValue() { ValueType = "ShortText", ShortTextValue = "USD", SettingId = id }); setting.SettingValues.Add(new SettingValue() { ValueType = "ShortText", ShortTextValue = "EUR", SettingId = id }); var appConfigFactory = new DSRepositoryFactory <IAppConfigRepository, DSAppConfigClient, AppConfigEntityFactory>(ServManager.GetUri(ServiceNameEnum.AppConfig)); using (var appConfigRepository = appConfigFactory.GetRepositoryInstance()) { appConfigRepository.Add(setting); appConfigRepository.UnitOfWork.Commit(); } }
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); }
private static Localization InitializeItem(Localization item, IEnumerable <ImportItem> systemValues) { if (item == null) { item = new AppConfigEntityFactory().CreateEntity <Localization>(); } var itemProperties = item.GetType().GetProperties(); systemValues.ToList().ForEach(x => SetPropertyValue(item, itemProperties.FirstOrDefault(y => y.Name == x.Name), x.Value)); return(item); }