static void Main(string[] args) { var maleAttrValue = new UserAttributeValue(); maleAttrValue.AddMaleEmpAttributes(1100, 500, 500); Console.ReadLine(); }
protected virtual void UpdateValueLocales(UserAttributeValue userAttributeValue, UserAttributeValueModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(userAttributeValue, x => x.Name, localized.Name, localized.LanguageId); } }
/// <summary> /// Updates the User attribute value /// </summary> /// <param name="UserAttributeValue">User attribute value</param> public virtual void UpdateUserAttributeValue(UserAttributeValue UserAttributeValue) { if (UserAttributeValue == null) { throw new ArgumentNullException("UserAttributeValue"); } _UserAttributeValueRepository.Update(UserAttributeValue); _cacheManager.RemoveByPattern(UserATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(UserATTRIBUTEVALUES_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(UserAttributeValue); }
/// <summary> /// Inserts a user attribute value /// </summary> /// <param name="userAttributeValue">User attribute value</param> public virtual void InsertUserAttributeValue(UserAttributeValue userAttributeValue) { if (userAttributeValue == null) { throw new ArgumentNullException("userAttributeValue"); } _userAttributeValueRepository.Insert(userAttributeValue); _cacheManager.RemoveByPattern(CUSTOMERATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(CUSTOMERATTRIBUTEVALUES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(userAttributeValue); }
/// <summary> /// Updates the user attribute value /// </summary> /// <param name="userAttributeValue">User attribute value</param> public virtual void UpdateUserAttributeValue(UserAttributeValue userAttributeValue) { if (userAttributeValue == null) { throw new ArgumentNullException(nameof(userAttributeValue)); } _userAttributeValueRepository.Update(userAttributeValue); _cacheManager.RemoveByPattern(NopUserServiceDefaults.UserAttributesPatternCacheKey); _cacheManager.RemoveByPattern(NopUserServiceDefaults.UserAttributeValuesPatternCacheKey); //event notification _eventPublisher.EntityUpdated(userAttributeValue); }
/// <summary> /// Prepare user attribute value model /// </summary> /// <param name="model">User attribute value model</param> /// <param name="userAttribute">User attribute</param> /// <param name="userAttributeValue">User attribute value</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>User attribute value model</returns> public virtual UserAttributeValueModel PrepareUserAttributeValueModel(UserAttributeValueModel model, UserAttribute userAttribute, UserAttributeValue userAttributeValue, bool excludeProperties = false) { if (userAttribute == null) { throw new ArgumentNullException(nameof(userAttribute)); } Action <UserAttributeValueLocalizedModel, int> localizedModelConfiguration = null; if (userAttributeValue != null) { //fill in model values from the entity model = model ?? userAttributeValue.ToModel <UserAttributeValueModel>(); //define localized model configuration action localizedModelConfiguration = (locale, languageId) => { locale.Name = _localizationService.GetLocalized(userAttributeValue, entity => entity.Name, languageId, false, false); }; } model.UserAttributeId = userAttribute.Id; //prepare localized models if (!excludeProperties) { model.Locales = _localizedModelFactory.PrepareLocalizedModels(localizedModelConfiguration); } return(model); }