public virtual void InsertSetting(Setting setting, bool clearCache = true) { Guard.NotNull(setting, nameof(setting)); _settingRepository.Insert(setting); HasChanges = true; if (clearCache) { ClearCache(); } _eventPublisher.EntityInserted(setting); }
/// <summary> /// Inserts an attribute /// </summary> /// <param name="attribute">attribute</param> public virtual void InsertAttribute(GenericAttribute attribute) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } _genericAttributeRepository.Insert(attribute); //cache _cacheManager.RemoveByPattern(NopCommonDefaults.GenericAttributePatternCacheKey); //event notification _eventPublisher.EntityInserted(attribute); }
/// <summary> /// Inserts a language /// </summary> /// <param name="language">Language</param> public virtual void InsertLanguage(Language language) { if (language == null) { throw new ArgumentNullException("language"); } _languageRepository.Insert(language); //cache _cacheManager.RemoveByPattern(LANGUAGES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(language); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } _aclRecordRepository.Insert(aclRecord); //cache _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(aclRecord); }
/// <summary> /// Inserts a store mapping record /// </summary> /// <param name="storeMapping">Store mapping</param> protected virtual void InsertStoreMapping(StoreMapping storeMapping) { if (storeMapping == null) { throw new ArgumentNullException(nameof(storeMapping)); } _storeMappingRepository.Insert(storeMapping); //cache _cacheManager.RemoveByPrefix(NopStoreDefaults.StoreMappingPrefixCacheKey); //event notification _eventPublisher.EntityInserted(storeMapping); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Insert(aclRecord); //cache _cacheManager.RemoveByPattern(NopSecurityDefaults.AclRecordPatternCacheKey); //event notification _eventPublisher.EntityInserted(aclRecord); }
/// <summary> /// Inserts an attribute /// </summary> /// <param name="attribute">attribute</param> public virtual void InsertAttribute(GenericAttribute attribute) { if (attribute == null) { throw new ArgumentNullException("attribute"); } _genericAttributeRepository.Insert(attribute); //cache _cacheManager.RemoveByPattern(GENERICATTRIBUTE_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(attribute); }
/// <summary> /// Inserts a store mapping record /// </summary> /// <param name="storeMapping">Store mapping</param> public virtual void InsertStoreMapping(StoreMapping storeMapping) { if (storeMapping == null) { throw new ArgumentNullException("storeMapping"); } _storeMappingRepository.Insert(storeMapping); //cache _cacheManager.RemoveByPattern(STOREMAPPING_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(storeMapping); }
/// <summary> /// Inserts a article tag /// </summary> /// <param name="articleTag">Article tag</param> public virtual void InsertArticleTag(ArticleTag articleTag) { if (articleTag == null) { throw new ArgumentNullException("articleTag"); } _articleTagRepository.Insert(articleTag); //cache _cacheManager.RemoveByPattern(ARTICLETAG_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(articleTag); }
/// <summary> /// Inserts a contact attribute /// </summary> /// <param name="contactAttribute">Contact attribute</param> public virtual async Task InsertContactAttribute(ContactAttribute contactAttribute) { if (contactAttribute == null) { throw new ArgumentNullException("contactAttribute"); } await _contactAttributeRepository.InsertAsync(contactAttribute); _cacheManager.RemoveByPattern(CONTACTATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(CONTACTATTRIBUTEVALUES_PATTERN_KEY); //event notification await _eventPublisher.EntityInserted(contactAttribute); }
/// <summary> /// Inserts category template /// </summary> /// <param name="categoryTemplate">Category template</param> public virtual void InsertCategoryTemplate(CategoryTemplate categoryTemplate) { if (categoryTemplate == null) { throw new ArgumentNullException("categoryTemplate"); } _categoryTemplateRepository.Insert(categoryTemplate); //cache _cacheManager.RemoveByPattern(CATEGORYTEMPLATES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(categoryTemplate); }
/// <summary> /// Inserts widget /// </summary> /// <param name="widget">Widget</param> public virtual void InsertWidget(Widget widget) { if (widget == null) { throw new ArgumentNullException("widget"); } _widgetRepository.Insert(widget); //cache _cacheManager.RemoveByPattern(WIDGETS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(widget); }
/// <summary> /// 添加区域语言字符串资源 /// </summary> /// <param name="localeStringResource">区域语言字符串资源</param> public virtual void InsertLocaleStringResource(LocaleStringResource localeStringResource) { if (localeStringResource == null) { throw new ArgumentNullException(nameof(localeStringResource)); } _lsrRepository.Insert(localeStringResource); //删除缓存 _cacheManager.RemoveByPattern(LOCALSTRINGRESOURCES_PATTERN_KEY); //发布添加通知 _eventPublisher.EntityInserted(localeStringResource); }
public Auth_User InsertUserLester(Auth_User user) { try { user.Deleted = 0; user.CreatedTime = DateTime.Now; user.Status = (int)EnumStatusUser.Approved; _userRepository.Insert(user); _eventPublisher.EntityInserted(user); var roles = _rolesServices.GetRoleByName(RoleDefault.RoleLester); var usersRole = new Auth_UserRoles() { UserID = user.Id, RoleID = roles.Id }; AddUserRoleMapping(usersRole); return(user); } catch (Exception ex) { _logger.Error("UpdateCustomerPassword error", ex); return(null); } }
public void InsertReport(ReportDetail report) { if (report == null) { throw new ArgumentNullException(nameof(report)); } _reportRepository.Insert(report); //cache //_cacheManager.RemoveByPattern(ORDERS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(report); }
/// <summary> /// Inserts a store /// </summary> /// <param name="store">Store</param> public virtual void InsertStore(Store store) { if (store == null) { throw new ArgumentNullException("store"); } _storeRepository.Insert(store); //clear cache _cacheManager.Clear(); //event notification _eventPublisher.EntityInserted(store); }
/// <summary> /// Inserts product template /// </summary> /// <param name="productTemplate">Product template</param> public virtual void InsertProductTemplate(ProductTemplate productTemplate) { if (productTemplate == null) { throw new ArgumentNullException("productTemplate"); } _productTemplateRepository.Insert(productTemplate); //cache _cacheManager.RemoveByPattern(PRODUCTTEMPLATES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(productTemplate); }
/// <summary> /// Inserts manufacturer template /// </summary> /// <param name="manufacturerTemplate">Manufacturer template</param> public virtual void InsertManufacturerTemplate(ManufacturerTemplate manufacturerTemplate) { if (manufacturerTemplate == null) { throw new ArgumentNullException("manufacturerTemplate"); } _manufacturerTemplateRepository.Insert(manufacturerTemplate); //cache _cacheManager.RemoveByPattern(MANUFACTURERTEMPLATES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(manufacturerTemplate); }
/// <summary> /// Inserts a locale string resource /// </summary> /// <param name="localeStringResource">Locale string resource</param> public virtual void InsertLocaleStringResource(LocaleStringResource localeStringResource) { if (localeStringResource == null) { throw new ArgumentNullException("localeStringResource"); } _lsrRepository.InsertAndCommit(localeStringResource); //cache _cacheManager.RemoveByPattern(LOCALSTRINGRESOURCES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(localeStringResource); }
public void InsertAttribute(GenericAttribute attribute) { if (attribute == null) { throw new ArgumentNullException("attribute"); } _repository.Insert(attribute); string key = string.Format(GENERICATTRIBUTE_KEY, attribute.EntityId, attribute.KeyGroup); //cache //_cacheManager.RemoveByPattern(GENERICATTRIBUTE_PATTERN_KEY);nop的做法 感觉没有必要 都删 _cacheManager.Remove(key); //event notification _eventPublisher.EntityInserted(attribute); }
/// <summary> /// Inserts a news tag /// </summary> /// <param name="newsTag">News tag</param> public virtual void InsertNewsTag(NewsTag newsTag) { if (newsTag == null) { throw new ArgumentNullException("newsTag"); } _newsTagRepository.Insert(newsTag); //cache _cacheManager.RemoveByPattern(NEWSTAG_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(newsTag); }
public virtual void InsertCategorySpecificationAtrribute(CategorySpecificationAtrribute categorySpecificationAtrribute) { if (categorySpecificationAtrribute == null) { throw new ArgumentNullException("categorySpecificationAtrribute"); } _categorySpecificationAtrributeRepository.Insert(categorySpecificationAtrribute); //cache _cacheManager.RemoveByPattern(CATEGORYSPECIFICATIONATTRIBUTE_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(categorySpecificationAtrribute); }
/// <summary> /// Inserts a application mapping record /// </summary> /// <param name="applicationMapping">Application mapping</param> public virtual void InsertApplicationMapping(ApplicationMapping applicationMapping) { if (applicationMapping == null) { throw new ArgumentNullException("applicationMapping"); } _applicationMappingRepository.Insert(applicationMapping); //cache _cacheManager.RemoveByPattern(APPLICATIONMAPPING_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(applicationMapping); }
/// <summary> /// Inserts material group /// </summary> /// <param name="materialGroup">MaterialGroup</param> public virtual void InsertMaterialGroup(MaterialGroup materialGroup) { if (materialGroup == null) { throw new ArgumentNullException(nameof(materialGroup)); } _materialGroupRepository.Insert(materialGroup); //cache _cacheManager.RemoveByPattern(MATERIAL_GROUPS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(materialGroup); }
public void InsertProductTag(ProductTag productTag) { if (productTag == null) { throw new ArgumentNullException("productTag"); } _productTagRepository.Insert(productTag); //cache _cacheManager.RemoveByPattern(PRODUCTTAG_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(productTag); }
/// <summary> /// Inserts a checkout attribute /// </summary> /// <param name="checkoutAttribute">Checkout attribute</param> public virtual void InsertCheckoutAttribute(CheckoutAttribute checkoutAttribute) { if (checkoutAttribute == null) { throw new ArgumentNullException("checkoutAttribute"); } _checkoutAttributeRepository.Insert(checkoutAttribute); _cacheManager.RemoveByPattern(CHECKOUTATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(CHECKOUTATTRIBUTEVALUES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(checkoutAttribute); }
/// <summary> /// Inserts a topic /// </summary> /// <param name="topic">Topic</param> public virtual void InsertTopic(Topic topic) { if (topic == null) { throw new ArgumentNullException("topic"); } _topicRepository.Insert(topic); //cache _cacheManager.RemoveByPattern(TOPICS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(topic); }
/// <summary> /// Inserts a topic /// </summary> /// <param name="topic">Topic</param> public virtual void InsertTopic(Topic topic) { if (topic == null) { throw new ArgumentNullException(nameof(topic)); } _topicRepository.Insert(topic); //cache _cacheManager.RemoveByPattern(NopTopicDefaults.TopicsPatternCacheKey); //event notification _eventPublisher.EntityInserted(topic); }
/// <summary> /// Inserts a shipment /// </summary> /// <param name="shipment">Shipment</param> public virtual void InsertShipment(Shipment shipment) { if (shipment == null) { throw new ArgumentNullException("shipment"); } var shipmentExists = _shipmentRepository.Table.FirstOrDefault(); shipment.ShipmentNumber = shipmentExists != null?_shipmentRepository.Table.Max(x => x.ShipmentNumber) + 1 : 1; _shipmentRepository.Insert(shipment); //event notification _eventPublisher.EntityInserted(shipment); }
public void InsertOrder(Order order) { if (order == null) { throw new ArgumentNullException(nameof(order)); } _orderRepository.Insert(order); //cache _cacheManager.RemoveByPattern(ORDERS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(order); }