/// <summary> /// Deletes a language /// </summary> /// <param name="languageId">Language identifier</param> public void DeleteLanguage(int languageId) { var language = GetLanguageById(languageId); if (language == null) { return; } if (!_context.IsAttached(language)) { _context.Languages.Attach(language); } _context.DeleteObject(language); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(LANGUAGES_PATTERN_KEY); } }
/// <summary> /// Deletes currency /// </summary> /// <param name="currencyId">Currency identifier</param> public void DeleteCurrency(int currencyId) { var currency = GetCurrencyById(currencyId); if (currency == null) { return; } if (!_context.IsAttached(currency)) { _context.Currencies.Attach(currency); } _context.DeleteObject(currency); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(CURRENCIES_PATTERN_KEY); } }
/// <summary> /// Deletes a tax rate /// </summary> /// <param name="taxRateId">Tax rate identifier</param> public void DeleteTaxRate(int taxRateId) { var taxRate = GetTaxRateById(taxRateId); if (taxRate == null) { return; } if (!_context.IsAttached(taxRate)) { _context.TaxRates.Attach(taxRate); } _context.DeleteObject(taxRate); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(TAXRATE_PATTERN_KEY); } }
/// <summary> /// Deletes a SMS provider /// </summary> /// <param name="smsProviderId">SMS provider identifier</param> public void DeleteSMSProvider(int smsProviderId) { var smsProvider = GetSMSProviderById(smsProviderId); if (smsProvider == null) { return; } if (!_context.IsAttached(smsProvider)) { _context.SMSProviders.Attach(smsProvider); } _context.DeleteObject(smsProvider); _context.SaveChanges(); if (CacheEnabled) { _cacheManager.RemoveByPattern(SMSPROVIDERS_PATTERN_KEY); } }
/// <summary> /// Deletes a news /// </summary> /// <param name="newsId">The news identifier</param> public void DeleteNews(int newsId) { var news = GetNewsById(newsId); if (news == null) { return; } if (!_context.IsAttached(news)) { _context.News.Attach(news); } _context.DeleteObject(news); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(NEWS_PATTERN_KEY); } }
/// <summary> /// Deletes a country /// </summary> /// <param name="countryId">Country identifier</param> public void DeleteCountry(int countryId) { var country = GetCountryById(countryId); if (country == null) { return; } if (!_context.IsAttached(country)) { _context.Countries.Attach(country); } _context.DeleteObject(country); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(COUNTRIES_PATTERN_KEY); } }
/// <summary> /// Deletes an blog post /// </summary> /// <param name="blogPostId">Blog post identifier</param> public void DeleteBlogPost(int blogPostId) { var blogPost = GetBlogPostById(blogPostId); if (blogPost == null) { return; } if (!_context.IsAttached(blogPost)) { _context.BlogPosts.Attach(blogPost); } _context.DeleteObject(blogPost); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(BLOGPOST_PATTERN_KEY); } }
/// <summary> /// Deletes a customer action /// </summary> /// <param name="customerActionId">Customer action identifier</param> public void DeleteCustomerAction(int customerActionId) { var customerAction = GetCustomerActionById(customerActionId); if (customerAction == null) { return; } if (!_context.IsAttached(customerAction)) { _context.CustomerActions.Attach(customerAction); } _context.DeleteObject(customerAction); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(CUSTOMERACTIONS_PATTERN_KEY); } }
/// <summary> /// Deletes a setting /// </summary> /// <param name="settingId">Setting identifer</param> public void DeleteSetting(int settingId) { var setting = GetSettingById(settingId); if (setting == null) { return; } if (!_context.IsAttached(setting)) { _context.Settings.Attach(setting); } _context.DeleteObject(setting); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(SETTINGS_ALL_KEY); } }
/// <summary> /// Deletes a state/province /// </summary> /// <param name="stateProvinceId">The state/province identifier</param> public void DeleteStateProvince(int stateProvinceId) { var stateProvince = GetStateProvinceById(stateProvinceId); if (stateProvince == null) { return; } if (!_context.IsAttached(stateProvince)) { _context.StateProvinces.Attach(stateProvince); } _context.DeleteObject(stateProvince); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(STATEPROVINCES_PATTERN_KEY); } }
/// <summary> /// Deletes a poll /// </summary> /// <param name="pollId">The poll identifier</param> public void DeletePoll(int pollId) { var poll = GetPollById(pollId); if (poll == null) { return; } if (!_context.IsAttached(poll)) { _context.Polls.Attach(poll); } _context.DeleteObject(poll); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(POLLS_PATTERN_KEY); _cacheManager.RemoveByPattern(POLLANSWERS_PATTERN_KEY); } }
/// <summary> /// Deletes a product attribute /// </summary> /// <param name="productAttributeId">Product attribute identifier</param> public void DeleteProductAttribute(int productAttributeId) { var productAttribute = GetProductAttributeById(productAttributeId); if (productAttribute == null) { return; } if (!_context.IsAttached(productAttribute)) { _context.ProductAttributes.Attach(productAttribute); } _context.DeleteObject(productAttribute); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(PRODUCTATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(PRODUCTVARIANTATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(PRODUCTVARIANTATTRIBUTEVALUES_PATTERN_KEY); } }
/// <summary> /// Deletes a log item /// </summary> /// <param name="logId">Log item identifier</param> public void DeleteLog(int logId) { var log = GetLogById(logId); if (log == null) { return; } if (!_context.IsAttached(log)) { _context.Log.Attach(log); } _context.DeleteObject(log); _context.SaveChanges(); }
/// <summary> /// Updates QBEntity /// </summary> /// <param name="entity">QBEntity</param> public void UpdateQBEntity(QBEntity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } entity.QBEntityId = CommonHelper.EnsureNotNull(entity.QBEntityId); entity.QBEntityId = CommonHelper.EnsureMaximumLength(entity.QBEntityId, 50); entity.SeqNum = CommonHelper.EnsureNotNull(entity.SeqNum); entity.SeqNum = CommonHelper.EnsureMaximumLength(entity.SeqNum, 20); if (!_context.IsAttached(entity)) { _context.QBEntities.Attach(entity); } _context.SaveChanges(); }
/// <summary> /// Deletes a shipping rate computation method /// </summary> /// <param name="shippingRateComputationMethodId">Shipping rate computation method identifier</param> public void DeleteShippingRateComputationMethod(int shippingRateComputationMethodId) { var shippingRateComputationMethod = GetShippingRateComputationMethodById(shippingRateComputationMethodId); if (shippingRateComputationMethod == null) { return; } if (!_context.IsAttached(shippingRateComputationMethod)) { _context.ShippingRateComputationMethods.Attach(shippingRateComputationMethod); } _context.DeleteObject(shippingRateComputationMethod); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(SHIPPINGRATECOMPUTATIONMETHODS_PATTERN_KEY); } }
/// <summary> /// Updates the affiliate /// </summary> /// <param name="affiliate">Affiliate</param> public void UpdateAffiliate(Affiliate affiliate) { if (affiliate == null) { throw new ArgumentNullException("affiliate"); } affiliate.FirstName = CommonHelper.EnsureNotNull(affiliate.FirstName); affiliate.LastName = CommonHelper.EnsureNotNull(affiliate.LastName); affiliate.FirstName = CommonHelper.EnsureMaximumLength(affiliate.FirstName, 100); affiliate.LastName = CommonHelper.EnsureMaximumLength(affiliate.LastName, 100); affiliate.MiddleName = CommonHelper.EnsureNotNull(affiliate.MiddleName); affiliate.MiddleName = CommonHelper.EnsureMaximumLength(affiliate.MiddleName, 100); affiliate.PhoneNumber = CommonHelper.EnsureNotNull(affiliate.PhoneNumber); affiliate.PhoneNumber = CommonHelper.EnsureMaximumLength(affiliate.PhoneNumber, 50); affiliate.Email = CommonHelper.EnsureNotNull(affiliate.Email); affiliate.Email = CommonHelper.EnsureMaximumLength(affiliate.Email, 255); affiliate.FaxNumber = CommonHelper.EnsureNotNull(affiliate.FaxNumber); affiliate.FaxNumber = CommonHelper.EnsureMaximumLength(affiliate.FaxNumber, 50); affiliate.Company = CommonHelper.EnsureNotNull(affiliate.Company); affiliate.Company = CommonHelper.EnsureMaximumLength(affiliate.Company, 100); affiliate.Address1 = CommonHelper.EnsureNotNull(affiliate.Address1); affiliate.Address1 = CommonHelper.EnsureMaximumLength(affiliate.Address1, 100); affiliate.Address2 = CommonHelper.EnsureNotNull(affiliate.Address2); affiliate.Address2 = CommonHelper.EnsureMaximumLength(affiliate.Address2, 100); affiliate.City = CommonHelper.EnsureNotNull(affiliate.City); affiliate.City = CommonHelper.EnsureMaximumLength(affiliate.City, 100); affiliate.StateProvince = CommonHelper.EnsureNotNull(affiliate.StateProvince); affiliate.StateProvince = CommonHelper.EnsureMaximumLength(affiliate.StateProvince, 100); affiliate.ZipPostalCode = CommonHelper.EnsureNotNull(affiliate.ZipPostalCode); affiliate.ZipPostalCode = CommonHelper.EnsureMaximumLength(affiliate.ZipPostalCode, 30); if (!_context.IsAttached(affiliate)) { _context.Affiliates.Attach(affiliate); } _context.SaveChanges(); }
/// <summary> /// Deletes a specification attribute /// </summary> /// <param name="specificationAttributeId">The specification attribute identifier</param> public void DeleteSpecificationAttribute(int specificationAttributeId) { var specificationAttribute = GetSpecificationAttributeById(specificationAttributeId); if (specificationAttribute == null) { return; } if (!_context.IsAttached(specificationAttribute)) { _context.SpecificationAttributes.Attach(specificationAttribute); } _context.DeleteObject(specificationAttribute); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(SPECIFICATIONATTRIBUTE_PATTERN_KEY); _cacheManager.RemoveByPattern(SPECIFICATIONATTRIBUTEOPTION_PATTERN_KEY); _cacheManager.RemoveByPattern(PRODUCTSPECIFICATIONATTRIBUTE_PATTERN_KEY); } }
/// <summary> /// Deletes a category template /// </summary> /// <param name="categoryTemplateId">Category template identifier</param> public void DeleteCategoryTemplate(int categoryTemplateId) { var categoryTemplate = GetCategoryTemplateById(categoryTemplateId); if (categoryTemplate == null) { return; } if (!_context.IsAttached(categoryTemplate)) { _context.CategoryTemplates.Attach(categoryTemplate); } _context.DeleteObject(categoryTemplate); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(CATEGORYTEMPLATES_PATTERN_KEY); } }
/// <summary> /// Deletes a checkout attribute /// </summary> /// <param name="checkoutAttributeId">Checkout attribute identifier</param> public void DeleteCheckoutAttribute(int checkoutAttributeId) { var checkoutAttribute = GetCheckoutAttributeById(checkoutAttributeId); if (checkoutAttribute == null) { return; } if (!_context.IsAttached(checkoutAttribute)) { _context.CheckoutAttributes.Attach(checkoutAttribute); } _context.DeleteObject(checkoutAttribute); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(CHECKOUTATTRIBUTES_PATTERN_KEY); _cacheManager.RemoveByPattern(CHECKOUTATTRIBUTEVALUES_PATTERN_KEY); } }
/// <summary> /// Updates the discount /// </summary> /// <param name="discount">Discount</param> public void UpdateDiscount(Discount discount) { if (discount == null) { throw new ArgumentNullException("discount"); } discount.Name = CommonHelper.EnsureNotNull(discount.Name); discount.Name = CommonHelper.EnsureMaximumLength(discount.Name, 100); discount.CouponCode = CommonHelper.EnsureNotNull(discount.CouponCode); discount.CouponCode = CommonHelper.EnsureMaximumLength(discount.CouponCode, 100); if (!_context.IsAttached(discount)) { _context.Discounts.Attach(discount); } _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(DISCOUNTS_PATTERN_KEY); } }