Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Refactoring (#322)

Krzysztof Pajak627248ea7297
diff --git a/.gitignore b/.gitignore
index 52fd0d883..cdfa8cc42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -350,13 +350,18 @@ src/Web/Grand.Web/wwwroot/assets/images/thumbs/*.jpeg
src/Web/Grand.Web/wwwroot/assets/images/thumbs/*.png
src/Web/Grand.Web/wwwroot/assets/images/thumbs/*.webp
src/Web/Grand.Web/wwwroot/assets/images/thumbs/.tmb/*
+src/Web/Grand.Web.Admin/wwwroot/assets/images/thumbs/*.**
!src/Web/Grand.Web/wwwroot/assets/files/exportimport/Index.htm
src/Web/Grand.Web/wwwroot/assets/images/uploaded/*
!src/Web/Grand.Web/wwwroot/assets/images/uploaded/placeholder.txt
src/Web/Grand.Web/App_Data/InstalledPlugins.cfg
src/Web/Grand.Web/App_Data/Settings.cfg
src/Web/Grand.Web/Plugins/*
+src/Web/Grand.Web.Admin/App_Data/InstalledPlugins.cfg
+src/Web/Grand.Web.Admin/App_Data/Settings.cfg
+src/Web/Grand.Web.Admin/Plugins/*
src/Web/Grand.Web/App_Data/DataProtectionKeys/*
+src/Web/Grand.Web.Admin/App_Data/DataProtectionKeys/*
!src/Web/Grand.Web/App_Data/DataProtectionKeys/Index.htm
src/Web/Grand.Web/App_Data/Download/*
!src/Web/Grand.Web/App_Data/Download/Index.htm
diff --git a/src/Business/Grand.Business.Catalog/Services/Prices/PricingService.cs b/src/Business/Grand.Business.Catalog/Services/Prices/PricingService.cs
index ecf53fb87..eb8e0ab95 100644
--- a/src/Business/Grand.Business.Catalog/Services/Prices/PricingService.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Prices/PricingService.cs
@@ -31,7 +31,6 @@ namespace Grand.Business.Catalog.Services.Prices
private readonly ICategoryService _categoryService;
private readonly IBrandService _brandService;
private readonly ICollectionService _collectionService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IProductService _productService;
private readonly IMediator _mediator;
private readonly ICurrencyService _currencyService;
@@ -47,7 +46,6 @@ namespace Grand.Business.Catalog.Services.Prices
ICategoryService categoryService,
IBrandService brandService,
ICollectionService collectionService,
- IProductAttributeParser productAttributeParser,
IProductService productService,
IMediator mediator,
ICurrencyService currencyService,
@@ -59,7 +57,6 @@ namespace Grand.Business.Catalog.Services.Prices
_categoryService = categoryService;
_brandService = brandService;
_collectionService = collectionService;
- _productAttributeParser = productAttributeParser;
_productService = productService;
_mediator = mediator;
_mediator = mediator;
@@ -596,7 +593,7 @@ namespace Grand.Business.Catalog.Services.Prices
if (!finalPrice.HasValue)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, attributes);
+ var combination = product.FindProductAttributeCombination(attributes);
if (combination != null)
{
if (combination.OverriddenPrice.HasValue)
@@ -619,7 +616,7 @@ namespace Grand.Business.Catalog.Services.Prices
double attributesTotalPrice = 0;
if (attributes != null && attributes.Any())
{
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, attributes);
+ var attributeValues = product.ParseProductAttributeValues(attributes);
if (attributeValues != null)
{
foreach (var attributeValue in attributeValues)
@@ -634,7 +631,7 @@ namespace Grand.Business.Catalog.Services.Prices
var p1 = await _productService.GetProductById(item.ProductId);
if (p1 != null)
{
- var bundledProductsAttributeValues = _productAttributeParser.ParseProductAttributeValues(p1, attributes);
+ var bundledProductsAttributeValues = p1.ParseProductAttributeValues(attributes);
if (bundledProductsAttributeValues != null)
{
foreach (var attributeValue in bundledProductsAttributeValues)
@@ -761,7 +758,7 @@ namespace Grand.Business.Catalog.Services.Prices
throw new ArgumentNullException(nameof(product));
double cost = product.ProductCost;
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, attributes);
+ var attributeValues = product.ParseProductAttributeValues(attributes);
foreach (var attributeValue in attributeValues)
{
switch (attributeValue.AttributeValueTypeId)
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs b/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs
index c38a8e726..357950cfa 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs
@@ -18,7 +18,6 @@ namespace Grand.Business.Catalog.Services.Products
private readonly IRepository<Product> _productRepository;
private readonly IRepository<InventoryJournal> _inventoryJournalRepository;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IStockQuantityService _stockQuantityService;
private readonly ICacheBase _cacheBase;
private readonly IMediator _mediator;
@@ -31,7 +30,6 @@ namespace Grand.Business.Catalog.Services.Products
public InventoryManageService(
IRepository<Product> productRepository,
IRepository<InventoryJournal> inventoryJournalRepository,
- IProductAttributeParser productAttributeParser,
IStockQuantityService stockQuantityService,
ICacheBase cacheBase,
IMediator mediator,
@@ -39,7 +37,6 @@ namespace Grand.Business.Catalog.Services.Products
{
_productRepository = productRepository;
_inventoryJournalRepository = inventoryJournalRepository;
- _productAttributeParser = productAttributeParser;
_stockQuantityService = stockQuantityService;
_cacheBase = cacheBase;
_mediator = mediator;
@@ -79,7 +76,7 @@ namespace Grand.Business.Catalog.Services.Products
}
private async Task ManageStockByAttributesInventory(Product product, Shipment shipment, ShipmentItem shipmentItem)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, shipmentItem.Attributes);
+ var combination = product.FindProductAttributeCombination(shipmentItem.Attributes);
if (combination == null)
return;
@@ -140,7 +137,7 @@ namespace Grand.Business.Catalog.Services.Products
}
private async Task ManageAttributesInventory(Product product, Shipment shipment, ShipmentItem shipmentItem)
{
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, shipmentItem.Attributes);
+ var attributeValues = product.ParseProductAttributeValues(shipmentItem.Attributes);
foreach (var attributeValue in attributeValues)
{
if (attributeValue.AttributeValueTypeId == AttributeValueType.AssociatedToProduct)
@@ -207,7 +204,7 @@ namespace Grand.Business.Catalog.Services.Products
//manage stock by attributes
if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, inventoryJournal.Attributes);
+ var combination = product.FindProductAttributeCombination(inventoryJournal.Attributes);
if (combination == null)
return;
@@ -406,7 +403,7 @@ namespace Grand.Business.Catalog.Services.Products
if (attributes != null && product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, attributes);
+ var combination = product.FindProductAttributeCombination(attributes);
if (combination != null)
{
if (quantityToChange < 0)
@@ -438,7 +435,7 @@ namespace Grand.Business.Catalog.Services.Products
}
//bundled products
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, attributes);
+ var attributeValues = product.ParseProductAttributeValues(attributes);
foreach (var attributeValue in attributeValues)
{
if (attributeValue.AttributeValueTypeId == AttributeValueType.AssociatedToProduct)
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
index b3dbbe97c..89fff2f8f 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
@@ -6,6 +6,7 @@ using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
+using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using System.Net;
@@ -19,7 +20,6 @@ namespace Grand.Business.Catalog.Services.Products
{
private readonly IWorkContext _workContext;
private readonly IProductAttributeService _productAttributeService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ITranslationService _translationService;
private readonly ITaxService _taxService;
private readonly IPriceFormatter _priceFormatter;
@@ -28,7 +28,6 @@ namespace Grand.Business.Catalog.Services.Products
public ProductAttributeFormatter(IWorkContext workContext,
IProductAttributeService productAttributeService,
- IProductAttributeParser productAttributeParser,
ITranslationService translationService,
ITaxService taxService,
IPriceFormatter priceFormatter,
@@ -37,7 +36,6 @@ namespace Grand.Business.Catalog.Services.Products
{
_workContext = workContext;
_productAttributeService = productAttributeService;
- _productAttributeParser = productAttributeParser;
_translationService = translationService;
_taxService = taxService;
_priceFormatter = priceFormatter;
@@ -128,13 +126,8 @@ namespace Grand.Business.Catalog.Services.Products
{
if (product.IsGiftVoucher)
{
- string giftVoucherRecipientName;
- string giftVoucherRecipientEmail;
- string giftVoucherSenderName;
- string giftVoucherSenderEmail;
- string giftVoucherMessage;
- _productAttributeParser.GetGiftVoucherAttribute(customAttributes, out giftVoucherRecipientName, out giftVoucherRecipientEmail,
- out giftVoucherSenderName, out giftVoucherSenderEmail, out giftVoucherMessage);
+ GiftVoucherExtensions.GetGiftVoucherAttribute(customAttributes, out var giftVoucherRecipientName, out var giftVoucherRecipientEmail,
+ out var giftVoucherSenderName, out var giftVoucherSenderEmail, out var giftVoucherMessage);
//sender
var giftVoucherFrom = product.GiftVoucherTypeId == GiftVoucherType.Virtual ?
@@ -169,7 +162,7 @@ namespace Grand.Business.Catalog.Services.Products
bool allowHyperlinks, bool showInAdmin)
{
var result = new StringBuilder();
- var attributes = _productAttributeParser.ParseProductAttributeMappings(product, customAttributes);
+ var attributes = product.ParseProductAttributeMappings(customAttributes);
for (int i = 0; i < attributes.Count; i++)
{
var productAttribute = await _productAttributeService.GetProductAttributeById(attributes[i].ProductAttributeId);
@@ -177,7 +170,7 @@ namespace Grand.Business.Catalog.Services.Products
continue;
var attribute = attributes[i];
- var valuesStr = _productAttributeParser.ParseValues(customAttributes, attribute.Id);
+ var valuesStr = ProductExtensions.ParseValues(customAttributes, attribute.Id);
for (int j = 0; j < valuesStr.Count; j++)
{
string valueStr = valuesStr[j];
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeParser.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeParser.cs
deleted file mode 100644
index 6f2ba809a..000000000
--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeParser.cs
+++ /dev/null
@@ -1,348 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Domain.Catalog;
-using Grand.Domain.Common;
-using Grand.SharedKernel.Extensions;
-
-namespace Grand.Business.Catalog.Services.Products
-{
- /// <summary>
- /// Product attribute parser
- /// </summary>
- public partial class ProductAttributeParser : IProductAttributeParser
- {
-
- #region Ctor
-
- public ProductAttributeParser()
- {
- }
-
- #endregion
-
- #region Product attributes
-
- /// <summary>
- /// Gets selected product attribute mappings
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <returns>Selected product attribute mappings</returns>
- public virtual IList<ProductAttributeMapping> ParseProductAttributeMappings(Product product, IList<CustomAttribute> customAttributes)
- {
- var result = new List<ProductAttributeMapping>();
- if (customAttributes == null || !customAttributes.Any())
- return result;
-
- foreach (var customAttribute in customAttributes.GroupBy(x => x.Key))
- {
- var attribute = product.ProductAttributeMappings.Where(x => x.Id == customAttribute.Key).FirstOrDefault();
- if (attribute != null)
- {
- result.Add(attribute);
- }
- }
- return result;
- }
-
- /// <summary>
- /// Get product attribute values
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <returns>Product attribute values</returns>
- public virtual IList<ProductAttributeValue> ParseProductAttributeValues(Product product, IList<CustomAttribute> customAttributes)
- {
- var values = new List<ProductAttributeValue>();
- if (customAttributes == null || !customAttributes.Any())
- return values;
-
- var attributes = ParseProductAttributeMappings(product, customAttributes);
- foreach (var attribute in attributes)
- {
- if (!attribute.ShouldHaveValues())
- continue;
-
- var valuesStr = ParseValues(customAttributes, attribute.Id);
- foreach (var valueStr in valuesStr)
- {
- if (!string.IsNullOrEmpty(valueStr))
- {
- if (attribute.ProductAttributeValues.Where(x => x.Id == valueStr).Count() > 0)
- {
- var value = attribute.ProductAttributeValues.Where(x => x.Id == valueStr).FirstOrDefault();
- if (value != null)
- {
- values.Add(value);
- }
- }
- }
- }
- }
- return values;
- }
-
- /// <summary>
- /// Gets selected product attribute values
- /// </summary>
- /// <param name="customAttributes">Attributes </param>
- /// <param name="productAttributeMappingId">Product attribute mapping identifier</param>
- /// <returns>Product attribute values</returns>
- public virtual IList<string> ParseValues(IList<CustomAttribute> customAttributes, string productAttributeMappingId)
- {
- var selectedValues = new List<string>();
- if (customAttributes == null || !customAttributes.Any())
- return selectedValues;
-
- return customAttributes.Where(x => x.Key == productAttributeMappingId).Select(x => x.Value).ToList();
-
- }
-
- /// <summary>
- /// Adds an attribute
- /// </summary>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeMapping">Product attribute mapping</param>
- /// <param name="value">Value</param>
- /// <returns>Attributes</returns>
- public virtual IList<CustomAttribute> AddProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping, string value)
- {
- if (customAttributes == null)
- customAttributes = new List<CustomAttribute>();
-
- customAttributes.Add(new CustomAttribute() { Key = productAttributeMapping.Id, Value = value });
-
- return customAttributes;
- }
- /// <summary>
- /// Remove an attribute
- /// </summary>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeMapping">Product attribute mapping</param>
- /// <returns>Updated result (XML format)</returns>
- public virtual IList<CustomAttribute> RemoveProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping)
- {
- return customAttributes.Where(x => x.Key != productAttributeMapping.Id).ToList();
- }
- /// <summary>
- /// Are attributes equal
- /// </summary>
- /// <param name="customAttributes1">The attributes of the first product</param>
- /// <param name="customAttributes2">The attributes of the second product</param>
- /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
- /// <returns>Result</returns>
- public virtual bool AreProductAttributesEqual(Product product, IList<CustomAttribute> customAttributes1, IList<CustomAttribute> customAttributes2, bool ignoreNonCombinableAttributes)
- {
- var attributes1 = ParseProductAttributeMappings(product, customAttributes1);
- if (ignoreNonCombinableAttributes)
- {
- attributes1 = attributes1.Where(x => !x.IsNonCombinable()).ToList();
- }
- var attributes2 = ParseProductAttributeMappings(product, customAttributes2);
- //TO DO - Where(x=>x.IsRequired).ToList()
-
- if (ignoreNonCombinableAttributes)
- {
- attributes2 = attributes2.Where(x => !x.IsNonCombinable()).ToList();
- }
- if (attributes1.Count != attributes2.Count)
- return false;
-
- bool attributesEqual = true;
- foreach (var a1 in attributes1)
- {
- bool hasAttribute = false;
- foreach (var a2 in attributes2)
- {
- if (a1.Id == a2.Id)
- {
- hasAttribute = true;
- var values1Str = ParseValues(customAttributes1, a1.Id);
- var values2Str = ParseValues(customAttributes2, a2.Id);
- if (values1Str.Count == values2Str.Count)
- {
- foreach (string str1 in values1Str)
- {
- bool hasValue = false;
- foreach (string str2 in values2Str)
- {
- //case insensitive?
- if (str1.Trim() == str2.Trim())
- {
- hasValue = true;
- break;
- }
- }
-
- if (!hasValue)
- {
- attributesEqual = false;
- break;
- }
- }
- }
- else
- {
- attributesEqual = false;
- break;
- }
- }
- }
-
- if (hasAttribute == false)
- {
- attributesEqual = false;
- break;
- }
- }
-
- return attributesEqual;
- }
-
- /// <summary>
- /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified
- /// </summary>
- /// <param name="pam">Product attribute</param>
- /// <param name="selectedAttributes">Selected attributes</param>
- /// <returns>Result</returns>
- public virtual bool? IsConditionMet(Product product, ProductAttributeMapping pam, IList<CustomAttribute> selectedAttributes)
- {
- if (pam == null)
- throw new ArgumentNullException(nameof(pam));
-
- if (selectedAttributes == null)
- selectedAttributes = new List<CustomAttribute>();
-
- var conditionAttribute = pam.ConditionAttribute;
- if (!conditionAttribute.Any())
- //no condition
- return null;
-
- //load an attribute this one depends on
- var dependOnAttribute = ParseProductAttributeMappings(product, conditionAttribute).FirstOrDefault();
- if (dependOnAttribute == null)
- return true;
-
- var valuesThatShouldBeSelected = ParseValues(conditionAttribute, dependOnAttribute.Id)
- .Where(x => !string.IsNullOrEmpty(x))
- .ToList();
- var selectedValues = ParseValues(selectedAttributes, dependOnAttribute.Id);
- if (valuesThatShouldBeSelected.Count != selectedValues.Count)
- return false;
-
- //compare values
- var allFound = true;
- foreach (var t1 in valuesThatShouldBeSelected)
- {
- bool found = false;
- foreach (var t2 in selectedValues)
- if (t1 == t2)
- found = true;
- if (!found)
- allFound = false;
- }
-
- return allFound;
- }
-
- /// <summary>
- /// Finds a product attribute combination by attributes stored
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
- /// <returns>Found product attribute combination</returns>
- public virtual ProductAttributeCombination FindProductAttributeCombination(Product product,
- IList<CustomAttribute> customAttributes, bool ignoreNonCombinableAttributes = true)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- var combinations = product.ProductAttributeCombinations;
- return combinations.FirstOrDefault(x =>
- AreProductAttributesEqual(product, x.Attributes, customAttributes, ignoreNonCombinableAttributes));
- }
-
- /// <summary>
- /// Generate all combinations
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
- /// <returns>Attribute combinations</returns>
- public virtual IList<IEnumerable<CustomAttribute>> GenerateAllCombinations(Product product)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- var allProductAttributMappings = product.ProductAttributeMappings.Where(x => !x.IsNonCombinable()).ToList();
-
- if (allProductAttributMappings.Count == 0)
- return null;
-
- var query = allProductAttributMappings.Select(o1 => o1.ProductAttributeValues.Select(o2 =>
- new CustomAttribute
- {
- Key = o1.Id,
- Value = o2.Id
- }
- )).SelectMany(x => x).ToList();
-
- var result = query.GroupBy(t => t.Key).CartesianProduct().ToList();
-
- return result;
- }
-
- #endregion
-
- #region Gift voucher attributes
-
- /// <summary>
- /// Add gift voucher attrbibutes
- /// </summary>
- /// <param name="attributes">Attributes</param>
- /// <param name="recipientName">Recipient name</param>
- /// <param name="recipientEmail">Recipient email</param>
- /// <param name="senderName">Sender name</param>
- /// <param name="senderEmail">Sender email</param>
- /// <param name="giftVoucherMessage">Message</param>
- /// <returns>Attributes</returns>
- public IList<CustomAttribute> AddGiftVoucherAttribute(IList<CustomAttribute> customAttributes, string recipientName,
- string recipientEmail, string senderName, string senderEmail, string giftVoucherMessage)
- {
- if (customAttributes == null)
- customAttributes = new List<CustomAttribute>();
-
- customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = recipientName });
- customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = recipientEmail });
- customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = senderName });
- customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = senderEmail });
- customAttributes.Add(new CustomAttribute() { Key = "Message", Value = giftVoucherMessage });
-
- return customAttributes;
- }
-
- /// <summary>
- /// Get gift voucher attrbibutes
- /// </summary>
- /// <param name="attributes">Attributes</param>
- /// <param name="recipientName">Recipient name</param>
- /// <param name="recipientEmail">Recipient email</param>
- /// <param name="senderName">Sender name</param>
- /// <param name="senderEmail">Sender email</param>
- /// <param name="giftVoucherMessage">Message</param>
- public void GetGiftVoucherAttribute(IList<CustomAttribute> customAttributes, out string recipientName,
- out string recipientEmail, out string senderName,
- out string senderEmail, out string giftVoucherMessage)
- {
- if (customAttributes == null)
- customAttributes = new List<CustomAttribute>();
-
- recipientName = customAttributes.FirstOrDefault(x => x.Key == "RecipientName")?.Value;
- recipientEmail = customAttributes.FirstOrDefault(x => x.Key == "RecipientEmail")?.Value; ;
- senderName = customAttributes.FirstOrDefault(x => x.Key == "SenderName")?.Value; ;
- senderEmail = customAttributes.FirstOrDefault(x => x.Key == "SenderEmail")?.Value; ;
- giftVoucherMessage = customAttributes.FirstOrDefault(x => x.Key == "Message")?.Value; ;
-
- }
-
- #endregion
- }
-}
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs
index 650853562..09d84111f 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs
@@ -1,6 +1,5 @@
using Grand.Business.Core.Events.Catalog;
using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Catalog.Queries.Handlers;
using Grand.Business.Core.Queries.Catalog;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Domain;
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/StockQuantityService.cs b/src/Business/Grand.Business.Catalog/Services/Products/StockQuantityService.cs
index 924bd4308..8e75520c0 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/StockQuantityService.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/StockQuantityService.cs
@@ -8,14 +8,10 @@ namespace Grand.Business.Catalog.Services.Products
public class StockQuantityService : IStockQuantityService
{
private readonly ITranslationService _translationService;
- private readonly IProductAttributeParser _productAttributeParser;
-
public StockQuantityService(
- ITranslationService translationService,
- IProductAttributeParser productAttributeParser)
+ ITranslationService translationService)
{
_translationService = translationService;
- _productAttributeParser = productAttributeParser;
}
public virtual int GetTotalStockQuantity(Product product, bool useReservedQuantity = true,
@@ -154,7 +150,7 @@ namespace Grand.Business.Catalog.Services.Products
if (!product.StockAvailability)
return stockMessage;
- var combination = _productAttributeParser.FindProductAttributeCombination(product, attributes);
+ var combination = product.FindProductAttributeCombination(attributes);
if (combination != null)
{
//combination exists
diff --git a/src/Business/Grand.Business.Catalog/Startup/StartupApplication.cs b/src/Business/Grand.Business.Catalog/Startup/StartupApplication.cs
index 96d20ea3c..973dbbf77 100644
--- a/src/Business/Grand.Business.Catalog/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.Catalog/Startup/StartupApplication.cs
@@ -48,7 +48,6 @@ namespace Grand.Business.Catalog.Startup
serviceCollection.AddScoped<ICollectionService, CollectionService>();
serviceCollection.AddScoped<IPriceFormatter, PriceFormatter>();
serviceCollection.AddScoped<IProductAttributeFormatter, ProductAttributeFormatter>();
- serviceCollection.AddScoped<IProductAttributeParser, ProductAttributeParser>();
serviceCollection.AddScoped<IProductAttributeService, ProductAttributeService>();
serviceCollection.AddScoped<IProductService, ProductService>();
serviceCollection.AddScoped<IProductCategoryService, ProductCategoryService>();
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ActivatedValueForPurchasedVouchersCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ActivatedValueForPurchasedVouchersCommandHandler.cs
index 35661e530..32bcaf426 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ActivatedValueForPurchasedVouchersCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ActivatedValueForPurchasedVouchersCommandHandler.cs
@@ -37,25 +37,22 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
if (request.Activate)
{
//activate
- bool isRecipientNotified = gc.IsRecipientNotified;
if (gc.GiftVoucherTypeId == GiftVoucherType.Virtual)
{
//send email for virtual gift voucher
- if (!String.IsNullOrEmpty(gc.RecipientEmail) &&
- !String.IsNullOrEmpty(gc.SenderEmail))
+ if (!string.IsNullOrEmpty(gc.RecipientEmail) &&
+ !string.IsNullOrEmpty(gc.SenderEmail))
{
var customerLang = await _languageService.GetLanguageById(request.Order.CustomerLanguageId);
if (customerLang == null)
customerLang = (await _languageService.GetAllLanguages()).FirstOrDefault();
if (customerLang == null)
throw new Exception("No languages could be loaded");
- int queuedEmailId = await _messageProviderService.SendGiftVoucherMessage(gc, request.Order, customerLang.Id);
- if (queuedEmailId > 0)
- isRecipientNotified = true;
+ _ = await _messageProviderService.SendGiftVoucherMessage(gc, request.Order, customerLang.Id);
+ gc.IsRecipientNotified = true;
}
}
gc.IsGiftVoucherActivated = true;
- gc.IsRecipientNotified = isRecipientNotified;
await _giftVoucherService.UpdateGiftVoucher(gc);
}
else
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/AddRequiredProductsCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/AddRequiredProductsCommandHandler.cs
index 369596f4d..36064e8c6 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/AddRequiredProductsCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/AddRequiredProductsCommandHandler.cs
@@ -1,12 +1,10 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Commands.Checkout.Orders;
+using Grand.Business.Core.Commands.Checkout.Orders;
+using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Checkout.Orders;
-using Grand.Business.Checkout.Services.Orders;
+using Grand.Business.Core.Utilities.Checkout;
using Grand.Domain.Catalog;
using Grand.Domain.Orders;
using MediatR;
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Utilities.Checkout;
namespace Grand.Business.Checkout.Commands.Handlers.Orders
{
@@ -69,13 +67,12 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
productId: rp.Id,
shoppingCartType: shoppingCartType,
storeId: storeId,
- automaticallyAddRequiredProductsIfEnabled: false,
+ automaticallyAddRequiredProductsIfEnabled: false,
validator: new ShoppingCartValidatorOptions() { GetRequiredProductWarnings = false });
if (rp.RequireOtherProducts && addToCart.warnings.Count == 0)
{
- await Handle(new AddRequiredProductsCommand
- {
+ await Handle(new AddRequiredProductsCommand {
Customer = customer,
ShoppingCartType = shoppingCartType,
StoreId = storeId,
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/CancelOrderItemCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/CancelOrderItemCommandHandler.cs
index 590135187..238037bca 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/CancelOrderItemCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/CancelOrderItemCommandHandler.cs
@@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using MediatR;
-using Grand.Business.Core.Extensions;
namespace Grand.Business.Checkout.Commands.Handlers.Orders
{
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/DeleteOrderItemCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/DeleteOrderItemCommandHandler.cs
index 86a27c99c..79ed9330c 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/DeleteOrderItemCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/DeleteOrderItemCommandHandler.cs
@@ -6,7 +6,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using MediatR;
-using Grand.Business.Core.Extensions;
namespace Grand.Business.Checkout.Commands.Handlers.Orders
{
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
index 5d8ff8d62..054e44937 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
@@ -48,7 +48,6 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
private readonly IOrderCalculationService _orderTotalCalculationService;
private readonly IPricingService _pricingService;
private readonly IPriceFormatter _priceFormatter;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IProductAttributeFormatter _productAttributeFormatter;
private readonly IGiftVoucherService _giftVoucherService;
private readonly ICheckoutAttributeFormatter _checkoutAttributeFormatter;
@@ -86,7 +85,6 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
IOrderCalculationService orderTotalCalculationService,
IPricingService priceCalculationService,
IPriceFormatter priceFormatter,
- IProductAttributeParser productAttributeParser,
IProductAttributeFormatter productAttributeFormatter,
IGiftVoucherService giftVoucherService,
ICheckoutAttributeFormatter checkoutAttributeFormatter,
@@ -123,7 +121,6 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
_orderTotalCalculationService = orderTotalCalculationService;
_pricingService = priceCalculationService;
_priceFormatter = priceFormatter;
- _productAttributeParser = productAttributeParser;
_productAttributeFormatter = productAttributeFormatter;
_giftVoucherService = giftVoucherService;
_checkoutAttributeFormatter = checkoutAttributeFormatter;
@@ -361,7 +358,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
double attributesTotalWeight = 0;
if (shoppingCartItem.Attributes != null && shoppingCartItem.Attributes.Any())
{
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, shoppingCartItem.Attributes);
+ var attributeValues = product.ParseProductAttributeValues(shoppingCartItem.Attributes);
foreach (var attributeValue in attributeValues)
{
switch (attributeValue.AttributeValueTypeId)
@@ -695,7 +692,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
var orderItem = new OrderItem {
OrderItemGuid = Guid.NewGuid(),
ProductId = sc.ProductId,
- Sku = product.FormatSku(sc.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(sc.Attributes),
VendorId = product.VendorId,
WarehouseId = warehouseId,
SeId = details.Customer.SeId,
@@ -761,7 +758,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
protected virtual async Task GenerateGiftVoucher(PlaceOrderContainter details, ShoppingCartItem sc, Order order, OrderItem orderItem, Product product)
{
- _productAttributeParser.GetGiftVoucherAttribute(sc.Attributes,
+ GiftVoucherExtensions.GetGiftVoucherAttribute(sc.Attributes,
out var giftVoucherRecipientName, out var giftVoucherRecipientEmail,
out var giftVoucherSenderName, out var giftVoucherSenderEmail, out var giftVoucherMessage);
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReOrderCommandHandler.cs
index 995d531a1..c9050b0b1 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReOrderCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReOrderCommandHandler.cs
@@ -1,7 +1,6 @@
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Commands.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Orders;
-using Grand.Business.Checkout.Services.Orders;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Domain.Catalog;
using Grand.Domain.Orders;
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs
index f1342f91d..012ed2321 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs
@@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using MediatR;
-using Grand.Business.Core.Extensions;
namespace Grand.Business.Checkout.Commands.Handlers.Orders
{
diff --git a/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeFormatter.cs b/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeFormatter.cs
index 4a94232b5..a81e07a1a 100644
--- a/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeFormatter.cs
+++ b/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeFormatter.cs
@@ -6,6 +6,7 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
+using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using System.Net;
diff --git a/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeParser.cs b/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeParser.cs
index 6298483ec..d1a8f19c4 100644
--- a/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeParser.cs
+++ b/src/Business/Grand.Business.Checkout/Services/CheckoutAttributes/CheckoutAttributeParser.cs
@@ -1,4 +1,3 @@
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
using Grand.Domain.Common;
using Grand.Domain.Orders;
diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
index 1baea66ef..61665351f 100644
--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
@@ -27,7 +27,6 @@ namespace Grand.Business.Checkout.Services.Orders
private readonly IWorkContext _workContext;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
private readonly ICustomerService _customerService;
private readonly IAclService _aclService;
@@ -43,7 +42,6 @@ namespace Grand.Business.Checkout.Services.Orders
public ShoppingCartService(
IWorkContext workContext,
IProductService productService,
- IProductAttributeParser productAttributeParser,
ICheckoutAttributeParser checkoutAttributeParser,
ICustomerService customerService,
IAclService aclService,
@@ -55,7 +53,6 @@ namespace Grand.Business.Checkout.Services.Orders
{
_workContext = workContext;
_productService = productService;
- _productAttributeParser = productAttributeParser;
_checkoutAttributeParser = checkoutAttributeParser;
_customerService = customerService;
_aclService = aclService;
@@ -129,7 +126,7 @@ namespace Grand.Business.Checkout.Services.Orders
{
//attributes
var _product = await _productService.GetProductById(sci.ProductId);
- bool attributesEqual = _productAttributeParser.AreProductAttributesEqual(_product, sci.Attributes, attributes, false);
+ bool attributesEqual = ProductExtensions.AreProductAttributesEqual(_product, sci.Attributes, attributes, false);
if (_product.ProductTypeId == ProductType.BundledProduct)
{
foreach (var bundle in _product.BundleProducts)
@@ -137,7 +134,7 @@ namespace Grand.Business.Checkout.Services.Orders
var p1 = await _productService.GetProductById(bundle.ProductId);
if (p1 != null)
{
- if (!_productAttributeParser.AreProductAttributesEqual(p1, sci.Attributes, attributes, false))
+ if (!ProductExtensions.AreProductAttributesEqual(p1, sci.Attributes, attributes, false))
attributesEqual = false;
}
}
@@ -146,11 +143,11 @@ namespace Grand.Business.Checkout.Services.Orders
bool giftVoucherInfoSame = true;
if (_product.IsGiftVoucher)
{
- _productAttributeParser.GetGiftVoucherAttribute(attributes,
+ GiftVoucherExtensions.GetGiftVoucherAttribute(attributes,
out var giftVoucherRecipientName1, out var giftVoucherRecipientEmail1,
out var giftVoucherSenderName1, out var giftVoucherSenderEmail1, out var giftVoucherMessage1);
- _productAttributeParser.GetGiftVoucherAttribute(sci.Attributes,
+ GiftVoucherExtensions.GetGiftVoucherAttribute(sci.Attributes,
out var giftVoucherRecipientName2, out var giftVoucherRecipientEmail2,
out var giftVoucherSenderName2, out var giftVoucherSenderEmail2, out var giftVoucherMessage2);
diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
index 9669ec700..77c390b9d 100644
--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
@@ -26,7 +26,6 @@ namespace Grand.Business.Checkout.Services.Orders
private readonly ICurrencyService _currencyService;
private readonly IProductService _productService;
private readonly ITranslationService _translationService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ICheckoutAttributeService _checkoutAttributeService;
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
private readonly IPriceFormatter _priceFormatter;
@@ -45,7 +44,6 @@ namespace Grand.Business.Checkout.Services.Orders
ICurrencyService currencyService,
IProductService productService,
ITranslationService translationService,
- IProductAttributeParser productAttributeParser,
ICheckoutAttributeService checkoutAttributeService,
ICheckoutAttributeParser checkoutAttributeParser,
IPriceFormatter priceFormatter,
@@ -62,7 +60,6 @@ namespace Grand.Business.Checkout.Services.Orders
_currencyService = currencyService;
_productService = productService;
_translationService = translationService;
- _productAttributeParser = productAttributeParser;
_checkoutAttributeService = checkoutAttributeService;
_checkoutAttributeParser = checkoutAttributeParser;
_priceFormatter = priceFormatter;
@@ -176,7 +173,7 @@ namespace Grand.Business.Checkout.Services.Orders
var warnings = new List<string>();
//ensure it's our attributes
- var attributes1 = _productAttributeParser.ParseProductAttributeMappings(product, shoppingCartItem.Attributes).ToList();
+ var attributes1 = product.ParseProductAttributeMappings(shoppingCartItem.Attributes).ToList();
if (product.ProductTypeId == ProductType.BundledProduct)
{
foreach (var bundle in product.BundleProducts)
@@ -184,7 +181,7 @@ namespace Grand.Business.Checkout.Services.Orders
var p1 = await _productService.GetProductById(bundle.ProductId);
if (p1 != null)
{
- var a1 = _productAttributeParser.ParseProductAttributeMappings(p1, shoppingCartItem.Attributes).ToList();
+ var a1 = p1.ParseProductAttributeMappings(shoppingCartItem.Attributes).ToList();
attributes1.AddRange(a1);
}
}
@@ -225,7 +222,7 @@ namespace Grand.Business.Checkout.Services.Orders
//validate conditional attributes only (if specified)
attributes2 = attributes2.Where(x =>
{
- var conditionMet = _productAttributeParser.IsConditionMet(product, x, shoppingCartItem.Attributes);
+ var conditionMet = product.IsConditionMet(x, shoppingCartItem.Attributes);
return !conditionMet.HasValue || conditionMet.Value;
}).ToList();
foreach (var a2 in attributes2)
@@ -238,7 +235,7 @@ namespace Grand.Business.Checkout.Services.Orders
{
if (a1.Id == a2.Id)
{
- var attributeValuesStr = _productAttributeParser.ParseValues(shoppingCartItem.Attributes, a1.Id);
+ var attributeValuesStr = ProductExtensions.ParseValues(shoppingCartItem.Attributes, a1.Id);
foreach (string str1 in attributeValuesStr)
{
if (!String.IsNullOrEmpty(str1.Trim()))
@@ -273,7 +270,7 @@ namespace Grand.Business.Checkout.Services.Orders
.Select(x => x.Id)
.ToArray();
- var selectedReadOnlyValueIds = _productAttributeParser.ParseProductAttributeValues(product, shoppingCartItem.Attributes)
+ var selectedReadOnlyValueIds = product.ParseProductAttributeValues(shoppingCartItem.Attributes)
//.Where(x => x.ProductAttributeMappingId == a2.Id)
.Select(x => x.Id)
.ToArray();
@@ -297,7 +294,7 @@ namespace Grand.Business.Checkout.Services.Orders
if (pam.AttributeControlTypeId == AttributeControlType.TextBox ||
pam.AttributeControlTypeId == AttributeControlType.MultilineTextbox)
{
- var valuesStr = _productAttributeParser.ParseValues(shoppingCartItem.Attributes, pam.Id);
+ var valuesStr = ProductExtensions.ParseValues(shoppingCartItem.Attributes, pam.Id);
var enteredText = valuesStr.FirstOrDefault();
int enteredTextLength = String.IsNullOrEmpty(enteredText) ? 0 : enteredText.Length;
@@ -315,7 +312,7 @@ namespace Grand.Business.Checkout.Services.Orders
if (pam.AttributeControlTypeId == AttributeControlType.TextBox ||
pam.AttributeControlTypeId == AttributeControlType.MultilineTextbox)
{
- var valuesStr = _productAttributeParser.ParseValues(shoppingCartItem.Attributes, pam.Id);
+ var valuesStr = ProductExtensions.ParseValues(shoppingCartItem.Attributes, pam.Id);
var enteredText = valuesStr.FirstOrDefault();
int enteredTextLength = string.IsNullOrEmpty(enteredText) ? 0 : enteredText.Length;
@@ -332,7 +329,7 @@ namespace Grand.Business.Checkout.Services.Orders
return warnings;
//validate bundled products
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, shoppingCartItem.Attributes);
+ var attributeValues = product.ParseProductAttributeValues(shoppingCartItem.Attributes);
foreach (var attributeValue in attributeValues)
{
var _productAttributeMapping = product.ProductAttributeMappings.Where(x => x.ProductAttributeValues.Any(z => z.Id == attributeValue.Id)).FirstOrDefault();
@@ -385,9 +382,9 @@ namespace Grand.Business.Checkout.Services.Orders
//gift vouchers
if (product.IsGiftVoucher)
{
- _productAttributeParser.GetGiftVoucherAttribute(attributes,
- out string giftVoucherRecipientName, out string giftVoucherRecipientEmail,
- out string giftVoucherSenderName, out string giftVoucherSenderEmail, out string giftVoucherMessage);
+ GiftVoucherExtensions.GetGiftVoucherAttribute(attributes,
+ out var giftVoucherRecipientName, out var giftVoucherRecipientEmail,
+ out var giftVoucherSenderName, out var giftVoucherSenderEmail, out var _);
if (string.IsNullOrEmpty(giftVoucherRecipientName))
warnings.Add(_translationService.GetResource("ShoppingCart.RecipientNameError"));
@@ -503,7 +500,7 @@ namespace Grand.Business.Checkout.Services.Orders
}
if (p1.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(p1, shoppingCartItem.Attributes);
+ var combination = p1.FindProductAttributeCombination(shoppingCartItem.Attributes);
if (combination != null)
{
//combination exists - check stock level
@@ -532,7 +529,7 @@ namespace Grand.Business.Checkout.Services.Orders
break;
case ManageInventoryMethod.ManageStockByAttributes:
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, shoppingCartItem.Attributes);
+ var combination = product.FindProductAttributeCombination(shoppingCartItem.Attributes);
if (combination != null)
{
//combination exists - check stock level
diff --git a/src/Business/Grand.Business.Checkout/Services/Shipping/GeneralShipmentTracker.cs b/src/Business/Grand.Business.Checkout/Services/Shipping/GeneralShipmentTracker.cs
deleted file mode 100644
index 7fd29c71b..000000000
--- a/src/Business/Grand.Business.Checkout/Services/Shipping/GeneralShipmentTracker.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using Grand.Business.Core.Enums.Checkout;
-using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Infrastructure.TypeSearchers;
-
-namespace Grand.Business.Checkout.Services.Shipping
-{
- /// <summary>
- /// General shipment tracker (finds an appropriate tracker by tracking number)
- /// </summary>
- public partial class GeneralShipmentTracker : IShipmentTracker
- {
- #region Fields
-
- private readonly ITypeSearcher _typeSearcher;
-
- #endregion
-
- #region Ctor
-
- /// <summary>
- /// Ctor
- /// </summary>
- /// <param name="typeSearcher">Type finder</param>
- public GeneralShipmentTracker(ITypeSearcher typeSearcher)
- {
- _typeSearcher = typeSearcher;
- }
-
- #endregion
-
- #region Utilities
-
- /// <summary>
- /// Gets all trackers
- /// </summary>
- /// <returns>All available shipment trackers</returns>
- protected virtual IList<IShipmentTracker> GetAllTrackers()
- {
- return _typeSearcher.ClassesOfType<IShipmentTracker>()
- //exclude this one
- .Where(x => x != typeof(GeneralShipmentTracker))
- .Select(x => x as IShipmentTracker)
- .ToList();
- }
-
- protected virtual async Task<IShipmentTracker> GetTrackerByTrackingNumber(string trackingNumber)
- {
- foreach (var item in GetAllTrackers())
- {
- if (await item.IsMatch(trackingNumber))
- return item;
- }
- return null;
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets if the current tracker can track the tracking number.
- /// </summary>
- /// <param name="trackingNumber">The tracking number to track.</param>
- /// <returns>True if the tracker can track, otherwise false.</returns>
- public virtual async Task<bool> IsMatch(string trackingNumber)
- {
- var tracker = await GetTrackerByTrackingNumber(trackingNumber);
- if (tracker != null)
- return await tracker.IsMatch(trackingNumber);
- return false;
- }
-
- /// <summary>
- /// Gets a url for a page to show tracking info (third party tracking page).
- /// </summary>
- /// <param name="trackingNumber">The tracking number to track.</param>
- /// <returns>A url to a tracking page.</returns>
- public virtual async Task<string> GetUrl(string trackingNumber)
- {
- var tracker = await GetTrackerByTrackingNumber(trackingNumber);
- if (tracker != null)
- return await tracker.GetUrl(trackingNumber);
- return null;
- }
-
- /// <summary>
- /// Gets all events for a tracking number.
- /// </summary>
- /// <param name="trackingNumber">The tracking number to track</param>
- /// <returns>List of Shipment Events.</returns>
- public virtual async Task<IList<ShipmentStatusEvent>> GetShipmentEvents(string trackingNumber)
- {
- if (string.IsNullOrEmpty(trackingNumber))
- return new List<ShipmentStatusEvent>();
-
- var tracker = await GetTrackerByTrackingNumber(trackingNumber);
- if (tracker != null)
- return await tracker.GetShipmentEvents(trackingNumber);
- return new List<ShipmentStatusEvent>();
- }
-
- #endregion
- }
-}
diff --git a/src/Business/Grand.Business.Checkout/Startup/StartupApplication.cs b/src/Business/Grand.Business.Checkout/Startup/StartupApplication.cs
index 829f12ba3..4f076e765 100644
--- a/src/Business/Grand.Business.Checkout/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.Checkout/Startup/StartupApplication.cs
@@ -1,19 +1,18 @@
-using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
-using Grand.Business.Core.Interfaces.Checkout.GiftVouchers;
-using Grand.Business.Core.Interfaces.Checkout.Orders;
-using Grand.Business.Core.Interfaces.Checkout.Payments;
-using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Checkout.Services.CheckoutAttributes;
+using Grand.Business.Checkout.Services.CheckoutAttributes;
using Grand.Business.Checkout.Services.GiftVouchers;
using Grand.Business.Checkout.Services.Orders;
using Grand.Business.Checkout.Services.Payments;
using Grand.Business.Checkout.Services.Shipping;
+using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
+using Grand.Business.Core.Interfaces.Checkout.GiftVouchers;
+using Grand.Business.Core.Interfaces.Checkout.Orders;
+using Grand.Business.Core.Interfaces.Checkout.Payments;
+using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Grand.Business.Core.Utilities.Checkout;
namespace Grand.Business.Checkout.Startup
{
diff --git a/src/Business/Grand.Business.Marketing/Services/Knowledgebase/KnowledgebaseService.cs b/src/Business/Grand.Business.Cms/Services/KnowledgebaseService.cs
similarity index 98%
rename from src/Business/Grand.Business.Marketing/Services/Knowledgebase/KnowledgebaseService.cs
rename to src/Business/Grand.Business.Cms/Services/KnowledgebaseService.cs
index 9102a6595..a009a7e55 100644
--- a/src/Business/Grand.Business.Marketing/Services/Knowledgebase/KnowledgebaseService.cs
+++ b/src/Business/Grand.Business.Cms/Services/KnowledgebaseService.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
+using Grand.Business.Core.Interfaces.Cms;
using Grand.Domain;
using Grand.Domain.Customers;
using Grand.Domain.Data;
@@ -11,7 +10,7 @@ using Grand.Infrastructure.Extensions;
using Grand.SharedKernel.Extensions;
using MediatR;
-namespace Grand.Business.Marketing.Services.Knowledgebase
+namespace Grand.Business.Cms.Services
{
public class KnowledgebaseService : IKnowledgebaseService
{
@@ -148,7 +147,7 @@ namespace Grand.Business.Marketing.Services.Knowledgebase
public virtual async Task<List<KnowledgebaseCategory>> GetKnowledgebaseCategories()
{
var categories = _knowledgebaseCategoryRepository.Table.OrderBy(x => x.ParentCategoryId).ThenBy(x => x.DisplayOrder).ToList();
- return await Task.FromResult(categories.SortCategoriesForTree());
+ return await Task.FromResult(categories);
}
/// <summary>
@@ -344,7 +343,7 @@ namespace Grand.Business.Marketing.Services.Knowledgebase
//Store acl
query = from p in query
where !p.LimitedToStores || p.Stores.Contains(_workContext.CurrentStore.Id)
- select p;
+ select p;
}
return await Task.FromResult(query.FirstOrDefault());
@@ -522,7 +521,7 @@ namespace Grand.Business.Marketing.Services.Knowledgebase
query = query.Where(p => p.Locales.Any(x => x.LocaleKey == "Name" && x.LocaleValue != null && x.LocaleValue.ToLower().Contains(name.ToLower()))
|| p.Name.ToLower().Contains(name.ToLower()));
-
+
}
query = query.OrderBy(x => x.DisplayOrder);
diff --git a/src/Business/Grand.Business.Cms/Startup/StartupApplication.cs b/src/Business/Grand.Business.Cms/Startup/StartupApplication.cs
index 52fb49209..4e9b458cd 100644
--- a/src/Business/Grand.Business.Cms/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.Cms/Startup/StartupApplication.cs
@@ -15,6 +15,7 @@ namespace Grand.Business.Cms.Startup
services.AddScoped<IBlogService, BlogService>();
services.AddScoped<IWidgetService, WidgetService>();
services.AddScoped<INewsService, NewsService>();
+ services.AddScoped<IKnowledgebaseService, KnowledgebaseService>();
services.AddScoped<IPageLayoutService, PageLayoutService>();
services.AddScoped<IPageService, PageService>();
services.AddScoped<ICookiePreference, CookiePreference>();
diff --git a/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs b/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
index e8a50ed9c..494ad958d 100644
--- a/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
+++ b/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
@@ -29,10 +29,6 @@ namespace Grand.Business.Common.Services.Security
StandardPermission.ManageSalesEmployees,
StandardPermission.ManageAddressAttribute,
StandardPermission.ManageCustomerAttribute,
- StandardPermission.ManageActions,
- StandardPermission.ManageReminders,
- StandardPermission.ManageBanners,
- StandardPermission.ManageInteractiveForm,
StandardPermission.ManageVendors,
StandardPermission.ManageVendorReviews,
StandardPermission.ManageCurrentCarts,
@@ -170,10 +166,6 @@ namespace Grand.Business.Common.Services.Security
StandardPermission.EnableWishlist,
StandardPermission.PublicStoreAllowNavigation,
StandardPermission.AccessClosedStore,
- StandardPermission.ManageBanners,
- StandardPermission.ManageInteractiveForm,
- StandardPermission.ManageActions,
- StandardPermission.ManageReminders,
StandardPermission.AllowUseApi
}
},
diff --git a/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventConditionCommand.cs b/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventConditionCommand.cs
deleted file mode 100644
index b2ad9eba5..000000000
--- a/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventConditionCommand.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Grand.Domain.Common;
-using Grand.Domain.Customers;
-using MediatR;
-
-namespace Grand.Business.Core.Commands.Marketing
-{
- public class CustomerActionEventConditionCommand : IRequest<bool>
- {
- public CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = new List<CustomerActionType>();
- }
- public IList<CustomerActionType> CustomerActionTypes { get; set; }
- public CustomerAction Action { get; set; }
- public string ProductId { get; set; }
- public IList<CustomAttribute> Attributes { get; set; } = new List<CustomAttribute>();
- public string CustomerId { get; set; }
- public string CurrentUrl { get; set; }
- public string PreviousUrl { get; set; }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventReactionCommand.cs b/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventReactionCommand.cs
deleted file mode 100644
index 488294564..000000000
--- a/src/Business/Grand.Business.Core/Commands/Marketing/CustomerActionEventReactionCommand.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Domain.Orders;
-using MediatR;
-
-namespace Grand.Business.Core.Commands.Marketing
-{
- public class CustomerActionEventReactionCommand : IRequest<bool>
- {
- public CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = new List<CustomerActionType>();
- }
- public IList<CustomerActionType> CustomerActionTypes { get; set; }
- public CustomerAction Action { get; set; }
- public ShoppingCartItem CartItem { get; set; }
- public Order Order { get; set; }
- public string CustomerId { get; set; }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/AffiliateExtensions.cs b/src/Business/Grand.Business.Core/Extensions/AffiliateExtensions.cs
index 1b339adfd..09fab33af 100644
--- a/src/Business/Grand.Business.Core/Extensions/AffiliateExtensions.cs
+++ b/src/Business/Grand.Business.Core/Extensions/AffiliateExtensions.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Customers;
+using Grand.Business.Core.Interfaces.Customers;
using Grand.Domain.Affiliates;
using Grand.Domain.Seo;
using Grand.Infrastructure.Extensions;
diff --git a/src/Business/Grand.Business.Core/Extensions/BlogExtensions.cs b/src/Business/Grand.Business.Core/Extensions/BlogExtensions.cs
deleted file mode 100644
index 27d715dd8..000000000
--- a/src/Business/Grand.Business.Core/Extensions/BlogExtensions.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Grand.Domain.Blogs;
-
-namespace Grand.Business.Core.Extensions
-{
- /// <summary>
- /// Extensions
- /// </summary>
- public static class BlogExtensions
- {
- /// <summary>
- /// Returns all posts published between the two dates.
- /// </summary>
- /// <param name="source">Source</param>
- /// <param name="dateFrom">Date from</param>
- /// <param name="dateTo">Date to</param>
- /// <returns>Filtered posts</returns>
- public static IList<BlogPost> GetPostsByDate(this IList<BlogPost> source,
- DateTime dateFrom, DateTime dateTo)
- {
- return source.Where(p => dateFrom.Date <= (p.StartDateUtc ?? p.CreatedOnUtc) && (p.StartDateUtc ?? p.CreatedOnUtc).Date <= dateTo).ToList();
- }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/ProductExtensions.cs b/src/Business/Grand.Business.Core/Extensions/ProductExtensions.cs
deleted file mode 100644
index f12fc9fa5..000000000
--- a/src/Business/Grand.Business.Core/Extensions/ProductExtensions.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Storage;
-using Grand.Domain.Catalog;
-using Grand.Domain.Common;
-using Grand.Domain.Customers;
-using Grand.Domain.Media;
-
-namespace Grand.Business.Core.Extensions
-{
- public static class ProductExtensions
- {
- /// <summary>
- /// Used to get an appropriate tier price
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="customer">Customer</param>
- /// <param name="storeId">Store id</param>
- /// <param name="quantity">Quantity</param>
- /// <returns>Price</returns>
- public static TierPrice GetPreferredTierPrice(this Product product, Customer customer, string storeId, string currencyCode, int quantity)
- {
- if (!product.TierPrices.Any())
- return null;
-
- var actualTierPrices = product.TierPrices.OrderBy(price => price.Quantity).ToList()
- .FilterByStore(storeId)
- .FilterByCurrency(currencyCode)
- .FilterForCustomer(customer)
- .FilterByDate()
- .RemoveDuplicatedQuantities();
-
- var tierPrice = actualTierPrices.LastOrDefault(price => quantity >= price.Quantity);
-
- return tierPrice;
- }
-
- /// <summary>
- /// Check if product tag exists
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="productTagId">Product tag id</param>
- /// <returns>Result</returns>
- public static bool ProductTagExists(this Product product,
- string productTagName)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- bool result = product.ProductTags.FirstOrDefault(pt => pt == productTagName) != null;
- return result;
- }
-
- /// <summary>
- /// List of allowed quantities
- /// </summary>
- /// <param name="product">Product</param>
- /// <returns>Result</returns>
- public static int[] ParseAllowedQuantities(this Product product)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- var result = new List<int>();
- if (!String.IsNullOrWhiteSpace(product.AllowedQuantities))
- {
- product.AllowedQuantities
- .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
- .ToList()
- .ForEach(qtyStr =>
- {
- int qty;
- if (int.TryParse(qtyStr.Trim(), out qty))
- {
- result.Add(qty);
- }
- });
- }
-
- return result.ToArray();
- }
-
- /// <summary>
- /// Gets SKU, Collection part number and GTIN
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeParser">Product attribute service</param>
- /// <param name="sku">SKU</param>
- /// <param name="Mpn">MPN</param>
- /// <param name="gtin">GTIN</param>
- private static void GetSkuMpnGtin(this Product product, IList<CustomAttribute> attributes, IProductAttributeParser productAttributeParser,
- out string sku, out string Mpn, out string gtin)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- sku = null;
- Mpn = null;
- gtin = null;
-
- if (attributes != null &&
- product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
- {
- if (productAttributeParser == null)
- throw new ArgumentNullException(nameof(productAttributeParser));
-
- var combination = productAttributeParser.FindProductAttributeCombination(product, attributes);
- if (combination != null)
- {
- sku = combination.Sku;
- Mpn = combination.Mpn;
- gtin = combination.Gtin;
- }
- }
-
- if (string.IsNullOrEmpty(sku))
- sku = product.Sku;
- if (string.IsNullOrEmpty(Mpn))
- Mpn = product.Mpn;
- if (string.IsNullOrEmpty(gtin))
- gtin = product.Gtin;
- }
-
- /// <summary>
- /// SKU
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeParser">Product attribute service</param>
- /// <returns>SKU</returns>
- public static string FormatSku(this Product product, IList<CustomAttribute> attributes = null, IProductAttributeParser productAttributeParser = null)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- string sku;
-
- product.GetSkuMpnGtin(attributes, productAttributeParser,
- out sku, out _, out _);
-
- return sku;
- }
-
- /// <summary>
- /// MPN
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeParser">Product attribute service</param>
- /// <returns>Collection part number</returns>
- public static string FormatMpn(this Product product, IList<CustomAttribute> attributes = null, IProductAttributeParser productAttributeParser = null)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- string Mpn;
-
- product.GetSkuMpnGtin(attributes, productAttributeParser,
- out _, out Mpn, out _);
-
- return Mpn;
- }
-
- /// <summary>
- /// GTIN
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="productAttributeParser">Product attribute service</param>
- /// <returns>GTIN</returns>
- public static string FormatGtin(this Product product, IList<CustomAttribute> attributes = null, IProductAttributeParser productAttributeParser = null)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- string gtin;
-
- product.GetSkuMpnGtin(attributes, productAttributeParser,
- out _, out _, out gtin);
-
- return gtin;
- }
-
- /// <summary>
- /// Get product picture (for shopping cart and order details pages)
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Atributes </param>
- /// <param name="pictureService">Picture service</param>
- /// <param name="productAttributeParser">Product attribute service</param>
- /// <returns>Picture</returns>
- public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,
- IProductService productService, IPictureService pictureService,
- IProductAttributeParser productAttributeParser)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
- if (pictureService == null)
- throw new ArgumentNullException(nameof(pictureService));
- if (productAttributeParser == null)
- throw new ArgumentNullException(nameof(productAttributeParser));
-
- Picture picture = null;
-
- if (attributes != null && attributes.Any())
- {
-
- var comb = productAttributeParser.FindProductAttributeCombination(product, attributes);
- if (comb != null)
- {
- if (!string.IsNullOrEmpty(comb.PictureId))
- {
- var combPicture = await pictureService.GetPictureById(comb.PictureId);
- if (combPicture != null)
- {
- picture = combPicture;
- }
- }
- }
- if (picture == null)
- {
- var attributeValues = productAttributeParser.ParseProductAttributeValues(product, attributes);
- foreach (var attributeValue in attributeValues)
- {
- var attributePicture = await pictureService.GetPictureById(attributeValue.PictureId);
- if (attributePicture != null)
- {
- picture = attributePicture;
- break;
- }
- }
- }
- }
- if (picture == null)
- {
- var pp = product.ProductPictures.OrderBy(x => x.DisplayOrder).FirstOrDefault();
- if (pp != null)
- picture = await pictureService.GetPictureById(pp.PictureId);
- }
-
- if (picture == null && !product.VisibleIndividually && !string.IsNullOrEmpty(product.ParentGroupedProductId))
- {
- var parentProduct = await productService.GetProductById(product.ParentGroupedProductId);
- if (parentProduct != null)
- if (parentProduct.ProductPictures.Any())
- {
- picture = await pictureService.GetPictureById(parentProduct.ProductPictures.FirstOrDefault().PictureId);
-
- }
- }
-
- return picture;
- }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Catalog/Products/IProductAttributeParser.cs b/src/Business/Grand.Business.Core/Interfaces/Catalog/Products/IProductAttributeParser.cs
deleted file mode 100644
index c6de12bb8..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Catalog/Products/IProductAttributeParser.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using Grand.Domain.Catalog;
-using Grand.Domain.Common;
-
-namespace Grand.Business.Core.Interfaces.Catalog.Products
-{
- /// <summary>
- /// Product attribute parser interface
- /// </summary>
- public partial interface IProductAttributeParser
- {
- #region Product attributes
-
- /// <summary>
- /// Gets selected product attribute mappings
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <returns>Selected product attribute mappings</returns>
- IList<ProductAttributeMapping> ParseProductAttributeMappings(Product product, IList<CustomAttribute> customAttributes);
-
- /// <summary>
- /// Get product attribute values
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <returns>Product attribute values</returns>
- IList<ProductAttributeValue> ParseProductAttributeValues(Product product, IList<CustomAttribute> customAttributes);
-
- /// <summary>
- /// Gets selected product attribute values
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <param name="productAttributeMappingId">Product attribute mapping identifier</param>
- /// <returns>Product attribute values</returns>
- IList<string> ParseValues(IList<CustomAttribute> customAttributes, string productAttributeMappingId);
-
- /// <summary>
- /// Adds an attribute
- /// </summary>
- /// <param name="customattributes">Attributes</param>
- /// <param name="productAttributeMapping">Product attribute mapping</param>
- /// <param name="value">Value</param>
- /// <returns>Attributes</returns>
- IList<CustomAttribute> AddProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping, string value);
-
- /// <summary>
- /// Remove an attribute
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <param name="productAttributeMapping">Product attribute mapping</param>
- /// <returns>Updated result</returns>
- IList<CustomAttribute> RemoveProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping);
-
-
- /// <summary>
- /// Are attributes equal
- /// </summary>
- /// <param name="customAttributes1">The attributes of the first product</param>
- /// <param name="customAttributes2">The attributes of the second product</param>
- /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
- /// <returns>Result</returns>
- bool AreProductAttributesEqual(Product product, IList<CustomAttribute> customAttributes1, IList<CustomAttribute> customAttributes2, bool ignoreNonCombinableAttributes);
-
- /// <summary>
- /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified
- /// </summary>
- /// <param name="pam">Product attribute</param>
- /// <param name="selectedAttributes">Selected attributes</param>
- /// <returns>Result</returns>
- bool? IsConditionMet(Product product, ProductAttributeMapping pam, IList<CustomAttribute> selectedAttributes);
-
- /// <summary>
- /// Finds a product attribute combination by attributes stored in XML
- /// </summary>
- /// <param name="product">Product</param>
- /// <param name="attributes">Attributes</param>
- /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
- /// <returns>Found product attribute combination</returns>
- ProductAttributeCombination FindProductAttributeCombination(Product product,
- IList<CustomAttribute> customAttributes, bool ignoreNonCombinableAttributes = true);
-
- /// <summary>
- /// Generate all combinations
- /// </summary>
- /// <param name="product">Product</param>
- /// <returns>Attribute combinations</returns>
- IList<IEnumerable<CustomAttribute>> GenerateAllCombinations(Product product);
-
- #endregion
-
- #region Gift voucher attributes
-
- /// <summary>
- /// Add gift voucher attrbibutes
- /// </summary>
- /// <param name="customAttributes">Attributes</param>
- /// <param name="recipientName">Recipient name</param>
- /// <param name="recipientEmail">Recipient email</param>
- /// <param name="senderName">Sender name</param>
- /// <param name="senderEmail">Sender email</param>
- /// <param name="giftVoucherMessage">Message</param>
- /// <returns>Attributes</returns>
- IList<CustomAttribute> AddGiftVoucherAttribute(IList<CustomAttribute> customAttributes, string recipientName,
- string recipientEmail, string senderName, string senderEmail, string giftVoucherMessage);
-
- /// <summary>
- /// Get gift voucher attrbibutes
- /// </summary>
- /// <param name="attributes">Attributes</param>
- /// <param name="recipientName">Recipient name</param>
- /// <param name="recipientEmail">Recipient email</param>
- /// <param name="senderName">Sender name</param>
- /// <param name="senderEmail">Sender email</param>
- /// <param name="giftVoucherMessage">Message</param>
- void GetGiftVoucherAttribute(IList<CustomAttribute> customAttributes, out string recipientName,
- out string recipientEmail, out string senderName,
- out string senderEmail, out string giftVoucherMessage);
-
- #endregion
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShipmentTracker.cs b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShipmentTracker.cs
index 800679169..672a428ca 100644
--- a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShipmentTracker.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShipmentTracker.cs
@@ -6,14 +6,7 @@ namespace Grand.Business.Core.Interfaces.Checkout.Shipping
/// Shipment tracker
/// </summary>
public partial interface IShipmentTracker
- {
- /// <summary>
- /// Gets if the current tracker can track the tracking number.
- /// </summary>
- /// <param name="trackingNumber">The tracking number to track.</param>
- /// <returns>True if the tracker can track, otherwise false.</returns>
- Task<bool> IsMatch(string trackingNumber);
-
+ {
/// <summary>
/// Gets a url for a page to show tracking info (third party tracking page).
/// </summary>
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Knowledgebase/IKnowledgebaseService.cs b/src/Business/Grand.Business.Core/Interfaces/Cms/IKnowledgebaseService.cs
similarity index 99%
rename from src/Business/Grand.Business.Core/Interfaces/Marketing/Knowledgebase/IKnowledgebaseService.cs
rename to src/Business/Grand.Business.Core/Interfaces/Cms/IKnowledgebaseService.cs
index baf839c1d..7a17f99d9 100644
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Knowledgebase/IKnowledgebaseService.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/Cms/IKnowledgebaseService.cs
@@ -1,7 +1,7 @@
using Grand.Domain;
using Grand.Domain.Knowledgebase;
-namespace Grand.Business.Core.Interfaces.Marketing.Knowledgebase
+namespace Grand.Business.Core.Interfaces.Cms
{
public interface IKnowledgebaseService
{
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Banners/IBannerService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Banners/IBannerService.cs
deleted file mode 100644
index 3dad561f8..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Banners/IBannerService.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Grand.Domain.Messages;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Banners
-{
- public partial interface IBannerService
- {
- /// <summary>
- /// Inserts a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- Task InsertBanner(Banner banner);
-
- /// <summary>
- /// Updates a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- Task UpdateBanner(Banner banner);
-
- /// <summary>
- /// Deleted a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- Task DeleteBanner(Banner banner);
-
- /// <summary>
- /// Gets a banner by identifier
- /// </summary>
- /// <param name="bannerId">Banner identifier</param>
- /// <returns>Banner</returns>
- Task<Banner> GetBannerById(string bannerId);
-
- /// <summary>
- /// Gets all banner
- /// </summary>
- /// <returns>Banners</returns>
- Task<IList<Banner>> GetAllBanners();
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IInteractiveFormService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IInteractiveFormService.cs
deleted file mode 100644
index 235b42ecb..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IInteractiveFormService.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using Grand.Domain.Messages;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Contacts
-{
- public partial interface IInteractiveFormService
- {
- /// <summary>
- /// Inserts a InteractiveForm
- /// </summary>
- /// <param name="InteractiveForm">Interactive Form</param>
- Task InsertForm(InteractiveForm form);
-
- /// <summary>
- /// Updates a InteractiveForm
- /// </summary>
- /// <param name="InteractiveForm">Interactive Form</param>
- Task UpdateForm(InteractiveForm form);
-
- /// <summary>
- /// Deleted a InteractiveForm
- /// </summary>
- /// <param name="InteractiveForm">Interactive Form</param>
- Task DeleteForm(InteractiveForm form);
-
- /// <summary>
- /// Gets a form by identifier
- /// </summary>
- /// <param name="formId">Form identifier</param>
- /// <returns>Interactive form</returns>
- Task<InteractiveForm> GetFormById(string formId);
-
- /// <summary>
- /// Gets a form by system name
- /// </summary>
- /// <param name="systemName">Form system name</param>
- /// <returns>Interactive form</returns>
- Task<InteractiveForm> GetFormBySystemName(string systemName);
-
- /// <summary>
- /// Gets all interactive forms
- /// </summary>
- /// <returns>Interactive forms</returns>
- Task<IList<InteractiveForm>> GetAllForms();
-
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IPopupService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IPopupService.cs
deleted file mode 100644
index 7d092ac3d..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Contacts/IPopupService.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Grand.Domain.Messages;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Contacts
-{
- public partial interface IPopupService
- {
- /// <summary>
- /// Inserts a popup
- /// </summary>
- /// <param name="popup">Popup</param>
- Task InsertPopupActive(PopupActive popup);
- /// <summary>
- /// Gets active banner for customer
- /// </summary>
- /// <returns>BannerActive</returns>
- Task<PopupActive> GetActivePopupByCustomerId(string customerId);
-
- /// <summary>
- /// Move popup to archive
- /// </summary>
- Task MovepopupToArchive(string id, string customerId);
-
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionEventService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionEventService.cs
deleted file mode 100644
index 697bc2944..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionEventService.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-using Grand.Domain.Orders;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Customers
-{
- public partial interface ICustomerActionEventService
- {
- /// <summary>
- /// Run action add to cart
- /// </summary>
- Task AddToCart(ShoppingCartItem cart, Product product, Customer customer);
-
- /// <summary>
- /// Run action add new order / paid order
- /// </summary>
- Task AddOrder(Order order, CustomerActionTypeEnum customerActionType);
-
- /// <summary>
- /// Viewed
- /// </summary>
- Task Viewed(Customer customer, string currentUrl, string previousUrl);
-
- /// <summary>
- /// Run action url
- /// </summary>
- Task Url(Customer customer, string currentUrl, string previousUrl);
-
-
- /// <summary>
- /// Run action url
- /// </summary>
- Task Registration(Customer customer);
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionService.cs
deleted file mode 100644
index 362453070..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerActionService.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Grand.Domain;
-using Grand.Domain.Customers;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Customers
-{
- public partial interface ICustomerActionService
- {
-
- /// <summary>
- /// Gets customer action
- /// </summary>
- /// <param name="id">Customer action identifier</param>
- /// <returns>Customer Action</returns>
- Task<CustomerAction> GetCustomerActionById(string id);
-
- /// <summary>
- /// Gets all customer actions
- /// </summary>
- /// <returns>Customer actions</returns>
- Task<IList<CustomerAction>> GetCustomerActions();
-
- /// <summary>
- /// Inserts a customer action
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- Task InsertCustomerAction(CustomerAction customerAction);
-
- /// <summary>
- /// Delete a customer action
- /// </summary>
- /// <param name="customerAction">Customer action</param>
- Task DeleteCustomerAction(CustomerAction customerAction);
-
- /// <summary>
- /// Updates the customer action
- /// </summary>
- /// <param name="customerTag">Customer tag</param>
- Task UpdateCustomerAction(CustomerAction customerAction);
-
- Task<IList<CustomerActionType>> GetCustomerActionType();
- Task<CustomerActionType> GetCustomerActionTypeById(string id);
- Task<IPagedList<CustomerActionHistory>> GetAllCustomerActionHistory(string customerActionId, int pageIndex = 0, int pageSize = 2147483647);
- Task UpdateCustomerActionType(CustomerActionType customerActionType);
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerReminderService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerReminderService.cs
deleted file mode 100644
index 81884d8ef..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Customers/ICustomerReminderService.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using Grand.Business.Core.Utilities.Marketing;
-using Grand.Domain;
-using Grand.Domain.Customers;
-
-namespace Grand.Business.Core.Interfaces.Marketing.Customers
-{
- public partial interface ICustomerReminderService
- {
-
-
- /// <summary>
- /// Gets customer reminder
- /// </summary>
- /// <param name="id">Customer reminder identifier</param>
- /// <returns>Customer reminder</returns>
- Task<CustomerReminder> GetCustomerReminderById(string id);
-
-
- /// <summary>
- /// Gets all customer reminders
- /// </summary>
- /// <returns>Customer reminders</returns>
- Task<IList<CustomerReminder>> GetCustomerReminders();
-
- /// <summary>
- /// Inserts a customer reminder
- /// </summary>
- /// <param name="CustomerReminder">Customer reminder</param>
- Task InsertCustomerReminder(CustomerReminder customerReminder);
-
- /// <summary>
- /// Delete a customer reminder
- /// </summary>
- /// <param name="customerReminder">Customer reminder</param>
- Task DeleteCustomerReminder(CustomerReminder customerReminder);
-
- /// <summary>
- /// Updates the customer reminder
- /// </summary>
- /// <param name="CustomerReminder">Customer reminder</param>
- Task UpdateCustomerReminder(CustomerReminder customerReminder);
-
- /// <summary>
- /// Gets customer reminders history for reminder
- /// </summary>
- /// <returns>SerializeCustomerReminderHistory</returns>
- Task<IPagedList<SerializeCustomerReminderHistory>> GetAllCustomerReminderHistory(string customerReminderId, int pageIndex = 0, int pageSize = 2147483647);
-
- /// <summary>
- /// Run task Abandoned Cart
- /// </summary>
- Task Task_AbandonedCart(string id = "");
- Task Task_RegisteredCustomer(string id = "");
- Task Task_LastActivity(string id = "");
- Task Task_LastPurchase(string id = "");
- Task Task_Birthday(string id = "");
- Task Task_CompletedOrder(string id = "");
- Task Task_UnpaidOrder(string id = "");
-
- }
-}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Marketing/Newsletters/INewsletterCategoryService.cs b/src/Business/Grand.Business.Core/Interfaces/Marketing/Newsletters/INewsletterCategoryService.cs
index 07f6cfdee..eb18ff75d 100644
--- a/src/Business/Grand.Business.Core/Interfaces/Marketing/Newsletters/INewsletterCategoryService.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/Marketing/Newsletters/INewsletterCategoryService.cs
@@ -26,7 +26,7 @@ namespace Grand.Business.Core.Interfaces.Marketing.Newsletters
/// Gets a newsletter by category
/// </summary>
/// <param name="Id">newsletter category</param>
- /// <returns>Banner</returns>
+ /// <returns>NewsletterCategory</returns>
Task<NewsletterCategory> GetNewsletterCategoryById(string Id);
/// <summary>
diff --git a/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageProviderService.cs b/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageProviderService.cs
index 23b422cc5..bc97d6830 100644
--- a/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageProviderService.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageProviderService.cs
@@ -463,36 +463,6 @@ namespace Grand.Business.Core.Interfaces.Messages
/// <returns>Queued email identifier</returns>
Task<int> SendContactVendorMessage(Customer customer, Store store, Vendor vendor, string languageId, string senderEmail, string senderName, string subject, string body, string ipaddress);
- /// <summary>
- /// Sends a customer action event - Add to cart notification to a customer
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="ShoppingCartItem">Item</param>
- /// <param name="languageId">Message language identifier</param>
- /// <param name="customerId">Customer identifier</param>
- /// <returns>Queued email identifier</returns>
- Task<int> SendCustomerActionAddToCartMessage(CustomerAction action, ShoppingCartItem cartItem, string languageId, Customer customer);
-
-
- /// <summary>
- /// Sends a customer action event - Add order notification to a customer
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="Order">Order</param>
- /// <param name="languageId">Message language identifier</param>
- /// <returns>Queued email identifier</returns>
- Task<int> SendCustomerActionAddToOrderMessage(CustomerAction action, Order order, Customer customer, string languageId);
-
-
- /// <summary>
- /// Sends a customer action event
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="languageId">Message language identifier</param>
- /// <param name="customerId">Customer identifier</param>
- /// <returns>Queued email identifier</returns>
- Task<int> SendCustomerActionMessage(CustomerAction action, string languageId, Customer customer);
-
/// <summary>
/// Sends auction ended notification to a customer (winner)
/// </summary>
diff --git a/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageTokenProvider.cs b/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageTokenProvider.cs
index 23fe8932c..a96aad36d 100644
--- a/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageTokenProvider.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/Messages/IMessageTokenProvider.cs
@@ -1,11 +1,8 @@
-using Grand.Domain.Customers;
-
-namespace Grand.Business.Core.Interfaces.Messages
+namespace Grand.Business.Core.Interfaces.Messages
{
public partial interface IMessageTokenProvider
{
string[] GetListOfCampaignAllowedTokens();
string[] GetListOfAllowedTokens();
- string[] GetListOfCustomerReminderAllowedTokens(CustomerReminderRuleEnum rule);
}
}
\ No newline at end of file
diff --git a/src/Business/Grand.Business.Core/Utilities/Common/Security/PermissionSystemName.cs b/src/Business/Grand.Business.Core/Utilities/Common/Security/PermissionSystemName.cs
index ec561c717..6dc9d7eec 100644
--- a/src/Business/Grand.Business.Core/Utilities/Common/Security/PermissionSystemName.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Common/Security/PermissionSystemName.cs
@@ -22,8 +22,6 @@
public const string Reports = "ManageReports";
public const string CustomerGroups = "ManageCustomerGroups";
public const string SalesEmployees = "ManageSalesEmployees";
- public const string Actions = "ManageActions";
- public const string Reminders = "ManageReminders";
public const string Vendors = "ManageVendors";
public const string VendorReviews = "ManageVendorReviews";
public const string CurrentCarts = "ManageCurrentCarts";
@@ -37,8 +35,6 @@
public const string Affiliates = "ManageAffiliates";
public const string PushNotifications = "ManagePushNotifications";
public const string Campaigns = "ManageCampaigns";
- public const string Banners = "ManageBanners";
- public const string InteractiveForms = "ManageInteractiveForms";
public const string Discounts = "ManageDiscounts";
public const string NewsletterSubscribers = "ManageNewsletterSubscribers";
public const string NewsletterCategories = "ManageNewsletterCategories";
diff --git a/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionCustomer.cs b/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionCustomer.cs
index ffeb73743..09502b560 100644
--- a/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionCustomer.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionCustomer.cs
@@ -60,21 +60,7 @@ namespace Grand.Business.Core.Utilities.Common.Security
Area = "Admin area",
Category = CategoryCustomer,
Actions = new List<string> { PermissionActionName.List, PermissionActionName.Create, PermissionActionName.Edit, PermissionActionName.Delete }
- };
- public static readonly Permission ManageActions = new Permission
- {
- Name = "Manage Customers Actions",
- SystemName = PermissionSystemName.Actions,
- Area = "Admin area",
- Category = CategoryCustomer
- };
- public static readonly Permission ManageReminders = new Permission
- {
- Name = "Manage Customers Reminders",
- SystemName = PermissionSystemName.Reminders,
- Area = "Admin area",
- Category = CategoryCustomer
- };
+ };
public static readonly Permission ManageVendors = new Permission
{
Name = "Manage Vendors",
diff --git a/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionMarketing.cs b/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionMarketing.cs
index 6b766b2f0..3fe06a06d 100644
--- a/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionMarketing.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Common/Security/StandardPermissionMarketing.cs
@@ -29,22 +29,7 @@ namespace Grand.Business.Core.Utilities.Common.Security
Area = "Admin area",
Category = CategoryMarketing,
Actions = new List<string> { PermissionActionName.List, PermissionActionName.Create, PermissionActionName.Edit, PermissionActionName.Preview, PermissionActionName.Delete, PermissionActionName.Export }
- };
- public static readonly Permission ManageBanners = new Permission
- {
- Name = "Manage Banners",
- SystemName = PermissionSystemName.Banners,
- Category = CategoryMarketing,
- Actions = new List<string> { PermissionActionName.List, PermissionActionName.Create, PermissionActionName.Edit, PermissionActionName.Preview, PermissionActionName.Delete }
- };
- public static readonly Permission ManageInteractiveForm = new Permission
- {
- Name = "Manage Interactive Forms",
- SystemName = PermissionSystemName.InteractiveForms,
- Area = "Admin area",
- Category = CategoryMarketing,
- Actions = new List<string> { PermissionActionName.List, PermissionActionName.Create, PermissionActionName.Edit, PermissionActionName.Preview, PermissionActionName.Delete }
- };
+ };
public static readonly Permission ManageDiscounts = new Permission
{
Name = "Manage Discounts",
diff --git a/src/Business/Grand.Business.Core/Utilities/Marketing/SerializeCustomerReminderHistory.cs b/src/Business/Grand.Business.Core/Utilities/Marketing/SerializeCustomerReminderHistory.cs
deleted file mode 100644
index f47910c1a..000000000
--- a/src/Business/Grand.Business.Core/Utilities/Marketing/SerializeCustomerReminderHistory.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Grand.Business.Core.Utilities.Marketing
-{
- public class SerializeCustomerReminderHistory
- {
- public string Id { get; set; }
- public string CustomerReminderId { get; set; }
- public string CustomerId { get; set; }
- public DateTime SendDate { get; set; }
- public int Level { get; set; }
- public string OrderId { get; set; }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs b/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs
index c63c2f068..0de863561 100644
--- a/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs
+++ b/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs
@@ -313,8 +313,8 @@ namespace Grand.Business.Core.Utilities.System
SystemName = "Marketing",
ResourceName = "Admin.Marketing",
PermissionNames = new List<string> { PermissionSystemName.Affiliates, PermissionSystemName.NewsletterCategories, PermissionSystemName.NewsletterSubscribers,
- PermissionSystemName.Campaigns, PermissionSystemName.Discounts, PermissionSystemName.Actions, PermissionSystemName.Reminders, PermissionSystemName.PushNotifications,
- PermissionSystemName.Banners, PermissionSystemName.InteractiveForms, PermissionSystemName.Affiliates, PermissionSystemName.Documents, PermissionSystemName.GiftVouchers,
+ PermissionSystemName.Campaigns, PermissionSystemName.Discounts, PermissionSystemName.PushNotifications,
+ PermissionSystemName.Affiliates, PermissionSystemName.Documents, PermissionSystemName.GiftVouchers,
PermissionSystemName.ContactAttributes},
IconClass = "icon-bulb",
DisplayOrder = 4,
@@ -336,16 +336,7 @@ namespace Grand.Business.Core.Utilities.System
ActionName = "List",
DisplayOrder = 1,
IconClass = "fa fa-dot-circle-o"
- },
- new AdminSiteMap {
- SystemName = "Customer reminders",
- ResourceName = "Admin.Customers.CustomerReminders",
- PermissionNames = new List<string> { PermissionSystemName.Reminders },
- ControllerName = "CustomerReminder",
- ActionName = "List",
- DisplayOrder = 2,
- IconClass = "fa fa-dot-circle-o"
- },
+ },
new AdminSiteMap {
SystemName = "Affiliates",
ResourceName = "Admin.Affiliates",
@@ -400,51 +391,6 @@ namespace Grand.Business.Core.Utilities.System
}
}
},
- new AdminSiteMap {
- SystemName = "Customer actions",
- ResourceName = "Admin.Customers.CustomerActions",
- PermissionNames = new List<string> { PermissionSystemName.Actions, PermissionSystemName.Banners, PermissionSystemName.InteractiveForms },
- IconClass = "fa fa-dot-circle-o",
- DisplayOrder = 6,
- ChildNodes = new List<AdminSiteMap>() {
- new AdminSiteMap {
- SystemName = "Customer action type",
- ResourceName = "Admin.Customers.Actiontype",
- PermissionNames = new List<string> { PermissionSystemName.Actions },
- ControllerName = "CustomerActionType",
- ActionName = "ListTypes",
- DisplayOrder = 0,
- IconClass = "fa fa-dot-circle-o"
- },
- new AdminSiteMap {
- SystemName = "Customer actions",
- ResourceName = "Admin.Customers.CustomerActions",
- PermissionNames = new List<string> { PermissionSystemName.Actions },
- ControllerName = "CustomerAction",
- ActionName = "List",
- DisplayOrder = 1,
- IconClass = "fa fa-dot-circle-o"
- },
- new AdminSiteMap {
- SystemName = "Banners",
- ResourceName = "Admin.Marketing.Banners",
- PermissionNames = new List<string> { PermissionSystemName.Banners },
- ControllerName = "Banner",
- ActionName = "List",
- DisplayOrder = 2,
- IconClass = "fa fa-dot-circle-o"
- },
- new AdminSiteMap {
- SystemName = "InteractiveForms",
- ResourceName = "Admin.Marketing.InteractiveForms",
- PermissionNames = new List<string> { PermissionSystemName.InteractiveForms },
- ControllerName = "InteractiveForm",
- ActionName = "List",
- DisplayOrder = 3,
- IconClass = "fa fa-dot-circle-o"
- }
- }
- },
new AdminSiteMap {
SystemName = "PushNotifications",
ResourceName = "Admin.PushNotifications",
diff --git a/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventConditionCommandHandler.cs b/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventConditionCommandHandler.cs
deleted file mode 100644
index 567e607b8..000000000
--- a/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventConditionCommandHandler.cs
+++ /dev/null
@@ -1,480 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Commands.Marketing;
-using Grand.Infrastructure;
-using Grand.Domain.Catalog;
-using Grand.Domain.Common;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using Grand.Domain.Logging;
-using Grand.SharedKernel.Extensions;
-using MediatR;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Grand.Business.Marketing.Commands.Handlers
-{
- public class CustomerActionEventConditionCommandHandler : IRequestHandler<CustomerActionEventConditionCommand, bool>
- {
- private readonly IServiceProvider _serviceProvider;
- private readonly IProductService _productService;
- private readonly ICustomerService _customerService;
- private readonly IRepository<ActivityLog> _activityLogRepository;
- private readonly IRepository<ActivityLogType> _activityLogTypeRepository;
-
- public CustomerActionEventConditionCommandHandler(
- IServiceProvider serviceProvider,
- IProductService productService,
- ICustomerService customerService,
- IRepository<ActivityLog> activityLogRepository,
- IRepository<ActivityLogType> activityLogTypeRepository)
- {
- _serviceProvider = serviceProvider;
- _productService = productService;
- _customerService = customerService;
- _activityLogRepository = activityLogRepository;
- _activityLogTypeRepository = activityLogTypeRepository;
- }
-
- public async Task<bool> Handle(CustomerActionEventConditionCommand request, CancellationToken cancellationToken)
- {
- return await Condition(
- request.CustomerActionTypes,
- request.Action,
- request.ProductId,
- request.Attributes,
- request.CustomerId,
- request.CurrentUrl,
- request.PreviousUrl);
- }
-
- protected async Task<bool> Condition(IList<CustomerActionType> customerActionTypes, CustomerAction action, string productId, IList<CustomAttribute> customAttributes, string customerId, string currentUrl, string previousUrl)
- {
- if (!action.Conditions.Any())
- return true;
-
- bool cond = false;
- foreach (var item in action.Conditions)
- {
- #region product
- if (!string.IsNullOrEmpty(productId))
- {
- var product = await _productService.GetProductById(productId);
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Category)
- {
- cond = ConditionCategory(item, product.ProductCategories);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Collection)
- {
- cond = ConditionCollection(item, product.ProductCollections);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Product)
- {
- cond = ConditionProducts(item, product.Id);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.ProductAttribute)
- {
- if (customAttributes != null && customAttributes.Any())
- {
- cond = ConditionProductAttribute(item, product, customAttributes);
- }
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.ProductSpecification)
- {
- cond = ConditionSpecificationAttribute(item, product.ProductSpecificationAttributes);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Vendor)
- {
- cond = ConditionVendors(item, product.VendorId);
- }
-
- }
- #endregion
-
- #region Action type viewed
- if (action.ActionTypeId == customerActionTypes.FirstOrDefault(x => x.SystemKeyword == "Viewed").Id)
- {
- cond = false;
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Category)
- {
- var _actLogType = (from a in _activityLogTypeRepository.Table
- where a.SystemKeyword == "PublicStore.ViewCategory"
- select a).FirstOrDefault();
- if (_actLogType != null)
- {
- if (_actLogType.Enabled)
- {
- var productCategory = (from p in _activityLogRepository.Table
- where p.CustomerId == customerId && p.ActivityLogTypeId == _actLogType.Id
- select p.EntityKeyId).Distinct().ToList();
- cond = ConditionCategory(item, productCategory);
- }
- }
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Collection)
- {
- cond = false;
- var _actLogType = (from a in _activityLogTypeRepository.Table
- where a.SystemKeyword == "PublicStore.ViewCollection"
- select a).FirstOrDefault();
- if (_actLogType != null)
- {
- if (_actLogType.Enabled)
- {
- var productCollection = (from p in _activityLogRepository.Table
- where p.CustomerId == customerId && p.ActivityLogTypeId == _actLogType.Id
- select p.EntityKeyId).Distinct().ToList();
- cond = ConditionCollection(item, productCollection);
- }
- }
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Product)
- {
- cond = false;
- var _actLogType = (from a in _activityLogTypeRepository.Table
- where a.SystemKeyword == "PublicStore.ViewProduct"
- select a).FirstOrDefault();
- if (_actLogType != null)
- {
- if (_actLogType.Enabled)
- {
- var products = (from p in _activityLogRepository.Table
- where p.CustomerId == customerId && p.ActivityLogTypeId == _actLogType.Id
- select p.EntityKeyId).Distinct().ToList();
- cond = ConditionProducts(item, products);
- }
- }
- }
- }
- #endregion
-
- var customer = await _customerService.GetCustomerById(customerId);
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerGroup)
- {
- cond = ConditionCustomerGroup(item, customer);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerTag)
- {
- cond = ConditionCustomerTag(item, customer);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerRegisterField)
- {
- cond = await ConditionCustomerRegister(item, customer);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomCustomerAttribute)
- {
- cond = await ConditionCustomerAttribute(item, customer);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.UrlCurrent)
- {
- cond = item.UrlCurrent.Select(x => x.Name).Contains(currentUrl);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.UrlReferrer)
- {
- cond = item.UrlReferrer.Select(x => x.Name).Contains(previousUrl);
- }
-
- if (item.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Store)
- {
- var workContext = _serviceProvider.GetRequiredService<IWorkContext>();
- cond = ConditionStores(item, workContext.CurrentStore.Id);
- }
-
- if (action.ConditionId == CustomerActionConditionEnum.OneOfThem && cond)
- return true;
- if (action.ConditionId == CustomerActionConditionEnum.AllOfThem && !cond)
- return false;
- }
-
- return cond;
- }
- protected bool ConditionCategory(CustomerAction.ActionCondition condition, ICollection<ProductCategory> categorties)
- {
- bool cond = true;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = categorties.Select(x => x.CategoryId).ContainsAll(condition.Categories);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = categorties.Select(x => x.CategoryId).ContainsAny(condition.Categories);
- }
-
- return cond;
- }
- protected bool ConditionCategory(CustomerAction.ActionCondition condition, ICollection<string> categorties)
- {
- bool cond = true;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = categorties.ContainsAll(condition.Categories);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = categorties.ContainsAny(condition.Categories);
- }
-
- return cond;
- }
- protected bool ConditionCollection(CustomerAction.ActionCondition condition, ICollection<ProductCollection> collections)
- {
- bool cond = true;
-
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = collections.Select(x => x.CollectionId).ContainsAll(condition.Collections);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = collections.Select(x => x.CollectionId).ContainsAny(condition.Collections);
- }
-
- return cond;
- }
- protected bool ConditionCollection(CustomerAction.ActionCondition condition, ICollection<string> collections)
- {
- bool cond = true;
-
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = collections.ContainsAll(condition.Collections);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = collections.ContainsAny(condition.Collections);
- }
-
- return cond;
- }
- protected bool ConditionProducts(CustomerAction.ActionCondition condition, string productId)
- {
- return condition.Products.Contains(productId);
- }
- protected bool ConditionStores(CustomerAction.ActionCondition condition, string storeId)
- {
- return condition.Stores.Contains(storeId);
- }
- protected bool ConditionProducts(CustomerAction.ActionCondition condition, ICollection<string> products)
- {
- bool cond = true;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = products.ContainsAll(condition.Products);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = products.ContainsAny(condition.Products);
- }
-
- return cond;
- }
- protected bool ConditionProductAttribute(CustomerAction.ActionCondition condition, Product product, IList<CustomAttribute> customAttributes)
- {
- bool cond = false;
- var productAttributeParser = _serviceProvider.GetRequiredService<IProductAttributeParser>();
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- var attributes = productAttributeParser.ParseProductAttributeMappings(product, customAttributes);
- foreach (var attr in attributes)
- {
- var attributeValuesStr = productAttributeParser.ParseValues(customAttributes, attr.Id);
- foreach (var attrV in attributeValuesStr)
- {
- var attrsv = attr.ProductAttributeValues.Where(x => x.Id == attrV).FirstOrDefault();
- if (attrsv != null)
- if (condition.ProductAttribute.Where(x => x.ProductAttributeId == attr.ProductAttributeId && x.Name == attrsv.Name).Count() > 0)
- {
- cond = true;
- }
- }
- }
- }
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var itemPA in condition.ProductAttribute)
- {
- var attributes = productAttributeParser.ParseProductAttributeMappings(product, customAttributes);
- if (attributes.Where(x => x.ProductAttributeId == itemPA.ProductAttributeId).Count() > 0)
- {
- cond = false;
- foreach (var attr in attributes.Where(x => x.ProductAttributeId == itemPA.ProductAttributeId))
- {
- var attributeValuesStr = productAttributeParser.ParseValues(customAttributes, attr.Id);
- foreach (var attrV in attributeValuesStr)
- {
- var attrsv = attr.ProductAttributeValues.Where(x => x.Id == attrV).FirstOrDefault();
- if (attrsv != null)
- {
- if (attrsv.Name == itemPA.Name)
- {
- cond = true;
- }
- }
- else
- {
- return false;
- }
- }
- }
- if (!cond)
- return false;
- }
- else
- {
- return false;
- }
- }
- }
-
- return cond;
- }
- protected bool ConditionSpecificationAttribute(CustomerAction.ActionCondition condition, ICollection<ProductSpecificationAttribute> productspecificationattribute)
- {
- bool cond = false;
-
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var spec in condition.ProductSpecifications)
- {
- if (productspecificationattribute.Where(x => x.SpecificationAttributeId == spec.ProductSpecyficationId && x.SpecificationAttributeOptionId == spec.ProductSpecyficationValueId).Count() == 0)
- cond = false;
- }
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- foreach (var spec in productspecificationattribute)
- {
- if (condition.ProductSpecifications.Where(x => x.ProductSpecyficationId == spec.SpecificationAttributeId && x.ProductSpecyficationValueId == spec.SpecificationAttributeOptionId).Count() > 0)
- cond = true;
- }
- }
-
- return cond;
- }
- protected bool ConditionVendors(CustomerAction.ActionCondition condition, string vendorId)
- {
- return condition.Vendors.Contains(vendorId);
- }
- protected bool ConditionCustomerGroup(CustomerAction.ActionCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var customerGroups = customer.Groups;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = customerGroups.Select(x => x).ContainsAll(condition.CustomerGroups);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = customerGroups.Select(x => x).ContainsAny(condition.CustomerGroups);
- }
- }
- return cond;
- }
- protected bool ConditionCustomerTag(CustomerAction.ActionCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var customerTags = customer.CustomerTags;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = customerTags.Select(x => x).ContainsAll(condition.CustomerTags);
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- cond = customerTags.Select(x => x).ContainsAny(condition.CustomerTags);
- }
- }
- return cond;
- }
- protected async Task<bool> ConditionCustomerRegister(CustomerAction.ActionCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var _userFields = customer.UserFields;
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var item in condition.CustomerRegistration)
- {
- if (_userFields.Where(x => x.Key == item.RegisterField && x.Value.ToLower() == item.RegisterValue.ToLower()).Count() == 0)
- cond = false;
- }
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- foreach (var item in condition.CustomerRegistration)
- {
- if (_userFields.Where(x => x.Key == item.RegisterField && x.Value.ToLower() == item.RegisterValue.ToLower()).Count() > 0)
- cond = true;
- }
- }
- }
- return await Task.FromResult(cond);
- }
- protected async Task<bool> ConditionCustomerAttribute(CustomerAction.ActionCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var customerAttributeParser = _serviceProvider.GetRequiredService<ICustomerAttributeParser>();
-
- if (condition.ConditionId == CustomerActionConditionEnum.AllOfThem)
- {
- if (customer.Attributes.Any())
- {
- var selectedValues = await customerAttributeParser.ParseCustomerAttributeValues(customer.Attributes);
- cond = true;
- foreach (var item in condition.CustomCustomerAttributes)
- {
- var _fields = item.RegisterField.Split(':');
- if (_fields.Count() > 1)
- {
- if (selectedValues.Where(x => x.CustomerAttributeId == _fields.FirstOrDefault() && x.Id == _fields.LastOrDefault()).Count() == 0)
- cond = false;
- }
- else
- cond = false;
- }
- }
- }
- if (condition.ConditionId == CustomerActionConditionEnum.OneOfThem)
- {
- if (customer.Attributes.Any())
- {
- var selectedValues = await customerAttributeParser.ParseCustomerAttributeValues(customer.Attributes);
- foreach (var item in condition.CustomCustomerAttributes)
- {
- var _fields = item.RegisterField.Split(':');
- if (_fields.Count() > 1)
- {
- if (selectedValues.Where(x => x.CustomerAttributeId == _fields.FirstOrDefault() && x.Id == _fields.LastOrDefault()).Count() > 0)
- cond = true;
- }
- }
- }
- }
- }
- return cond;
- }
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventReactionCommandHandler.cs b/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventReactionCommandHandler.cs
deleted file mode 100644
index bb1109bd9..000000000
--- a/src/Business/Grand.Business.Marketing/Commands/Handlers/CustomerActionEventReactionCommandHandler.cs
+++ /dev/null
@@ -1,245 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Commands.Marketing;
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Infrastructure;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using Grand.Domain.Orders;
-using MediatR;
-using Microsoft.Extensions.DependencyInjection;
-using Grand.Business.Core.Interfaces.Common.Directory;
-
-namespace Grand.Business.Marketing.Commands.Handlers
-{
- public class CustomerActionEventReactionCommandHandler : IRequestHandler<CustomerActionEventReactionCommand, bool>
- {
- private readonly IRepository<Banner> _bannerRepository;
- private readonly IRepository<InteractiveForm> _interactiveFormRepository;
- private readonly IRepository<CustomerActionHistory> _customerActionHistoryRepository;
- private readonly IWorkContext _workContext;
- private readonly IPopupService _popupService;
- private readonly IServiceProvider _serviceProvider;
- private readonly ICustomerService _customerService;
-
- public CustomerActionEventReactionCommandHandler(
- IRepository<Banner> bannerRepository,
- IRepository<InteractiveForm> interactiveFormRepository,
- IRepository<CustomerActionHistory> customerActionHistoryRepository,
- IWorkContext workContext,
- IPopupService popupService,
- IServiceProvider serviceProvider,
- ICustomerService customerService)
- {
- _bannerRepository = bannerRepository;
- _interactiveFormRepository = interactiveFormRepository;
- _customerActionHistoryRepository = customerActionHistoryRepository;
- _workContext = workContext;
- _popupService = popupService;
- _serviceProvider = serviceProvider;
- _customerService = customerService;
- }
-
- public async Task<bool> Handle(CustomerActionEventReactionCommand request, CancellationToken cancellationToken)
- {
- await Reaction(request.CustomerActionTypes, request.Action, request.CustomerId, request.CartItem, request.Order);
- return true;
- }
- public async Task Reaction(IList<CustomerActionType> customerActionTypes, CustomerAction action, string customerId, ShoppingCartItem cartItem, Order order)
- {
- if (action.ReactionTypeId == CustomerReactionTypeEnum.Banner)
- {
- var banner = await _bannerRepository.GetByIdAsync(action.BannerId);
- if (banner != null)
- await PrepareBanner(action, banner, customerId);
- }
- if (action.ReactionTypeId == CustomerReactionTypeEnum.InteractiveForm)
- {
- var interactiveform = await _interactiveFormRepository.GetByIdAsync(action.InteractiveFormId);
- if (interactiveform != null)
- await PrepareInteractiveForm(action, interactiveform, customerId);
- }
-
- var customer = await _customerService.GetCustomerById(customerId);
-
- if (action.ReactionTypeId == CustomerReactionTypeEnum.Email)
- {
- var messageProviderService = _serviceProvider.GetRequiredService<IMessageProviderService>();
- if (action.ActionTypeId == customerActionTypes.FirstOrDefault(x => x.SystemKeyword == "AddToCart").Id)
- {
- if (cartItem != null)
- await messageProviderService.SendCustomerActionAddToCartMessage(action, cartItem,
- _workContext.WorkingLanguage.Id, customer);
- }
-
- if (action.ActionTypeId == customerActionTypes.FirstOrDefault(x => x.SystemKeyword == "AddOrder").Id)
- {
- if (order != null)
- await messageProviderService.SendCustomerActionAddToOrderMessage(action, order, customer,
- _workContext.WorkingLanguage.Id);
- }
-
- if (action.ActionTypeId != customerActionTypes.FirstOrDefault(x => x.SystemKeyword == "AddOrder").Id
- && action.ActionTypeId != customerActionTypes.FirstOrDefault(x => x.SystemKeyword == "AddToCart").Id)
- {
- await messageProviderService.SendCustomerActionMessage(action,
- _workContext.WorkingLanguage.Id, customer);
- }
- }
-
- if (action.ReactionTypeId == CustomerReactionTypeEnum.AssignToCustomerGroup)
- {
- await AssignToCustomerGroup(action, customer);
- }
-
- if (action.ReactionTypeId == CustomerReactionTypeEnum.AssignToCustomerTag)
- {
- await AssignToCustomerTag(action, customer);
- }
-
- await SaveActionToCustomer(action.Id, customer.Id);
-
- }
-
- protected async Task PrepareBanner(CustomerAction action, Banner banner, string customerId)
- {
- var banneractive = new PopupActive()
- {
- Body = banner.GetTranslation(x => x.Body, _workContext.WorkingLanguage.Id),
- CreatedOnUtc = DateTime.UtcNow,
- CustomerId = customerId,
- CustomerActionId = action.Id,
- Name = banner.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),
- PopupTypeId = (int)PopupType.Banner
- };
- await _popupService.InsertPopupActive(banneractive);
- }
-
- protected async Task PrepareInteractiveForm(CustomerAction action, InteractiveForm form, string customerId)
- {
-
- var body = PrepareDataInteractiveForm(form);
-
- var formactive = new PopupActive()
- {
- Body = body,
- CreatedOnUtc = DateTime.UtcNow,
- CustomerId = customerId,
- CustomerActionId = action.Id,
- Name = form.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),
- PopupTypeId = (int)PopupType.InteractiveForm
- };
- await _popupService.InsertPopupActive(formactive);
- }
-
- protected string PrepareDataInteractiveForm(InteractiveForm form)
- {
- var body = form.GetTranslation(x => x.Body, _workContext.WorkingLanguage.Id);
- body += $"<input type='hidden' name='Id' value='{form.Id}'>";
- foreach (var item in form.FormAttributes)
- {
- if (item.FormControlTypeId == FormControlType.TextBox)
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control", item.Class);
- string _value = item.DefaultValue;
- var textbox = string.Format("<input type='text' name='{0}' class='{1}' style='{2}' value='{3}' {4}>", item.SystemName, _class, _style, _value, item.IsRequired ? "required" : "");
- body = body.Replace(string.Format("%{0}%", item.SystemName), textbox);
- }
- if (item.FormControlTypeId == FormControlType.MultilineTextbox)
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control", item.Class);
- string _value = item.DefaultValue;
- var textarea = string.Format("<textarea name='{0}' class='{1}' style='{2}' {3}> {4} </textarea>", item.SystemName, _class, _style, item.IsRequired ? "required" : "", _value);
- body = body.Replace(string.Format("%{0}%", item.SystemName), textarea);
- }
- if (item.FormControlTypeId == FormControlType.Checkboxes)
- {
- var checkbox = "<div class='custom-controls-stacked'>";
- foreach (var itemcheck in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "custom-control-input", item.Class);
-
- checkbox += "<div class='custom-control custom-checkbox'>";
- checkbox += string.Format("<input type='checkbox' class='{0}' style='{1}' {2} id='{3}' name='{4}' value='{5}'>", _class, _style,
- itemcheck.IsPreSelected ? "checked" : "", itemcheck.Id, item.SystemName, itemcheck.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- checkbox += string.Format("<label class='custom-control-label' for='{0}'>{1}</label>", itemcheck.Id, itemcheck.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- checkbox += "</div>";
- }
- checkbox += "</div>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), checkbox);
- }
-
- if (item.FormControlTypeId == FormControlType.DropdownList)
- {
- var dropdown = string.Empty;
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control custom-select", item.Class);
-
- dropdown = string.Format("<select name='{0}' class='{1}' style='{2}'>", item.SystemName, _class, _style);
- foreach (var itemdropdown in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- dropdown += string.Format("<option value='{0}' {1}>{2}</option>", itemdropdown.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id), itemdropdown.IsPreSelected ? "selected" : "", itemdropdown.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- }
- dropdown += "</select>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), dropdown);
- }
- if (item.FormControlTypeId == FormControlType.RadioList)
- {
- var radio = "<div class='custom-controls-stacked'>";
- foreach (var itemradio in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "custom-control-input", item.Class);
-
- radio += "<div class='custom-control custom-radio'>";
- radio += string.Format("<input type='radio' class='{0}' style='{1}' {2} id='{3}' name='{4}' value='{5}'>", _class, _style,
- itemradio.IsPreSelected ? "checked" : "", itemradio.Id, item.SystemName, itemradio.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- radio += string.Format("<label class='custom-control-label' for='{0}'>{1}</label>", itemradio.Id, itemradio.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- radio += "</div>";
- }
- radio += "</div>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), radio);
- }
- }
- body = body.Replace("%sendbutton%", "<input type='submit' id='send-interactive-form' class='btn btn-success interactive-form-button' value='Send' />");
- body = body.Replace("%errormessage%", "<div class='message-error'><div class='validation-summary-errors'><div id='errorMessages'></div></div></div>");
-
- return body;
- }
-
- protected async Task AssignToCustomerGroup(CustomerAction action, Customer customer)
- {
- if (customer.Groups.Where(x => x == action.CustomerGroupId).Count() == 0)
- {
- var customerService = _serviceProvider.GetRequiredService<ICustomerService>();
- var groupService = _serviceProvider.GetRequiredService<IGroupService>();
- var customerGroup = await groupService.GetCustomerGroupById(action.CustomerGroupId);
- if (customerGroup != null)
- {
- await customerService.InsertCustomerGroupInCustomer(customerGroup, customer.Id);
- }
- }
- }
-
- protected async Task AssignToCustomerTag(CustomerAction action, Customer customer)
- {
- if (customer.CustomerTags.Where(x => x == action.CustomerTagId).Count() == 0)
- {
- var customerTagService = _serviceProvider.GetRequiredService<ICustomerTagService>();
- await customerTagService.InsertTagToCustomer(action.CustomerTagId, customer.Id);
- }
- }
-
- protected async Task SaveActionToCustomer(string actionId, string customerId)
- {
- await _customerActionHistoryRepository.InsertAsync(new CustomerActionHistory() { CustomerId = customerId, CustomerActionId = actionId, CreateDateUtc = DateTime.UtcNow });
- }
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Events/AddToCartEventHandler.cs b/src/Business/Grand.Business.Marketing/Events/AddToCartEventHandler.cs
deleted file mode 100644
index acb5592d1..000000000
--- a/src/Business/Grand.Business.Marketing/Events/AddToCartEventHandler.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Grand.Business.Core.Events.Checkout.ShoppingCart;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using MediatR;
-
-namespace Grand.Business.Marketing.Events
-{
- public class AddToCartEventHandler : INotificationHandler<AddToCartEvent>
- {
- private readonly ICustomerActionEventService _customerActionEventService;
-
- public AddToCartEventHandler(ICustomerActionEventService customerActionEventService)
- {
- _customerActionEventService = customerActionEventService;
- }
-
- public async Task Handle(AddToCartEvent notification, CancellationToken cancellationToken)
- {
- await _customerActionEventService.AddToCart(notification.ShoppingCartItem, notification.Product, notification.Customer);
- }
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Events/OrderPaidEventHandler.cs b/src/Business/Grand.Business.Marketing/Events/OrderPaidEventHandler.cs
deleted file mode 100644
index 14632294e..000000000
--- a/src/Business/Grand.Business.Marketing/Events/OrderPaidEventHandler.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Grand.Business.Core.Events.Checkout.Orders;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Domain.Customers;
-using MediatR;
-
-namespace Grand.Business.Marketing.Events
-{
- public class OrderPaidEventHandler : INotificationHandler<OrderPaidEvent>
- {
- private readonly ICustomerActionEventService _customerActionEventService;
-
- public OrderPaidEventHandler(ICustomerActionEventService customerActionEventService)
- {
- _customerActionEventService = customerActionEventService;
- }
-
- public async Task Handle(OrderPaidEvent notification, CancellationToken cancellationToken)
- {
- //customer action event service - paid order
- await _customerActionEventService.AddOrder(notification.Order, CustomerActionTypeEnum.PaidOrder);
- }
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Events/OrderPlacedEventHandler.cs b/src/Business/Grand.Business.Marketing/Events/OrderPlacedEventHandler.cs
deleted file mode 100644
index f406efcf7..000000000
--- a/src/Business/Grand.Business.Marketing/Events/OrderPlacedEventHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Grand.Business.Core.Events.Checkout.Orders;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using MediatR;
-
-namespace Grand.Business.Marketing.Events
-{
- public class OrderPlacedEventHandler : INotificationHandler<OrderPlacedEvent>
- {
- private readonly ICustomerActionEventService _customerActionEventService;
- private readonly IRepository<CustomerReminderHistory> _customerReminderHistory;
-
- public OrderPlacedEventHandler(ICustomerActionEventService customerActionEventService,
- IRepository<CustomerReminderHistory> customerReminderHistory)
- {
- _customerActionEventService = customerActionEventService;
- _customerReminderHistory = customerReminderHistory;
- }
-
- public async Task Handle(OrderPlacedEvent notification, CancellationToken cancellationToken)
- {
- //cutomer action - add order
- await _customerActionEventService.AddOrder(notification.Order, CustomerActionTypeEnum.AddOrder);
-
- //customer reminder
- var update = UpdateBuilder<CustomerReminderHistory>.Create()
- .Set(x => x.EndDate, DateTime.UtcNow)
- .Set(x => x.Status, CustomerReminderHistoryStatusEnum.CompletedOrdered)
- .Set(x => x.OrderId, notification.Order.Id);
-
- _ = _customerReminderHistory.UpdateManyAsync(x => x.CustomerId == notification.Order.CustomerId && x.Status == CustomerReminderHistoryStatusEnum.Started, update);
-
- }
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Banners/BannerService.cs b/src/Business/Grand.Business.Marketing/Services/Banners/BannerService.cs
deleted file mode 100644
index ef39f04c1..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Banners/BannerService.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Banners;
-using Grand.Infrastructure.Extensions;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using MediatR;
-
-namespace Grand.Business.Marketing.Services.Banners
-{
- public partial class BannerService : IBannerService
- {
- private readonly IRepository<Banner> _bannerRepository;
- private readonly IMediator _mediator;
-
- /// <summary>
- /// Ctor
- /// </summary>
- /// <param name="bannerRepository">Banner repository</param>
- /// <param name="mediator">Mediator</param>
- public BannerService(IRepository<Banner> bannerRepository,
- IMediator mediator)
- {
- _bannerRepository = bannerRepository;
- _mediator = mediator;
- }
-
- /// <summary>
- /// Inserts a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- public virtual async Task InsertBanner(Banner banner)
- {
- if (banner == null)
- throw new ArgumentNullException(nameof(banner));
-
- await _bannerRepository.InsertAsync(banner);
-
- //event notification
- await _mediator.EntityInserted(banner);
- }
-
- /// <summary>
- /// Updates a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- public virtual async Task UpdateBanner(Banner banner)
- {
- if (banner == null)
- throw new ArgumentNullException(nameof(banner));
-
- await _bannerRepository.UpdateAsync(banner);
-
- //event notification
- await _mediator.EntityUpdated(banner);
- }
-
- /// <summary>
- /// Deleted a banner
- /// </summary>
- /// <param name="banner">Banner</param>
- public virtual async Task DeleteBanner(Banner banner)
- {
- if (banner == null)
- throw new ArgumentNullException(nameof(banner));
-
- await _bannerRepository.DeleteAsync(banner);
-
- //event notification
- await _mediator.EntityDeleted(banner);
- }
-
- /// <summary>
- /// Gets a banner by identifier
- /// </summary>
- /// <param name="bannerId">Banner identifier</param>
- /// <returns>Banner</returns>
- public virtual Task<Banner> GetBannerById(string bannerId)
- {
- return _bannerRepository.GetByIdAsync(bannerId);
- }
-
- /// <summary>
- /// Gets all banners
- /// </summary>
- /// <returns>Banners</returns>
- public virtual async Task<IList<Banner>> GetAllBanners()
- {
-
- var query = from c in _bannerRepository.Table
- orderby c.CreatedOnUtc
- select c;
- return await Task.FromResult(query.ToList());
- }
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Campaigns/CampaignService.cs b/src/Business/Grand.Business.Marketing/Services/Campaigns/CampaignService.cs
index 7d7102ce0..b132447fe 100644
--- a/src/Business/Grand.Business.Marketing/Services/Campaigns/CampaignService.cs
+++ b/src/Business/Grand.Business.Marketing/Services/Campaigns/CampaignService.cs
@@ -354,10 +354,6 @@ namespace Grand.Business.Marketing.Services.Campaigns
await _queuedEmailService.InsertQueuedEmail(email);
await InsertCampaignHistory(new CampaignHistory() { CampaignId = campaign.Id, CustomerId = subscription.CustomerId, Email = subscription.Email, CreatedDateUtc = DateTime.UtcNow, StoreId = campaign.StoreId });
- //activity log
- if (customer != null)
- _ = _customerActivityService.InsertActivity("CustomerReminder.SendCampaign", campaign.Id, customer, "", _translationService.GetResource("ActivityLog.SendCampaign"), campaign.Name);
-
totalEmailsSent++;
}
return totalEmailsSent;
diff --git a/src/Business/Grand.Business.Marketing/Services/Contacts/InteractiveFormService.cs b/src/Business/Grand.Business.Marketing/Services/Contacts/InteractiveFormService.cs
deleted file mode 100644
index 96e5f57ca..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Contacts/InteractiveFormService.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure.Extensions;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using MediatR;
-
-namespace Grand.Business.Marketing.Services.Contacts
-{
- public partial class InteractiveFormService : IInteractiveFormService
- {
- private readonly IRepository<InteractiveForm> _formRepository;
- private readonly IMediator _mediator;
-
- /// <summary>
- /// Ctor
- /// </summary>
- /// <param name="formRepository">Form repository</param>
- /// <param name="mediator">Mediator</param>
- public InteractiveFormService(IRepository<InteractiveForm> formRepository,
- IMediator mediator)
- {
- _formRepository = formRepository;
- _mediator = mediator;
- }
-
- /// <summary>
- /// Inserts a form
- /// </summary>
- /// <param name="InteractiveForm">InteractiveForm</param>
- public virtual async Task InsertForm(InteractiveForm form)
- {
- if (form == null)
- throw new ArgumentNullException(nameof(form));
-
- await _formRepository.InsertAsync(form);
- //event notification
- await _mediator.EntityInserted(form);
- }
-
- /// <summary>
- /// Updates a form
- /// </summary>
- /// <param name="Form">Form</param>
- public virtual async Task UpdateForm(InteractiveForm form)
- {
- if (form == null)
- throw new ArgumentNullException(nameof(form));
-
- await _formRepository.UpdateAsync(form);
-
- //event notification
- await _mediator.EntityUpdated(form);
- }
-
- /// <summary>
- /// Deleted a interactive form
- /// </summary>
- /// <param name="form">Interactive form</param>
- public virtual async Task DeleteForm(InteractiveForm form)
- {
- if (form == null)
- throw new ArgumentNullException(nameof(form));
-
- await _formRepository.DeleteAsync(form);
- //event notification
- await _mediator.EntityDeleted(form);
- }
-
- /// <summary>
- /// Gets a form by identifier
- /// </summary>
- /// <param name="formId">Form identifier</param>
- /// <returns>Banner</returns>
- public virtual Task<InteractiveForm> GetFormById(string formId)
- {
- if (string.IsNullOrEmpty(formId))
- throw new ArgumentNullException("formId");
-
- return _formRepository.GetByIdAsync(formId);
- }
-
- /// <summary>
- /// Gets a form by system name
- /// </summary>
- /// <param name="systemName">Form system name</param>
- /// <returns>Interactive form</returns>
- public virtual async Task<InteractiveForm> GetFormBySystemName(string systemName)
- {
- if (string.IsNullOrEmpty(systemName))
- throw new ArgumentNullException(nameof(systemName));
-
- return await Task.FromResult(_formRepository.Table.Where(x => x.SystemName == systemName).FirstOrDefault());
- }
-
- /// <summary>
- /// Gets all Interactive forms
- /// </summary>
- /// <returns>Interactive forms</returns>
- public virtual async Task<IList<InteractiveForm>> GetAllForms()
- {
-
- var query = from c in _formRepository.Table
- orderby c.CreatedOnUtc
- select c;
-
- return await Task.FromResult(query.ToList());
- }
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Contacts/PopupService.cs b/src/Business/Grand.Business.Marketing/Services/Contacts/PopupService.cs
deleted file mode 100644
index 44005a335..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Contacts/PopupService.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure.Extensions;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using MediatR;
-
-namespace Grand.Business.Marketing.Services.Contacts
-{
- public partial class PopupService : IPopupService
- {
- private readonly IRepository<PopupActive> _popupActiveRepository;
- private readonly IRepository<PopupArchive> _popupArchiveRepository;
- private readonly IMediator _mediator;
-
- /// <summary>
- /// Ctor
- /// </summary>
- /// <param name="popupActiveRepository">Popup Active repository</param>
- /// <param name="popupArchiveRepository">Popup Archive repository</param>
- /// <param name="mediator">Mediator</param>
- public PopupService(IRepository<PopupActive> popupActiveRepository,
- IRepository<PopupArchive> popupArchiveRepository,
- IMediator mediator)
- {
- _popupActiveRepository = popupActiveRepository;
- _popupArchiveRepository = popupArchiveRepository;
- _mediator = mediator;
- }
-
- /// <summary>
- /// Inserts a popup
- /// </summary>
- /// <param name="popup">Popup</param>
- public virtual async Task InsertPopupActive(PopupActive popup)
- {
- if (popup == null)
- throw new ArgumentNullException(nameof(popup));
-
- await _popupActiveRepository.InsertAsync(popup);
-
- //event notification
- await _mediator.EntityInserted(popup);
- }
-
-
- public virtual async Task<PopupActive> GetActivePopupByCustomerId(string customerId)
- {
- var query = from c in _popupActiveRepository.Table
- where c.CustomerId == customerId
- orderby c.CreatedOnUtc
- select c;
- return await Task.FromResult(query.FirstOrDefault());
- }
-
- public virtual async Task MovepopupToArchive(string id, string customerId)
- {
- if (String.IsNullOrEmpty(customerId) || String.IsNullOrEmpty(id))
- return;
-
- var query = from c in _popupActiveRepository.Table
- where c.CustomerId == customerId && c.Id == id
- select c;
-
- var popup = await Task.FromResult(query.FirstOrDefault());
- if (popup != null)
- {
- var archiveBanner = new PopupArchive()
- {
- Body = popup.Body,
- BACreatedOnUtc = popup.CreatedOnUtc,
- CreatedOnUtc = DateTime.UtcNow,
- CustomerActionId = popup.CustomerActionId,
- CustomerId = popup.CustomerId,
- PopupActiveId = popup.Id,
- PopupTypeId = popup.PopupTypeId,
- Name = popup.Name,
- };
- await _popupArchiveRepository.InsertAsync(archiveBanner);
- await _popupActiveRepository.DeleteAsync(popup);
- }
-
- }
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionEventService.cs b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionEventService.cs
deleted file mode 100644
index 624dca96a..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionEventService.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-using Grand.Business.Core.Commands.Marketing;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Infrastructure.Caching;
-using Grand.Infrastructure.Caching.Constants;
-using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using Grand.Domain.Orders;
-using MediatR;
-
-namespace Grand.Business.Marketing.Services.Customers
-{
- public partial class CustomerActionEventService : ICustomerActionEventService
- {
- #region Fields
-
- private readonly IRepository<CustomerAction> _customerActionRepository;
- private readonly IRepository<CustomerActionHistory> _customerActionHistoryRepository;
- private readonly IRepository<CustomerActionType> _customerActionTypeRepository;
- private readonly ICacheBase _cacheBase;
- private readonly IMediator _mediator;
-
- #endregion
-
- #region Ctor
-
- public CustomerActionEventService(
- IRepository<CustomerAction> customerActionRepository,
- IRepository<CustomerActionType> customerActionTypeRepository,
- IRepository<CustomerActionHistory> customerActionHistoryRepository,
- ICacheBase cacheBase,
- IMediator mediator)
- {
- _customerActionRepository = customerActionRepository;
- _customerActionTypeRepository = customerActionTypeRepository;
- _customerActionHistoryRepository = customerActionHistoryRepository;
- _cacheBase = cacheBase;
- _mediator = mediator;
- }
-
- #endregion
-
- #region Utilities
-
- protected async Task<IList<CustomerActionType>> GetAllCustomerActionType()
- {
- return await _cacheBase.GetAsync(CacheKey.CUSTOMER_ACTION_TYPE, async () =>
- {
- return await Task.FromResult(_customerActionTypeRepository.Table.ToList());
- });
- }
-
- protected bool UsedAction(string actionId, string customerId)
- {
- var query = from u in _customerActionHistoryRepository.Table
- where u.CustomerId == customerId && u.CustomerActionId == actionId
- select u.Id;
- if (query.Count() > 0)
- return true;
-
- return false;
- }
-
- #endregion
-
- #region Methods
-
- public virtual async Task AddToCart(ShoppingCartItem cart, Product product, Customer customer)
- {
- var actiontypes = await GetAllCustomerActionType();
- var actionType = actiontypes.Where(x => x.SystemKeyword == CustomerActionTypeEnum.AddToCart.ToString()).FirstOrDefault();
- if (actionType?.Enabled == true)
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var query = from a in _customerActionRepository.Table
- where a.Active == true && a.ActionTypeId == actionType.Id
- && datetimeUtcNow >= a.StartDateTimeUtc && datetimeUtcNow <= a.EndDateTimeUtc
- select a;
-
- foreach (var item in query.ToList())
- {
- if (!UsedAction(item.Id, customer.Id))
- {
- if (await _mediator.Send(new CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- ProductId = product.Id,
- Attributes = cart.Attributes,
- CustomerId = customer.Id
- }))
- {
- await _mediator.Send(new CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CartItem = cart,
- CustomerId = customer.Id
- });
- }
- }
- }
- }
- }
-
- public virtual async Task AddOrder(Order order, CustomerActionTypeEnum customerActionType)
- {
- var actiontypes = await GetAllCustomerActionType();
- var actionType = actiontypes.Where(x => x.SystemKeyword == customerActionType.ToString()).FirstOrDefault();
- if (actionType?.Enabled == true)
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var query = from a in _customerActionRepository.Table
- where a.Active == true && a.ActionTypeId == actionType.Id
- && datetimeUtcNow >= a.StartDateTimeUtc && datetimeUtcNow <= a.EndDateTimeUtc
- select a;
-
- foreach (var item in query.ToList())
- {
- if (!UsedAction(item.Id, order.CustomerId))
- {
- foreach (var orderItem in order.OrderItems)
- {
- if (await _mediator.Send(new CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- ProductId = orderItem.ProductId,
- CustomerId = order.CustomerId,
- Attributes = orderItem.Attributes
- }))
- {
- await _mediator.Send(new CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- Order = order,
- CustomerId = order.CustomerId,
- });
- break;
- }
- }
- }
- }
-
- }
-
- }
-
- public virtual async Task Url(Customer customer, string currentUrl, string previousUrl)
- {
- if (!customer.IsSystemAccount)
- {
- var actiontypes = await GetAllCustomerActionType();
- var actionType = actiontypes.FirstOrDefault(x => x.SystemKeyword == CustomerActionTypeEnum.Url.ToString());
- if (actionType?.Enabled == true)
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var query = from a in _customerActionRepository.Table
- where a.Active == true && a.ActionTypeId == actionType.Id
- && datetimeUtcNow >= a.StartDateTimeUtc && datetimeUtcNow <= a.EndDateTimeUtc
- select a;
-
- foreach (var item in query.ToList())
- {
- if (!UsedAction(item.Id, customer.Id))
- {
- if (await _mediator.Send(new CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id,
- CurrentUrl = currentUrl,
- PreviousUrl = previousUrl
- }))
- {
- await _mediator.Send(new CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id
- });
- }
- }
- }
- }
- }
- }
-
- public virtual async Task Viewed(Customer customer, string currentUrl, string previousUrl)
- {
- if (!customer.IsSystemAccount)
- {
- var actiontypes = await GetAllCustomerActionType();
- var actionType = actiontypes.Where(x => x.SystemKeyword == CustomerActionTypeEnum.Viewed.ToString()).FirstOrDefault();
- if (actionType?.Enabled == true)
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var query = from a in _customerActionRepository.Table
- where a.Active == true && a.ActionTypeId == actionType.Id
- && datetimeUtcNow >= a.StartDateTimeUtc && datetimeUtcNow <= a.EndDateTimeUtc
- select a;
-
- foreach (var item in query.ToList())
- {
- if (!UsedAction(item.Id, customer.Id))
- {
- if (await _mediator.Send(new CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id,
- CurrentUrl = currentUrl,
- PreviousUrl = previousUrl
- }))
- {
- await _mediator.Send(new CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id
- });
- }
- }
- }
-
- }
- }
-
- }
-
- public virtual async Task Registration(Customer customer)
- {
- var actiontypes = await GetAllCustomerActionType();
- var actionType = actiontypes.Where(x => x.SystemKeyword == CustomerActionTypeEnum.Registration.ToString()).FirstOrDefault();
- if (actionType?.Enabled == true)
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var query = from a in _customerActionRepository.Table
- where a.Active == true && a.ActionTypeId == actionType.Id
- && datetimeUtcNow >= a.StartDateTimeUtc && datetimeUtcNow <= a.EndDateTimeUtc
- select a;
-
- foreach (var item in query.ToList())
- {
- if (!UsedAction(item.Id, customer.Id))
- {
- if (await _mediator.Send(new CustomerActionEventConditionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id
- }))
- {
- await _mediator.Send(new CustomerActionEventReactionCommand()
- {
- CustomerActionTypes = actiontypes,
- Action = item,
- CustomerId = customer.Id
- });
- }
- }
- }
-
- }
- }
-
- #endregion
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionService.cs b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionService.cs
deleted file mode 100644
index f28160368..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerActionService.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Infrastructure.Caching;
-using Grand.Infrastructure.Caching.Constants;
-using Grand.Infrastructure.Extensions;
-using Grand.Domain;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using MediatR;
-
-namespace Grand.Business.Marketing.Services.Customers
-{
- public partial class CustomerActionService : ICustomerActionService
- {
- #region Fields
-
- private readonly IRepository<CustomerAction> _customerActionRepository;
- private readonly IRepository<CustomerActionType> _customerActionTypeRepository;
- private readonly IRepository<CustomerActionHistory> _customerActionHistoryRepository;
- private readonly IMediator _mediator;
- private readonly ICacheBase _cacheBase;
-
- #endregion
-
- #region Ctor
-
- public CustomerActionService(IRepository<CustomerAction> customerActionRepository,
- IRepository<CustomerActionType> customerActionTypeRepository,
- IRepository<CustomerActionHistory> customerActionHistoryRepository,
- IMediator mediator,
- ICacheBase cacheBase)
- {
- _customerActionRepository = customerActionRepository;
- _customerActionTypeRepository = customerActionTypeRepository;
- _customerActionHistoryRepository = customerActionHistoryRepository;
- _mediator = mediator;
- _cacheBase = cacheBase;
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets customer action
- /// </summary>
- /// <param name="id">Customer action identifier</param>
- /// <returns>Customer Action</returns>
- public virtual Task<CustomerAction> GetCustomerActionById(string id)
- {
- return _customerActionRepository.GetByIdAsync(id);
- }
-
-
- /// <summary>
- /// Gets all customer actions
- /// </summary>
- /// <returns>Customer actions</returns>
- public virtual async Task<IList<CustomerAction>> GetCustomerActions()
- {
- return await Task.FromResult(_customerActionRepository.Table.ToList());
- }
-
- /// <summary>
- /// Inserts a customer action
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- public virtual async Task InsertCustomerAction(CustomerAction customerAction)
- {
- if (customerAction == null)
- throw new ArgumentNullException(nameof(customerAction));
-
- await _customerActionRepository.InsertAsync(customerAction);
-
- //event notification
- await _mediator.EntityInserted(customerAction);
-
- }
-
- /// <summary>
- /// Delete a customer action
- /// </summary>
- /// <param name="customerAction">Customer action</param>
- public virtual async Task DeleteCustomerAction(CustomerAction customerAction)
- {
- if (customerAction == null)
- throw new ArgumentNullException(nameof(customerAction));
-
- await _customerActionRepository.DeleteAsync(customerAction);
-
- //event notification
- await _mediator.EntityDeleted(customerAction);
-
- }
-
- /// <summary>
- /// Updates the customer action
- /// </summary>
- /// <param name="customerTag">Customer tag</param>
- public virtual async Task UpdateCustomerAction(CustomerAction customerAction)
- {
- if (customerAction == null)
- throw new ArgumentNullException(nameof(customerAction));
-
- await _customerActionRepository.UpdateAsync(customerAction);
-
- //event notification
- await _mediator.EntityUpdated(customerAction);
- }
-
- #endregion
-
- #region Condition Type
-
- public virtual async Task<IList<CustomerActionType>> GetCustomerActionType()
- {
- return await Task.FromResult(_customerActionTypeRepository.Table.ToList());
- }
-
- public virtual async Task<IPagedList<CustomerActionHistory>> GetAllCustomerActionHistory(string customerActionId, int pageIndex = 0, int pageSize = 2147483647)
- {
- var query = from h in _customerActionHistoryRepository.Table
- where h.CustomerActionId == customerActionId
- select h;
- return await PagedList<CustomerActionHistory>.Create(query, pageIndex, pageSize);
- }
-
- public virtual async Task<CustomerActionType> GetCustomerActionTypeById(string id)
- {
- return await _customerActionTypeRepository.GetByIdAsync(id);
- }
-
- public virtual async Task UpdateCustomerActionType(CustomerActionType customerActionType)
- {
- if (customerActionType == null)
- throw new ArgumentNullException(nameof(customerActionType));
-
- await _customerActionTypeRepository.UpdateAsync(customerActionType);
-
- //clear cache
- await _cacheBase.RemoveAsync(CacheKey.CUSTOMER_ACTION_TYPE);
- //event notification
- await _mediator.EntityUpdated(customerActionType);
- }
-
- #endregion
-
- }
-}
diff --git a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerReminderService.cs b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerReminderService.cs
deleted file mode 100644
index c3b86cf88..000000000
--- a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerReminderService.cs
+++ /dev/null
@@ -1,1413 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Infrastructure.Extensions;
-using Grand.Domain;
-using Grand.Domain.Common;
-using Grand.Domain.Customers;
-using Grand.Domain.Data;
-using Grand.Domain.Localization;
-using Grand.Domain.Messages;
-using Grand.Domain.Orders;
-using Grand.Domain.Payments;
-using Grand.SharedKernel.Extensions;
-using MediatR;
-using Grand.Business.Core.Utilities.Marketing;
-
-namespace Grand.Business.Marketing.Services.Customers
-{
- public partial class CustomerReminderService : ICustomerReminderService
- {
- #region Fields
-
- private readonly IRepository<CustomerReminder> _customerReminderRepository;
- private readonly IRepository<CustomerReminderHistory> _customerReminderHistoryRepository;
- private readonly IRepository<Customer> _customerRepository;
- private readonly IRepository<Order> _orderRepository;
- private readonly IMediator _mediator;
- private readonly IEmailAccountService _emailAccountService;
- private readonly IQueuedEmailService _queuedEmailService;
- private readonly IStoreService _storeService;
- private readonly ICustomerAttributeParser _customerAttributeParser;
- private readonly IProductService _productService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly ITranslationService _translationService;
- private readonly ILanguageService _languageService;
-
- #endregion
-
- #region Ctor
-
- public CustomerReminderService(
- IRepository<CustomerReminder> customerReminderRepository,
- IRepository<CustomerReminderHistory> customerReminderHistoryRepository,
- IRepository<Customer> customerRepository,
- IRepository<Order> orderRepository,
- IMediator mediator,
- IEmailAccountService emailAccountService,
- IQueuedEmailService queuedEmailService,
- IStoreService storeService,
- IProductService productService,
- ICustomerAttributeParser customerAttributeParser,
- ICustomerActivityService customerActivityService,
- ITranslationService translationService,
- ILanguageService languageService)
- {
- _customerReminderRepository = customerReminderRepository;
- _customerReminderHistoryRepository = customerReminderHistoryRepository;
- _customerRepository = customerRepository;
- _orderRepository = orderRepository;
- _mediator = mediator;
- _emailAccountService = emailAccountService;
- _queuedEmailService = queuedEmailService;
- _storeService = storeService;
- _customerAttributeParser = customerAttributeParser;
- _productService = productService;
- _customerActivityService = customerActivityService;
- _translationService = translationService;
- _languageService = languageService;
- }
-
- #endregion
-
- #region Utilities
-
- protected async Task<bool> SendEmail(Customer customer, CustomerReminder customerReminder, string reminderlevelId)
- {
- var reminderLevel = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId);
- var emailAccount = await _emailAccountService.GetEmailAccountById(reminderLevel.EmailAccountId);
- var store = customer.ShoppingCartItems.Count > 0 ? await _storeService.GetStoreById(customer.ShoppingCartItems.FirstOrDefault().StoreId) : (await _storeService.GetAllStores()).FirstOrDefault();
-
- //retrieve message template data
- var bcc = reminderLevel.BccEmailAddresses;
- var languages = await _languageService.GetAllLanguages();
- var langId = customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LanguageId, store?.Id);
- if (string.IsNullOrEmpty(langId))
- langId = languages.FirstOrDefault().Id;
-
- var language = languages.FirstOrDefault(x => x.Id == langId);
- if (language == null)
- language = languages.FirstOrDefault();
-
- var email = new QueuedEmail();
-
- var builder = new LiquidObjectBuilder(_mediator);
- builder.AddStoreTokens(store, language, emailAccount)
- .AddCustomerTokens(customer, store, null, language)
- .AddShoppingCartTokens(customer, store, language);
-
- LiquidObject liquidObject = await builder.BuildAsync();
- liquidObject.Email = new LiquidEmail(email.Id);
-
- var body = LiquidExtensions.Render(liquidObject, reminderLevel.Body);
- var subject = LiquidExtensions.Render(liquidObject, reminderLevel.Subject);
-
- //limit name length
- var toName = CommonHelper.EnsureMaximumLength(customer.GetFullName(), 300);
-
- email.PriorityId = QueuedEmailPriority.High;
- email.From = emailAccount.Email;
- email.FromName = emailAccount.DisplayName;
- email.To = customer.Email;
- email.ToName = toName;
- email.ReplyTo = string.Empty;
- email.ReplyToName = string.Empty;
- email.CC = string.Empty;
- email.Bcc = bcc;
- email.Subject = subject;
- email.Body = body;
- email.AttachmentFilePath = "";
- email.AttachmentFileName = "";
- email.AttachedDownloads = null;
- email.CreatedOnUtc = DateTime.UtcNow;
- email.EmailAccountId = emailAccount.Id;
- email.Reference = Reference.CustomerReminder;
- email.ObjectId = customerReminder.Id;
-
- await _queuedEmailService.InsertQueuedEmail(email);
- //activity log
- _ = _customerActivityService.InsertActivity(string.Format("CustomerReminder.{0}", customerReminder.ReminderRuleId.ToString()), customer.Id, customer, "", _translationService.GetResource(string.Format("ActivityLog.{0}", customerReminder.ReminderRuleId.ToString())), customerReminder.Name);
-
- return true;
- }
-
- protected async Task<bool> SendEmail(Customer customer, Order order, CustomerReminder customerReminder, string reminderlevelId)
- {
- var reminderLevel = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId);
- var emailAccount = await _emailAccountService.GetEmailAccountById(reminderLevel.EmailAccountId);
- var store = await _storeService.GetStoreById(customer.StoreId);
- if (order != null)
- {
- store = await _storeService.GetStoreById(order.StoreId);
- }
- if (store == null)
- {
- store = (await _storeService.GetAllStores()).FirstOrDefault();
- }
-
- //retrieve message template data
- var bcc = reminderLevel.BccEmailAddresses;
- Language language = null;
- if (order != null)
- {
- language = await _languageService.GetLanguageById(order.CustomerLanguageId);
- }
- else
- {
- var customerLanguageId = customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LanguageId);
- if (!string.IsNullOrEmpty(customerLanguageId))
- language = await _languageService.GetLanguageById(customerLanguageId);
- }
- if (language == null)
- {
- language = (await _languageService.GetAllLanguages()).FirstOrDefault();
- }
-
- var builder = new LiquidObjectBuilder(_mediator);
- builder.AddStoreTokens(store, language, emailAccount)
- .AddCustomerTokens(customer, store, null, language)
- .AddShoppingCartTokens(customer, store, language)
- .AddOrderTokens(order, customer, await _storeService.GetStoreById(order.StoreId), null);
-
- var liquidObject = await builder.BuildAsync();
- var body = LiquidExtensions.Render(liquidObject, reminderLevel.Body);
- var subject = LiquidExtensions.Render(liquidObject, reminderLevel.Subject);
-
- //limit name length
- var toName = CommonHelper.EnsureMaximumLength(customer.GetFullName(), 300);
- var email = new QueuedEmail
- {
- PriorityId = QueuedEmailPriority.High,
- From = emailAccount.Email,
- FromName = emailAccount.DisplayName,
- To = customer.Email,
- ToName = toName,
- ReplyTo = string.Empty,
- ReplyToName = string.Empty,
- CC = string.Empty,
- Bcc = bcc,
- Subject = subject,
- Body = body,
- AttachmentFilePath = "",
- AttachmentFileName = "",
- AttachedDownloads = null,
- CreatedOnUtc = DateTime.UtcNow,
- EmailAccountId = emailAccount.Id,
- Reference = Reference.CustomerReminder,
- ObjectId = customerReminder.Id,
- };
-
- await _queuedEmailService.InsertQueuedEmail(email);
- //activity log
- _ = _customerActivityService.InsertActivity(string.Format("CustomerReminder.{0}", customerReminder.ReminderRuleId.ToString()), customer.Id, customer, "", string.Format("ActivityLog.{0}", customerReminder.ReminderRuleId.ToString()), customerReminder.Name);
-
- return true;
- }
-
-
- #region Conditions
- protected async Task<bool> CheckConditions(CustomerReminder customerReminder, Customer customer)
- {
- if (customerReminder.Conditions.Count == 0)
- return true;
-
-
- bool cond = false;
- foreach (var item in customerReminder.Conditions)
- {
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Category)
- {
- cond = await ConditionCategory(item, customer.ShoppingCartItems.Where(x => x.ShoppingCartTypeId == ShoppingCartType.ShoppingCart).Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Product)
- {
- cond = ConditionProducts(item, customer.ShoppingCartItems.Where(x => x.ShoppingCartTypeId == ShoppingCartType.ShoppingCart).Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Collection)
- {
- cond = await ConditionCollection(item, customer.ShoppingCartItems.Where(x => x.ShoppingCartTypeId == ShoppingCartType.ShoppingCart).Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerTag)
- {
- cond = ConditionCustomerTag(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerGroup)
- {
- cond = ConditionCustomerGroup(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerRegisterField)
- {
- cond = ConditionCustomerRegister(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomCustomerAttribute)
- {
- cond = await ConditionCustomerAttribute(item, customer);
- }
- }
-
- return cond;
- }
- protected async Task<bool> CheckConditions(CustomerReminder customerReminder, Customer customer, Order order)
- {
- if (customerReminder.Conditions.Count == 0)
- return true;
-
-
- bool cond = false;
- foreach (var item in customerReminder.Conditions)
- {
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Category)
- {
- cond = await ConditionCategory(item, order.OrderItems.Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Product)
- {
- cond = ConditionProducts(item, order.OrderItems.Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.Collection)
- {
- cond = await ConditionCollection(item, order.OrderItems.Select(x => x.ProductId).ToList());
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerTag)
- {
- cond = ConditionCustomerTag(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerGroup)
- {
- cond = ConditionCustomerGroup(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerRegisterField)
- {
- cond = ConditionCustomerRegister(item, customer);
- }
- if (item.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomCustomerAttribute)
- {
- cond = await ConditionCustomerAttribute(item, customer);
- }
- }
-
- return cond;
- }
- protected async Task<bool> ConditionCategory(CustomerReminder.ReminderCondition condition, ICollection<string> products)
- {
- bool cond = false;
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var item in condition.Categories)
- {
- foreach (var product in products)
- {
- var pr = await _productService.GetProductById(product);
- if (pr != null)
- {
- if (pr.ProductCategories.Where(x => x.CategoryId == item).Count() == 0)
- return false;
- }
- else
- {
- return false;
- }
- }
- }
- }
-
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- foreach (var item in condition.Categories)
- {
- foreach (var product in products)
- {
- var pr = await _productService.GetProductById(product);
- if (pr != null)
- {
- if (pr.ProductCategories.Where(x => x.CategoryId == item).Count() > 0)
- return true;
- }
- }
- }
- }
-
- return cond;
- }
- protected async Task<bool> ConditionCollection(CustomerReminder.ReminderCondition condition, ICollection<string> products)
- {
- bool cond = false;
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var item in condition.Collections)
- {
- foreach (var product in products)
- {
- var pr = await _productService.GetProductById(product);
- if (pr != null)
- {
- if (pr.ProductCollections.Where(x => x.CollectionId == item).Count() == 0)
- return false;
- }
- else
- {
- return false;
- }
- }
- }
- }
-
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- foreach (var item in condition.Collections)
- {
- foreach (var product in products)
- {
- var pr = await _productService.GetProductById(product);
- if (pr != null)
- {
- if (pr.ProductCollections.Where(x => x.CollectionId == item).Count() > 0)
- return true;
- }
- }
- }
- }
-
- return cond;
- }
- protected bool ConditionProducts(CustomerReminder.ReminderCondition condition, ICollection<string> products)
- {
- bool cond = true;
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = products.ContainsAll(condition.Products);
- }
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- cond = products.ContainsAny(condition.Products);
- }
-
- return cond;
- }
- protected bool ConditionCustomerGroup(CustomerReminder.ReminderCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var customerGroups = customer.Groups;
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = customerGroups.ContainsAll(condition.CustomerGroups);
- }
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- cond = customerGroups.ContainsAny(condition.CustomerGroups);
- }
- }
- return cond;
- }
- protected bool ConditionCustomerTag(CustomerReminder.ReminderCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- var customerTags = customer.CustomerTags;
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = customerTags.Select(x => x).ContainsAll(condition.CustomerTags);
- }
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- cond = customerTags.Select(x => x).ContainsAny(condition.CustomerTags);
- }
- }
- return cond;
- }
- protected bool ConditionCustomerRegister(CustomerReminder.ReminderCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- cond = true;
- foreach (var item in condition.CustomerRegistration)
- {
- if (customer.UserFields.Where(x => x.Key == item.RegisterField && x.Value == item.RegisterValue).Count() == 0)
- cond = false;
- }
- }
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- foreach (var item in condition.CustomerRegistration)
- {
- if (customer.UserFields.Where(x => x.Key == item.RegisterField && x.Value == item.RegisterValue).Count() > 0)
- cond = true;
- }
- }
- }
- return cond;
- }
- protected async Task<bool> ConditionCustomerAttribute(CustomerReminder.ReminderCondition condition, Customer customer)
- {
- bool cond = false;
- if (customer != null)
- {
- if (condition.ConditionId == CustomerReminderConditionEnum.AllOfThem)
- {
- if (customer.Attributes.Any())
- {
- var selectedValues = await _customerAttributeParser.ParseCustomerAttributeValues(customer.Attributes);
- cond = true;
- foreach (var item in condition.CustomCustomerAttributes)
- {
- var _fields = item.RegisterField.Split(':');
- if (_fields.Count() > 1)
- {
- if (selectedValues.Where(x => x.CustomerAttributeId == _fields.FirstOrDefault() && x.Id == _fields.LastOrDefault()).Count() == 0)
- cond = false;
- }
- else
- cond = false;
- }
- }
- }
- if (condition.ConditionId == CustomerReminderConditionEnum.OneOfThem)
- {
- if (customer.Attributes.Any())
- {
- var selectedValues = await _customerAttributeParser.ParseCustomerAttributeValues(customer.Attributes);
- foreach (var item in condition.CustomCustomerAttributes)
- {
- var _fields = item.RegisterField.Split(':');
- if (_fields.Count() > 1)
- {
- if (selectedValues.Where(x => x.CustomerAttributeId == _fields.FirstOrDefault() && x.Id == _fields.LastOrDefault()).Count() > 0)
- cond = true;
- }
- }
- }
- }
- }
- return cond;
- }
- #endregion
-
- #region History
-
- protected async Task UpdateHistory(Customer customer, CustomerReminder customerReminder, string reminderlevelId, CustomerReminderHistory history)
- {
- if (history != null)
- {
- history.Levels.Add(new CustomerReminderHistory.HistoryLevel()
- {
- Level = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level,
- ReminderLevelId = reminderlevelId,
- SendDate = DateTime.UtcNow,
- });
- if (customerReminder.Levels.Max(x => x.Level) ==
- customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level)
- {
- history.Status = CustomerReminderHistoryStatusEnum.CompletedReminder;
- history.EndDate = DateTime.UtcNow;
- }
- await _customerReminderHistoryRepository.UpdateAsync(history);
- }
- else
- {
- history = new CustomerReminderHistory();
- history.CustomerId = customer.Id;
- history.Status = CustomerReminderHistoryStatusEnum.Started;
- history.StartDate = DateTime.UtcNow;
- history.CustomerReminderId = customerReminder.Id;
- history.ReminderRuleId = customerReminder.ReminderRuleId;
- history.Levels.Add(new CustomerReminderHistory.HistoryLevel()
- {
- Level = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level,
- ReminderLevelId = reminderlevelId,
- SendDate = DateTime.UtcNow,
- });
-
- await _customerReminderHistoryRepository.InsertAsync(history);
- }
-
- }
-
- protected async Task UpdateHistory(Order order, CustomerReminder customerReminder, string reminderlevelId, CustomerReminderHistory history)
- {
- if (history != null)
- {
- history.Levels.Add(new CustomerReminderHistory.HistoryLevel()
- {
- Level = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level,
- ReminderLevelId = reminderlevelId,
- SendDate = DateTime.UtcNow,
- });
- if (customerReminder.Levels.Max(x => x.Level) ==
- customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level)
- {
- history.Status = CustomerReminderHistoryStatusEnum.CompletedReminder;
- history.EndDate = DateTime.UtcNow;
- }
- await _customerReminderHistoryRepository.UpdateAsync(history);
- }
- else
- {
- history = new CustomerReminderHistory();
- history.BaseOrderId = order.Id;
- history.CustomerId = order.CustomerId;
- history.Status = CustomerReminderHistoryStatusEnum.Started;
- history.StartDate = DateTime.UtcNow;
- history.CustomerReminderId = customerReminder.Id;
- history.ReminderRuleId = customerReminder.ReminderRuleId;
- history.Levels.Add(new CustomerReminderHistory.HistoryLevel()
- {
- Level = customerReminder.Levels.FirstOrDefault(x => x.Id == reminderlevelId).Level,
- ReminderLevelId = reminderlevelId,
- SendDate = DateTime.UtcNow,
- });
-
- await _customerReminderHistoryRepository.InsertAsync(history);
- }
-
- }
- protected async Task CloseHistoryReminder(CustomerReminder customerReminder, CustomerReminderHistory history)
- {
- history.Status = CustomerReminderHistoryStatusEnum.CompletedReminder;
- history.EndDate = DateTime.UtcNow;
- await _customerReminderHistoryRepository.UpdateAsync(history);
- }
-
- #endregion
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets customer reminder
- /// </summary>
- /// <param name="id">Customer reminder identifier</param>
- /// <returns>Customer reminder</returns>
- public virtual Task<CustomerReminder> GetCustomerReminderById(string id)
- {
- return _customerReminderRepository.GetByIdAsync(id);
- }
-
-
- /// <summary>
- /// Gets all customer reminders
- /// </summary>
- /// <returns>Customer reminders</returns>
- public virtual async Task<IList<CustomerReminder>> GetCustomerReminders()
- {
- var query = from p in _customerReminderRepository.Table
- orderby p.DisplayOrder
- select p;
- return await Task.FromResult(query.ToList());
- }
-
- /// <summary>
- /// Inserts a customer reminder
- /// </summary>
- /// <param name="CustomerReminder">Customer reminder</param>
- public virtual async Task InsertCustomerReminder(CustomerReminder customerReminder)
- {
- if (customerReminder == null)
- throw new ArgumentNullException(nameof(customerReminder));
-
- await _customerReminderRepository.InsertAsync(customerReminder);
-
- //event notification
- await _mediator.EntityInserted(customerReminder);
-
- }
-
- /// <summary>
- /// Delete a customer reminder
- /// </summary>
- /// <param name="customerReminder">Customer reminder</param>
- public virtual async Task DeleteCustomerReminder(CustomerReminder customerReminder)
- {
- if (customerReminder == null)
- throw new ArgumentNullException(nameof(customerReminder));
-
- await _customerReminderRepository.DeleteAsync(customerReminder);
-
- //event notification
- await _mediator.EntityDeleted(customerReminder);
-
- }
-
- /// <summary>
- /// Updates the customer reminder
- /// </summary>
- /// <param name="CustomerReminder">Customer reminder</param>
- public virtual async Task UpdateCustomerReminder(CustomerReminder customerReminder)
- {
- if (customerReminder == null)
- throw new ArgumentNullException(nameof(customerReminder));
-
- await _customerReminderRepository.UpdateAsync(customerReminder);
-
- //event notification
- await _mediator.EntityUpdated(customerReminder);
- }
-
-
-
- public virtual async Task<IPagedList<SerializeCustomerReminderHistory>> GetAllCustomerReminderHistory(string customerReminderId, int pageIndex = 0, int pageSize = 2147483647)
- {
- var query = from h in _customerReminderHistoryRepository.Table
- from l in h.Levels
- select new SerializeCustomerReminderHistory() { CustomerId = h.CustomerId, Id = h.Id, CustomerReminderId = h.CustomerReminderId, Level = l.Level, SendDate = l.SendDate, OrderId = h.OrderId };
-
- query = from p in query
- where p.CustomerReminderId == customerReminderId
- select p;
- return await PagedList<SerializeCustomerReminderHistory>.Create(query, pageIndex, pageSize);
- }
-
- #endregion
-
- #region Tasks
-
- public virtual async Task Task_AbandonedCart(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.AbandonedCart
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.AbandonedCart
- select cr).ToList();
- }
-
- foreach (var reminder in customerReminder)
- {
- var customers = (from cu in _customerRepository.Table
- where cu.ShoppingCartItems.Any() && cu.LastUpdateCartDateUtc > reminder.LastUpdateDate && cu.Active && !cu.Deleted
- && (!String.IsNullOrEmpty(cu.Email))
- select cu).ToList();
-
- foreach (var customer in customers)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerId == customer.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
-
- if (DateTime.UtcNow > customer.LastUpdateCartDateUtc.Value.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
-
- if (DateTime.UtcNow > customer.LastUpdateCartDateUtc.Value.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- }
-
- public virtual async Task Task_RegisteredCustomer(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.RegisteredCustomer
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.RegisteredCustomer
- select cr).ToList();
- }
- foreach (var reminder in customerReminder)
- {
- var customers = (from cu in _customerRepository.Table
- where cu.CreatedOnUtc > reminder.LastUpdateDate && cu.Active && !cu.Deleted
- && (!String.IsNullOrEmpty(cu.Email))
- && !cu.IsSystemAccount
- select cu).ToList();
-
- foreach (var customer in customers)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerId == customer.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
-
- if (DateTime.UtcNow > customer.CreatedOnUtc.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
-
- if (DateTime.UtcNow > customer.CreatedOnUtc.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- }
-
- public virtual async Task Task_LastActivity(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.LastActivity
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.LastActivity
- select cr).ToList();
- }
- foreach (var reminder in customerReminder)
- {
- var customers = (from cu in _customerRepository.Table
- where cu.LastActivityDateUtc < reminder.LastUpdateDate && cu.Active && !cu.Deleted
- && (!String.IsNullOrEmpty(cu.Email))
- select cu).ToList();
-
- foreach (var customer in customers)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerId == customer.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
-
- if (DateTime.UtcNow > customer.LastActivityDateUtc.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (DateTime.UtcNow > customer.LastActivityDateUtc.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes))
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- }
-
- public virtual async Task Task_LastPurchase(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.LastPurchase
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.LastPurchase
- select cr).ToList();
- }
- foreach (var reminder in customerReminder)
- {
- var customers = (from cu in _customerRepository.Table
- where cu.LastPurchaseDateUtc < reminder.LastUpdateDate || cu.LastPurchaseDateUtc == null
- && (!String.IsNullOrEmpty(cu.Email)) && cu.Active && !cu.Deleted
- && !cu.IsSystemAccount
- select cu).ToList();
-
- foreach (var customer in customers)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerId == customer.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- DateTime lastpurchaseDate = customer.LastPurchaseDateUtc.HasValue ? customer.LastPurchaseDateUtc.Value.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes) : DateTime.MinValue;
- if (DateTime.UtcNow > lastpurchaseDate)
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- DateTime lastpurchaseDate = customer.LastPurchaseDateUtc.HasValue ? customer.LastPurchaseDateUtc.Value.AddDays(level.Day).AddHours(level.Hour).AddMinutes(level.Minutes) : DateTime.MinValue;
- if (DateTime.UtcNow > lastpurchaseDate)
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- }
- }
-
- public virtual async Task Task_Birthday(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.Birthday
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.Birthday
- select cr).ToList();
- }
-
- foreach (var reminder in customerReminder)
- {
- int day = 0;
- if (reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null)
- day = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault().Day;
-
- string dateDDMM = DateTime.Now.AddDays(day).ToString("-MM-dd");
-
- var customers = (from cu in _customerRepository.Table
- where (!String.IsNullOrEmpty(cu.Email)) && cu.Active && !cu.Deleted
- && cu.UserFields.Any(x => x.Key == "DateOfBirth" && x.Value.Contains(dateDDMM))
- select cu).ToList();
-
- foreach (var customer in customers)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerId == customer.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer))
- {
- var send = await SendEmail(customer, reminder, level.Id);
- if (send)
- await UpdateHistory(customer, reminder, level.Id, null);
- }
- }
- }
- }
-
- var activehistory = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerReminderId == reminder.Id && hc.Status == CustomerReminderHistoryStatusEnum.Started
- select hc).ToList();
-
- foreach (var activereminderhistory in activehistory)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- var customer = _customerRepository.Table.FirstOrDefault(x => x.Id == activereminderhistory.CustomerId);
- if (reminderLevel != null && customer != null && customer.Active && !customer.Deleted)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(customer, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- }
-
- }
-
- public virtual async Task Task_CompletedOrder(string id = "")
- {
- var dateNow = DateTime.UtcNow.Date;
- var datetimeUtcNow = DateTime.UtcNow;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.CompletedOrder
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.CompletedOrder
- select cr).ToList();
- }
-
- foreach (var reminder in customerReminder)
- {
- int day = 0;
- if (reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null)
- day = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault().Day;
-
- var orders = (from or in _orderRepository.Table
- where or.OrderStatusId == (int)OrderStatusSystem.Complete
- && or.CreatedOnUtc >= reminder.LastUpdateDate && or.CreatedOnUtc >= dateNow.AddDays(-day)
- select or).ToList();
-
- foreach (var order in orders)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.BaseOrderId == order.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
-
- Customer customer = await _customerRepository.GetByIdAsync(order.CustomerId);
- if (customer != null && customer.Active && !customer.Deleted)
- {
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, order, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(order, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer, order))
- {
- var send = await SendEmail(customer, order, reminder, level.Id);
- if (send)
- await UpdateHistory(order, reminder, level.Id, null);
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer, order))
- {
- var send = await SendEmail(customer, order, reminder, level.Id);
- if (send)
- await UpdateHistory(order, reminder, level.Id, null);
- }
- }
- }
- }
- }
-
- var activehistory = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerReminderId == reminder.Id && hc.Status == CustomerReminderHistoryStatusEnum.Started
- select hc).ToList();
-
- foreach (var activereminderhistory in activehistory)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- var order = _orderRepository.Table.FirstOrDefault(x => x.Id == activereminderhistory.BaseOrderId);
- var customer = _customerRepository.Table.FirstOrDefault(x => x.Id == order.CustomerId && x.Active && !x.Deleted);
- if (reminderLevel != null && order != null && customer != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, order, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(order, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
-
- }
-
- }
- public virtual async Task Task_UnpaidOrder(string id = "")
- {
- var datetimeUtcNow = DateTime.UtcNow;
- var dateNow = DateTime.UtcNow.Date;
- var customerReminder = new List<CustomerReminder>();
- if (String.IsNullOrEmpty(id))
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Active && datetimeUtcNow >= cr.StartDateTimeUtc && datetimeUtcNow <= cr.EndDateTimeUtc
- && cr.ReminderRuleId == CustomerReminderRuleEnum.UnpaidOrder
- select cr).ToList();
- }
- else
- {
- customerReminder = (from cr in _customerReminderRepository.Table
- where cr.Id == id && cr.ReminderRuleId == CustomerReminderRuleEnum.UnpaidOrder
- select cr).ToList();
- }
-
- foreach (var reminder in customerReminder)
- {
- int day = 0;
- if (reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null)
- day = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault().Day;
-
- var orders = (from or in _orderRepository.Table
- where or.PaymentStatusId == PaymentStatus.Pending
- && or.CreatedOnUtc >= reminder.LastUpdateDate && or.CreatedOnUtc >= dateNow.AddDays(-day)
- select or).ToList();
-
- foreach (var order in orders)
- {
- var history = (from hc in _customerReminderHistoryRepository.Table
- where hc.BaseOrderId == order.Id && hc.CustomerReminderId == reminder.Id
- select hc).ToList();
-
- Customer customer = await _customerRepository.GetByIdAsync(order.CustomerId);
- if (customer != null && customer.Active && !customer.Deleted)
- {
- if (history.Any())
- {
- var activereminderhistory = history.FirstOrDefault(x => x.Status == CustomerReminderHistoryStatusEnum.Started);
- if (activereminderhistory != null)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- if (reminderLevel != null)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, order, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(order, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- else
- {
- if (DateTime.UtcNow > history.Max(x => x.EndDate).AddDays(reminder.RenewedDay) && reminder.AllowRenew)
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer, order))
- {
- var send = await SendEmail(customer, order, reminder, level.Id);
- if (send)
- await UpdateHistory(order, reminder, level.Id, null);
- }
- }
- }
- }
- }
- else
- {
- var level = reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() != null ? reminder.Levels.OrderBy(x => x.Level).FirstOrDefault() : null;
- if (level != null)
- {
- if (await CheckConditions(reminder, customer, order))
- {
- var send = await SendEmail(customer, order, reminder, level.Id);
- if (send)
- await UpdateHistory(order, reminder, level.Id, null);
- }
- }
- }
- }
- }
- var activehistory = (from hc in _customerReminderHistoryRepository.Table
- where hc.CustomerReminderId == reminder.Id && hc.Status == CustomerReminderHistoryStatusEnum.Started
- select hc).ToList();
-
- foreach (var activereminderhistory in activehistory)
- {
- var lastLevel = activereminderhistory.Levels.OrderBy(x => x.SendDate).LastOrDefault();
- var reminderLevel = reminder.Levels.FirstOrDefault(x => x.Level > lastLevel.Level);
- var order = _orderRepository.Table.FirstOrDefault(x => x.Id == activereminderhistory.BaseOrderId);
- var customer = _customerRepository.Table.FirstOrDefault(x => x.Id == order.CustomerId && x.Active && !x.Deleted);
- if (reminderLevel != null && order != null && customer != null)
- {
- if (order.PaymentStatusId == PaymentStatus.Pending)
- {
- if (DateTime.UtcNow > lastLevel.SendDate.AddDays(reminderLevel.Day).AddHours(reminderLevel.Hour).AddMinutes(reminderLevel.Minutes))
- {
- var send = await SendEmail(customer, order, reminder, reminderLevel.Id);
- if (send)
- await UpdateHistory(order, reminder, reminderLevel.Id, activereminderhistory);
- }
- }
- else
- await CloseHistoryReminder(reminder, activereminderhistory);
-
- }
- else
- {
- await CloseHistoryReminder(reminder, activereminderhistory);
- }
- }
- }
- }
-
- #endregion
- }
-
-
-}
\ No newline at end of file
diff --git a/src/Business/Grand.Business.Marketing/Services/Newsletters/NewsletterCategoryService.cs b/src/Business/Grand.Business.Marketing/Services/Newsletters/NewsletterCategoryService.cs
index a6d3b9cd0..4fbc22437 100644
--- a/src/Business/Grand.Business.Marketing/Services/Newsletters/NewsletterCategoryService.cs
+++ b/src/Business/Grand.Business.Marketing/Services/Newsletters/NewsletterCategoryService.cs
@@ -76,7 +76,7 @@ namespace Grand.Business.Marketing.Services.Newsteletters
/// Gets a newsletter by category
/// </summary>
/// <param name="id">newsletter category</param>
- /// <returns>Banner</returns>
+ /// <returns>NewsletterCategory</returns>
public virtual Task<NewsletterCategory> GetNewsletterCategoryById(string id)
{
return _newsletterCategoryRepository.GetByIdAsync(id);
diff --git a/src/Business/Grand.Business.Marketing/Startup/StartupApplication.cs b/src/Business/Grand.Business.Marketing/Startup/StartupApplication.cs
index bb49bbb2b..cde3e1cbc 100644
--- a/src/Business/Grand.Business.Marketing/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.Marketing/Startup/StartupApplication.cs
@@ -1,19 +1,15 @@
-using Grand.Business.Core.Interfaces.Marketing.Banners;
-using Grand.Business.Core.Interfaces.Marketing.Campaigns;
+using Grand.Business.Core.Interfaces.Marketing.Campaigns;
using Grand.Business.Core.Interfaces.Marketing.Contacts;
using Grand.Business.Core.Interfaces.Marketing.Courses;
using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Business.Core.Interfaces.Marketing.Documents;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Business.Core.Interfaces.Marketing.Newsletters;
using Grand.Business.Core.Interfaces.Marketing.PushNotifications;
-using Grand.Business.Marketing.Services.Banners;
using Grand.Business.Marketing.Services.Campaigns;
using Grand.Business.Marketing.Services.Contacts;
using Grand.Business.Marketing.Services.Courses;
using Grand.Business.Marketing.Services.Customers;
using Grand.Business.Marketing.Services.Documents;
-using Grand.Business.Marketing.Services.Knowledgebase;
using Grand.Business.Marketing.Services.Newsteletters;
using Grand.Business.Marketing.Services.PushNotifications;
using Grand.Infrastructure;
@@ -30,7 +26,6 @@ namespace Grand.Business.Marketing.Startup
{
RegisterCoursesService(services);
RegisterDocumentsService(services);
- RegisterKnowledgebaseService(services);
RegisterCommon(services);
RegisterCustomer(services);
}
@@ -44,17 +39,11 @@ namespace Grand.Business.Marketing.Startup
private void RegisterCustomer(IServiceCollection serviceCollection)
{
serviceCollection.AddScoped<ICustomerTagService, CustomerTagService>();
- serviceCollection.AddScoped<ICustomerActionService, CustomerActionService>();
- serviceCollection.AddScoped<ICustomerActionEventService, CustomerActionEventService>();
- serviceCollection.AddScoped<ICustomerReminderService, CustomerReminderService>();
serviceCollection.AddScoped<ICustomerProductService, CustomerProductService>();
serviceCollection.AddScoped<ICustomerCoordinatesService, CustomerCoordinatesService>();
}
private void RegisterCommon(IServiceCollection serviceCollection)
{
- serviceCollection.AddScoped<IBannerService, BannerService>();
- serviceCollection.AddScoped<IPopupService, PopupService>();
- serviceCollection.AddScoped<IInteractiveFormService, InteractiveFormService>();
serviceCollection.AddScoped<IContactAttributeParser, ContactAttributeParser>();
serviceCollection.AddScoped<IContactAttributeService, ContactAttributeService>();
serviceCollection.AddScoped<IContactUsService, ContactUsService>();
@@ -79,10 +68,5 @@ namespace Grand.Business.Marketing.Startup
serviceCollection.AddScoped<IDocumentService, DocumentService>();
}
- private void RegisterKnowledgebaseService(IServiceCollection serviceCollection)
- {
- serviceCollection.AddScoped<IKnowledgebaseService, KnowledgebaseService>();
- }
-
}
}
diff --git a/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs b/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs
index 491cca6cd..189438552 100644
--- a/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs
+++ b/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs
@@ -1735,109 +1735,6 @@ namespace Grand.Business.Messages.Services
reference: Reference.Vendor, objectId: vendor?.Id);
}
- #region Customer Action Event
-
- /// <summary>
- /// Sends a customer action event - Add to cart notification to a customer
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="ShoppingCartItem">Item</param>
- /// <param name="languageId">Message language identifier</param>
- /// <param name="customerId">Customer identifier</param>
- /// <returns>Queued email identifier</returns>
- public virtual async Task<int> SendCustomerActionAddToCartMessage(CustomerAction action, ShoppingCartItem cartItem, string languageId, Customer customer)
- {
- if (cartItem == null)
- throw new ArgumentNullException(nameof(cartItem));
-
- var store = await GetStore(cartItem.StoreId);
- var language = await EnsureLanguageIsActive(languageId, store.Id);
-
- var messageTemplate = await _messageTemplateService.GetMessageTemplateById(action.MessageTemplateId);
- if (messageTemplate == null)
- return 0;
-
- //email account
- var emailAccount = await GetEmailAccountOfMessageTemplate(messageTemplate, language.Id);
-
- var builder = new LiquidObjectBuilder(_mediator);
- builder.AddStoreTokens(store, language, emailAccount);
- //product
- var product = await _mediator.Send(new GetProductByIdQuery() { Id = cartItem.ProductId });
- builder.AddProductTokens(product, language, store, _storeHelper.DomainHost);
-
- LiquidObject liquidObject = await builder.BuildAsync();
- //event notification
- await _mediator.MessageTokensAdded(messageTemplate, liquidObject);
-
- var toEmail = customer.Email;
- var toName = customer.GetFullName();
-
- if (string.IsNullOrEmpty(toEmail))
- return 0;
-
- return await SendNotification(messageTemplate, emailAccount,
- languageId, liquidObject,
- toEmail, toName,
- reference: Reference.Customer, objectId: customer?.Id);
- }
-
-
- /// <summary>
- /// Sends a customer action event - Add to cart notification to a customer
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="Order">Order</param>
- /// <param name="languageId">Message language identifier</param>
- /// <returns>Queued email identifier</returns>
- public virtual async Task<int> SendCustomerActionAddToOrderMessage(CustomerAction action, Order order, Customer customer, string languageId)
- {
- if (order == null)
- throw new ArgumentNullException(nameof(order));
-
- var store = await GetStore(order.StoreId);
- var language = await EnsureLanguageIsActive(languageId, store.Id);
-
- var messageTemplate = await _messageTemplateService.GetMessageTemplateById(action.MessageTemplateId);
- if (messageTemplate == null)
- return 0;
-
- //email account
- var emailAccount = await GetEmailAccountOfMessageTemplate(messageTemplate, language.Id);
-
- var builder = new LiquidObjectBuilder(_mediator);
- builder.AddStoreTokens(store, language, emailAccount)
- .AddOrderTokens(order, customer, store, _storeHelper.DomainHost)
- .AddCustomerTokens(customer, store, _storeHelper.DomainHost, language);
-
- LiquidObject liquidObject = await builder.BuildAsync();
- //event notification
- await _mediator.MessageTokensAdded(messageTemplate, liquidObject);
-
- var toEmail = string.Empty;
- var toName = string.Empty;
-
- if (order.BillingAddress != null)
- {
- toEmail = order.BillingAddress.Email;
- toName = string.Format("{0} {1}", order.BillingAddress.FirstName, order.BillingAddress.LastName);
- }
- else
- {
- if (order.ShippingAddress != null)
- {
- toEmail = order.ShippingAddress.Email;
- toName = string.Format("{0} {1}", order.ShippingAddress.FirstName, order.ShippingAddress.LastName);
- }
- }
-
- return await SendNotification(messageTemplate, emailAccount,
- languageId, liquidObject,
- toEmail, toName,
- reference: Reference.Customer, objectId: customer?.Id);
-
- }
-
#region Auction notification
public virtual async Task<int> SendAuctionWinEndedCustomerMessage(Product product, string languageId, Bid bid)
@@ -2079,49 +1976,6 @@ namespace Grand.Business.Messages.Services
}
#endregion
-
-
- /// <summary>
- /// Sends a customer action event - Add to cart notification to a customer
- /// </summary>
- /// <param name="CustomerAction">Customer action</param>
- /// <param name="languageId">Message language identifier</param>
- /// <param name="customerId">Customer identifier</param>
- /// <returns>Queued email identifier</returns>
- public virtual async Task<int> SendCustomerActionMessage(CustomerAction action, string languageId, Customer customer)
- {
- var store = await GetStore(customer.StoreId);
- var language = await EnsureLanguageIsActive(languageId, store.Id);
-
- var messageTemplate = await _messageTemplateService.GetMessageTemplateById(action.MessageTemplateId);
- if (messageTemplate == null)
- return 0;
-
- //email account
- var emailAccount = await GetEmailAccountOfMessageTemplate(messageTemplate, language.Id);
-
- var builder = new LiquidObjectBuilder(_mediator);
- builder.AddStoreTokens(store, language, emailAccount)
- .AddCustomerTokens(customer, store, _storeHelper.DomainHost, language);
-
- LiquidObject liquidObject = await builder.BuildAsync();
- //event notification
- await _mediator.MessageTokensAdded(messageTemplate, liquidObject);
-
- var toEmail = customer.Email;
- var toName = customer.GetFullName();
-
- if (string.IsNullOrEmpty(toEmail))
- return 0;
-
- return await SendNotification(messageTemplate, emailAccount,
- languageId, liquidObject,
- toEmail, toName,
- reference: Reference.Customer, objectId: customer.Id);
- }
-
- #endregion
-
public virtual async Task<int> SendNotification(MessageTemplate messageTemplate,
EmailAccount emailAccount, string languageId, LiquidObject liquidObject,
string toEmailAddress, string toName,
diff --git a/src/Business/Grand.Business.Messages/Services/MessageTokenProvider.cs b/src/Business/Grand.Business.Messages/Services/MessageTokenProvider.cs
index 0d8fb063a..ea88f78cd 100644
--- a/src/Business/Grand.Business.Messages/Services/MessageTokenProvider.cs
+++ b/src/Business/Grand.Business.Messages/Services/MessageTokenProvider.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Messages;
-using Grand.Domain.Customers;
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
namespace Grand.Business.Messages.Services
@@ -54,25 +53,6 @@ namespace Grand.Business.Messages.Services
return allowedTokens.ToArray();
}
- public virtual string[] GetListOfCustomerReminderAllowedTokens(CustomerReminderRuleEnum rule)
- {
- var allowedTokens = LiquidExtensions.GetTokens(typeof(LiquidStore));
-
- if (rule == CustomerReminderRuleEnum.AbandonedCart)
- {
- allowedTokens.AddRange(LiquidExtensions.GetTokens(typeof(LiquidShoppingCart)));
- }
-
- if (rule == CustomerReminderRuleEnum.CompletedOrder || rule == CustomerReminderRuleEnum.UnpaidOrder)
- {
- allowedTokens.AddRange(LiquidExtensions.GetTokens(typeof(LiquidOrder)));
- }
-
- allowedTokens.AddRange(LiquidExtensions.GetTokens(typeof(LiquidCustomer)));
-
- return allowedTokens.ToArray();
- }
-
#endregion
}
}
\ No newline at end of file
diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
index 724ca07eb..5be6fad1b 100644
--- a/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
+++ b/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
@@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Business.Core.Commands.System.Common;
using Grand.Domain.Blogs;
diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetAttributeCombinationTokensCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetAttributeCombinationTokensCommandHandler.cs
index e425d2627..2d3fceaf1 100644
--- a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetAttributeCombinationTokensCommandHandler.cs
+++ b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetAttributeCombinationTokensCommandHandler.cs
@@ -1,7 +1,7 @@
-using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Commands.Messages;
using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Commands.Messages;
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
+using Grand.Domain.Catalog;
using MediatR;
namespace Grand.Business.System.Commands.Handlers.Messages
@@ -9,21 +9,18 @@ namespace Grand.Business.System.Commands.Handlers.Messages
public class GetAttributeCombinationTokensCommandHandler : IRequestHandler<GetAttributeCombinationTokensCommand, LiquidAttributeCombination>
{
private readonly IProductAttributeFormatter _productAttributeFormatter;
- private readonly IProductAttributeParser _productAttributeParser;
public GetAttributeCombinationTokensCommandHandler(
- IProductAttributeFormatter productAttributeFormatter,
- IProductAttributeParser productAttributeParser)
+ IProductAttributeFormatter productAttributeFormatter)
{
_productAttributeFormatter = productAttributeFormatter;
- _productAttributeParser = productAttributeParser;
}
public async Task<LiquidAttributeCombination> Handle(GetAttributeCombinationTokensCommand request, CancellationToken cancellationToken)
{
var liquidAttributeCombination = new LiquidAttributeCombination(request.Combination);
liquidAttributeCombination.Formatted = await _productAttributeFormatter.FormatAttributes(request.Product, request.Combination.Attributes, null, renderPrices: false);
- liquidAttributeCombination.SKU = request.Product.FormatSku(request.Combination.Attributes, _productAttributeParser);
+ liquidAttributeCombination.SKU = request.Product.FormatSku(request.Combination.Attributes);
return liquidAttributeCombination;
}
}
diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
index decc38a35..115541431 100644
--- a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
+++ b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
@@ -1,4 +1,5 @@
-using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Commands.Messages;
+using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Checkout.GiftVouchers;
@@ -7,8 +8,9 @@ using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Commands.Messages;
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
+using Grand.Domain.Catalog;
+using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using Grand.Domain.Tax;
using Grand.Domain.Vendors;
@@ -24,7 +26,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
private readonly IProductService _productService;
private readonly IVendorService _vendorService;
private readonly IPriceFormatter _priceFormatter;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ICountryService _countryService;
private readonly IAddressAttributeParser _addressAttributeParser;
private readonly IPaymentService _paymentService;
@@ -39,7 +40,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
IProductService productService,
IVendorService vendorService,
IPriceFormatter priceFormatter,
- IProductAttributeParser productAttributeParser,
ICountryService countryService,
IAddressAttributeParser addressAttributeParser,
IPaymentService paymentService,
@@ -52,7 +52,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
_productService = productService;
_vendorService = vendorService;
_priceFormatter = priceFormatter;
- _productAttributeParser = productAttributeParser;
_countryService = countryService;
_addressAttributeParser = addressAttributeParser;
_paymentService = paymentService;
@@ -114,7 +113,7 @@ namespace Grand.Business.System.Commands.Handlers.Messages
string sku = "";
if (product != null)
- sku = product.FormatSku(item.Attributes, _productAttributeParser);
+ sku = product.FormatSku(item.Attributes);
liqitem.ProductSku = WebUtility.HtmlEncode(sku);
liquidOrder.OrderItems.Add(liqitem);
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderAbandonedCartScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderAbandonedCartScheduleTask.cs
deleted file mode 100644
index ae6506437..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderAbandonedCartScheduleTask.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderAbandonedCartScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
-
- public CustomerReminderAbandonedCartScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_AbandonedCart();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderBirthdayScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderBirthdayScheduleTask.cs
deleted file mode 100644
index 9301ffe26..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderBirthdayScheduleTask.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderBirthdayScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
-
- public CustomerReminderBirthdayScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_Birthday();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderCompletedOrderScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderCompletedOrderScheduleTask.cs
deleted file mode 100644
index 46e58c106..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderCompletedOrderScheduleTask.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderCompletedOrderScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
-
- public CustomerReminderCompletedOrderScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_CompletedOrder();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastActivityScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastActivityScheduleTask.cs
deleted file mode 100644
index 9dd15b330..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastActivityScheduleTask.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderLastActivityScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
- public CustomerReminderLastActivityScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_LastActivity();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastPurchaseScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastPurchaseScheduleTask.cs
deleted file mode 100644
index 7f9dd75a7..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderLastPurchaseScheduleTask.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderLastPurchaseScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
- public CustomerReminderLastPurchaseScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_LastPurchase();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderRegisteredCustomerScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderRegisteredCustomerScheduleTask.cs
deleted file mode 100644
index 9886f8c02..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderRegisteredCustomerScheduleTask.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderRegisteredCustomerScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
- public CustomerReminderRegisteredCustomerScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_RegisteredCustomer();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderUnpaidOrderScheduleTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderUnpaidOrderScheduleTask.cs
deleted file mode 100644
index b5f8570c3..000000000
--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/CustomerReminderUnpaidOrderScheduleTask.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.System.ScheduleTasks;
-
-namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasks
-{
- public partial class CustomerReminderUnpaidOrderScheduleTask : IScheduleTask
- {
- private readonly ICustomerReminderService _customerReminderService;
- public CustomerReminderUnpaidOrderScheduleTask(ICustomerReminderService customerReminderService)
- {
- _customerReminderService = customerReminderService;
- }
-
- public async Task Execute()
- {
- await _customerReminderService.Task_UnpaidOrder();
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataActivityLogTypes.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataActivityLogTypes.cs
index 29b160716..0d77d4d1b 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataActivityLogTypes.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataActivityLogTypes.cs
@@ -351,25 +351,7 @@ namespace Grand.Business.System.Services.Installation
SystemKeyword = "EditPage",
Enabled = true,
Name = "Edit a page"
- },
- new ActivityLogType
- {
- SystemKeyword = "InteractiveFormDelete",
- Enabled = true,
- Name = "Delete a interactive form"
- },
- new ActivityLogType
- {
- SystemKeyword = "InteractiveFormEdit",
- Enabled = true,
- Name = "Edit a interactive form"
- },
- new ActivityLogType
- {
- SystemKeyword = "InteractiveFormAdd",
- Enabled = true,
- Name = "Add a interactive form"
- },
+ },
new ActivityLogType
{
SystemKeyword = "EditWidget",
@@ -418,13 +400,7 @@ namespace Grand.Business.System.Services.Installation
SystemKeyword = "PublicStore.AskQuestion",
Enabled = false,
Name = "Public store. Ask a question about product"
- },
- new ActivityLogType
- {
- SystemKeyword = "PublicStore.InteractiveForm",
- Enabled = false,
- Name = "Public store. Show interactive form"
- },
+ },
new ActivityLogType
{
SystemKeyword = "PublicStore.PlaceOrder",
@@ -508,43 +484,7 @@ namespace Grand.Business.System.Services.Installation
SystemKeyword = "PublicStore.DeleteAccount",
Enabled = false,
Name = "Public store. Delete account"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.AbandonedCart",
- Enabled = true,
- Name = "Send email Customer reminder - AbandonedCart"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.RegisteredCustomer",
- Enabled = true,
- Name = "Send email Customer reminder - RegisteredCustomer"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.LastActivity",
- Enabled = true,
- Name = "Send email Customer reminder - LastActivity"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.LastPurchase",
- Enabled = true,
- Name = "Send email Customer reminder - LastPurchase"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.Birthday",
- Enabled = true,
- Name = "Send email Customer reminder - Birthday"
- },
- new ActivityLogType
- {
- SystemKeyword = "CustomerReminder.SendCampaign",
- Enabled = true,
- Name = "Send Campaign"
- },
+ },
new ActivityLogType
{
SystemKeyword = "CustomerAdmin.SendEmail",
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomerActions.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomerActions.cs
deleted file mode 100644
index f9446a10b..000000000
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomerActions.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using Grand.Business.Core.Interfaces.System.Installation;
-using Grand.Domain.Customers;
-
-namespace Grand.Business.System.Services.Installation
-{
- public partial class InstallationService : IInstallationService
- {
- protected virtual async Task InstallCustomerAction()
- {
- var customerActionType = new List<CustomerActionType>()
- {
- new CustomerActionType()
- {
- Name = "Add to cart",
- SystemKeyword = "AddToCart",
- Enabled = false,
- ConditionType = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13 }
- },
- new CustomerActionType()
- {
- Name = "Add order",
- SystemKeyword = "AddOrder",
- Enabled = false,
- ConditionType = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13 }
- },
- new CustomerActionType()
- {
- Name = "Paid order",
- SystemKeyword = "PaidOrder",
- Enabled = false,
- ConditionType = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13 }
- },
- new CustomerActionType()
- {
- Name = "Viewed",
- SystemKeyword = "Viewed",
- Enabled = false,
- ConditionType = {1, 2, 3, 7, 8, 9, 10, 13}
- },
- new CustomerActionType()
- {
- Name = "Url",
- SystemKeyword = "Url",
- Enabled = false,
- ConditionType = {7, 8, 9, 10, 11, 12, 13}
- },
- new CustomerActionType()
- {
- Name = "Customer Registration",
- SystemKeyword = "Registration",
- Enabled = false,
- ConditionType = {7, 8, 9, 10, 13}
- }
- };
- await _customerActionType.InsertAsync(customerActionType);
-
- }
- }
-}
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs
index fcce56131..17a6cd505 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs
@@ -33,16 +33,12 @@ Disallow: /changecurrency/*
Disallow: /checkout/*
Disallow: /compareproducts
Disallow: /account/*
-Disallow: /common/customeractioneventurl
-Disallow: /common/getactivepopup
-Disallow: /common/removepopup
Disallow: /emailwishlist
Disallow: /login/*
Disallow: /newsletter/subscriptionactivation
Disallow: /order/*
Disallow: /orderdetails
Disallow: /passwordrecovery/confirm
-Disallow: /popupinteractiveform
Disallow: /register/*
Disallow: /merchandisereturn
Disallow: /merchandisereturn/history
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataScheduleTasks.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataScheduleTasks.cs
index 9c5b9bb78..0b95ff41d 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataScheduleTasks.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataScheduleTasks.cs
@@ -59,63 +59,7 @@ namespace Grand.Business.System.Services.Installation
Enabled = false,
StopOnError = false,
TimeInterval = 10080
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - AbandonedCart",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderAbandonedCartScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 20
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - RegisteredCustomer",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderRegisteredCustomerScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - LastActivity",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderLastActivityScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - LastPurchase",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderLastPurchaseScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - Birthday",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderBirthdayScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - Completed order",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderCompletedOrderScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
- new ScheduleTask
- {
- ScheduleTaskName = "Customer reminder - Unpaid order",
- Type = "Grand.Business.System.Services.BackgroundServices.ScheduleTasks.CustomerReminderUnpaidOrderScheduleTask, Grand.Business.System",
- Enabled = false,
- StopOnError = false,
- TimeInterval = 1440
- },
+ },
new ScheduleTask
{
ScheduleTaskName = "End of the auctions",
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
index 783bb8b75..54cdebda4 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Common.Configuration;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Business.Core.Interfaces.System.Installation;
using Grand.Domain.AdminSearch;
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs b/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs
index dc489d4af..ca0ffb278 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs
@@ -121,31 +121,22 @@ namespace Grand.Business.System.Services.Installation
private readonly IRepository<MerchandiseReturnReason> _merchandiseReturnReasonRepository;
private readonly IRepository<MerchandiseReturnAction> _merchandiseReturnActionRepository;
private readonly IRepository<ContactUs> _contactUsRepository;
- private readonly IRepository<CustomerAction> _customerAction;
- private readonly IRepository<CustomerActionType> _customerActionType;
- private readonly IRepository<CustomerActionHistory> _customerActionHistory;
- private readonly IRepository<PopupArchive> _popupArchive;
- private readonly IRepository<CustomerReminderHistory> _customerReminderHistoryRepository;
private readonly IRepository<RecentlyViewedProduct> _recentlyViewedProductRepository;
private readonly IRepository<KnowledgebaseArticle> _knowledgebaseArticleRepository;
private readonly IRepository<KnowledgebaseCategory> _knowledgebaseCategoryRepository;
private readonly IRepository<OrderTag> _orderTagRepository;
private readonly IRepository<OrderStatus> _orderStatusRepository;
- private readonly IRepository<PopupActive> _popupActiveRepository;
private readonly IRepository<PickupPoint> _pickupPointRepository;
private readonly IRepository<OutOfStockSubscription> _outOfStockSubscriptionRepository;
private readonly IRepository<ShipmentNote> _shipmentNoteRepository;
private readonly IRepository<PaymentTransaction> _paymentTransactionRepository;
private readonly IRepository<QueuedEmail> _queuedEmailRepository;
private readonly IRepository<GiftVoucher> _giftVoucherRepository;
- private readonly IRepository<CustomerReminder> _customerReminderRepository;
private readonly IRepository<DocumentType> _documentTypeRepository;
private readonly IRepository<Document> _documentRepository;
private readonly IRepository<SalesEmployee> _salesRepository;
private readonly IRepository<VendorReview> _vendorReviewRepository;
private readonly IRepository<NewsletterCategory> _newsletterCategoryRepository;
- private readonly IRepository<InteractiveForm> _formRepository;
- private readonly IRepository<Banner> _bannerRepository;
private readonly IRepository<Course> _courseRepository;
private readonly IRepository<CourseLevel> _courseLevelRepository;
private readonly IRepository<RobotsTxt> _robotsTxtRepository;
@@ -239,31 +230,22 @@ namespace Grand.Business.System.Services.Installation
IRepository<MerchandiseReturnReason> merchandiseReturnReasonRepository,
IRepository<MerchandiseReturnAction> merchandiseReturnActionRepository,
IRepository<ContactUs> contactUsRepository,
- IRepository<CustomerAction> customerAction,
- IRepository<CustomerActionType> customerActionType,
- IRepository<CustomerActionHistory> customerActionHistory,
- IRepository<PopupArchive> popupArchive,
- IRepository<CustomerReminderHistory> customerReminderHistoryRepository,
IRepository<RecentlyViewedProduct> recentlyViewedProductRepository,
IRepository<KnowledgebaseArticle> knowledgebaseArticleRepository,
IRepository<KnowledgebaseCategory> knowledgebaseCategoryRepository,
IRepository<OrderTag> orderTagRepository,
IRepository<OrderStatus> orderStatusRepository,
- IRepository<PopupActive> popupActiveRepository,
IRepository<PickupPoint> pickupPointRepository,
IRepository<OutOfStockSubscription> outOfStockSubscriptionRepository,
IRepository<ShipmentNote> shipmentNoteRepository,
IRepository<PaymentTransaction> paymentTransactionRepository,
IRepository<QueuedEmail> queuedEmailRepository,
IRepository<GiftVoucher> giftVoucherRepository,
- IRepository<CustomerReminder> customerReminderRepository,
IRepository<DocumentType> documentTypeRepository,
IRepository<Document> documentRepository,
IRepository<SalesEmployee> salesRepository,
IRepository<VendorReview> vendorReviewRepository,
IRepository<NewsletterCategory> newsletterCategoryRepository,
- IRepository<InteractiveForm> formRepository,
- IRepository<Banner> bannerRepository,
IRepository<Course> courseRepository,
IRepository<CourseLevel> courseLevelRepository,
IRepository<RobotsTxt> robotsTxtRepository)
@@ -346,23 +328,16 @@ namespace Grand.Business.System.Services.Installation
_merchandiseReturnReasonRepository = merchandiseReturnReasonRepository;
_contactUsRepository = contactUsRepository;
_merchandiseReturnActionRepository = merchandiseReturnActionRepository;
- _customerAction = customerAction;
- _customerActionType = customerActionType;
- _customerActionHistory = customerActionHistory;
- _customerReminderHistoryRepository = customerReminderHistoryRepository;
_knowledgebaseArticleRepository = knowledgebaseArticleRepository;
_knowledgebaseCategoryRepository = knowledgebaseCategoryRepository;
- _popupArchive = popupArchive;
_orderTagRepository = orderTagRepository;
_orderStatusRepository = orderStatusRepository;
- _popupActiveRepository = popupActiveRepository;
_pickupPointRepository = pickupPointRepository;
_outOfStockSubscriptionRepository = outOfStockSubscriptionRepository;
_blogCategoryRepository = blogCategoryRepository;
_paymentTransactionRepository = paymentTransactionRepository;
_queuedEmailRepository = queuedEmailRepository;
_giftVoucherRepository = giftVoucherRepository;
- _customerReminderRepository = customerReminderRepository;
_documentTypeRepository = documentTypeRepository;
_documentRepository = documentRepository;
_salesRepository = salesRepository;
@@ -370,8 +345,6 @@ namespace Grand.Business.System.Services.Installation
_vendorReviewRepository = vendorReviewRepository;
_contactAttributeRepository = contactAttributeRepository;
_newsletterCategoryRepository = newsletterCategoryRepository;
- _formRepository = formRepository;
- _bannerRepository = bannerRepository;
_courseRepository = courseRepository;
_courseLevelRepository = courseLevelRepository;
_robotsTxtRepository = robotsTxtRepository;
@@ -467,9 +440,6 @@ namespace Grand.Business.System.Services.Installation
await dbContext.CreateIndex(_customerNoteRepository, OrderBuilder<CustomerNote>.Create().Ascending(x => x.CustomerId).Descending(x => x.CreatedOnUtc), "CustomerId");
await dbContext.CreateIndex(_customerNoteRepository, OrderBuilder<CustomerNote>.Create().Descending(x => x.CreatedOnUtc), "CreatedOnUtc");
- //customer reminder
- await dbContext.CreateIndex(_customerReminderRepository, OrderBuilder<CustomerReminder>.Create().Ascending(x => x.DisplayOrder), "DisplayOrder");
-
//user api
await dbContext.CreateIndex(_userapiRepository, OrderBuilder<UserApi>.Create().Ascending(x => x.Email), "Email", true);
@@ -687,17 +657,6 @@ namespace Grand.Business.System.Services.Installation
await dbContext.CreateIndex(_contactUsRepository, OrderBuilder<ContactUs>.Create().Ascending(x => x.Email), "Email");
await dbContext.CreateIndex(_contactUsRepository, OrderBuilder<ContactUs>.Create().Descending(x => x.CreatedOnUtc), "CreatedOnUtc");
- //customer action
- await dbContext.CreateIndex(_customerAction, OrderBuilder<CustomerAction>.Create().Ascending(x => x.ActionTypeId), "ActionTypeId");
- await dbContext.CreateIndex(_customerActionHistory, OrderBuilder<CustomerActionHistory>.Create().Ascending(x => x.CustomerId).Ascending(x => x.CustomerActionId), "Customer_Action");
-
- //banner
- await dbContext.CreateIndex(_popupArchive, OrderBuilder<PopupArchive>.Create().Ascending(x => x.CustomerActionId), "CustomerActionId");
- await dbContext.CreateIndex(_popupActiveRepository, OrderBuilder<PopupActive>.Create().Ascending(x => x.CreatedOnUtc), "CreatedOnUtc");
-
- //customer reminder
- await dbContext.CreateIndex(_customerReminderHistoryRepository, OrderBuilder<CustomerReminderHistory>.Create().Ascending(x => x.CustomerId).Ascending(x => x.CustomerReminderId), "CustomerId");
-
//page
await dbContext.CreateIndex(_pageRepository, OrderBuilder<Page>.Create().Ascending(x => x.DisplayOrder).Ascending(x => x.SystemName), "DisplayOrder_SystemName");
@@ -733,12 +692,6 @@ namespace Grand.Business.System.Services.Installation
//newslettercategory
await dbContext.CreateIndex(_newsletterCategoryRepository, OrderBuilder<NewsletterCategory>.Create().Ascending(x => x.DisplayOrder), "DisplayOrder");
- //interactive form
- await dbContext.CreateIndex(_formRepository, OrderBuilder<InteractiveForm>.Create().Ascending(x => x.CreatedOnUtc), "CreatedOnUtc");
-
- //banner
- await dbContext.CreateIndex(_bannerRepository, OrderBuilder<Banner>.Create().Ascending(x => x.CreatedOnUtc), "CreatedOnUtc");
-
//course
await dbContext.CreateIndex(_courseRepository, OrderBuilder<Course>.Create().Ascending(x => x.CreatedOnUtc), "CreatedOnUtc");
await dbContext.CreateIndex(_courseLevelRepository, OrderBuilder<CourseLevel>.Create().Ascending(x => x.DisplayOrder), "DisplayOrder");
@@ -811,7 +764,6 @@ namespace Grand.Business.System.Services.Installation
await InstallCustomersAndUsers(defaultUserEmail, defaultUserPassword);
await InstallEmailAccounts();
await InstallMessageTemplates();
- await InstallCustomerAction();
await InstallSettings(installSampleData);
await InstallPageLayouts();
await InstallPages();
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationActivityLogTypes.cs b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationActivityLogTypes.cs
new file mode 100644
index 000000000..a8d322685
--- /dev/null
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationActivityLogTypes.cs
@@ -0,0 +1,55 @@
+using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Domain.Data;
+using Grand.Domain.Logging;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Business.System.Services.Migrations._2._1
+{
+ public class MigrationActivityLogTypes : IMigration
+ {
+
+ public int Priority => 0;
+ public DbVersion Version => new(2, 1);
+ public Guid Identity => new("6B364BD3-CB5D-4060-B5ED-E3D8E0D1DF6B");
+ public string Name => "Remove activity log types";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="database"></param>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<ActivityLogType>>();
+ var logService = serviceProvider.GetRequiredService<ILogger>();
+ try
+ {
+ var activityLogTypes = repository
+ .Table.Where(x =>
+ x.SystemKeyword == "InteractiveFormDelete" ||
+ x.SystemKeyword == "InteractiveFormEdit" ||
+ x.SystemKeyword == "InteractiveFormAdd" ||
+ x.SystemKeyword == "PublicStore.InteractiveForm" ||
+ x.SystemKeyword == "CustomerReminder.AbandonedCart" ||
+ x.SystemKeyword == "CustomerReminder.RegisteredCustomer" ||
+ x.SystemKeyword == "CustomerReminder.LastActivity" ||
+ x.SystemKeyword == "CustomerReminder.LastPurchase" ||
+ x.SystemKeyword == "CustomerReminder.Birthday" ||
+ x.SystemKeyword == "CustomerReminder.SendCampaign");
+ foreach (var item in activityLogTypes)
+ {
+ repository.Delete(item);
+ }
+
+ }
+ catch (Exception ex)
+ {
+ logService.InsertLog(LogLevel.Error, "UpgradeProcess - RemoveOldActivityLogType", ex.Message).GetAwaiter().GetResult();
+ }
+ return true;
+
+ }
+ }
+}
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationScheduleTasks.cs b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationScheduleTasks.cs
new file mode 100644
index 000000000..516300222
--- /dev/null
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationScheduleTasks.cs
@@ -0,0 +1,54 @@
+using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Domain.Data;
+using Grand.Domain.Logging;
+using Grand.Domain.Tasks;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Business.System.Services.Migrations._2._1
+{
+ public class MigrationScheduleTasks : IMigration
+ {
+
+ public int Priority => 0;
+ public DbVersion Version => new(2, 1);
+ public Guid Identity => new("81E2C287-F5F2-4E52-B0B8-119D8D71D0C2");
+ public string Name => "Remove ScheduleTasks";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="database"></param>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<ScheduleTask>>();
+ var logService = serviceProvider.GetRequiredService<ILogger>();
+ try
+ {
+ var scheduleTasks = repository
+ .Table.Where(x =>
+ x.ScheduleTaskName == "Customer reminder - AbandonedCart" ||
+ x.ScheduleTaskName == "Customer reminder - RegisteredCustomer" ||
+ x.ScheduleTaskName == "Customer reminder - LastActivity" ||
+ x.ScheduleTaskName == "Customer reminder - LastPurchase" ||
+ x.ScheduleTaskName == "Customer reminder - Birthday" ||
+ x.ScheduleTaskName == "Customer reminder - Completed order" ||
+ x.ScheduleTaskName == "Customer reminder - Unpaid order"
+ );
+ foreach (var item in scheduleTasks)
+ {
+ repository.Delete(item);
+ }
+
+ }
+ catch (Exception ex)
+ {
+ logService.InsertLog(LogLevel.Error, "UpgradeProcess - RemoveOldScheduleTasks", ex.Message).GetAwaiter().GetResult();
+ }
+ return true;
+
+ }
+ }
+}
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationSystemPermission.cs b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationSystemPermission.cs
new file mode 100644
index 000000000..3e53c99e3
--- /dev/null
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationSystemPermission.cs
@@ -0,0 +1,41 @@
+using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Domain.Data;
+using Grand.Domain.Permissions;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Business.System.Services.Migrations._2._1
+{
+ public class MigrationSystemPermission : IMigration
+ {
+ public int Priority => 0;
+ public DbVersion Version => new(2, 1);
+ public Guid Identity => new("E87B6FE8-5723-4753-948E-E6D641EF8A86");
+ public string Name => "Remove old permissions";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="database"></param>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<Permission>>();
+ var logService = serviceProvider.GetRequiredService<ILogger>();
+ try
+ {
+ var permissionManageActions = repository.Table.FirstOrDefault(x => x.SystemName == "ManageActions");
+ if (permissionManageActions == null) repository.Delete(permissionManageActions);
+ var permissionManageReminders = repository.Table.FirstOrDefault(x => x.SystemName == "ManageReminders");
+ if (permissionManageReminders == null) repository.Delete(permissionManageReminders);
+
+ }
+ catch (Exception ex)
+ {
+ logService.InsertLog(Domain.Logging.LogLevel.Error, "UpgradeProcess - RemoveOldPermissions", ex.Message).GetAwaiter().GetResult();
+ }
+ return true;
+ }
+ }
+}
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpdateAdminSiteMap.cs b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpdateAdminSiteMap.cs
new file mode 100644
index 000000000..9bfe3cf65
--- /dev/null
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpdateAdminSiteMap.cs
@@ -0,0 +1,51 @@
+using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Business.Core.Utilities.Common.Security;
+using Grand.Domain.Data;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Business.System.Services.Migrations._2._1
+{
+ public class MigrationUpdateAdminSiteMap : IMigration
+ {
+
+ public int Priority => 0;
+ public DbVersion Version => new(2, 1);
+ public Guid Identity => new("8E1C04EB-4A76-4C6F-91E2-4C873EDA9C14");
+ public string Name => "Update standard admin site map - remove unused";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="database"></param>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<Domain.Admin.AdminSiteMap>>();
+ var logService = serviceProvider.GetRequiredService<ILogger>();
+
+ try
+ {
+ var sitemapSystem = repository.Table.FirstOrDefault(x => x.SystemName == "Marketing");
+ if (sitemapSystem != null)
+ {
+ sitemapSystem.PermissionNames = new List<string> { PermissionSystemName.Affiliates, PermissionSystemName.NewsletterCategories, PermissionSystemName.NewsletterSubscribers,
+ PermissionSystemName.Campaigns, PermissionSystemName.Discounts, PermissionSystemName.PushNotifications,
+ PermissionSystemName.Affiliates, PermissionSystemName.Documents, PermissionSystemName.GiftVouchers,
+ PermissionSystemName.ContactAttributes};
+
+ sitemapSystem.ChildNodes.Remove(sitemapSystem.ChildNodes.FirstOrDefault(x => x.SystemName == "Customer reminders"));
+ sitemapSystem.ChildNodes.Remove(sitemapSystem.ChildNodes.FirstOrDefault(x => x.SystemName == "Customer actions"));
+
+ repository.Update(sitemapSystem);
+ }
+ }
+ catch (Exception ex)
+ {
+ logService.InsertLog(Domain.Logging.LogLevel.Error, "UpgradeProcess - UpdateAdminSiteMap", ex.Message).GetAwaiter().GetResult();
+ }
+ return true;
+ }
+ }
+}
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpgradeDbVersion_21.cs b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpgradeDbVersion_21.cs
new file mode 100644
index 000000000..2dfcc30dc
--- /dev/null
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.1/MigrationUpgradeDbVersion_21.cs
@@ -0,0 +1,37 @@
+using Grand.Domain.Common;
+using Grand.Domain.Data;
+using Grand.Infrastructure;
+using Grand.Infrastructure.Migrations;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Grand.Business.System.Services.Migrations._2._1
+{
+ public class MigrationUpgradeDbVersion_21 : IMigration
+ {
+
+ public int Priority => 0;
+
+ public DbVersion Version => new(2, 1);
+
+ public Guid Identity => new("EA674DAA-66B2-4F21-9C68-008ACE752FBD");
+
+ public string Name => "Upgrade version of the database to 2.1";
+
+ /// <summary>
+ /// Upgrade process
+ /// </summary>
+ /// <param name="database"></param>
+ /// <param name="serviceProvider"></param>
+ /// <returns></returns>
+ public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider)
+ {
+ var repository = serviceProvider.GetRequiredService<IRepository<GrandNodeVersion>>();
+
+ var dbversion = repository.Table.ToList().FirstOrDefault();
+ dbversion.DataBaseVersion = $"{GrandVersion.SupportedDBVersion}";
+ repository.Update(dbversion);
+
+ return true;
+ }
+ }
+}
diff --git a/src/Business/Grand.Business.System/Startup/StartupApplication.cs b/src/Business/Grand.Business.System/Startup/StartupApplication.cs
index d2e8ddf1b..570f8e5b0 100644
--- a/src/Business/Grand.Business.System/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.System/Startup/StartupApplication.cs
@@ -48,13 +48,6 @@ namespace Grand.Business.System.Startup
serviceCollection.AddScoped<IScheduleTask, ClearCacheScheduleTask>();
serviceCollection.AddScoped<IScheduleTask, ClearLogScheduleTask>();
serviceCollection.AddScoped<IScheduleTask, GenerateSitemapXmlTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderAbandonedCartScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderBirthdayScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderCompletedOrderScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderLastActivityScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderLastPurchaseScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderRegisteredCustomerScheduleTask>();
- serviceCollection.AddScoped<IScheduleTask, CustomerReminderUnpaidOrderScheduleTask>();
serviceCollection.AddScoped<IScheduleTask, DeleteGuestsScheduleTask>();
serviceCollection.AddScoped<IScheduleTask, UpdateExchangeRateScheduleTask>();
serviceCollection.AddScoped<IScheduleTask, EndAuctionsTask>();
diff --git a/src/Core/Grand.Domain/Blogs/BlogExtensions.cs b/src/Core/Grand.Domain/Blogs/BlogExtensions.cs
index a02a2e63f..3a1d662c1 100644
--- a/src/Core/Grand.Domain/Blogs/BlogExtensions.cs
+++ b/src/Core/Grand.Domain/Blogs/BlogExtensions.cs
@@ -20,5 +20,18 @@
}
return parsedTags.ToArray();
}
+
+ /// <summary>
+ /// Returns all posts published between the two dates.
+ /// </summary>
+ /// <param name="source">Source</param>
+ /// <param name="dateFrom">Date from</param>
+ /// <param name="dateTo">Date to</param>
+ /// <returns>Filtered posts</returns>
+ public static IList<BlogPost> GetPostsByDate(this IList<BlogPost> source,
+ DateTime dateFrom, DateTime dateTo)
+ {
+ return source.Where(p => dateFrom.Date <= (p.StartDateUtc ?? p.CreatedOnUtc) && (p.StartDateUtc ?? p.CreatedOnUtc).Date <= dateTo).ToList();
+ }
}
}
diff --git a/src/Business/Grand.Business.Core/Extensions/ProductAttributeExtensions.cs b/src/Core/Grand.Domain/Catalog/ProductAttributeExtensions.cs
similarity index 96%
rename from src/Business/Grand.Business.Core/Extensions/ProductAttributeExtensions.cs
rename to src/Core/Grand.Domain/Catalog/ProductAttributeExtensions.cs
index d3006fcb3..f50f70840 100644
--- a/src/Business/Grand.Business.Core/Extensions/ProductAttributeExtensions.cs
+++ b/src/Core/Grand.Domain/Catalog/ProductAttributeExtensions.cs
@@ -1,6 +1,4 @@
-using Grand.Domain.Catalog;
-
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Catalog
{
public static class ProductAttributeExtensions
{
@@ -45,9 +43,9 @@ namespace Grand.Business.Core.Extensions
return true;
}
-
+
public static bool IsNonCombinable(this ProductAttributeMapping productAttributeMapping)
- {
+ {
if (productAttributeMapping == null)
return false;
diff --git a/src/Core/Grand.Domain/Catalog/ProductExtensions.cs b/src/Core/Grand.Domain/Catalog/ProductExtensions.cs
index 309b608c0..a0c3c29d7 100644
--- a/src/Core/Grand.Domain/Catalog/ProductExtensions.cs
+++ b/src/Core/Grand.Domain/Catalog/ProductExtensions.cs
@@ -1,10 +1,441 @@
-namespace Grand.Domain.Catalog
+using Grand.Domain.Common;
+using Grand.Domain.Customers;
+using Grand.SharedKernel.Extensions;
+
+namespace Grand.Domain.Catalog
{
/// <summary>
/// Product extensions
/// </summary>
public static class ProductExtensions
{
+
+ /// <summary>
+ /// Used to get an appropriate tier price
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="customer">Customer</param>
+ /// <param name="storeId">Store id</param>
+ /// <param name="quantity">Quantity</param>
+ /// <returns>Price</returns>
+ public static TierPrice GetPreferredTierPrice(this Product product, Customer customer, string storeId, string currencyCode, int quantity)
+ {
+ if (!product.TierPrices.Any())
+ return null;
+
+ var actualTierPrices = product.TierPrices.OrderBy(price => price.Quantity).ToList()
+ .FilterByStore(storeId)
+ .FilterByCurrency(currencyCode)
+ .FilterForCustomer(customer)
+ .FilterByDate()
+ .RemoveDuplicatedQuantities();
+
+ var tierPrice = actualTierPrices.LastOrDefault(price => quantity >= price.Quantity);
+
+ return tierPrice;
+ }
+
+ /// <summary>
+ /// Check if product tag exists
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="productTagId">Product tag id</param>
+ /// <returns>Result</returns>
+ public static bool ProductTagExists(this Product product,
+ string productTagName)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ bool result = product.ProductTags.FirstOrDefault(pt => pt == productTagName) != null;
+ return result;
+ }
+
+ /// <summary>
+ /// List of allowed quantities
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <returns>Result</returns>
+ public static int[] ParseAllowedQuantities(this Product product)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ var result = new List<int>();
+ if (!String.IsNullOrWhiteSpace(product.AllowedQuantities))
+ {
+ product.AllowedQuantities
+ .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
+ .ToList()
+ .ForEach(qtyStr =>
+ {
+ int qty;
+ if (int.TryParse(qtyStr.Trim(), out qty))
+ {
+ result.Add(qty);
+ }
+ });
+ }
+
+ return result.ToArray();
+ }
+
+ /// <summary>
+ /// Gets SKU, Collection part number and GTIN
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Attributes</param>
+ /// <param name="productAttributeParser">Product attribute service</param>
+ /// <param name="sku">SKU</param>
+ /// <param name="Mpn">MPN</param>
+ /// <param name="gtin">GTIN</param>
+ private static void GetSkuMpnGtin(this Product product, IList<CustomAttribute> attributes,
+ out string sku, out string Mpn, out string gtin)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ sku = null;
+ Mpn = null;
+ gtin = null;
+
+ if (attributes != null &&
+ product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
+ {
+ var combination = FindProductAttributeCombination(product, attributes);
+ if (combination != null)
+ {
+ sku = combination.Sku;
+ Mpn = combination.Mpn;
+ gtin = combination.Gtin;
+ }
+ }
+
+ if (string.IsNullOrEmpty(sku))
+ sku = product.Sku;
+ if (string.IsNullOrEmpty(Mpn))
+ Mpn = product.Mpn;
+ if (string.IsNullOrEmpty(gtin))
+ gtin = product.Gtin;
+ }
+
+ /// <summary>
+ /// Finds a product attribute combination by attributes stored
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="customAttributes">Attributes</param>
+ /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
+ /// <returns>Found product attribute combination</returns>
+ public static ProductAttributeCombination FindProductAttributeCombination(this Product product,
+ IList<CustomAttribute> customAttributes, bool ignoreNonCombinableAttributes = true)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ var combinations = product.ProductAttributeCombinations;
+ return combinations.FirstOrDefault(x =>
+ AreProductAttributesEqual(product, x.Attributes, customAttributes, ignoreNonCombinableAttributes));
+ }
+
+
+ /// <summary>
+ /// Gets selected product attribute mappings
+ /// </summary>
+ /// <param name="customAttributes">Attributes</param>
+ /// <returns>Selected product attribute mappings</returns>
+ public static IList<ProductAttributeMapping> ParseProductAttributeMappings(this Product product, IList<CustomAttribute> customAttributes)
+ {
+ var result = new List<ProductAttributeMapping>();
+ if (customAttributes == null || !customAttributes.Any())
+ return result;
+
+ foreach (var customAttribute in customAttributes.GroupBy(x => x.Key))
+ {
+ var attribute = product.ProductAttributeMappings.Where(x => x.Id == customAttribute.Key).FirstOrDefault();
+ if (attribute != null)
+ {
+ result.Add(attribute);
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Get product attribute values
+ /// </summary>
+ /// <param name="customAttributes">Attributes</param>
+ /// <returns>Product attribute values</returns>
+ public static IList<ProductAttributeValue> ParseProductAttributeValues(this Product product, IList<CustomAttribute> customAttributes)
+ {
+ var values = new List<ProductAttributeValue>();
+ if (customAttributes == null || !customAttributes.Any())
+ return values;
+
+ var attributes = ParseProductAttributeMappings(product, customAttributes);
+ foreach (var attribute in attributes)
+ {
+ if (!attribute.ShouldHaveValues())
+ continue;
+
+ var valuesStr = ParseValues(customAttributes, attribute.Id);
+ foreach (var valueStr in valuesStr)
+ {
+ if (!string.IsNullOrEmpty(valueStr))
+ {
+ if (attribute.ProductAttributeValues.Where(x => x.Id == valueStr).Count() > 0)
+ {
+ var value = attribute.ProductAttributeValues.Where(x => x.Id == valueStr).FirstOrDefault();
+ if (value != null)
+ {
+ values.Add(value);
+ }
+ }
+ }
+ }
+ }
+ return values;
+ }
+
+ /// <summary>
+ /// Gets selected product attribute values
+ /// </summary>
+ /// <param name="customAttributes">Attributes </param>
+ /// <param name="productAttributeMappingId">Product attribute mapping identifier</param>
+ /// <returns>Product attribute values</returns>
+ public static IList<string> ParseValues(IList<CustomAttribute> customAttributes, string productAttributeMappingId)
+ {
+ var selectedValues = new List<string>();
+ if (customAttributes == null || !customAttributes.Any())
+ return selectedValues;
+
+ return customAttributes.Where(x => x.Key == productAttributeMappingId).Select(x => x.Value).ToList();
+
+ }
+
+ /// <summary>
+ /// Adds an attribute
+ /// </summary>
+ /// <param name="attributes">Attributes</param>
+ /// <param name="productAttributeMapping">Product attribute mapping</param>
+ /// <param name="value">Value</param>
+ /// <returns>Attributes</returns>
+ public static IList<CustomAttribute> AddProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping, string value)
+ {
+ if (customAttributes == null)
+ customAttributes = new List<CustomAttribute>();
+
+ customAttributes.Add(new CustomAttribute() { Key = productAttributeMapping.Id, Value = value });
+
+ return customAttributes;
+ }
+ /// <summary>
+ /// Remove an attribute
+ /// </summary>
+ /// <param name="attributes">Attributes</param>
+ /// <param name="productAttributeMapping">Product attribute mapping</param>
+ /// <returns>Updated result (XML format)</returns>
+ public static IList<CustomAttribute> RemoveProductAttribute(IList<CustomAttribute> customAttributes, ProductAttributeMapping productAttributeMapping)
+ {
+ return customAttributes.Where(x => x.Key != productAttributeMapping.Id).ToList();
+ }
+ /// <summary>
+ /// Are attributes equal
+ /// </summary>
+ /// <param name="customAttributes1">The attributes of the first product</param>
+ /// <param name="customAttributes2">The attributes of the second product</param>
+ /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
+ /// <returns>Result</returns>
+ public static bool AreProductAttributesEqual(Product product, IList<CustomAttribute> customAttributes1, IList<CustomAttribute> customAttributes2, bool ignoreNonCombinableAttributes)
+ {
+ var attributes1 = ParseProductAttributeMappings(product, customAttributes1);
+ if (ignoreNonCombinableAttributes)
+ {
+ attributes1 = attributes1.Where(x => !x.IsNonCombinable()).ToList();
+ }
+ var attributes2 = ParseProductAttributeMappings(product, customAttributes2);
+ //TO DO - Where(x=>x.IsRequired).ToList()
+
+ if (ignoreNonCombinableAttributes)
+ {
+ attributes2 = attributes2.Where(x => !x.IsNonCombinable()).ToList();
+ }
+ if (attributes1.Count != attributes2.Count)
+ return false;
+
+ bool attributesEqual = true;
+ foreach (var a1 in attributes1)
+ {
+ bool hasAttribute = false;
+ foreach (var a2 in attributes2)
+ {
+ if (a1.Id == a2.Id)
+ {
+ hasAttribute = true;
+ var values1Str = ParseValues(customAttributes1, a1.Id);
+ var values2Str = ParseValues(customAttributes2, a2.Id);
+ if (values1Str.Count == values2Str.Count)
+ {
+ foreach (string str1 in values1Str)
+ {
+ bool hasValue = false;
+ foreach (string str2 in values2Str)
+ {
+ //case insensitive?
+ if (str1.Trim() == str2.Trim())
+ {
+ hasValue = true;
+ break;
+ }
+ }
+
+ if (!hasValue)
+ {
+ attributesEqual = false;
+ break;
+ }
+ }
+ }
+ else
+ {
+ attributesEqual = false;
+ break;
+ }
+ }
+ }
+
+ if (hasAttribute == false)
+ {
+ attributesEqual = false;
+ break;
+ }
+ }
+
+ return attributesEqual;
+ }
+
+ /// <summary>
+ /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified
+ /// </summary>
+ /// <param name="pam">Product attribute</param>
+ /// <param name="selectedAttributes">Selected attributes</param>
+ /// <returns>Result</returns>
+ public static bool? IsConditionMet(this Product product, ProductAttributeMapping pam, IList<CustomAttribute> selectedAttributes)
+ {
+ if (pam == null)
+ throw new ArgumentNullException(nameof(pam));
+
+ if (selectedAttributes == null)
+ selectedAttributes = new List<CustomAttribute>();
+
+ var conditionAttribute = pam.ConditionAttribute;
+ if (!conditionAttribute.Any())
+ //no condition
+ return null;
+
+ //load an attribute this one depends on
+ var dependOnAttribute = ParseProductAttributeMappings(product, conditionAttribute).FirstOrDefault();
+ if (dependOnAttribute == null)
+ return true;
+
+ var valuesThatShouldBeSelected = ParseValues(conditionAttribute, dependOnAttribute.Id)
+ .Where(x => !string.IsNullOrEmpty(x))
+ .ToList();
+ var selectedValues = ParseValues(selectedAttributes, dependOnAttribute.Id);
+ if (valuesThatShouldBeSelected.Count != selectedValues.Count)
+ return false;
+
+ //compare values
+ var allFound = true;
+ foreach (var t1 in valuesThatShouldBeSelected)
+ {
+ bool found = false;
+ foreach (var t2 in selectedValues)
+ if (t1 == t2)
+ found = true;
+ if (!found)
+ allFound = false;
+ }
+
+ return allFound;
+ }
+
+ /// <summary>
+ /// Generate all combinations
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param>
+ /// <returns>Attribute combinations</returns>
+ public static IList<IEnumerable<CustomAttribute>> GenerateAllCombinations(this Product product)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ var allProductAttributMappings = product.ProductAttributeMappings.Where(x => !x.IsNonCombinable()).ToList();
+
+ if (allProductAttributMappings.Count == 0)
+ return null;
+
+ var query = allProductAttributMappings.Select(o1 => o1.ProductAttributeValues.Select(o2 =>
+ new CustomAttribute {
+ Key = o1.Id,
+ Value = o2.Id
+ }
+ )).SelectMany(x => x).ToList();
+
+ var result = query.GroupBy(t => t.Key).CartesianProduct().ToList();
+
+ return result;
+ }
+
+ /// <summary>
+ /// SKU
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Attributes</param>
+ /// <returns>SKU</returns>
+ public static string FormatSku(this Product product, IList<CustomAttribute> attributes = null)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ product.GetSkuMpnGtin(attributes, out var sku, out _, out _);
+
+ return sku;
+ }
+
+ /// <summary>
+ /// MPN
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Attributes</param>
+ /// <returns>Collection part number</returns>
+ public static string FormatMpn(this Product product, IList<CustomAttribute> attributes = null)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ product.GetSkuMpnGtin(attributes, out _, out var Mpn, out _);
+
+ return Mpn;
+ }
+
+ /// <summary>
+ /// GTIN
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Attributes</param>
+ /// <param name="productAttributeParser">Product attribute service</param>
+ /// <returns>GTIN</returns>
+ public static string FormatGtin(this Product product, IList<CustomAttribute> attributes = null)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+
+ product.GetSkuMpnGtin(attributes, out _, out _, out var gtin);
+
+ return gtin;
+ }
+
/// <summary>
/// Parse "required product Ids" property
/// </summary>
diff --git a/src/Business/Grand.Business.Core/Extensions/TierPriceExtensions.cs b/src/Core/Grand.Domain/Catalog/TierPriceExtensions.cs
similarity index 98%
rename from src/Business/Grand.Business.Core/Extensions/TierPriceExtensions.cs
rename to src/Core/Grand.Domain/Catalog/TierPriceExtensions.cs
index b3cadba6b..86e94c247 100644
--- a/src/Business/Grand.Business.Core/Extensions/TierPriceExtensions.cs
+++ b/src/Core/Grand.Domain/Catalog/TierPriceExtensions.cs
@@ -1,7 +1,6 @@
-using Grand.Domain.Catalog;
using Grand.Domain.Customers;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Catalog
{
public static class TierPriceExtensions
{
diff --git a/src/Business/Grand.Business.Core/Extensions/AddressAttributeExtensions.cs b/src/Core/Grand.Domain/Common/AddressAttributeExtensions.cs
similarity index 93%
rename from src/Business/Grand.Business.Core/Extensions/AddressAttributeExtensions.cs
rename to src/Core/Grand.Domain/Common/AddressAttributeExtensions.cs
index 1c42e201b..203b1b275 100644
--- a/src/Business/Grand.Business.Core/Extensions/AddressAttributeExtensions.cs
+++ b/src/Core/Grand.Domain/Common/AddressAttributeExtensions.cs
@@ -1,7 +1,6 @@
using Grand.Domain.Catalog;
-using Grand.Domain.Common;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Common
{
/// <summary>
/// Extensions
diff --git a/src/Business/Grand.Business.Core/Extensions/AddressExtensions.cs b/src/Core/Grand.Domain/Common/AddressExtensions.cs
similarity index 97%
rename from src/Business/Grand.Business.Core/Extensions/AddressExtensions.cs
rename to src/Core/Grand.Domain/Common/AddressExtensions.cs
index e89cbb637..e8b0fcf94 100644
--- a/src/Business/Grand.Business.Core/Extensions/AddressExtensions.cs
+++ b/src/Core/Grand.Domain/Common/AddressExtensions.cs
@@ -1,6 +1,4 @@
-using Grand.Domain.Common;
-
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Common
{
public static class AddressExtensions
{
diff --git a/src/Core/Grand.Domain/Common/Reference.cs b/src/Core/Grand.Domain/Common/Reference.cs
index 76d4ec6af..46986dfca 100644
--- a/src/Core/Grand.Domain/Common/Reference.cs
+++ b/src/Core/Grand.Domain/Common/Reference.cs
@@ -63,10 +63,6 @@
/// </summary>
Campaign = 130,
/// <summary>
- /// Customer reminder
- /// </summary>
- CustomerReminder = 140,
- /// <summary>
/// Customer
/// </summary>
Customer = 150,
diff --git a/src/Core/Grand.Domain/Customers/CustomerAction.cs b/src/Core/Grand.Domain/Customers/CustomerAction.cs
deleted file mode 100644
index ddea0d3a4..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerAction.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-namespace Grand.Domain.Customers
-{
- /// <summary>
- /// Represents a customer action
- /// </summary>
- public partial class CustomerAction : BaseEntity
- {
- private ICollection<ActionCondition> _condition;
- /// <summary>
- /// Gets or sets the name
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets active action
- /// </summary>
- public bool Active { get; set; }
-
-
- /// <summary>
- /// Gets or sets the action Type
- /// </summary>
- public string ActionTypeId { get; set; }
-
- /// <summary>
- /// Gets or sets the action conditions
- /// </summary>
- public CustomerActionConditionEnum ConditionId { get; set; }
-
- /// <summary>
- /// Gets or sets the action conditions
- /// </summary>
- public CustomerReactionTypeEnum ReactionTypeId { get; set; }
-
- public string BannerId { get; set; }
- public string InteractiveFormId { get; set; }
-
- public string MessageTemplateId { get; set; }
-
- public string CustomerGroupId { get; set; }
-
- public string CustomerTagId { get; set; }
- /// <summary>
- /// Gets or sets the start date
- /// </summary>
- public DateTime StartDateTimeUtc { get; set; }
-
- /// <summary>
- /// Gets or sets the end date
- /// </summary>
- public DateTime EndDateTimeUtc { get; set; }
-
- /// <summary>
- /// Gets or sets the customer groups
- /// </summary>
- public virtual ICollection<ActionCondition> Conditions
- {
- get { return _condition ??= new List<ActionCondition>(); }
- protected set { _condition = value; }
- }
-
- public partial class ActionCondition: SubBaseEntity
- {
- private ICollection<string> _products;
- private ICollection<string> _categories;
- private ICollection<string> _collections;
- private ICollection<string> _vendors;
- private ICollection<string> _customerGroups;
- private ICollection<string> _customerTags;
- private ICollection<string> _stores;
- private ICollection<ProductAttributeValue> _productAttribute;
- private ICollection<ProductSpecification> _productSpecification;
- private ICollection<CustomerRegister> _customerRegister;
- private ICollection<CustomerRegister> _customCustomerAttributes;
- private ICollection<Url> _urlReferrer;
- private ICollection<Url> _urlCurrent;
-
- public string Name { get; set; }
-
- public CustomerActionConditionTypeEnum CustomerActionConditionTypeId { get; set; }
-
- public CustomerActionConditionEnum ConditionId { get; set; }
-
- public virtual ICollection<string> Products
- {
- get { return _products ??= new List<string>(); }
- protected set { _products = value; }
- }
-
- public virtual ICollection<string> Categories
- {
- get { return _categories ??= new List<string>(); }
- protected set { _categories = value; }
- }
-
- public virtual ICollection<string> Collections
- {
- get { return _collections ??= new List<string>(); }
- protected set { _collections = value; }
- }
-
- public virtual ICollection<string> Vendors
- {
- get { return _vendors ??= new List<string>(); }
- protected set { _vendors = value; }
- }
- public virtual ICollection<string> CustomerGroups
- {
- get { return _customerGroups ??= new List<string>(); }
- protected set { _customerGroups = value; }
- }
- public virtual ICollection<string> CustomerTags
- {
- get { return _customerTags ??= new List<string>(); }
- protected set { _customerTags = value; }
- }
- public virtual ICollection<string> Stores
- {
- get { return _stores ??= new List<string>(); }
- protected set { _stores = value; }
- }
- public virtual ICollection<ProductAttributeValue> ProductAttribute
- {
- get { return _productAttribute ??= new List<ProductAttributeValue>(); }
- protected set { _productAttribute = value; }
- }
-
- public virtual ICollection<ProductSpecification> ProductSpecifications
- {
- get { return _productSpecification ??= new List<ProductSpecification>(); }
- protected set { _productSpecification = value; }
- }
-
- public virtual ICollection<CustomerRegister> CustomerRegistration
- {
- get { return _customerRegister ??= new List<CustomerRegister>(); }
- protected set { _customerRegister = value; }
- }
-
- public virtual ICollection<CustomerRegister> CustomCustomerAttributes
- {
- get { return _customCustomerAttributes ??= new List<CustomerRegister>(); }
- protected set { _customCustomerAttributes = value; }
- }
-
- public virtual ICollection<Url> UrlReferrer
- {
- get { return _urlReferrer ??= new List<Url>(); }
- protected set { _urlReferrer = value; }
- }
-
- public virtual ICollection<Url> UrlCurrent
- {
- get { return _urlCurrent ??= new List<Url>(); }
- protected set { _urlCurrent = value; }
- }
-
- public partial class ProductAttributeValue: SubBaseEntity
- {
- public string ProductAttributeId { get; set; }
- public string Name { get; set; }
- }
-
- public partial class Url : SubBaseEntity
- {
- public string Name { get; set; }
- }
-
- public partial class ProductSpecification : SubBaseEntity
- {
- public string ProductSpecyficationId { get; set; }
- public string ProductSpecyficationValueId { get; set; }
- }
-
- public partial class CustomerRegister : SubBaseEntity
- {
- public string RegisterField { get; set; }
- public string RegisterValue { get; set; }
- }
-
- }
-
- }
-}
diff --git a/src/Core/Grand.Domain/Customers/CustomerActionEnum.cs b/src/Core/Grand.Domain/Customers/CustomerActionEnum.cs
deleted file mode 100644
index 49bcea18b..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerActionEnum.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace Grand.Domain.Customers
-{
- public enum CustomerActionTypeEnum
- {
- AddToCart = 1,
- AddOrder = 2,
- Viewed = 3,
- Url = 4,
- Registration = 5,
- PaidOrder = 6
- }
- public enum CustomerActionConditionEnum
- {
- OneOfThem = 0,
- AllOfThem = 1,
- }
-
- public enum CustomerActionConditionTypeEnum
- {
- Product = 1,
- Category = 2,
- Collection = 3,
- Vendor = 4,
- ProductAttribute = 5,
- ProductSpecification = 6,
- CustomerGroup = 7,
- CustomerTag = 8,
- CustomerRegisterField = 9,
- CustomCustomerAttribute = 10,
- UrlReferrer = 11,
- UrlCurrent = 12,
- Store = 13
- }
-
- public enum CustomerReactionTypeEnum
- {
- Banner = 1,
- Email = 2,
- AssignToCustomerGroup = 3,
- AssignToCustomerTag = 4,
- InteractiveForm = 5,
- }
-
-
-}
diff --git a/src/Core/Grand.Domain/Customers/CustomerActionHistory.cs b/src/Core/Grand.Domain/Customers/CustomerActionHistory.cs
deleted file mode 100644
index df6f38837..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerActionHistory.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Grand.Domain.Customers
-{
- /// <summary>
- /// Represents a customer action
- /// </summary>
- public partial class CustomerActionHistory : BaseEntity
- {
- public string CustomerActionId { get; set; }
- public string CustomerId { get; set; }
- public DateTime CreateDateUtc { get; set; }
-
- }
-}
diff --git a/src/Core/Grand.Domain/Customers/CustomerActionType.cs b/src/Core/Grand.Domain/Customers/CustomerActionType.cs
deleted file mode 100644
index 82ac1267a..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerActionType.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace Grand.Domain.Customers
-{
- /// <summary>
- /// Represents a Customer ActionType
- /// </summary>
- public partial class CustomerActionType : BaseEntity
- {
- private ICollection<int> _conditionType;
-
- public string SystemKeyword { get; set; }
-
- public string Name { get; set; }
-
- public bool Enabled { get; set; }
-
- public virtual ICollection<int> ConditionType
- {
- get { return _conditionType ??= new List<int>(); }
- protected set { _conditionType = value; }
- }
-
-
- }
-
-
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/CustomerAttributeExtensions.cs b/src/Core/Grand.Domain/Customers/CustomerAttributeExtensions.cs
similarity index 93%
rename from src/Business/Grand.Business.Core/Extensions/CustomerAttributeExtensions.cs
rename to src/Core/Grand.Domain/Customers/CustomerAttributeExtensions.cs
index 4e2aac27a..732bde6cd 100644
--- a/src/Business/Grand.Business.Core/Extensions/CustomerAttributeExtensions.cs
+++ b/src/Core/Grand.Domain/Customers/CustomerAttributeExtensions.cs
@@ -1,7 +1,6 @@
using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Customers
{
/// <summary>
/// Extensions
diff --git a/src/Core/Grand.Domain/Customers/CustomerReminder.cs b/src/Core/Grand.Domain/Customers/CustomerReminder.cs
deleted file mode 100644
index 0d2effb7d..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerReminder.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-namespace Grand.Domain.Customers
-{
- /// <summary>
- /// Represents a customer reminder
- /// </summary>
- public partial class CustomerReminder : BaseEntity
- {
- private ICollection<ReminderCondition> _condition;
-
- private ICollection<ReminderLevel> _level;
-
- /// <summary>
- /// Gets or sets the name
- /// </summary>
- public string Name { get; set; }
-
- public DateTime StartDateTimeUtc { get; set; }
- public DateTime EndDateTimeUtc { get; set; }
- public DateTime LastUpdateDate { get; set; }
-
- public bool AllowRenew { get; set; }
- public int RenewedDay { get; set; }
- /// <summary>
- /// Gets or sets display order
- /// </summary>
- public int DisplayOrder { get; set; }
-
- /// <summary>
- /// Gets or sets active action
- /// </summary>
- public bool Active { get; set; }
-
- /// <summary>
- /// Gets or sets the action conditions
- /// </summary>
- public CustomerReminderConditionEnum ConditionId { get; set; }
-
- /// <summary>
- /// Gets or sets the reminder rule
- /// </summary>
- public CustomerReminderRuleEnum ReminderRuleId { get; set; }
-
- /// <summary>
- /// Gets or sets the customer condition
- /// </summary>
- public virtual ICollection<ReminderCondition> Conditions
- {
- get { return _condition ??= new List<ReminderCondition>(); }
- protected set { _condition = value; }
- }
-
- /// <summary>
- /// Gets or sets the reminder level
- /// </summary>
- public virtual ICollection<ReminderLevel> Levels
- {
- get { return _level ??= new List<ReminderLevel>(); }
- protected set { _level = value; }
- }
-
-
- public partial class ReminderCondition: SubBaseEntity
- {
- private ICollection<string> _products;
- private ICollection<string> _categories;
- private ICollection<string> _collections;
- private ICollection<string> _customerGroups;
- private ICollection<string> _customerTags;
- private ICollection<CustomerRegister> _customerRegister;
- private ICollection<CustomerRegister> _customCustomerAttributes;
-
- public string Name { get; set; }
-
- public CustomerReminderConditionTypeEnum ConditionTypeId { get; set; }
-
- public CustomerReminderConditionEnum ConditionId { get; set; }
-
- public virtual ICollection<string> Products
- {
- get { return _products ??= new List<string>(); }
- protected set { _products = value; }
- }
-
- public virtual ICollection<string> Categories
- {
- get { return _categories ??= new List<string>(); }
- protected set { _categories = value; }
- }
-
- public virtual ICollection<string> Collections
- {
- get { return _collections ??= new List<string>(); }
- protected set { _collections = value; }
- }
-
- public virtual ICollection<string> CustomerGroups
- {
- get { return _customerGroups ??= new List<string>(); }
- protected set { _customerGroups = value; }
- }
- public virtual ICollection<string> CustomerTags
- {
- get { return _customerTags ??= new List<string>(); }
- protected set { _customerTags = value; }
- }
-
- public virtual ICollection<CustomerRegister> CustomerRegistration
- {
- get { return _customerRegister ??= new List<CustomerRegister>(); }
- protected set { _customerRegister = value; }
- }
-
- public virtual ICollection<CustomerRegister> CustomCustomerAttributes
- {
- get { return _customCustomerAttributes ??= new List<CustomerRegister>(); }
- protected set { _customCustomerAttributes = value; }
- }
-
- public partial class CustomerRegister: SubBaseEntity
- {
- public string RegisterField { get; set; }
- public string RegisterValue { get; set; }
- }
-
- }
-
- public partial class ReminderLevel: SubBaseEntity
- {
- public string Name { get; set; }
- public int Level { get; set; }
- public int Day { get; set; }
- public int Hour { get; set; }
- public int Minutes { get; set; }
- public string EmailAccountId { get; set; }
- public string BccEmailAddresses { get; set; }
- public string Subject { get; set; }
- public string Body { get; set; }
- }
-
- }
-}
diff --git a/src/Core/Grand.Domain/Customers/CustomerReminderEnum.cs b/src/Core/Grand.Domain/Customers/CustomerReminderEnum.cs
deleted file mode 100644
index f16e74a40..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerReminderEnum.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace Grand.Domain.Customers
-{
- public enum CustomerReminderRuleEnum
- {
- AbandonedCart = 1,
- RegisteredCustomer = 2,
- LastPurchase = 3,
- LastActivity = 4,
- Birthday = 5,
- CompletedOrder = 6,
- UnpaidOrder = 7
- }
-
- public enum CustomerReminderConditionTypeEnum
- {
- Product = 1,
- Category = 2,
- Collection = 3,
- CustomerGroup = 4,
- CustomerTag = 5,
- CustomerRegisterField = 6,
- CustomCustomerAttribute = 7,
- }
-
- public enum CustomerReminderConditionEnum
- {
- OneOfThem = 0,
- AllOfThem = 1,
- }
- public enum CustomerReminderHistoryStatusEnum
- {
- Started = 10,
- CompletedReminder = 20,
- CompletedOrdered = 30,
- }
-
-
-}
diff --git a/src/Core/Grand.Domain/Customers/CustomerReminderHistory.cs b/src/Core/Grand.Domain/Customers/CustomerReminderHistory.cs
deleted file mode 100644
index 8a25a4529..000000000
--- a/src/Core/Grand.Domain/Customers/CustomerReminderHistory.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace Grand.Domain.Customers
-{
- /// <summary>
- /// Represents a customer reminder history
- /// </summary>
- public partial class CustomerReminderHistory : BaseEntity
- {
- private ICollection<HistoryLevel> _level;
-
- public string CustomerReminderId { get; set; }
- public string CustomerId { get; set; }
- public CustomerReminderRuleEnum ReminderRuleId { get; set; }
- public CustomerReminderHistoryStatusEnum Status { get; set; }
-
- public string OrderId { get; set; }
- public string BaseOrderId { get; set; }
- public DateTime StartDate { get; set; }
- public DateTime EndDate { get; set; }
-
- /// <summary>
- /// Gets or sets the reminder level history
- /// </summary>
- public virtual ICollection<HistoryLevel> Levels
- {
- get { return _level ??= new List<HistoryLevel>(); }
- protected set { _level = value; }
- }
-
-
- public partial class HistoryLevel : SubBaseEntity
- {
- public string ReminderLevelId { get; set; }
- public int Level { get; set; }
- public DateTime SendDate { get; set; }
-
- }
-
- }
-}
diff --git a/src/Core/Grand.Domain/Messages/Banner.cs b/src/Core/Grand.Domain/Messages/Banner.cs
deleted file mode 100644
index 2436d92d3..000000000
--- a/src/Core/Grand.Domain/Messages/Banner.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using Grand.Domain.Localization;
-
-namespace Grand.Domain.Messages
-{
- /// <summary>
- /// Represents a banner
- /// </summary>
- public partial class Banner : BaseEntity, ITranslationEntity
- {
- public Banner()
- {
- Locales = new List<TranslationEntity>();
- }
- /// <summary>
- /// Gets or sets the name
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the body
- /// </summary>
- public string Body { get; set; }
-
- /// <summary>
- /// Gets or sets the collection of locales
- /// </summary>
- public IList<TranslationEntity> Locales { get; set; }
- /// <summary>
- /// Gets or sets the date and time of instance creation
- /// </summary>
- public DateTime CreatedOnUtc { get; set; }
-
-
- }
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/ContactAttributeExtensions.cs b/src/Core/Grand.Domain/Messages/ContactAttributeExtensions.cs
similarity index 96%
rename from src/Business/Grand.Business.Core/Extensions/ContactAttributeExtensions.cs
rename to src/Core/Grand.Domain/Messages/ContactAttributeExtensions.cs
index e525ee754..6bc0c5963 100644
--- a/src/Business/Grand.Business.Core/Extensions/ContactAttributeExtensions.cs
+++ b/src/Core/Grand.Domain/Messages/ContactAttributeExtensions.cs
@@ -1,7 +1,6 @@
using Grand.Domain.Catalog;
-using Grand.Domain.Messages;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Messages
{
/// <summary>
/// Extensions
@@ -23,7 +22,7 @@ namespace Grand.Business.Core.Extensions
contactAttribute.AttributeControlType == AttributeControlType.Datepicker ||
contactAttribute.AttributeControlType == AttributeControlType.FileUpload)
return false;
-
+
//other attribute controle types support values
return true;
}
diff --git a/src/Core/Grand.Domain/Messages/FormControlType.cs b/src/Core/Grand.Domain/Messages/FormControlType.cs
deleted file mode 100644
index 767eb7818..000000000
--- a/src/Core/Grand.Domain/Messages/FormControlType.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace Grand.Domain.Messages
-{
- public enum FormControlType
- {
- /// <summary>
- /// Dropdown list
- /// </summary>
- DropdownList = 1,
- /// <summary>
- /// Radio list
- /// </summary>
- RadioList = 2,
- /// <summary>
- /// Checkboxes
- /// </summary>
- Checkboxes = 3,
- /// <summary>
- /// TextBox
- /// </summary>
- TextBox = 4,
- /// <summary>
- /// Multiline textbox
- /// </summary>
- MultilineTextbox = 5
-
- }
-}
diff --git a/src/Core/Grand.Domain/Messages/InteractiveForm.cs b/src/Core/Grand.Domain/Messages/InteractiveForm.cs
deleted file mode 100644
index eae413d30..000000000
--- a/src/Core/Grand.Domain/Messages/InteractiveForm.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using Grand.Domain.Localization;
-
-namespace Grand.Domain.Messages
-{
- /// <summary>
- /// Represents a interactive forms
- /// </summary>
- public partial class InteractiveForm : BaseEntity, ITranslationEntity
- {
- private ICollection<FormAttribute> _formAttributes;
- public InteractiveForm()
- {
- Locales = new List<TranslationEntity>();
- }
- /// <summary>
- /// Gets or sets the name
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the system name
- /// </summary>
- public string SystemName { get; set; }
-
- /// <summary>
- /// Gets or sets the body
- /// </summary>
- public string Body { get; set; }
-
- /// <summary>
- /// Gets or sets the used email account identifier
- /// </summary>
- public string EmailAccountId { get; set; }
- /// <summary>
- /// Gets or sets the collection of locales
- /// </summary>
- public IList<TranslationEntity> Locales { get; set; }
- /// <summary>
- /// Gets or sets the date and time of instance creation
- /// </summary>
- public DateTime CreatedOnUtc { get; set; }
-
-
- public virtual ICollection<FormAttribute> FormAttributes
- {
- get { return _formAttributes ??= new List<FormAttribute>(); }
- protected set { _formAttributes = value; }
- }
-
- public class FormAttribute : SubBaseEntity, ITranslationEntity
- {
- private ICollection<FormAttributeValue> _formAttributeValues;
-
- public FormAttribute()
- {
- Locales = new List<TranslationEntity>();
- }
- /// <summary>
- /// Gets or sets the name
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the SystemName
- /// </summary>
- public string SystemName { get; set; }
-
- /// <summary>
- /// Gets or sets the regex validation
- /// </summary>
- public string RegexValidation { get; set; }
-
- /// <summary>
- /// Gets or sets the css style
- /// </summary>
- public string Style { get; set; }
-
- /// <summary>
- /// Gets or sets the css class
- /// </summary>
- public string Class { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the entity is required
- /// </summary>
- public bool IsRequired { get; set; }
-
- /// <summary>
- /// Gets or sets the attribute control type identifier
- /// </summary>
- public FormControlType FormControlTypeId { get; set; }
-
- /// <summary>
- /// Gets or sets the validation rule for minimum length (for textbox and multiline textbox)
- /// </summary>
- public int? ValidationMinLength { get; set; }
-
- /// <summary>
- /// Gets or sets the validation rule for maximum length (for textbox and multiline textbox)
- /// </summary>
- public int? ValidationMaxLength { get; set; }
- /// <summary>
- /// Gets or sets the default value (for textbox and multiline textbox)
- /// </summary>
- public string DefaultValue { get; set; }
-
- public IList<TranslationEntity> Locales { get; set; }
- public virtual ICollection<FormAttributeValue> FormAttributeValues
- {
- get { return _formAttributeValues ??= new List<FormAttributeValue>(); }
- protected set { _formAttributeValues = value; }
- }
- }
-
-
- public class FormAttributeValue : SubBaseEntity, ITranslationEntity
- {
- public FormAttributeValue()
- {
- Locales = new List<TranslationEntity>();
- }
- /// <summary>
- /// Gets or sets the checkout attribute name
- /// </summary>
- public string Name { get; set; }
- /// <summary>
- /// Gets or sets a value indicating whether the value is pre-selected
- /// </summary>
- public bool IsPreSelected { get; set; }
-
- /// <summary>
- /// Gets or sets the display order
- /// </summary>
- public int DisplayOrder { get; set; }
-
- public IList<TranslationEntity> Locales { get; set; }
- }
- }
-}
diff --git a/src/Core/Grand.Domain/Messages/PopupActive.cs b/src/Core/Grand.Domain/Messages/PopupActive.cs
deleted file mode 100644
index 0b3095d18..000000000
--- a/src/Core/Grand.Domain/Messages/PopupActive.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Grand.Domain.Messages
-{
- public partial class PopupActive : BaseEntity
- {
- public string Name { get; set; }
- public string Body { get; set; }
- public string CustomerId { get; set; }
- public string CustomerActionId { get; set; }
- public int PopupTypeId { get; set; }
- public DateTime CreatedOnUtc { get; set; }
- }
-
-}
diff --git a/src/Core/Grand.Domain/Messages/PopupArchive.cs b/src/Core/Grand.Domain/Messages/PopupArchive.cs
deleted file mode 100644
index 73629ad21..000000000
--- a/src/Core/Grand.Domain/Messages/PopupArchive.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Grand.Domain.Messages
-{
- public partial class PopupArchive : BaseEntity
- {
- public string PopupActiveId { get; set; }
- public string Name { get; set; }
- public string Body { get; set; }
- public string CustomerId { get; set; }
- public string CustomerActionId { get; set; }
- public int PopupTypeId { get; set; }
- public DateTime CreatedOnUtc { get; set; }
- public DateTime BACreatedOnUtc { get; set; }
- }
-}
diff --git a/src/Core/Grand.Domain/Messages/PopupType.cs b/src/Core/Grand.Domain/Messages/PopupType.cs
deleted file mode 100644
index 0c6122465..000000000
--- a/src/Core/Grand.Domain/Messages/PopupType.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Grand.Domain.Messages
-{
- public enum PopupType
- {
- /// <summary>
- /// Banner
- /// </summary>
- Banner = 10,
- /// <summary>
- /// Interactive form
- /// </summary>
- InteractiveForm = 20,
- /// <summary>
- /// Other
- /// </summary>
- Other = 99,
- }
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/CheckoutAttributeExtensions.cs b/src/Core/Grand.Domain/Orders/CheckoutAttributeExtensions.cs
similarity index 96%
rename from src/Business/Grand.Business.Core/Extensions/CheckoutAttributeExtensions.cs
rename to src/Core/Grand.Domain/Orders/CheckoutAttributeExtensions.cs
index d201b40a7..d27211510 100644
--- a/src/Business/Grand.Business.Core/Extensions/CheckoutAttributeExtensions.cs
+++ b/src/Core/Grand.Domain/Orders/CheckoutAttributeExtensions.cs
@@ -1,7 +1,6 @@
using Grand.Domain.Catalog;
-using Grand.Domain.Orders;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Orders
{
/// <summary>
/// Extensions
@@ -23,7 +22,7 @@ namespace Grand.Business.Core.Extensions
checkoutAttribute.AttributeControlTypeId == AttributeControlType.Datepicker ||
checkoutAttribute.AttributeControlTypeId == AttributeControlType.FileUpload)
return false;
-
+
return true;
}
diff --git a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
index aadd182a9..ac8a2b3ad 100644
--- a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
+++ b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
@@ -1,3 +1,4 @@
+using Grand.Domain.Common;
using Grand.Domain.Directory;
using Grand.Domain.Stores;
@@ -8,6 +9,55 @@ namespace Grand.Domain.Orders
/// </summary>
public static class GiftVoucherExtensions
{
+ /// <summary>
+ /// Add gift voucher attrbibutes
+ /// </summary>
+ /// <param name="customAttributes">Attributes</param>
+ /// <param name="recipientName">Recipient name</param>
+ /// <param name="recipientEmail">Recipient email</param>
+ /// <param name="senderName">Sender name</param>
+ /// <param name="senderEmail">Sender email</param>
+ /// <param name="giftVoucherMessage">Message</param>
+ /// <returns>Attributes</returns>
+ public static IList<CustomAttribute> AddGiftVoucherAttribute(IList<CustomAttribute> customAttributes, string recipientName,
+ string recipientEmail, string senderName, string senderEmail, string giftVoucherMessage)
+ {
+ if (customAttributes == null)
+ customAttributes = new List<CustomAttribute>();
+
+ customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = recipientName });
+ customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = recipientEmail });
+ customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = senderName });
+ customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = senderEmail });
+ customAttributes.Add(new CustomAttribute() { Key = "Message", Value = giftVoucherMessage });
+
+ return customAttributes;
+ }
+
+ /// <summary>
+ /// Get gift voucher attrbibutes
+ /// </summary>
+ /// <param name="customAttributes">Attributes</param>
+ /// <param name="recipientName">Recipient name</param>
+ /// <param name="recipientEmail">Recipient email</param>
+ /// <param name="senderName">Sender name</param>
+ /// <param name="senderEmail">Sender email</param>
+ /// <param name="giftVoucherMessage">Message</param>
+ public static void GetGiftVoucherAttribute(IList<CustomAttribute> customAttributes, out string recipientName,
+ out string recipientEmail, out string senderName,
+ out string senderEmail, out string giftVoucherMessage)
+ {
+ if (customAttributes == null)
+ customAttributes = new List<CustomAttribute>();
+
+ recipientName = customAttributes.FirstOrDefault(x => x.Key == "RecipientName")?.Value;
+ recipientEmail = customAttributes.FirstOrDefault(x => x.Key == "RecipientEmail")?.Value; ;
+ senderName = customAttributes.FirstOrDefault(x => x.Key == "SenderName")?.Value; ;
+ senderEmail = customAttributes.FirstOrDefault(x => x.Key == "SenderEmail")?.Value; ;
+ giftVoucherMessage = customAttributes.FirstOrDefault(x => x.Key == "Message")?.Value; ;
+
+ }
+
/// <summary>
/// Gets a gift voucher remaining amount
/// </summary>
diff --git a/src/Business/Grand.Business.Core/Extensions/OrderExtensions.cs b/src/Core/Grand.Domain/Orders/OrderExtensions.cs
similarity index 98%
rename from src/Business/Grand.Business.Core/Extensions/OrderExtensions.cs
rename to src/Core/Grand.Domain/Orders/OrderExtensions.cs
index 8f1b3e0fa..360bc53ec 100644
--- a/src/Business/Grand.Business.Core/Extensions/OrderExtensions.cs
+++ b/src/Core/Grand.Domain/Orders/OrderExtensions.cs
@@ -1,8 +1,7 @@
using Grand.Domain.Catalog;
-using Grand.Domain.Orders;
using Grand.Domain.Payments;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Orders
{
public static class OrderExtensions
{
diff --git a/src/Business/Grand.Business.Core/Extensions/ShoppingCartExtensions.cs b/src/Core/Grand.Domain/Orders/ShoppingCartExtensions.cs
similarity index 93%
rename from src/Business/Grand.Business.Core/Extensions/ShoppingCartExtensions.cs
rename to src/Core/Grand.Domain/Orders/ShoppingCartExtensions.cs
index 6441c7e90..d67cae3c3 100644
--- a/src/Business/Grand.Business.Core/Extensions/ShoppingCartExtensions.cs
+++ b/src/Core/Grand.Domain/Orders/ShoppingCartExtensions.cs
@@ -1,6 +1,4 @@
-using Grand.Domain.Orders;
-
-namespace Grand.Business.Core.Extensions
+namespace Grand.Domain.Orders
{
/// <summary>
/// Represents a shopping cart
diff --git a/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs b/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
index e369242f2..012f1277e 100644
--- a/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Security.Cryptography;
diff --git a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
index 5888fcb7d..002ab940d 100644
--- a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
@@ -1,6 +1,4 @@
-using System.IO;
-
-namespace Grand.SharedKernel.Extensions
+namespace Grand.SharedKernel.Extensions
{
public static class CommonPath
{
diff --git a/src/Core/Grand.SharedKernel/Extensions/ExtendedLinq.cs b/src/Core/Grand.SharedKernel/Extensions/ExtendedLinq.cs
index 6a0e8d1dd..b0d56455d 100644
--- a/src/Core/Grand.SharedKernel/Extensions/ExtendedLinq.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/ExtendedLinq.cs
@@ -1,7 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Grand.SharedKernel.Extensions
+namespace Grand.SharedKernel.Extensions
{
public static class ExtendedLinq
{
diff --git a/src/Core/Grand.SharedKernel/GrandException.cs b/src/Core/Grand.SharedKernel/GrandException.cs
index 90956c8db..a7917edf6 100644
--- a/src/Core/Grand.SharedKernel/GrandException.cs
+++ b/src/Core/Grand.SharedKernel/GrandException.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace Grand.SharedKernel
+namespace Grand.SharedKernel
{
/// <summary>
/// Represents errors that occur during application execution
diff --git a/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs b/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs
index 5b76750ec..9c0a0bddc 100644
--- a/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs
+++ b/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs
@@ -1,15 +1,10 @@
using Grand.Business.Core.Interfaces.Authentication;
-using Grand.Domain.Configuration;
-using Grand.Domain.Data;
-using Grand.Domain.Data.Mongo;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Google;
using Microsoft.AspNetCore.Authentication.OAuth;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Serilog;
using System.Net;
-using System.Text.Json;
namespace Authentication.Google.Infrastructure
{
diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs
index d79c5bb62..fd8860cca 100644
--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs
+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs
@@ -1,6 +1,4 @@
-using DiscountRules.Standard.Models;
-using Grand.Business.Core.Interfaces.Catalog.Discounts;
-using Grand.Business.Core.Interfaces.Common.Configuration;
+using Grand.Business.Core.Interfaces.Catalog.Discounts;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Web.Common.Controllers;
diff --git a/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs
index e023015a3..6345009c3 100644
--- a/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs
+++ b/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs
@@ -1,6 +1,5 @@
using Grand.Business.Core.Interfaces.Catalog.Discounts;
using Grand.Business.Core.Utilities.Catalog;
-using Grand.Business.Core.Extensions;
using Grand.Domain.Orders;
namespace DiscountRules.Provider
diff --git a/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs
index e7a89ddf2..e7f7ce393 100644
--- a/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs
+++ b/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs
@@ -1,6 +1,5 @@
using Grand.Business.Core.Interfaces.Catalog.Discounts;
using Grand.Business.Core.Utilities.Catalog;
-using Grand.Business.Core.Extensions;
using Grand.Domain.Orders;
namespace DiscountRules.Provider
diff --git a/src/Plugins/DiscountRules.Standard/Providers/ShoppingCartDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/ShoppingCartDiscountRule.cs
index 8ad24f144..31ce2e72b 100644
--- a/src/Plugins/DiscountRules.Standard/Providers/ShoppingCartDiscountRule.cs
+++ b/src/Plugins/DiscountRules.Standard/Providers/ShoppingCartDiscountRule.cs
@@ -2,7 +2,6 @@
using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Utilities.Catalog;
-using Grand.Business.Core.Extensions;
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs
index c0fdbe1cc..4680f1b56 100644
--- a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs
+++ b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Enums.Checkout;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Business.Core.Utilities.Checkout;
diff --git a/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs b/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs
index ca84e9491..055cd5d40 100644
--- a/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs
+++ b/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs
@@ -28,7 +28,6 @@ namespace Shipping.ByWeight
private readonly IServiceProvider _serviceProvider;
private readonly ITranslationService _translationService;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
private readonly ICurrencyService _currencyService;
private readonly ByWeightShippingSettings _byWeightShippingSettings;
@@ -42,7 +41,6 @@ namespace Shipping.ByWeight
ITranslationService translationService,
IProductService productService,
IServiceProvider serviceProvider,
- IProductAttributeParser productAttributeParser,
ICheckoutAttributeParser checkoutAttributeParser,
ICurrencyService currencyService,
ByWeightShippingSettings byWeightShippingSettings)
@@ -52,7 +50,6 @@ namespace Shipping.ByWeight
_translationService = translationService;
_productService = productService;
_serviceProvider = serviceProvider;
- _productAttributeParser = productAttributeParser;
_checkoutAttributeParser = checkoutAttributeParser;
_currencyService = currencyService;
_byWeightShippingSettings = byWeightShippingSettings;
@@ -121,7 +118,7 @@ namespace Shipping.ByWeight
double attributesTotalWeight = 0;
if (shoppingCartItem.Attributes != null && shoppingCartItem.Attributes.Any())
{
- var attributeValues = _productAttributeParser.ParseProductAttributeValues(product, shoppingCartItem.Attributes);
+ var attributeValues = product.ParseProductAttributeValues(shoppingCartItem.Attributes);
foreach (var attributeValue in attributeValues)
{
switch (attributeValue.AttributeValueTypeId)
diff --git a/src/Plugins/Widgets.FacebookPixel/StartupApplication.cs b/src/Plugins/Widgets.FacebookPixel/StartupApplication.cs
index 2c753d6ba..b06075bb9 100644
--- a/src/Plugins/Widgets.FacebookPixel/StartupApplication.cs
+++ b/src/Plugins/Widgets.FacebookPixel/StartupApplication.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Cms;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
diff --git a/src/Plugins/Widgets.GoogleAnalytics/Components/WidgetsGoogleAnalyticsViewComponent.cs b/src/Plugins/Widgets.GoogleAnalytics/Components/WidgetsGoogleAnalyticsViewComponent.cs
index d74729fbc..8dd43cbce 100644
--- a/src/Plugins/Widgets.GoogleAnalytics/Components/WidgetsGoogleAnalyticsViewComponent.cs
+++ b/src/Plugins/Widgets.GoogleAnalytics/Components/WidgetsGoogleAnalyticsViewComponent.cs
@@ -1,10 +1,10 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Catalog.Categories;
+using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Domain.Catalog;
using Grand.Domain.Logging;
using Grand.Domain.Orders;
using Grand.Infrastructure;
@@ -120,7 +120,6 @@ namespace Widgets.GoogleAnalytics.Components
var productService = _serviceProvider.GetRequiredService<IProductService>();
var categoryService = _serviceProvider.GetRequiredService<ICategoryService>();
- var productAttributeParser = _serviceProvider.GetRequiredService<IProductAttributeParser>();
foreach (var item in order.OrderItems)
{
@@ -136,7 +135,7 @@ namespace Widgets.GoogleAnalytics.Components
}
analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{ORDERID}", order.Id.ToString());
//The SKU code is a required parameter for every item that is added to the transaction
- analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTSKU}", FixIllegalJavaScriptChars(product.FormatSku(item.Attributes, productAttributeParser)));
+ analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTSKU}", FixIllegalJavaScriptChars(product.FormatSku(item.Attributes)));
analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTNAME}", FixIllegalJavaScriptChars(product.Name));
analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{CATEGORYNAME}", FixIllegalJavaScriptChars(category));
var unitPrice = _googleAnalyticsEcommerceSettings.IncludingTax ? item.UnitPriceInclTax : item.UnitPriceExclTax;
diff --git a/src/Plugins/Widgets.GoogleAnalytics/StartupApplication.cs b/src/Plugins/Widgets.GoogleAnalytics/StartupApplication.cs
index 4310fdb0d..fa4f6aed4 100644
--- a/src/Plugins/Widgets.GoogleAnalytics/StartupApplication.cs
+++ b/src/Plugins/Widgets.GoogleAnalytics/StartupApplication.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Cms;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs
index fa0dd58de..31637ed5b 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Catalog.Tests.Extensions
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductExtensionsTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductExtensionsTests.cs
index 87fc2d7ad..5b90caf76 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Catalog.Tests.Extensions
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Extensions/TierPriceExtensionsTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Extensions/TierPriceExtensionsTests.cs
index 463be5962..77466d640 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Extensions/TierPriceExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Extensions/TierPriceExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Catalog.Tests.Extensions
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Handlers/UpdateIntervalPropertiesCommandHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Handlers/UpdateIntervalPropertiesCommandHandlerTests.cs
index 4ade439f6..135ba3502 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Handlers/UpdateIntervalPropertiesCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Handlers/UpdateIntervalPropertiesCommandHandlerTests.cs
@@ -3,9 +3,7 @@ using Grand.Business.Core.Commands.Catalog;
using Grand.Domain.Catalog;
using Grand.Domain.Data.Mongo;
using Grand.Infrastructure.Caching;
-using Grand.Infrastructure.Events;
using Grand.SharedKernel.Extensions;
-using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Service/Prices/PriceServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Service/Prices/PriceServiceTests.cs
index 72b552dbd..8283de550 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Service/Prices/PriceServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Service/Prices/PriceServiceTests.cs
@@ -39,7 +39,6 @@ namespace Grand.Business.Catalog.Tests.Service.Prices
private ICategoryService _categoryService;
private IBrandService _brandService;
private ICollectionService _collectionService;
- private IProductAttributeParser _productAttributeParser;
private Mock<IProductService> tempProductService;
private IProductService _productService;
private ShoppingCartSettings _shoppingCartSettings;
@@ -75,7 +74,6 @@ namespace Grand.Business.Catalog.Tests.Service.Prices
{
_productService = tempProductService.Object;
}
- _productAttributeParser = new Mock<IProductAttributeParser>().Object;
_shoppingCartSettings = new ShoppingCartSettings();
_catalogSettings = new CatalogSettings();
var eventPublisher = new Mock<IMediator>();
@@ -120,7 +118,6 @@ namespace Grand.Business.Catalog.Tests.Service.Prices
_categoryService,
_brandService,
_collectionService,
- _productAttributeParser,
_productService,
_eventPublisher,
_currencyService,
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Service/Products/ProductAttributeParserTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Service/Products/ProductAttributeParserTests.cs
index 0d556bed8..c84809a75 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Service/Products/ProductAttributeParserTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Service/Products/ProductAttributeParserTests.cs
@@ -1,20 +1,17 @@
-using Grand.Business.Catalog.Services.Products;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Catalog.Tests.Service.Products
{
[TestClass()]
- public class ProductAttributeParserTests
+ public class ProductExtensionsAttributeParserTests
{
- private ProductAttributeParser _parrser;
private List<CustomAttribute> customAtr;
[TestInitialize()]
public void Init()
{
- _parrser = new ProductAttributeParser();
customAtr = new List<CustomAttribute>()
{
new CustomAttribute(){Key="key1",Value="value1" },
@@ -30,7 +27,7 @@ namespace Grand.Business.Catalog.Tests.Service.Products
var product = new Product();
product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key1" });
product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key2" });
- var result = _parrser.ParseProductAttributeMappings(product, customAtr);
+ var result = product.ParseProductAttributeMappings(customAtr);
Assert.IsTrue(result.Any(c => c.Id.Equals("key1")));
Assert.IsTrue(result.Any(c => c.Id.Equals("key2")));
@@ -44,7 +41,7 @@ namespace Grand.Business.Catalog.Tests.Service.Products
var product = new Product();
product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key10" });
product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key12" });
- var result = _parrser.ParseProductAttributeMappings(product, customAtr);
+ var result = product.ParseProductAttributeMappings(customAtr);
Assert.IsTrue(result.Count == 0);
}
@@ -58,7 +55,7 @@ namespace Grand.Business.Catalog.Tests.Service.Products
var mapping2 = new ProductAttributeMapping() { Id = "key2" };
mapping2.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "value2" });
product.ProductAttributeMappings.Add(mapping2);
- var result = _parrser.ParseProductAttributeValues(product, customAtr);
+ var result = product.ParseProductAttributeValues(customAtr);
Assert.IsTrue(result.Any(c => c.Id.Equals("value1")));
Assert.IsTrue(result.Any(c => c.Id.Equals("value2")));
@@ -69,14 +66,14 @@ namespace Grand.Business.Catalog.Tests.Service.Products
[TestMethod()]
public void ParseValues_ReturnExpectedValues()
{
- var result = _parrser.ParseValues(customAtr, "key1");
+ var result = ProductExtensions.ParseValues(customAtr, "key1");
Assert.IsTrue(result.Any(c => c.Equals("value1")));
}
[TestMethod()]
public void AddProductAttribute_ReturnExpectedValues()
{
- var result = _parrser.AddProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key6" }, "value6");
+ var result = ProductExtensions.AddProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key6" }, "value6");
Assert.IsTrue(result.Count == 5);
Assert.IsTrue(result.Last().Value.Equals("value6"));
}
@@ -84,7 +81,7 @@ namespace Grand.Business.Catalog.Tests.Service.Products
[TestMethod()]
public void RemoveProductAttribute_ReturnExpectedValues()
{
- var result = _parrser.RemoveProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key1" });
+ var result = ProductExtensions.RemoveProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key1" });
Assert.IsTrue(result.Count == 3);
Assert.IsFalse(result.Any(c => c.Key.Equals("key1")));
}
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Service/Products/StockQuantityServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Service/Products/StockQuantityServiceTests.cs
index ee69e7d27..dbb473979 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Service/Products/StockQuantityServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Service/Products/StockQuantityServiceTests.cs
@@ -22,8 +22,7 @@ namespace Grand.Business.Catalog.Tests.Service.Products
_translationService = tempLocalizationService.Object;
}
_stockQuantityService = new StockQuantityService(
- tempLocalizationService.Object,
- new ProductAttributeParser());
+ tempLocalizationService.Object);
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Extensions/CheckoutAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Extensions/CheckoutAttributeExtensionsTests.cs
index 93567dd86..ab4ae20bf 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Extensions/CheckoutAttributeExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Extensions/CheckoutAttributeExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Grand.Domain.Orders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Extensions/OrderExtensionsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Extensions/OrderExtensionsTests.cs
index 0c06f2ce3..8ba13ccfb 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Extensions/OrderExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Extensions/OrderExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Grand.Domain.Orders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShoppingCartExtensionsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShoppingCartExtensionsTests.cs
index 6256b0ba6..6254ddd5d 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShoppingCartExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShoppingCartExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Checkout.Tests.Extensions
diff --git a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
index 82dfb55d9..04cda2b29 100644
--- a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Blogs;
+using Grand.Domain.Blogs;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Cms.Tests.Extensions
diff --git a/src/Tests/Grand.Business.Common.Tests/Extensions/AddressAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Common.Tests/Extensions/AddressAttributeExtensionsTests.cs
index 226ef57b3..14144760b 100644
--- a/src/Tests/Grand.Business.Common.Tests/Extensions/AddressAttributeExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Extensions/AddressAttributeExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs
index 2921620ca..8e5e493e8 100644
--- a/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
using Grand.Domain.Messages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Extensions/KnowledgebaseExtensionsTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Extensions/KnowledgebaseExtensionsTests.cs
deleted file mode 100644
index 832a71067..000000000
--- a/src/Tests/Grand.Business.Marketing.Tests/Extensions/KnowledgebaseExtensionsTests.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Domain.Knowledgebase;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Grand.Business.Marketing.Tests.Extensions
-{
- [TestClass()]
- public class KnowledgebaseExtensionsTests
- {
- private List<KnowledgebaseCategory> _allCategories;
-
- [TestInitialize()]
- public void Init()
- {
- _allCategories = new List<KnowledgebaseCategory>()
- {
- new KnowledgebaseCategory(){Id="1",Name="category1",ParentCategoryId="2"},
- new KnowledgebaseCategory(){Id="2",Name="category2",ParentCategoryId="3"},
- new KnowledgebaseCategory(){Id="3",Name="category3",ParentCategoryId="4"},
- new KnowledgebaseCategory(){Id="4",Name="category4"},
- new KnowledgebaseCategory(){Id="5",Name="category5"},
- new KnowledgebaseCategory(){Id="6",Name="category6"},
- };
- }
-
-
- [TestMethod()]
- public void GetFormattedBreadCrumb_ReturnExpectedValue()
- {
- var category = _allCategories.First();
- var result = category.GetFormattedBreadCrumb(_allCategories);
- var category2 = new KnowledgebaseCategory() { Id = "2", Name = "category2", ParentCategoryId = "3" };
- Assert.AreEqual("category4 >> category3 >> category2 >> category1", result);
- Assert.AreEqual("category4 // category3 // category2 // category1", category.GetFormattedBreadCrumb(_allCategories, separator: "//"));
- Assert.AreEqual("category4 >> category3 >> category2", category2.GetFormattedBreadCrumb(_allCategories));
- }
- }
-}
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Banners/BannerServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Banners/BannerServiceTests.cs
deleted file mode 100644
index 6b6470412..000000000
--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Banners/BannerServiceTests.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using Grand.Business.Marketing.Services.Banners;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using Grand.Infrastructure.Events;
-using MediatR;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-
-namespace Grand.Business.Marketing.Tests.Services.Banners
-{
- [TestClass()]
- public class BannerServiceTests
- {
- private Mock<IMediator> _mediatorMock;
- private Mock<IRepository<Banner>> _repositoryMock;
- private BannerService _bannerService;
-
- [TestInitialize()]
- public void Init()
- {
- _mediatorMock = new Mock<IMediator>();
- _repositoryMock = new Mock<IRepository<Banner>>();
- _bannerService = new BannerService(_repositoryMock.Object, _mediatorMock.Object);
- }
-
-
- [TestMethod()]
- public void DeleteBanner_NullArgument_ThrowException()
- {
- Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await _bannerService.DeleteBanner(null), "banner");
- }
-
- [TestMethod()]
- public async Task Delete_ValidArgument_InvokeRepository()
- {
- await _bannerService.DeleteBanner(new Banner());
- _repositoryMock.Verify(c => c.DeleteAsync(It.IsAny<Banner>()), Times.Once);
- _mediatorMock.Verify(c => c.Publish(It.IsAny<EntityDeleted<Banner>>(), default(CancellationToken)), Times.Once);
- }
-
- [TestMethod()]
- public void InsertBanner_NullArgument_ThrowException()
- {
- Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await _bannerService.InsertBanner(null), "banner");
- }
-
- [TestMethod()]
- public async Task InsertBanner_ValidArgument_InvokeRepository()
- {
- await _bannerService.InsertBanner(new Banner());
- _repositoryMock.Verify(c => c.InsertAsync(It.IsAny<Banner>()), Times.Once);
- _mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<Banner>>(), default(CancellationToken)), Times.Once);
- }
-
- [TestMethod()]
- public void UpdateBanner_NullArgument_ThrowException()
- {
- Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await _bannerService.UpdateBanner(null), "banner");
- }
-
- [TestMethod()]
- public async Task UpdateBanner_ValidArgument_InvokeRepository()
- {
- await _bannerService.UpdateBanner(new Banner());
- _repositoryMock.Verify(c => c.UpdateAsync(It.IsAny<Banner>()), Times.Once);
- _mediatorMock.Verify(c => c.Publish(It.IsAny<EntityUpdated<Banner>>(), default(CancellationToken)), Times.Once);
- }
- }
-}
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/PopupServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/PopupServiceTests.cs
deleted file mode 100644
index fa4f19267..000000000
--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/PopupServiceTests.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Grand.Business.Marketing.Services.Contacts;
-using Grand.Domain.Data;
-using Grand.Domain.Messages;
-using Grand.Infrastructure.Events;
-using Grand.SharedKernel.Extensions;
-using MediatR;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-
-namespace Grand.Business.Marketing.Tests.Services.Contacts
-{
- [TestClass()]
- public class PopupServiceTests
- {
- private Mock<IRepository<PopupActive>> _repoMock;
- private Mock<IRepository<PopupArchive>> _repositoryArchiveMock;
- private Mock<IMediator> _mediatorMock;
- private PopupService _popupService;
-
- [TestInitialize()]
- public void Init()
- {
- CommonPath.BaseDirectory = "";
-
- _repoMock = new Mock<IRepository<PopupActive>>();
- _repositoryArchiveMock = new Mock<IRepository<PopupArchive>>();
- _mediatorMock = new Mock<IMediator>();
- _popupService = new PopupService(_repoMock.Object, _repositoryArchiveMock.Object, _mediatorMock.Object);
- }
-
- [TestMethod()]
- public void InsertPopupActive_NullArguemnt_ThrowException()
- {
- Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await _popupService.InsertPopupActive(null));
- }
-
- [TestMethod()]
- public async Task InsertPopupActive_ValidArguemnt_InvokeRepositoryAndPublishEvent()
- {
- await _popupService.InsertPopupActive(new PopupActive());
- _repoMock.Verify(c => c.InsertAsync(It.IsAny<PopupActive>()), Times.Once);
- _mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<PopupActive>>(), default), Times.Once);
- }
- }
-}
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs
deleted file mode 100644
index 9baeedb75..000000000
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-
-namespace Grand.Business.System.Tests.Services.BackgroundService
-{
- [TestClass]
- public class CustomerReminderAbandonedCartScheduleTaskTests
- {
- private Mock<ICustomerReminderService> _crServiceMock;
- private CustomerReminderAbandonedCartScheduleTask _task;
-
- [TestInitialize]
- public void Init()
- {
- _crServiceMock = new Mock<ICustomerReminderService>();
- _task = new CustomerReminderAbandonedCartScheduleTask(_crServiceMock.Object);
- }
-
- [TestMethod]
- public async Task Execute_InovkeReminderService()
- {
- await _task.Execute();
- _crServiceMock.Verify(c => c.Task_AbandonedCart(It.IsAny<string>()), Times.Once);
- }
- }
-}
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs
deleted file mode 100644
index 682e95b2a..000000000
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-
-namespace Grand.Business.System.Tests.Services.BackgroundService
-{
- [TestClass]
- public class CustomerReminderTasksTests
- {
- private Mock<ICustomerReminderService> _customerRemiderServiceMock;
- private CustomerReminderBirthdayScheduleTask _customerReminderBirthdayTask;
- private CustomerReminderCompletedOrderScheduleTask _completedOrderTask;
- private CustomerReminderLastActivityScheduleTask _lastActivityScheduleTask;
- private CustomerReminderLastPurchaseScheduleTask _LastPurchaseScheduleTask;
- private CustomerReminderRegisteredCustomerScheduleTask _registeredCustomerScheduleTask;
- private CustomerReminderUnpaidOrderScheduleTask _unpaidOrderScheduleTask;
-
- [TestInitialize]
- public void Init()
- {
- _customerRemiderServiceMock = new Mock<ICustomerReminderService>();
- _customerReminderBirthdayTask = new CustomerReminderBirthdayScheduleTask(_customerRemiderServiceMock.Object);
- _completedOrderTask = new CustomerReminderCompletedOrderScheduleTask(_customerRemiderServiceMock.Object);
- _lastActivityScheduleTask = new CustomerReminderLastActivityScheduleTask(_customerRemiderServiceMock.Object);
- _LastPurchaseScheduleTask = new CustomerReminderLastPurchaseScheduleTask(_customerRemiderServiceMock.Object);
- _registeredCustomerScheduleTask = new CustomerReminderRegisteredCustomerScheduleTask(_customerRemiderServiceMock.Object);
- _unpaidOrderScheduleTask = new CustomerReminderUnpaidOrderScheduleTask(_customerRemiderServiceMock.Object);
- }
-
- [TestMethod]
- public async Task BirthdayTaskExecute_InvokeExpectedMethod()
- {
- await _customerReminderBirthdayTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_Birthday(It.IsAny<string>()), Times.Once);
- }
-
- [TestMethod]
- public async Task CompletedOrderTaskExecute_InvokeExpectedMethod()
- {
- await _completedOrderTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_CompletedOrder(It.IsAny<string>()), Times.Once);
- }
-
- [TestMethod]
- public async Task LastActivityScheduleTaskExecute_InvokeExpectedMethod()
- {
- await _lastActivityScheduleTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_LastActivity(It.IsAny<string>()), Times.Once);
- }
-
- [TestMethod]
- public async Task LastPurchaseScheduleTaskExecute_InvokeExpectedMethod()
- {
- await _LastPurchaseScheduleTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_LastPurchase(It.IsAny<string>()), Times.Once);
- }
-
- [TestMethod]
- public async Task RegisteredCustomerScheduleTaskExecute_InvokeExpectedMethod()
- {
- await _registeredCustomerScheduleTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_RegisteredCustomer(It.IsAny<string>()), Times.Once);
- }
-
- [TestMethod]
- public async Task UnpaidOrderScheduleTaskExecute_InvokeExpectedMethod()
- {
- await _unpaidOrderScheduleTask.Execute();
- _customerRemiderServiceMock.Verify(c => c.Task_UnpaidOrder(It.IsAny<string>()), Times.Once);
- }
- }
-}
diff --git a/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs b/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
index dfa9518b7..c31990998 100644
--- a/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
+++ b/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
@@ -13,25 +13,15 @@
* limitations under the License.
*/
-using MongoDB.Bson;
-using MongoDB.Bson.Serialization.Serializers;
using MongoDB.Driver;
-using MongoDB.Driver.Core.Bindings;
using MongoDB.Driver.Core.Clusters;
-using MongoDB.Driver.Core.Clusters.ServerSelectors;
using MongoDB.Driver.Core.Configuration;
-using MongoDB.Driver.Core.Misc;
-using MongoDB.Driver.Core.Operations;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.WireProtocol.Messages.Encoders;
using NUnit.Framework;
-using System;
-using System.Collections.Generic;
using System.Diagnostics;
-using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
-using System.Threading;
namespace Grand.Data.Tests.MongoDb
diff --git a/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs b/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
index 01e542cef..38aaa87be 100644
--- a/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
+++ b/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
@@ -1,6 +1,5 @@

using MongoDB.Driver;
-using System;
namespace Grand.Data.Tests.MongoDb
{
diff --git a/src/Web/Grand.Web.Admin/App_Data/GeoLite2-Country.mmdb b/src/Web/Grand.Web.Admin/App_Data/GeoLite2-Country.mmdb
new file mode 100644
index 000000000..6948a5244
Binary files /dev/null and b/src/Web/Grand.Web.Admin/App_Data/GeoLite2-Country.mmdb differ
diff --git a/src/Web/Grand.Web.Admin/App_Data/appsettings.json b/src/Web/Grand.Web.Admin/App_Data/appsettings.json
new file mode 100644
index 000000000..4e01828d0
--- /dev/null
+++ b/src/Web/Grand.Web.Admin/App_Data/appsettings.json
@@ -0,0 +1,238 @@
+{
+ "Application": {
+
+ //Enable if you want to see the full error in production environment. It's ignored (always enabled) in development environment
+ "DisplayFullErrorStack": true,
+
+ //Value of "Cache-Control" header value for static content
+ "StaticFilesCacheControl": "public,max-age=31536000",
+
+ //Ignore the migration process
+ "SkipMigrationProcess": false,
+
+ //Enable the session-based TempData provider
+ "UseSessionStateTempDataProvider": false,
+
+ //Use my request localization culture
+ "UseRequestLocalization": false,
+ "DefaultRequestCulture": "en-US",
+ "SupportedCultures": [ "en-US", "pl-PL" ], //sample list
+
+ //Indicates whether to disable hosted service - BackgroundServiceTask
+ "DisableHostedService": false,
+
+ //Note: While use of custom response header encoding may be needed in some cases,
+ //we discourage the use of non-ASCII encodings to avoid compatibility issues
+ //with other HTTP clients.
+ "AllowNonAsciiCharInHeaders": false,
+
+ //Gets or sets the maximum allowed size of any request body in bytes
+ //the default value is 30MB
+ "MaxRequestBodySize": null, //max 2147483648
+
+ //(Serilog) Request logging - The package includes middleware for smarter HTTP request logging.
+ "UseSerilogRequestLogging": false
+ },
+
+ "Database": {
+ //This setting is required to use LiteDB database
+ "UseLiteDb": false,
+ //LiteDB database as a singleton service in the application
+ "Singleton": true,
+ //Init connection string - it's required only for the installation process!
+ "LiteDbConnectionString": "Filename=App_Data/database.db"
+ },
+
+ "Security": {
+
+ //Use a reverse proxy server - more information you can find at: https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/linux-nginx
+ "UseForwardedHeaders": false,
+
+ //AllowedHosts, is used for host filtering to bind your app to specific hostnames
+ "AllowedHosts": "*",
+
+ //This settings adds the following headers to all responses that pass
+ //X-Content-Type-Options: nosniff
+ //Strict-Transport-Security: max-age=31536000; includeSubDomains
+ //X-Frame-Options: Deny
+ //X-XSS-Protection: 1; mode=block
+ //Referrer-Policy: strict-origin-when-cross-origin
+ //Content-Security-Policy: object-src 'none'; form-action 'self'; frame-ancestors 'none'
+ "UseDefaultSecurityHeaders": false,
+
+ //HTTP Strict Transport Security Protocol
+ "UseHsts": false,
+
+ //We recommend all ASP.NET Core web apps call HTTPS Redirection Middleware to redirect all HTTP requests to HTTPS
+ "UseHttpsRedirection": false,
+ "HttpsRedirectionRedirect": 308,
+ "HttpsRedirectionHttpsPort": 443,
+
+ //Key persistence location you can point to a directory on the local machine, or it can point to a folder on a network share.
+ //if is null it will use the default directory path - ApplicationPath\App_Data\DataProtectionKeys
+ "KeyPersistenceLocation": null,
+
+ //Gets or sets a value indicating for cookie auth expires in hours - default 24 * 365 = 8760
+ "CookieAuthExpires": 8760,
+
+ //Gets or sets a value for cookie prefix - any changes will log out all of the customers
+ "CookiePrefix": ".Grand.",
+
+ //Gets or sets a value for cookie claim issuer - any changes will log out all of the customers
+ "CookieClaimsIssuer": "grandnode",
+
+ //CookieSecurePolicy.Always always sets the Secure flag
+ //Always setting the Secure flag is the most restrictive and most secure option.
+ //This is the one you should be targeting if your production environment fully runs on HTTPS
+ "CookieSecurePolicyAlways": false
+ },
+
+ "Extensions": {
+
+ //For developers - more info you can find at https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/
+ //https://github.com/dotnet/roslyn/wiki/Roslyn-Overview
+ "UseRoslynScripts": false,
+
+ //Disable upload extensions plugins/themes
+ "DisableUploadExtensions": false,
+
+ //A list of plugins to be ignored during start application - pattern
+ "PluginSkipLoadingPattern": "",
+
+ //Enable if you want to clear /Plugins/bin directory on application startup
+ "ClearPluginShadowDirectoryOnStartup": true,
+
+ //For develop you should enable if you want to copy plugin dll files to directory /Plugins/bin on application startup
+ "PluginShadowCopy": true
+ },
+
+ "Performance": {
+
+ //Indicates whether to compress response (gzip by default)
+ //You may want to disable it, for example, If you have an active IIS Dynamic Compression Module configured at the server level
+ "UseResponseCompression": false,
+
+ //Gets or sets a value indicating for default cache time in minutes"
+ "DefaultCacheTimeMinutes": 60,
+ },
+
+ "Redis": {
+ ///Enable the Publish/Subscribe messaging with redis to manage memory cache on every server
+ "RedisPubSubEnabled": false,
+ "RedisPubSubConnectionString": "127.0.0.1:6379,allowAdmin=true",
+ "RedisPubSubChannel": "channel",
+ "PersistKeysToRedis": false,
+ "PersistKeysToRedisUrl": "127.0.0.1:6379,allowAdmin=true,defaultDatabase=1"
+ },
+
+ "Rabbit": {
+ //Enable RabbitMq
+ "RabbitEnabled": false,
+ "RabbitCachePubSubEnabled": false,
+ "RabbitHostName": "localhost",
+ "RabbitVirtualHost": "/",
+ "RabbitUsername": "guest",
+ "RabbitPassword": "guest",
+ //must be unique for each instance
+ "RabbitCacheReceiveEndpoint": "grandnode"
+ },
+ "Azure": {
+
+ //Enable "RunOnAzureWebApps" if you run on Windows Azure Web Apps
+ "RunOnAzureWebApps": false,
+
+ //Azure BLOB storage.
+ //Specify your connection string, container name, end point for BLOB storage here
+ "AzureBlobStorageConnectionString": "",
+ "AzureBlobStorageContainerName": "",
+ "AzureBlobStorageEndPoint": "",
+
+ //DataProtection - Azure Key Vault - you can use only one of method PersistKeysToAzureKeyVault or PersistKeysToAzureBlobStorage
+ "PersistKeysAzureBlobStorageConnectionString": "", //required
+ "PersistKeysToAzureKeyVault": false,
+ "PersistKeysToAzureBlobStorage": false,
+ "DataProtectionContainerName": "", //required
+ "DataProtectionBlobName": "keys.xml", //required
+ "KeyIdentifier": "" //required when use PersistKeysToAzureKeyVault
+
+ },
+ "Amazon": {
+
+ //Amazon Blob storage
+ //<!--Available Region System Names can be found here http://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region -->
+ "AmazonAwsAccessKeyId": "",
+ "AmazonAwsSecretAccessKey": "",
+ "AmazonBucketName": "",
+ "AmazonRegion": "",
+ "AmazonDistributionDomainName": "" //Domain name for cloudfront distribution
+
+ },
+ //access to the api to web controllers
+ "FrontendAPI": {
+ "Enabled": false,
+ "SecretKey": "your private secret key", //at least 16 characters
+ "ValidateIssuer": false,
+ "ValidIssuer": "",
+ "ValidateAudience": false,
+ "ValidAudience": "",
+ "ValidateLifetime": true,
+ "ValidateIssuerSigningKey": true,
+ "ExpiryInMinutes": 1440,
+ "RefreshTokenExpiryInMinutes": 1440
+ },
+ //api for admin
+ "BackendAPI": {
+ "Enabled": false,
+ "UseSwagger": false,
+ "SecretKey": "your private secret key", //at least 16 characters
+ "ValidateIssuer": false,
+ "ValidIssuer": "",
+ "ValidateAudience": false,
+ "ValidAudience": "",
+ "ValidateLifetime": true,
+ "ValidateIssuerSigningKey": true,
+ "ExpiryInMinutes": 1440,
+ //generate system model
+ "SystemModel": true
+ },
+
+ //Settings only for advanced users
+ "Advanced": {
+ "DbConnectionString": "",
+ "DbProvider": 0,
+ "InstalledPlugins": []
+ },
+
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.File" ]
+ //,
+ //"MinimumLevel": {
+ // "Default": "Warning"
+ // }
+ //,
+ //"WriteTo": [
+ // {
+ // "Name": "File",
+ // "Args": { "path": "logs/log.txt" }
+ // }
+ // ]
+ },
+
+ "ApplicationInsights": {
+ "Enabled": false,
+ "ConnectionString": ""
+ }
+ //https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core
+ //The following configuration allows ApplicationInsights to capture
+ //all Information logs and more severe logs
+ //"Logging": {
+ // "LogLevel": {
+ // "Default": "Warning"
+ // },
+ // "ApplicationInsights": {
+ // "LogLevel": {
+ // "Default": "Information"
+ // }
+ // }
+ //}
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Create.cshtml
deleted file mode 100644
index a08dcbcc4..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Create.cshtml
+++ /dev/null
@@ -1,31 +0,0 @@
-@model BannerModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.Banners.AddNew"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="Banner" asp-action="Create" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tag"></i>
- @Loc["admin.marketing.Banners.AddNew"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["admin.marketing.Banners.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="banner-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Edit.cshtml
deleted file mode 100644
index 1d47b1cd0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Edit.cshtml
+++ /dev/null
@@ -1,33 +0,0 @@
-@model BannerModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.Banners.EditBannerDetails"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="Banner" asp-action="Edit" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tag"></i>
- @Loc["admin.marketing.Banners.EditBannerDetails"] - @Model.Name
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["admin.marketing.Banners.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="banner-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
-
-<admin-delete-confirmation button-id="banner-delete"/>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/List.cshtml
deleted file mode 100644
index 897e2c568..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/List.cshtml
+++ /dev/null
@@ -1,76 +0,0 @@
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.Banners"];
-}
-
-<div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tags"></i>
- @Loc["admin.marketing.Banners"]
- </div>
- <div class="actions btn-group btn-group-devided">
- <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span></a>
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="x_content">
- <div id="banners-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-
-
-<script>
- $(document).ready(function () {
- $("#banners-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("List", "Banner", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["admin.marketing.Banners.Fields.Name"]",
- template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>',
- }]
- });
- });
-</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Partials/CreateOrUpdate.cshtml
deleted file mode 100644
index ee948b9c5..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Banner/Partials/CreateOrUpdate.cshtml
+++ /dev/null
@@ -1,48 +0,0 @@
-@model BannerModel
-@using Microsoft.AspNetCore.Mvc.Razor;
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-
-@{ Func<int, HelperResult>
- template = @<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Name" />
- <span asp-validation-for="Locales[item].Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Body" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Body" asp-template="Editor" />
- <span asp-validation-for="Locales[item].Body"></span>
- </div>
- </div>
- <input type="hidden" asp-for="@Model.Locales[item].LanguageId" />
- </div>
-</div>;
-}
-
-<div class="form-horizontal">
- <localized-editor localized-template=@template name="banner-localized" [email protected](c=>c.LanguageId).ToList()>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Body" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Body" asp-template="Editor" />
- <span asp-validation-for="Body"></span>
- </div>
- </div>
- </div>
- </localized-editor>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.cshtml
index 4a6cf3532..437e25d4c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.cshtml
@@ -45,6 +45,6 @@
</items>
</admin-tabstrip>
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.min.js"></script>
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.caret.min.js"></script>
\ No newline at end of file
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.min.js"></script>
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.caret.min.js"></script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabInfo.cshtml
index 4e0d0efe2..ba5c76ce6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -1,8 +1,8 @@
@model CampaignModel
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/mode/xml/xml.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.css" />
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/mode/xml/xml.js"></script>
<div class="form-horizontal">
<div class="form-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdateValue.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdateValue.cshtml
index d8901d075..c0bff07ca 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdateValue.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdateValue.cshtml
@@ -1,8 +1,8 @@
@model CheckoutAttributeValueModel
@using Microsoft.AspNetCore.Mvc.Razor;
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="CheckoutAttributeId" type="hidden" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdateValue.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdateValue.cshtml
index b578913f7..d93d83006 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdateValue.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdateValue.cshtml
@@ -1,8 +1,8 @@
@model ContactAttributeValueModel
@using Microsoft.AspNetCore.Mvc.Razor;
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
index c374cb593..c04439be9 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
@@ -7,9 +7,9 @@
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.min.js"></script>
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.caret.min.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.min.js"></script>
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.caret.min.js"></script>
<script>
//tags
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/AddCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/AddCondition.cshtml
deleted file mode 100644
index a1aac8a9d..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/AddCondition.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model CustomerActionConditionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerAction.AddCustomerActionCondition"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="AddCondition" method="post" id="customer-action-condition-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerAction.AddCustomerActionCondition"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerAction.BackToAction"] + ")", "Edit", new { Id = Model.CustomerActionId }) </small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateCondition" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CategoryAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CategoryAddPopup.cshtml
deleted file mode 100644
index 8ca4f32cf..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CategoryAddPopup.cshtml
+++ /dev/null
@@ -1,180 +0,0 @@
-@model CustomerActionConditionModel.AddCategoryConditionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerActionCondition.Category.AddNew"];
-}
-<form id="CategoryAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="CategoryAddPopup" method="post"
- asp-route-CustomerActionId="@Context.Request.Query["CustomerActionId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerActionId" type="hidden" />
- <input asp-for="CustomerActionConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerActionCondition.Category.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0 mb-3">
- <div class="row align-items-end">
- <div class="col-md-8 col-sm-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchCategoryName" class="control-label" />
- <admin-input asp-for="SearchCategoryName" />
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-sm btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-categories">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="categories-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- var mfp = $.magnificPopup.instance;
- $("#CategoryAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshCategories').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
- $("#categories-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("CategoryAddPopupList", "CustomerAction", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedCategoryIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Breadcrumb",
- title: "@Loc["Admin.Catalog.Categories.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Categories.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
- $('#search-categories').click(function() {
- var grid = $('#categories-grid').data('kendoGrid');
- grid.dataSource.page(1); //new search. Set page size to 1
- //grid.dataSource.read(); we already loaded the grid above using "page" function
- //clear selected checkboxes
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchCategoryName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-categories").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#categories-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
-
- function additionalData() {
- var data = {
- SearchCategoryName: $('#@Html.IdFor(model => model.SearchCategoryName)').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#categories-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#categories-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
-
- </script>
-
-</form>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CollectionAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CollectionAddPopup.cshtml
deleted file mode 100644
index b5432c162..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/CollectionAddPopup.cshtml
+++ /dev/null
@@ -1,182 +0,0 @@
-@model CustomerActionConditionModel.AddCollectionConditionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerActionCondition.Collections.AddNew"];
-}
-<form id="CollectionAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="CollectionAddPopup" method="post"
- asp-route-CustomerActionId="@Context.Request.Query["CustomerActionId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerActionId" type="hidden" />
- <input asp-for="CustomerActionConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerActionCondition.Collections.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0 mb-3">
- <div class="row align-items-end">
- <div class="col-md-8 col-sm-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchCollectionName" class="control-label" />
- <admin-input asp-for="SearchCollectionName" />
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-sm btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-collections">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="collections-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- var mfp = $.magnificPopup.instance;
- $("#CollectionAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshCollections').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
-
- $("#collections-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("CollectionAddPopupList", "Discount", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedCollectionIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Name",
- title: "@Loc["Admin.Catalog.Collections.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Collections.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
-
- $('#search-collections').click(function() {
- var grid = $('#collections-grid').data('kendoGrid');
- grid.dataSource.page(1); //new search. Set page size to 1
- //grid.dataSource.read(); we already loaded the grid above using "page" function
- //clear selected checkboxes
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchCollectionName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-collections").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#collections-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
- function additionalData() {
- var data = {
- SearchCollectionName: $('#@Html.IdFor(model => model.SearchCollectionName)').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#collections-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#collections-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
-
- </script>
-
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Create.cshtml
deleted file mode 100644
index ca2c94148..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Create.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model CustomerActionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerAction.AddNew"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="Create" method="post" id="customer-action-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-user"></i>
- @Loc["Admin.Customers.CustomerAction.AddNew"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Customers.CustomerAction.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Edit.cshtml
deleted file mode 100644
index 2f5a32070..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Edit.cshtml
+++ /dev/null
@@ -1,32 +0,0 @@
-@model CustomerActionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerAction.EditCustomerAction"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="Edit" method="post" id="customer-action-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-users"></i>
- @Loc["Admin.Customers.CustomerAction.EditCustomerAction"] - @Model.Name
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Customers.CustomerAction.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="customeraction-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
-<admin-delete-confirmation button-id="customeraction-delete"/>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/EditCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/EditCondition.cshtml
deleted file mode 100644
index f5451e24f..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/EditCondition.cshtml
+++ /dev/null
@@ -1,34 +0,0 @@
-@model CustomerActionConditionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerAction.EditCustomerActionCondition"];
-}
-
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="EditCondition"
- asp-route-customerActionId="@Context.Request.Query["CustomerActionId"]"
- asp-route-cid="@Context.Request.Query["cid"]"
- method="post" id="customer-action-condition-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerAction.EditCustomerActionCondition"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerAction.BackToAction"] + ")", "Edit", new { Id = Model.CustomerActionId }) </small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateCondition" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/List.cshtml
deleted file mode 100644
index 74c6af631..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/List.cshtml
+++ /dev/null
@@ -1,82 +0,0 @@
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerActions"];
-}
-
-<div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-users"></i>
- @Loc["Admin.Customers.CustomerActions"]
- </div>
- <div class="actions">
- <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span></a>
- </div>
- </div>
- <div class="x_content form">
- <div id="customeractions-grid"></div>
- </div>
- </div>
- </div>
-</div>
-
-<script>
- $(document).ready(function () {
- $("#customeractions-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("List", "CustomerAction", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerAction.Fields.Name"]",
- width: 300,
- template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>',
- }, {
- field: "ActionType",
- title: "@Loc["admin.customers.actiontype.fields.name"]",
- width: 100
- },
- {
- field: "Active",
- title: "@Loc["Admin.Customers.CustomerAction.Fields.Active"]",
- width: 50,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Active) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
- });
-</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCategory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCategory.cshtml
deleted file mode 100644
index f36450424..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCategory.cshtml
+++ /dev/null
@@ -1,108 +0,0 @@
-@model CustomerActionConditionModel
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="categories-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCategory" href="@(Url.Action("CategoryAddPopup", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, btnId = "btnRefreshCategories", formId = "customer-action-condition-form", area = Constants.AreaAdmin }))" class="btn default">@Loc["Admin.Customers.CustomerActionCondition.Category.AddNew"]</a>
- <input type="submit" id="btnRefreshCategories" style="display: none" />
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewCategory').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#categories-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCategory", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken,
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CategoryName: {editable: false, type: "string" },
- CategoryId: {editable: false, type: "string" }
- }
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "CategoryName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CategoryName"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(CategoryName)#</a>',
- },{
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 150
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshCategories').click(function () {
- var grid = $("#categories-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCollection.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCollection.cshtml
deleted file mode 100644
index d15a651d5..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCollection.cshtml
+++ /dev/null
@@ -1,109 +0,0 @@
-@model CustomerActionConditionModel
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
- }
-
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="collections-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCollection" href="@(Url.Action("CollectionAddPopup", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, btnId = "btnRefreshCollections", formId = "customer-action-condition-form", area = Constants.AreaAdmin }))" class="btn default">@Loc["Admin.Customers.CustomerActionCondition.Collections.AddNew"]</a>
- <input type="submit" id="btnRefreshCollections" style="display: none" />
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $('#btnAddNewCollection').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#collections-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCollection", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CollectionName: {editable: false, type: "string" },
- CollectionId: {editable: false, type: "string" }
- }
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "CollectionName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.Collection"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Collection", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(CollectionName)#</a>',
- }, {
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 150
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshCollections').click(function () {
- //refresh grid
- var grid = $("#collections-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-
- }
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomCustomerAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomCustomerAttribute.cshtml
deleted file mode 100644
index 5a18d2807..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomCustomerAttribute.cshtml
+++ /dev/null
@@ -1,133 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customerattribute-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customerattribute-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttribute", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttributeInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttributeUpdate", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerAttributeId: { editable: true, type: "string" },
- CustomerAttributeName: { editable: true, type: "string" },
- CustomerAttributeValue: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerAttributeName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomCustomerAttributeName"]",
- width: 200,
- editor: crDropDownEditorCA,
- template: "#:CustomerAttributeId#"
- }, {
- field: "CustomerAttributeValue",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomCustomerAttributeValue"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
-});
-
-
- function crDropDownEditorCA(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerAttributeName"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomCustomerAttributeFields", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerGroup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerGroup.cshtml
deleted file mode 100644
index 07e2fb293..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerGroup.cshtml
+++ /dev/null
@@ -1,113 +0,0 @@
-@model CustomerActionConditionModel
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customergroup-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customergroup-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerGroup", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerGroupInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerGroup: { editable: true, type: "string" },
- CustomerGroupId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerGroup",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomerGroupName"]",
- width: 200,
- editor: customerGroupDropDownEditor,
- template: "#:CustomerGroup#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
- function customerGroupDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerGroupId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerGroups", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerRegister.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerRegister.cshtml
deleted file mode 100644
index 5c0298286..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerRegister.cshtml
+++ /dev/null
@@ -1,133 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customerregister-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customerregister-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegister", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegisterInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegisterUpdate", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerRegisterName: { editable: true, type: "string" },
- CustomerRegisterValue: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerRegisterName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomerRegisterName"]",
- width: 200,
- editor: crDropDownEditor,
- template: "#:CustomerRegisterName#"
- }, {
- field: "CustomerRegisterValue",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomerRegisterValue"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
-});
-
-
-function crDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerRegisterName"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerRegisterFields", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerTag.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerTag.cshtml
deleted file mode 100644
index 2b3c3966e..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionCustomerTag.cshtml
+++ /dev/null
@@ -1,113 +0,0 @@
-@model CustomerActionConditionModel
-
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customertag-grid"></div>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#customertag-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerTag", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerTagInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerTag: { editable: true, type: "string" },
- CustomerTagId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerTag",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.CustomerTagName"]",
- width: 200,
- editor: customerTagDropDownEditor,
- template: "#:CustomerTag#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
-});
-
-
- function customerTagDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerTagId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerTags", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionInfo.cshtml
deleted file mode 100644
index 0b37cfdfc..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionInfo.cshtml
+++ /dev/null
@@ -1,271 +0,0 @@
-@model CustomerActionConditionModel
-<script>
- $(document).ready(function () {
- $("#@Html.IdFor(model => model.CustomerActionConditionTypeId)").change(toggleConditionType);
- toggleConditionType();
- });
-
- function toggleConditionType() {
- var selectedConditionTypeId = $("#@Html.IdFor(model => model.CustomerActionConditionTypeId)").val();
- if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.Product).ToString()))
- {
- $('#tab-product').show();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.Collection).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').show();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
-
- } else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.Category).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').show();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.Vendor).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').show();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.ProductAttribute).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').show();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.ProductSpecification).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').show();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.CustomerGroup).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').show();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.Store).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').show();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.CustomerTag).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').show();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.CustomerRegisterField).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').show();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.CustomCustomerAttribute).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').show();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.UrlReferrer).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').show();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerActionConditionTypeEnum.UrlCurrent).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').show();
- $('#tab-store').hide();
- }
- else
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-vendor').hide();
- $('#tab-productAttribute').hide();
- $('#tab-productSpecification').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- $('#tab-urlReferrer').hide();
- $('#tab-urlCurrent').hide();
- $('#tab-store').hide();
- }
- }
-
-</script>
-
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="CustomerActionConditionTypeId" />
- <div class="col-md-9 col-sm-9">
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <admin-select asp-for="CustomerActionConditionTypeId" asp-items="Model.CustomerActionConditionType" disabled/>
- }
- else
- {
- <admin-select asp-for="CustomerActionConditionTypeId" asp-items="Model.CustomerActionConditionType" />
- }
- <span asp-validation-for="CustomerActionConditionTypeId"></span>
- <input asp-for="CustomerActionConditionTypeId" type="hidden" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ConditionId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionId" asp-items="((Grand.Domain.Customers.CustomerActionConditionEnum)Model.ConditionId).ToSelectList(Context)" />
- <span asp-validation-for="ConditionId"></span>
- </div>
- </div>
- </div>
-</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProduct.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProduct.cshtml
deleted file mode 100644
index 8b604cbf4..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProduct.cshtml
+++ /dev/null
@@ -1,106 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="products-grid"></div>
- </div>
- <div class="panel-footer">
- <a type="submit" id="btnAddNewProduct" href="@(Url.Action("ProductAddPopup", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, btnId = "btnRefreshProducts", formId = "customer-action-condition-form", area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Customers.CustomerActionCondition.Products.AddNew"]</a>
- <input type="submit" id="btnRefreshProducts" style="display: none" />
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $('#btnAddNewProduct').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionProduct", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "ProductName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.ProductName"]",
- width: 300,
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(ProductName)#</a>',
- },
- {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshProducts').click(function () {
- var grid = $("#products-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductAttribute.cshtml
deleted file mode 100644
index 235d53945..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductAttribute.cshtml
+++ /dev/null
@@ -1,133 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="productattribute-grid"></div>
- </div>
- </div>
-
-
- <script>
- $(document).ready(function () {
- $("#productattribute-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionProductAttribute", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionProductAttributeInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionProductAttributeUpdate", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- ProductAttributeName: { editable: true, type: "string" },
- ProductAttributeId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "ProductAttributeName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.ProductAttributeName"]",
- width: 200,
- editor: attrDropDownEditor,
- template: "#:ProductAttributeName#"
- }, {
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.ProductAttributeValueName"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function attrDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:ProductAttributeId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("ProductAttributes", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductSpecification.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductSpecification.cshtml
deleted file mode 100644
index 633ee61b6..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionProductSpecification.cshtml
+++ /dev/null
@@ -1,161 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="specification-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#specification-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionProductSpecification", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionProductSpecificationInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- SpecificationName: { editable: true, type: "string" },
- SpecificationValueName: { editable: true, type: "string" },
- SpecificationId: { editable: true, type: "string" },
- SpecificationValueId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "SpecificationName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.SpecificationName"]",
- width: 200,
- editor: specDropDownEditor,
- template: "#:SpecificationName#"
-
- },
- {
- field: "SpecificationValueName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.SpecificationValueName"]",
- width: 200,
- editor: specValueDropDownEditor,
- template: "#:SpecificationValueName#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
- var dataSourceValue = new kendo.data.DataSource({
- transport: {
- read: "@Html.Raw(Url.Action("ProductSpecificationValue", "CustomerAction", new { specificationId = 0, area = Constants.AreaAdmin }))"
- }
- });
-
- function specDropDownEditor(container, options) {
- $('<input id="dropdownspecification" required data-text-field="Name" data-value-field="Id" data-bind="value:SpecificationId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- change: onChange,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("ProductSpecification", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
-
- function specValueDropDownEditor(container, options) {
- $('<input id="dropdownspecificationvalue" required data-text-field="Name" data-value-field="Id" data-bind="value:SpecificationValueId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- optionLabel: " -- Select -- "
- });
- }
-
- function onChange() {
- var specValId = $("#dropdownspecification").val();
- if (specValId == '') {
- $("#dropdownspecificationvalue").data("kendoDropDownList").setDataSource(null);
- $("#dropdownspecificationvalue").data("kendoDropDownList").refresh();
- }
- else {
- var url = "@Html.Raw(Url.Action("ProductSpecificationValue", "CustomerAction", new { area = Constants.AreaAdmin }))?specificationId=" + specValId;
- var dataSourceValue = new kendo.data.DataSource({
- transport: {
- read: url,
- }
- });
- dataSourceValue.read();
- $("#dropdownspecificationvalue").data("kendoDropDownList").setDataSource(dataSourceValue);
- }
- }
-
-
-
- </script>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionStore.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionStore.cshtml
deleted file mode 100644
index dc7c28c2d..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionStore.cshtml
+++ /dev/null
@@ -1,114 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="store-grid"></div>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#store-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionStore", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionStoreInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Store: { editable: true, type: "string" },
- StoreId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "Store",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.StoreName"]",
- width: 200,
- editor: storeDropDownEditor,
- template: "#:Store#"
- }, {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function storeDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:StoreId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("Stores", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
-</script>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlCurrent.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlCurrent.cshtml
deleted file mode 100644
index 26e348d6f..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlCurrent.cshtml
+++ /dev/null
@@ -1,107 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="urlcurrent-grid"></div>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#urlcurrent-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionUrlCurrent", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionUrlCurrentInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionUrlCurrentUpdate", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Name: { editable: true, type: "string" },
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.UrlCurrentName"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlReferrer.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlReferrer.cshtml
deleted file mode 100644
index f24f24826..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionUrlReferrer.cshtml
+++ /dev/null
@@ -1,110 +0,0 @@
-@model CustomerActionConditionModel
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="urlreferrer-grid"></div>
- </div>
- </div>
-
-
- <script>
- $(document).ready(function () {
- $("#urlreferrer-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionUrlReferrer", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionUrlReferrerInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionUrlReferrerUpdate", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Name: { editable: true, type: "string" },
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.UrlReferrerName"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
-});
-
-</script>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionVendor.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionVendor.cshtml
deleted file mode 100644
index f5b7af36d..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/ConditionVendor.cshtml
+++ /dev/null
@@ -1,116 +0,0 @@
-@model CustomerActionConditionModel
-
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerActionCondition.SaveBeforeEdit"]
- </div>
-}
-
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="vendor-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#vendor-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionVendor", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionVendorInsert", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerAction", new { customerActionId = Model.CustomerActionId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- VendorName: { editable: true, type: "string" },
- VendorId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "VendorName",
- title: "@Loc["Admin.Customers.CustomerActionCondition.Fields.VendorName"]",
- width: 200,
- editor: vendorDropDownEditor,
- template: "#:VendorName#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function vendorDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:VendorId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("Vendors", "CustomerAction", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabConditions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabConditions.cshtml
deleted file mode 100644
index d6c2d80ef..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabConditions.cshtml
+++ /dev/null
@@ -1,90 +0,0 @@
-@model CustomerActionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerAction.SaveBeforeEdit"]
- </div>
- }
-
- if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="conditions-grid"></div>
- </div>
- <div class="panel-footer">
- <button type="submit" id="btnAddNewCondition" name="btnAddNewCondition" onclick="javascript:setLocation('@(Url.Action("AddCondition", "CustomerAction", new { customerActionId = Model.Id, area = Constants.AreaAdmin }))'); return false;" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Customers.CustomerAction.Conditions.AddNew"]</button>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#conditions-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("Conditions", "CustomerAction", new { customerActionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDelete", "CustomerAction", new { customerActionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerAction.Fields.Name"]",
- width: 300,
- template: '<a class="k-link" href="@Url.Action("EditCondition", "CustomerAction", new { area = Constants.AreaAdmin })/?customerActionId=@(Model.Id)&cid=#=Id#">#=kendo.htmlEncode(Name)#</a>',
- },
- {
- field: "Condition",
- title: "@Loc["Admin.Customers.CustomerAction.Fields.ConditionType"]",
- width: 100,
- },
- {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabHistory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabHistory.cshtml
deleted file mode 100644
index 87f753917..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabHistory.cshtml
+++ /dev/null
@@ -1,73 +0,0 @@
-@model CustomerActionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
-
- if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerAction.SaveBeforeEdit"]
- </div>
- }
- if (!String.IsNullOrEmpty(Model.Id))
- {
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="history-grid"></div>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#history-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("History", "CustomerAction", new { customerActionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "CreateDate",
- title: "@Loc["Admin.Customers.CustomerAction.History.Fields.CreateDate"]",
- width: 200,
- type: "date",
- format: "{0:G}"
- },
- {
- field: "Email",
- title: "@Loc["Admin.Customers.CustomerAction.History.Fields.Customer"]",
- width: 100,
- }]
- });
- });
- </script>
- }
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabInfo.cshtml
deleted file mode 100644
index 4f7b668da..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabInfo.cshtml
+++ /dev/null
@@ -1,69 +0,0 @@
-@model CustomerActionModel
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Active" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="Active" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="Active"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="StartDateTime" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="StartDateTime" />
- <span asp-validation-for="StartDateTime"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="EndDateTime" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="EndDateTime" />
- <span asp-validation-for="EndDateTime"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ActionTypeId" />
- <div class="col-md-9 col-sm-9">
- @if (Model.ConditionCount > 0)
- {
- <admin-select asp-for="ActionTypeId" asp-items="Model.ActionType" disabled/>
- }
- else
- {
- <admin-select asp-for="ActionTypeId" asp-items="Model.ActionType" />
- }
- <span asp-validation-for="ActionTypeId"></span>
- <div class="note note-info margin-top-10">
- <p>@Loc["admin.customers.actiontype.helpText.AddToCart"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.AddOrder"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Viewed"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Url"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Registration"]</p>
- </div>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ConditionId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionId" asp-items="((Grand.Domain.Customers.CustomerActionConditionEnum)Model.ConditionId).ToSelectList(Context)" />
- <span asp-validation-for="ConditionId"></span>
- <div class="note note-info margin-top-10">
- <p>@Loc["admin.customers.actiontype.helpText.OneOfThem"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.AllOfThem"]</p>
- </div>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabReaction.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabReaction.cshtml
deleted file mode 100644
index 494cb50d2..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.TabReaction.cshtml
+++ /dev/null
@@ -1,55 +0,0 @@
-@model CustomerActionModel
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="ReactionTypeId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ReactionTypeId" asp-items="((Grand.Domain.Customers.CustomerReactionTypeEnum)Model.ReactionTypeId).ToSelectList(Context)" />
- <span asp-validation-for="ReactionTypeId"></span>
- <div class="note note-info margin-top-10">
- <p>@Loc["admin.customers.actiontype.helpText.Banner"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.InteractiveForm"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Email"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Customergroup"]</p>
- <p>@Loc["admin.customers.actiontype.helpText.Customertag"]</p>
- </div>
- </div>
- </div>
- <div class="form-group" id="plnBanner">
- <admin-label asp-for="BannerId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="BannerId" asp-items="Model.Banners" />
- <span asp-validation-for="BannerId"></span>
- </div>
- </div>
- <div class="form-group" id="plnInteractiveForm">
- <admin-label asp-for="InteractiveFormId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="InteractiveFormId" asp-items="Model.InteractiveForms" />
- <span asp-validation-for="InteractiveFormId"></span>
- </div>
- </div>
- <div class="form-group" id="plnMessage">
- <admin-label asp-for="MessageTemplateId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="MessageTemplateId" asp-items="Model.MessageTemplates" />
- <span asp-validation-for="MessageTemplateId"></span>
- </div>
- </div>
- <div class="form-group" id="plnRole">
- <admin-label asp-for="CustomerGroupId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="CustomerGroupId" asp-items="Model.CustomerGroups" />
- <span asp-validation-for="CustomerGroupId"></span>
- </div>
- </div>
- <div class="form-group" id="plnTag">
- <admin-label asp-for="CustomerTagId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="CustomerTagId" asp-items="Model.CustomerTags" />
- <span asp-validation-for="CustomerTagId"></span>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.cshtml
deleted file mode 100644
index 5ef804375..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdate.cshtml
+++ /dev/null
@@ -1,95 +0,0 @@
-@model CustomerActionModel
-
-<input asp-for="Id" type="hidden" />
-@{
- var validationSummary = Html.ValidationSummary(false);
- if (!String.IsNullOrEmpty(validationSummary.ToString()))
- {
- <div class="message-error">@validationSummary</div>
- }
-}
-<script>
- $(document).ready(function () {
- $("#@Html.IdFor(model => model.ReactionTypeId)").change(toggleReaction);
- toggleReaction();
-
- function toggleReaction() {
- var selectedReactionTypeId = $("#@Html.IdFor(model => model.ReactionTypeId)").val();
- if (selectedReactionTypeId == @(((int)Grand.Domain.Customers.CustomerReactionTypeEnum.Banner).ToString()))
- {
- $('#plnBanner').show();
- $('#plnInteractiveForm').hide();
- $('#plnMessage').hide();
- $('#plnRole').hide();
- $('#plnTag').hide();
- }
- if (selectedReactionTypeId == @(((int)Grand.Domain.Customers.CustomerReactionTypeEnum.InteractiveForm).ToString()))
- {
- $('#plnBanner').hide();
- $('#plnInteractiveForm').show();
- $('#plnMessage').hide();
- $('#plnRole').hide();
- $('#plnTag').hide();
- }
- else if (selectedReactionTypeId == @(((int)Grand.Domain.Customers.CustomerReactionTypeEnum.Email).ToString()))
- {
- $('#plnBanner').hide();
- $('#plnInteractiveForm').hide();
- $('#plnMessage').show();
- $('#plnRole').hide();
- $('#plnTag').hide();
-
- } else if (selectedReactionTypeId == @(((int)Grand.Domain.Customers.CustomerReactionTypeEnum.AssignToCustomerGroup).ToString()))
- {
- $('#plnBanner').hide();
- $('#plnInteractiveForm').hide();
- $('#plnMessage').hide();
- $('#plnRole').show();
- $('#plnTag').hide();
-
- } else if (selectedReactionTypeId == @(((int)Grand.Domain.Customers.CustomerReactionTypeEnum.AssignToCustomerTag).ToString()))
- {
- $('#plnBanner').hide();
- $('#plnInteractiveForm').hide();
- $('#plnMessage').hide();
- $('#plnRole').hide();
- $('#plnTag').show();
- }
- }
- });
-</script>
-
-<admin-tabstrip name="customeraction-edit">
- <items>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerAction.Info"]" tab-index="0">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerAction.Conditions"]" tab-index="1">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabConditions" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerAction.Reaction"]" tab-index="2">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabReaction" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerAction.History"]" tab-index="3">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabHistory" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="customer_action_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
-
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdateCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdateCondition.cshtml
deleted file mode 100644
index fdaada4e3..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/Partials/CreateOrUpdateCondition.cshtml
+++ /dev/null
@@ -1,110 +0,0 @@
-@model CustomerActionConditionModel
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<input asp-for="CustomerActionId" type="hidden" />
-
-<admin-tabstrip name="customeractioncondition-edit">
- <items>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Info"]" tab-index="0" id="tab-info">
- <content>
- <div>
- <partial name="Partials/ConditionInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Products"]" tab-index="1" id="tab-product">
- <content>
- <div>
- <partial name="Partials/ConditionProduct" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Categories"]" tab-index="2" id="tab-category">
- <content>
- <div>
- <partial name="Partials/ConditionCategory" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Collections"]" tab-index="3" id="tab-collection">
- <content>
- <div>
- <partial name="Partials/ConditionCollection" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Vendors"]" tab-index="4" id="tab-vendor">
- <content>
- <div>
- <partial name="Partials/ConditionVendor" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.ProductAttributes"]" tab-index="5" id="tab-productAttribute">
- <content>
- <div>
- <partial name="Partials/ConditionProductAttribute" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.ProductSpecifications"]" tab-index="6" id="tab-productSpecification">
- <content>
- <div>
- <partial name="Partials/ConditionProductSpecification" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.CustomerGroup"]" tab-index="7" id="tab-customerGroup">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerGroup" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.CustomerTag"]" tab-index="8" id="tab-customerTag">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerTag" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.CustomerRegister"]" tab-index="9" id="tab-customerRegister">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerRegister" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.CustomCustomerAttribute"]" tab-index="10" id="tab-customAttribute">
- <content>
- <div>
- <partial name="Partials/ConditionCustomCustomerAttribute" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.UrlReferrer"]" tab-index="11" id="tab-urlReferrer">
- <content>
- <div>
- <partial name="Partials/ConditionUrlReferrer" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.UrlCurrent"]" tab-index="12" id="tab-urlCurrent">
- <content>
- <div>
- <partial name="Partials/ConditionUrlCurrent" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Store"]" tab-index="13" id="tab-store">
- <content>
- <div>
- <partial name="Partials/ConditionStore" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="customer_action_condition_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
-
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/ProductAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/ProductAddPopup.cshtml
deleted file mode 100644
index adf03aec8..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAction/ProductAddPopup.cshtml
+++ /dev/null
@@ -1,236 +0,0 @@
-@inject AdminAreaSettings adminAreaSettings
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerActionCondition.Products.AddNew"];
-}
-@model CustomerActionConditionModel.AddProductToConditionModel
-
-<form id="ProductAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerAction" asp-action="ProductAddPopup" method="post"
- asp-route-CustomerActionId="@Context.Request.Query["CustomerActionId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerActionId" type="hidden" />
- <input asp-for="CustomerActionConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit popup-window">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerActionCondition.Products.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0">
- <div class="row align-items-end">
- <div class="col-md col-ms-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchProductName" class="control-label" />
- <admin-input asp-for="SearchProductName" />
- </div>
- </div>
- <div class="col-md-auto col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-products">
- <i class="fa fa-search"></i>&nbsp; @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
- <i class="fa fa-filter"></i>&nbsp; @Loc["Admin.Common.Filters"]
- </button>
- </div>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> &nbsp; @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- <div class="collapse" id="filterCollapse">
- <div class="drop-filters-container">
- <div class="form-group">
- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCategoryId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchBrandId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCollectionId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchStoreId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchStoreId" asp-items="Model.AvailableStores" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchVendorId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchVendorId" asp-items="Model.AvailableVendors" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />
- </div>
- </div>
- </div>
- </div>
- <div id="products-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- var mfp = $.magnificPopup.instance;
- $("#ProductAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshProducts').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
-
- $('.extend-collapse').hide();
- $('.filter-text-open').hide();
- $('.filter-extend-button').click(function () {
- $('.extend-collapse').toggle("slow");
- $('.filter-text-open').toggle();
- $('.filter-text-close').toggle();
- });
-
- $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductAddPopupList", "CustomerAction", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedProductIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Name",
- title: "@Loc["Admin.Catalog.Products.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Products.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
-
- $('#search-products').click(function() {
- var grid = $('#products-grid').data('kendoGrid');
- grid.dataSource.page(1);
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchProductName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-products").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#products-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
- function additionalData() {
- var data = {
- SearchProductName: $('#@Html.IdFor(model => model.SearchProductName)').val(),
- SearchCategoryId: $('#SearchCategoryId').val(),
- SearchBrandId: $('#SearchBrandId').val(),
- SearchCollectionId: $('#SearchCollectionId').val(),
- SearchStoreId: $('#SearchStoreId').val(),
- SearchVendorId: $('#SearchVendorId').val(),
- SearchProductTypeId: $('#SearchProductTypeId').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#products-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#products-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerActionType/ListTypes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerActionType/ListTypes.cshtml
deleted file mode 100644
index 6ef01b3cd..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerActionType/ListTypes.cshtml
+++ /dev/null
@@ -1,115 +0,0 @@
-@model List<CustomerActionTypeModel>
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.ActionType"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerActionType" asp-action="SaveTypes" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-repeat"></i>
- @Loc["Admin.Customers.ActionType"]
- </div>
- <div class="actions">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- <div class="x_content form">
- <div id="actionType-grid"></div>
- </div>
- </div>
- </div>
- </div>
- <script>
-
- //local datasource
- var actionTypes = [
- @for(int i=0;i<Model.Count;i++)
- {
- var alt = Model[i];
- <text>
- {
- Id: "@(alt.Id)",
- Name: "@(Html.Raw(System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(string.IsNullOrEmpty(alt.Name) ? "" : alt.Name)))",
- Enabled: @(alt.Enabled.ToString().ToLowerInvariant())
- }
- </text>
- if (i != Model.Count - 1)
- {
- <text>,</text>
- }
- }
- ];
-
- $(document).ready(function () {
- $("#actionType-grid").kendoGrid({
- dataSource: {
- data: actionTypes,
- schema: {
- model: {
- fields: {
- Id: { type: "string" },
- Name: { type: "string" },
- Enabled: { type: "boolean" }
- }
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- }
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- scrollable: false,
- columns: [
- {
- field: "Name",
- title: "@Loc["Admin.Customers.ActionType.Fields.Name"]",
- width: 100
- }, {
- field: "Enabled",
- headerTemplate: "@Loc["Admin.Customers.ActionType.Fields.Enabled"]&nbsp<label class='mt-checkbox mt-checkbox-outline control control-checkbox'><input id='mastercheckbox' type='checkbox' /> <div class='control__indicator'></div></label>",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: "<label class='mt-checkbox mt-checkbox-outline control control-checkbox'><input name='checkbox_action_types' value='#=Id#' type='checkbox' class='checkboxGroups' # if(Enabled) {# checked='checked' #} # /> <div class='control__indicator'></div></label>",
- width: 100
- }
- ]
- });
- });
-
- </script>
-
-
- <script>
-
- $(document).ready(function () {
-
- updateMasterCheckbox();
-
- $('#mastercheckbox').click(function () {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- //wire up checkboxes.
- $('#actionType-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function (e) {
- updateMasterCheckbox();
- });
- });
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#actionType-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#actionType-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddCondition.cshtml
deleted file mode 100644
index a3a6e18e5..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddCondition.cshtml
+++ /dev/null
@@ -1,33 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.AddCondition"];
-}
-
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder"
- asp-action="AddCondition" method="post" id="customer-reminder-condition-form"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerReminder.AddCondition"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerReminder.BackToAction"] + ")", "Edit", new { Id = Model.CustomerReminderId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateCondition" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddLevel.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddLevel.cshtml
deleted file mode 100644
index 4bdb58c0c..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/AddLevel.cshtml
+++ /dev/null
@@ -1,33 +0,0 @@
-@model CustomerReminderModel.ReminderLevelModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.AddLevel"];
-}
-
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="AddLevel"
- method="post" id="customer-reminder-level-form"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerReminder.AddLevel"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerReminder.BackToAction"] + ")", "Edit", new { Id = Model.CustomerReminderId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateLevel" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CategoryAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CategoryAddPopup.cshtml
deleted file mode 100644
index de607155e..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CategoryAddPopup.cshtml
+++ /dev/null
@@ -1,178 +0,0 @@
-@model CustomerReminderModel.ConditionModel.AddCategoryConditionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.Condition.Category.AddNew"];
-}
-
-<form id="CategoryAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="CategoryAddPopup" method="post"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerReminderId" type="hidden" />
- <input asp-for="ConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-cubes"></i>
- @Loc["Admin.Customers.CustomerActionCondition.Category.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0 mb-3">
- <div class="row align-items-end">
- <div class="col-md-8 col-sm-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchCategoryName" class="control-label" />
- <admin-input asp-for="SearchCategoryName" />
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-sm btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-categories">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="categories-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- var mfp = $.magnificPopup.instance;
- $("#CategoryAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshCategories').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
- $("#categories-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("CategoryAddPopupList", "CustomerReminder", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedCategoryIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Breadcrumb",
- title: "@Loc["Admin.Catalog.Categories.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Categories.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
-
- $('#search-categories').click(function() {
- var grid = $('#categories-grid').data('kendoGrid');
- grid.dataSource.page(1);
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchCategoryName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-categories").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#categories-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
- function additionalData() {
- var data = {
- SearchCategoryName: $('#@Html.IdFor(model => model.SearchCategoryName)').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#categories-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#categories-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
-
- </script>
-</form>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CollectionAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CollectionAddPopup.cshtml
deleted file mode 100644
index 96e273743..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/CollectionAddPopup.cshtml
+++ /dev/null
@@ -1,181 +0,0 @@
-@model CustomerReminderModel.ConditionModel.AddCollectionConditionModel
-@inject AdminAreaSettings adminAreaSettings
-
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.Condition.Collections.AddNew"];
-}
-<form id="CollectionAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="CollectionAddPopup" method="post"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerReminderId" type="hidden" />
- <input asp-for="ConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-cubes"></i>
- @Loc["Admin.Customers.CustomerReminder.Condition.Collections.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0 mb-3">
- <div class="row align-items-end">
- <div class="col-md-8 col-sm-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchCollectionName" class="control-label" />
- <admin-input asp-for="SearchCollectionName" />
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-sm btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-collections">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="collections-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- var mfp = $.magnificPopup.instance;
- $("#CollectionAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshCollections').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
-
- $("#collections-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("CollectionAddPopupList", "CustomerReminder", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedCollectionIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Name",
- title: "@Loc["Admin.Catalog.Collections.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Collections.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
-
- $('#search-collections').click(function() {
- var grid = $('#collections-grid').data('kendoGrid');
- grid.dataSource.page(1);
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchCollectionName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-collections").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#collections-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
-
- function additionalData() {
- var data = {
- SearchCollectionName: $('#@Html.IdFor(model => model.SearchCollectionName)').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#collections-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#collections-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
-
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Create.cshtml
deleted file mode 100644
index a9af11610..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Create.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model CustomerReminderModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.AddNew"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="Create" method="post" id="customer-reminder-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-bell"></i>
- @Loc["Admin.Customers.CustomerReminder.AddNew"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Customers.CustomerReminder.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Edit.cshtml
deleted file mode 100644
index 29f73c362..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Edit.cshtml
+++ /dev/null
@@ -1,50 +0,0 @@
-@model CustomerReminderModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.Edit"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder"
- asp-action="Edit" method="post" id="customer-reminder-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-bell"></i>
- @Loc["Admin.Customers.CustomerReminder.Edit"] - @Model.Name
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Customers.CustomerReminder.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="customerreminder-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
-
-<admin-delete-confirmation button-id="customerreminder-delete"/>
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="Run" method="post" id="run-form">
-
- <input asp-for="Id" type="hidden" />
-</form>
-
-<script>
-
- $(document).ready(function () {
- $('#run').click(function (e) {
- e.preventDefault();
- $('#run-form').submit();
- return false;
- });
- });
-
-</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditCondition.cshtml
deleted file mode 100644
index 774308d70..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditCondition.cshtml
+++ /dev/null
@@ -1,34 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.EditCondition"];
-}
-
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="EditCondition"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]"
- asp-route-cid="@Context.Request.Query["cid"]"
- method="post" id="customer-reminder-condition-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-code-fork"></i>
- @Loc["Admin.Customers.CustomerReminder.EditCondition"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerReminder.BackToAction"] + ")", "Edit", new { Id = Model.CustomerReminderId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateCondition" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditLevel.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditLevel.cshtml
deleted file mode 100644
index f67e88eaf..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/EditLevel.cshtml
+++ /dev/null
@@ -1,36 +0,0 @@
-@model CustomerReminderModel.ReminderLevelModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.EditLevel"];
-}
-
-<form asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder"
- asp-action="EditLevel"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]"
- asp-route-cid="@Context.Request.Query["cid"]"
- method="post"
- id="customer-reminder-level-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["Admin.Customers.CustomerReminder.EditLevel"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["Admin.Customers.CustomerReminder.BackToAction"] + ")", "Edit", new { Id = Model.CustomerReminderId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateLevel" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/List.cshtml
deleted file mode 100644
index 7fe7a882f..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/List.cshtml
+++ /dev/null
@@ -1,81 +0,0 @@
-@{
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminders"];
-}
-
-<div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-users"></i>
- @Loc["Admin.Customers.CustomerReminders"]
- </div>
- <div class="actions">
- <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span></a>
- </div>
- </div>
- <div class="x_content form">
- <div id="customerreminders-grid"></div>
- </div>
- </div>
- </div>
-</div>
-<script>
- $(document).ready(function () {
- $("#customerreminders-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("List", "CustomerReminder", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.Name"]",
- width: 300,
- template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>',
- },
- {
- field: "Rule",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.ReminderRule"]",
- width: 100
- },
- {
- field: "Active",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.Active"]",
- width: 50,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Active) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
- });
-</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCategory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCategory.cshtml
deleted file mode 100644
index baa3f17a7..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCategory.cshtml
+++ /dev/null
@@ -1,107 +0,0 @@
-@model CustomerReminderModel.ConditionModel
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="categories-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCategory" href="@(Url.Action("CategoryAddPopup", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, btnId = "btnRefreshCategories", formId = "customer-reminder-condition-form", area = Constants.AreaAdmin }))" class="btn default">@Loc["Admin.Customers.CustomerReminder.Condition.Category.AddNew"]</a>
- <input type="submit" id="btnRefreshCategories" style="display: none" />
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewCategory').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#categories-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCategory", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken,
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CategoryName: {editable: false, type: "string" },
- CategoryId: { editable: false, type: "string" }
- }
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "CategoryName",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CategoryName"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(CategoryName)#</a>',
- }, {
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 150
- }]
- });
- });
- </script>
- <script>
- $(document).ready(function () {
- $('#btnRefreshCategories').click(function () {
- var grid = $("#categories-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-
- }
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCollection.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCollection.cshtml
deleted file mode 100644
index 225faa051..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCollection.cshtml
+++ /dev/null
@@ -1,107 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="collections-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCollection" href="@(Url.Action("CollectionAddPopup", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, btnId = "btnRefreshCollections", formId = "customer-reminder-condition-form", area = Constants.AreaAdmin }))" class="btn default">@Loc["Admin.Customers.CustomerReminder.Condition.Collections.AddNew"]</a>
- <input type="submit" id="btnRefreshCollections" style="display: none" />
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewCollection').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#collections-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCollection", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CollectionName: {editable: false, type: "string" },
- CollectionId: { editable: false, type: "string" }
- }
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "CollectionName",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.Collection"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Collection", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(CollectionName)#</a>',
- }, {
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 150
- }]
- });
- });
- </script>
- <script>
- $(document).ready(function () {
- $('#btnRefreshCollections').click(function () {
- var grid = $("#collections-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
- }
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomCustomerAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomCustomerAttribute.cshtml
deleted file mode 100644
index ab2f1e08e..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomCustomerAttribute.cshtml
+++ /dev/null
@@ -1,132 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
-
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customerattribute-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customerattribute-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttribute", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttributeInsert", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionCustomCustomerAttributeUpdate", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerAttributeId: { editable: true, type: "string" },
- CustomerAttributeName: { editable: true, type: "string" },
- CustomerAttributeValue: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerAttributeName",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomCustomerAttributeName"]",
- width: 200,
- editor: crDropDownEditorCA,
- template: "#:CustomerAttributeId#"
- }, {
- field: "CustomerAttributeValue",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomCustomerAttributeValue"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
- function crDropDownEditorCA(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerAttributeName"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomCustomerAttributeFields", "CustomerReminder", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerGroup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerGroup.cshtml
deleted file mode 100644
index 70769c1a1..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerGroup.cshtml
+++ /dev/null
@@ -1,113 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customergroup-grid"></div>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#customergroup-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerGroup", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerGroupInsert", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerGroup: { editable: true, type: "string" },
- CustomerGroupId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerGroup",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomerGroupName"]",
- width: 200,
- editor: customerGroupDropDownEditor,
- template: "#:CustomerGroup#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function customerGroupDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerGroupId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerGroups", "CustomerReminder", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerRegister.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerRegister.cshtml
deleted file mode 100644
index ab3c8de42..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerRegister.cshtml
+++ /dev/null
@@ -1,132 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customerregister-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customerregister-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegister", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegisterInsert", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ConditionCustomerRegisterUpdate", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerRegisterName: { editable: true, type: "string" },
- CustomerRegisterValue: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerRegisterName",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomerRegisterName"]",
- width: 200,
- editor: crDropDownEditor,
- template: "#:CustomerRegisterName#"
- }, {
- field: "CustomerRegisterValue",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomerRegisterValue"]",
- width: 200,
- },
- {
- command: [
- {
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- },{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function crDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerRegisterName"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerRegisterFields", "CustomerReminder", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerTag.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerTag.cshtml
deleted file mode 100644
index 3392b35cd..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionCustomerTag.cshtml
+++ /dev/null
@@ -1,114 +0,0 @@
-@model CustomerReminderModel.ConditionModel
- @if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
- }
- @if (!String.IsNullOrEmpty(Model.Id))
- {
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="customertag-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#customertag-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionCustomerTag", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ConditionCustomerTagInsert", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- CustomerTag: { editable: true, type: "string" },
- CustomerTagId: { editable: true, type: "string" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }, { name: "save", text: "@Loc["Admin.Common.Save"]" }, { name: "cancel", text: "@Loc["Admin.Common.Cancel"]" }],
- editable: {
- confirmation: false,
- mode: "inline",
- },
- scrollable: false,
- columns: [{
- field: "CustomerTag",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.CustomerTagName"]",
- width: 200,
- editor: customerTagDropDownEditor,
- template: "#:CustomerTag#"
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-
-
- function customerTagDropDownEditor(container, options) {
- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CustomerTagId"/>')
- .appendTo(container)
- .kendoDropDownList({
- autoBind: false,
- dataSource:
- {
- transport: {
- read: "@Html.Raw(Url.Action("CustomerTags", "CustomerReminder", new { area = Constants.AreaAdmin }))"
- }
- },
- optionLabel: " -- Select -- "
- });
- }
- </script>
- }
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionInfo.cshtml
deleted file mode 100644
index 01d9c51d0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionInfo.cshtml
+++ /dev/null
@@ -1,128 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
-<script>
- $(document).ready(function () {
- $("#@Html.IdFor(model => model.ConditionTypeId)").change(toggleConditionType);
- toggleConditionType();
- });
-
- function toggleConditionType() {
- var selectedConditionTypeId = $("#@Html.IdFor(model => model.ConditionTypeId)").val();
- if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.Product).ToString()))
- {
- $('#tab-product').show();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.Collection).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').show();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
-
- } else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.Category).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').show();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
-
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.CustomerGroup).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').show();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.CustomerTag).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').show();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.CustomerRegisterField).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').show();
- $('#tab-customAttribute').hide();
- }
- else if (selectedConditionTypeId == @(((int)Grand.Domain.Customers.CustomerReminderConditionTypeEnum.CustomCustomerAttribute).ToString()))
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').show();
- }
- else
- {
- $('#tab-product').hide();
- $('#tab-collection').hide();
- $('#tab-category').hide();
- $('#tab-customerGroup').hide();
- $('#tab-customerTag').hide();
- $('#tab-customerRegister').hide();
- $('#tab-customAttribute').hide();
- }
- }
-
-</script>
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ConditionTypeId" />
- <div class="col-md-9 col-sm-9">
- @if (!String.IsNullOrEmpty(Model.Id))
- {
- <admin-select asp-for="ConditionTypeId" asp-items="Model.ConditionType" disabled/>
- }
- else
- {
- <admin-select asp-for="ConditionTypeId" asp-items="Model.ConditionType" />
- }
- <span asp-validation-for="ConditionTypeId"></span>
- <input asp-for="ConditionTypeId" type="hidden" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ConditionId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionId" asp-items="((Grand.Domain.Customers.CustomerReminderConditionEnum)Model.ConditionId).ToSelectList(Context)" />
- <span asp-validation-for="ConditionId"></span>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionProduct.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionProduct.cshtml
deleted file mode 100644
index 172241366..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/ConditionProduct.cshtml
+++ /dev/null
@@ -1,105 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-@if (String.IsNullOrEmpty(Model.Id))
-{
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.Condition.SaveBeforeEdit"]
- </div>
-}
-@if (!String.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="products-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewProduct" href="@(Url.Action("ProductAddPopup", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, btnId = "btnRefreshProducts", formId = "customer-reminder-condition-form", area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Customers.CustomerReminder.Condition.Products.AddNew"]</a>
- <input type="submit" id="btnRefreshProducts" style="display: none" />
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewProduct').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ConditionProduct", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDeletePosition", "CustomerReminder", new { customerReminderId = Model.CustomerReminderId, conditionId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "ProductName",
- title: "@Loc["Admin.Customers.CustomerReminder.Condition.Fields.ProductName"]",
- width: 300,
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(ProductName)#</a>',
-
- },
- {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshProducts').click(function () {
- var grid = $("#products-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabConditions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabConditions.cshtml
deleted file mode 100644
index 1dda89bcc..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabConditions.cshtml
+++ /dev/null
@@ -1,87 +0,0 @@
-@model CustomerReminderModel
-@{
-
- if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.SaveBeforeEdit"]
- </div>
- }
- if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="conditions-grid"></div>
- </div>
- <div class="panel-footer">
- <button type="submit" id="btnAddNewCondition" name="btnAddNewCondition" onclick="javascript:setLocation('@(Url.Action("AddCondition", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))'); return false;" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Customers.CustomerReminder.Conditions.AddNew"]</button>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#conditions-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("Conditions", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ConditionDelete", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.Name"]",
- width: 300,
- template: '<a class="k-link" href="@Url.Action("EditCondition", "CustomerReminder", new { area = Constants.AreaAdmin })/?customerReminderId=@(Model.Id)&cid=#=Id#">#=kendo.htmlEncode(Name)#</a>',
- },
- {
- field: "Condition",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.ConditionType"]",
- width: 100,
- },
- {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabHistory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabHistory.cshtml
deleted file mode 100644
index e456441a2..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabHistory.cshtml
+++ /dev/null
@@ -1,84 +0,0 @@
-@model CustomerReminderModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.SaveBeforeEdit"]
- </div>
- }
- if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="history-grid"></div>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#history-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("History", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "SendDate",
- title: "@Loc["Admin.Customers.CustomerReminder.History.Fields.SendDate"]",
- width: 200,
- type: "date",
- format: "{0:G}"
- },
- {
- field: "Email",
- title: "@Loc["Admin.Customers.CustomerReminder.History.Fields.Customer"]",
- width: 100,
- },
- {
- field: "Level",
- title: "@Loc["Admin.Customers.CustomerReminder.History.Fields.Level"]",
- width: 50,
- },
- {
- field: "OrderId",
- title: "@Loc["Admin.Customers.CustomerReminder.History.Fields.Order"]",
- width: 50,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(OrderId) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
- });
- </script>
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabInfo.cshtml
deleted file mode 100644
index 8270f8e15..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabInfo.cshtml
+++ /dev/null
@@ -1,116 +0,0 @@
-@model CustomerReminderModel
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Active" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="Active" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="Active"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="StartDateTime" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="StartDateTime" />
- <span asp-validation-for="StartDateTime"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="EndDateTime" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="EndDateTime" />
- <span asp-validation-for="EndDateTime"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="LastUpdateDate" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="LastUpdateDate" />
- <span asp-validation-for="LastUpdateDate"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="DisplayOrder" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="DisplayOrder" />
- <span asp-validation-for="DisplayOrder"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="AllowRenew" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="AllowRenew" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="AllowRenew"></span>
- </div>
- </div>
- <div class="form-group" id="pnlAllowRenew">
- <admin-label asp-for="RenewedDay" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="RenewedDay" />
- <span asp-validation-for="RenewedDay"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ReminderRuleId" />
- <div class="col-md-9 col-sm-9">
- @if (Model.ConditionCount > 0)
- {
- <admin-select asp-for="ReminderRuleId" asp-items="((Grand.Domain.Customers.CustomerReminderRuleEnum)Model.ReminderRuleId).ToSelectList(Context)" disabled />
- }
- else
- {
- <admin-select asp-for="ReminderRuleId" asp-items="((Grand.Domain.Customers.CustomerReminderRuleEnum)Model.ReminderRuleId).ToSelectList(Context)" />
- }
- <span asp-validation-for="ReminderRuleId"></span>
- <div class="note note-info margin-top-10">
- @Loc["admin.customers.customerreminder.text1"]
- </div>
- <div class="note note-warning">
- @Loc["admin.customers.customerreminder.text2"]
- </div>
- <div class="note note-info">
- @Loc["admin.customers.customerreminder.text3"]
- </div>
- <div class="note note-warning">
- @Loc["admin.customers.customerreminder.text4"]
- </div>
- <div class="note note-info">
- @Loc["admin.customers.customerreminder.text5"]
- </div>
- <div class="note note-warning">
- @Loc["admin.customers.customerreminder.text6"]
- </div>
- <div class="note note-info">
- @Loc["admin.customers.customerreminder.text7"]
- </div>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="ConditionId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionId" asp-items="((Grand.Domain.Customers.CustomerReminderConditionEnum)Model.ConditionId).ToSelectList(Context)" />
- <span asp-validation-for="ConditionId"></span>
- <div class="note note-info margin-top-10">
- @Loc["admin.customers.actiontype.helpText.OneOfThem"]
- </div>
- <div class="note note-warning">
- @Loc["admin.customers.actiontype.helpText.AllOfThem"]
- </div>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabLevels.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabLevels.cshtml
deleted file mode 100644
index 60431e27f..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.TabLevels.cshtml
+++ /dev/null
@@ -1,88 +0,0 @@
-@model CustomerReminderModel
-@{
-
- if (String.IsNullOrEmpty(Model.Id))
- {
- <div class="note note-info">
- @Loc["Admin.Customers.CustomerReminder.SaveBeforeEdit"]
- </div>
- }
- if (!String.IsNullOrEmpty(Model.Id))
- {
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="levels-grid"></div>
- </div>
- <div class="panel-footer">
- <button type="submit" id="btnAddNewLevel" name="btnAddNewLevel" onclick="javascript:setLocation('@(Url.Action("AddLevel", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))'); return false;" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Customers.CustomerReminder.Levels.AddNew"]</button>
- </div>
- </div>
- <script>
- $(document).ready(function () {
- $("#levels-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("Levels", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("DeleteLevel", "CustomerReminder", new { customerReminderId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function (e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "Name",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.Name"]",
- width: 300,
- template: '<a class="k-link" href="@Url.Action("EditLevel", "CustomerReminder", new { area = Constants.AreaAdmin })/?customerReminderId=@(Model.Id)&cid=#=Id#">#=kendo.htmlEncode(Name)#</a>',
- },
- {
- field: "Level",
- title: "@Loc["Admin.Customers.CustomerReminder.Fields.Level"]",
- width: 100,
- },
- {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.cshtml
deleted file mode 100644
index 5dcee74f0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdate.cshtml
+++ /dev/null
@@ -1,51 +0,0 @@
-@model CustomerReminderModel
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<script>
- $(document).ready(function () {
- $("#@Html.IdFor(model => model.AllowRenew)").change(toggleAllowRenew);
- toggleAllowRenew();
- function toggleAllowRenew() {
- if ($('#@Html.IdFor(model => model.AllowRenew)').is(':checked')) {
- $('#pnlAllowRenew').show();
- } else {
- $('#pnlAllowRenew').hide();
- }
- }
- });
-</script>
-
-<admin-tabstrip name="customerreminder-edit">
- <items>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Info"]" tab-index="0">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Conditions"]" tab-index="1">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabConditions" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Levels"]" tab-index="2">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabLevels" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.History"]" tab-index="3">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabHistory" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="customer_reminder_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateCondition.cshtml
deleted file mode 100644
index 49ff34c40..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateCondition.cshtml
+++ /dev/null
@@ -1,67 +0,0 @@
-@model CustomerReminderModel.ConditionModel
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<input asp-for="CustomerReminderId" type="hidden" />
-
-<admin-tabstrip name="customerremindercondition-edit">
- <items>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.Info"]" tab-index="0">
- <content>
- <div>
- <partial name="Partials/ConditionInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerActionCondition.Products"]" tab-index="1" id="tab-product">
- <content>
- <div>
- <partial name="Partials/ConditionProduct" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.Categories"]" tab-index="2" id="tab-category">
- <content>
- <div>
- <partial name="Partials/ConditionCategory" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.Collections"]" tab-index="3" id="tab-collection">
- <content>
- <div>
- <partial name="Partials/ConditionCollection" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.CustomerGroup"]" tab-index="4" id="tab-customerGroup">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerGroup" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.CustomerTag"]" tab-index="5" id="tab-customerTag">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerTag" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.CustomerRegister"]" tab-index="6" id="tab-customerRegister">
- <content>
- <div>
- <partial name="Partials/ConditionCustomerRegister" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Customers.CustomerReminder.Condition.CustomCustomerAttribute"]" tab-index="7" id="tab-customAttribute">
- <content>
- <div>
- <partial name="Partials/ConditionCustomCustomerAttribute" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="customer_reminder_condition_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateLevel.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateLevel.cshtml
deleted file mode 100644
index ae0ce232d..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/Partials/CreateOrUpdateLevel.cshtml
+++ /dev/null
@@ -1,123 +0,0 @@
-@model CustomerReminderModel.ReminderLevelModel
-<input asp-for="Id" type="hidden" />
-<input asp-for="CustomerReminderId" type="hidden" />
-@{
- var validationSummary = Html.ValidationSummary(false);
- if (!string.IsNullOrEmpty(validationSummary.ToString()))
- {
- <div class="message-error">@validationSummary</div>
- }
-}
-
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/mode/xml/xml.js"></script>
-
-
-<div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Level" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Level" />
- <span asp-validation-for="Level"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-3 col-sm-3">
- </div>
- <div class="col-md-9 col-sm-9 form-inline">
- <div class="form-group">
- <label class="control-label">@Loc["Admin.Customers.CustomerReminder.Level.Fields.SendDay"]</label>
- <br>
- @Html.EditorFor(model => model.Day)
- <span asp-validation-for="Day"></span>
- </div>
- <div class="form-group">
- <label class="control-label">@Loc["Admin.Customers.CustomerReminder.Level.Fields.SendHour"]</label>
- <br>
- @Html.EditorFor(model => model.Hour)
- <span asp-validation-for="Hour"></span>
- </div>
- <div class="form-group">
- <label class="control-label">@Loc["Admin.Customers.CustomerReminder.Level.Fields.SendMinutes"]</label>
- <br>
- @Html.EditorFor(model => model.Minutes)
- <span asp-validation-for="Minutes"></span>
- </div>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="EmailAccounts" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="EmailAccountId" asp-items="Model.EmailAccounts" />
- <span asp-validation-for="EmailAccountId"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="BccEmailAddresses" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="BccEmailAddresses" />
- <span asp-validation-for="BccEmailAddresses"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Subject" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Subject" />
- <span asp-validation-for="Subject"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Body" />
- <div class="col-md-9 col-sm-9">
- <div>
- <label>@Loc["Admin.Content.MessageTemplates.Fields.AllowedTokens"]</label>
- <input type="search" name="SearchTokens" class="form-control SearchTokens" placeholder="@Loc["Search"]" />
- </div>
- <div class="AllowedTokens">
- @foreach (var token in Model.AllowedTokens)
- {
- <button type="button" onclick="AddTokenToEditor(this)" class="btn btn-info">@token</button>
- }
- </div>
- <admin-input asp-for="Body" asp-template="Codemirror" />
- <span asp-validation-for="Body"></span>
- </div>
- </div>
- </div>
-</div>
-<script>
- $(document).ready(function () {
- $(".SearchTokens").on("input", function (e) { SearchTokens(e); })
- $("input").click(function (e) {
- onInputFocus = $(e.target);
- });
- });
-
- function AddTokenToEditor(e) {
- var cm = $('.CodeMirror')[0].CodeMirror;
- var doc = cm.getDoc();
- var cursor = doc.getCursor(); // gets the line number in the cursor position
- doc.replaceRange($(e).text(), cursor);
- }
-
- function SearchTokens(e) {
- var searchVal = $(e.target).val();
- var TokensPnl = $(e.target).closest(".form-group").find(".AllowedTokens");
- $(TokensPnl).find(".btn").show()
- .each(function (i, c) {
- var Token = $(c).text();
- if (Token.search(new RegExp(searchVal, "i")) == -1) {
- $(c).hide();
- }
- });
- }
-</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/ProductAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/ProductAddPopup.cshtml
deleted file mode 100644
index 67781382e..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerReminder/ProductAddPopup.cshtml
+++ /dev/null
@@ -1,237 +0,0 @@
-@model CustomerReminderModel.ConditionModel.AddProductToConditionModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["Admin.Customers.CustomerReminder.Condition.Products.AddNew"];
-}
-
-<form id="ProductAddPopup" asp-area="@Constants.AreaAdmin" asp-controller="CustomerReminder" asp-action="ProductAddPopup" method="post"
- asp-route-CustomerReminderId="@Context.Request.Query["CustomerReminderId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <input asp-for="CustomerReminderId" type="hidden" />
- <input asp-for="ConditionId" type="hidden" />
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit popup-window">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-cubes"></i>
- @Loc["Admin.Customers.CustomerActionCondition.Products.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0">
- <div class="row align-items-end">
- <div class="col-md col-ms-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchProductName" class="control-label" />
- <admin-input asp-for="SearchProductName" />
- </div>
- </div>
- <div class="col-md-auto col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success filter-submit" id="search-products">
- <i class="fa fa-search"></i>&nbsp; @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
- <i class="fa fa-filter"></i>&nbsp; @Loc["Admin.Common.Filters"]
- </button>
- </div>
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> &nbsp; @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
- </div>
- <div class="collapse" id="filterCollapse">
- <div class="drop-filters-container">
- <div class="form-group">
- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCategoryId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchBrandId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCollectionId" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchStoreId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchStoreId" asp-items="Model.AvailableStores" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchVendorId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchVendorId" asp-items="Model.AvailableVendors" />
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />
- </div>
- </div>
- </div>
- </div>
- <div id="products-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- var mfp = $.magnificPopup.instance;
- $("#ProductAddPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshProducts').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
-
- $('.extend-collapse').hide();
- $('.filter-extend-button').click(function () {
- $('.extend-collapse').toggle("slow");
- $('.filter-text-close').toggle();
- });
-
- $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductAddPopupList", "CustomerReminder", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Id",
- headerTemplate: "<input id='mastercheckbox' type='checkbox'/>",
- headerAttributes: { style: "text-align:center" },
- template: "<input type='checkbox' name='SelectedProductIds' value='#=Id#' class='checkboxGroups' />",
- attributes: { style: "text-align:center" },
- width: 50
- }, {
- field: "Name",
- title: "@Loc["Admin.Catalog.Products.Fields.Name"]"
- }, {
- field: "Published",
- title: "@Loc["Admin.Catalog.Products.Fields.Published"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- }]
- });
-
-
- $('#search-products').click(function() {
- var grid = $('#products-grid').data('kendoGrid');
- grid.dataSource.page(1);
- $('.checkboxGroups').prop('checked', false).change();
- return false;
- });
-
- $("#@Html.IdFor(model => model.SearchProductName)").keydown(function(event) {
- if (event.keyCode == 13) {
- $("#search-products").click();
- return false;
- }
- });
-
- //wire up checkboxes
- $('#mastercheckbox').click(function() {
- $('.checkboxGroups').prop('checked', $(this).is(':checked')).change();
- });
-
- $('#products-grid').on('change', 'input[type=checkbox][id!=mastercheckbox]', function(e) {
- updateMasterCheckbox();
- });
-
-
- function additionalData() {
- var data = {
- SearchProductName: $('#@Html.IdFor(model => model.SearchProductName)').val(),
- SearchCategoryId: $('#SearchCategoryId').val(),
- SearchBrandId: $('#SearchBrandId').val(),
- SearchCollectionId: $('#SearchCollectionId').val(),
- SearchStoreId: $('#SearchStoreId').val(),
- SearchVendorId: $('#SearchVendorId').val(),
- SearchProductTypeId: $('#SearchProductTypeId').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
-
- function updateMasterCheckbox() {
- var numChkBoxes = $('#products-grid input[type=checkbox][id!=mastercheckbox]').length;
- var numChkBoxesChecked = $('#products-grid input[type=checkbox][id!=mastercheckbox]:checked').length;
- $('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
- }
-
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/CreateType.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/CreateType.cshtml
index 02110133d..04f13957e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/CreateType.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/CreateType.cshtml
@@ -17,7 +17,7 @@
<div class="btn-group btn-group-devided">
<button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
<button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="banner-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
+ <span id="type-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
<vc:admin-widget widget-zone="document_type_details_buttons" additional-data="Model" />
</div>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
index d8b4f359e..f56d77187 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
@@ -114,7 +114,7 @@
</div>
<div class="x_content-body">
<div class="partialContents" data-url="@Url.Action("DashboardActivity", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -139,7 +139,7 @@
</div>
<div class="x_content">
<div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardGeneralData", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -176,7 +176,7 @@
</div>
<div class="x_content">
<div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataBySource", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -191,7 +191,7 @@
</div>
<div class="x_content">
<div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByExit", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -210,7 +210,7 @@
</div>
<div class="x_content">
<div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByDevice", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -225,7 +225,7 @@
</div>
<div class="x_content">
<div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByLocalization", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
</div>
</div>
</div>
@@ -368,7 +368,7 @@
}
$(".Dashboard_GoogleAnalytics_Data").each(function (index, item) {
- $(item).html('<img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif" /> Loading ...');
+ $(item).html('<img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...');
var url = $(item).data("url") + '?startDate=' + $('#dashboard-report-range').data('daterangepicker').startDate.format('YYYY-MM-DD') + '&endDate=' + $('#dashboard-report-range').data('daterangepicker').endDate.format('YYYY-MM-DD');
if (url && url.length > 0) {
$(item).load(url);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/AddAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/AddAttribute.cshtml
deleted file mode 100644
index 811a77b80..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/AddAttribute.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model InteractiveFormAttributeModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.AddAttribute"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="AddAttribute" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-sitemap"></i>
- @Loc["admin.marketing.InteractiveForms.AddAttribute"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["admin.marketing.InteractiveForms.BackToForm"] + ")", "Edit", new { Id = Model.FormId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateAttribute" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Create.cshtml
deleted file mode 100644
index 8f28813f5..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Create.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model InteractiveFormModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.AddNew"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="Create" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tag"></i>
- @Loc["admin.marketing.InteractiveForms.AddNew"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["admin.marketing.InteractiveForms.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Edit.cshtml
deleted file mode 100644
index 95e62ace0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Edit.cshtml
+++ /dev/null
@@ -1,32 +0,0 @@
-@model InteractiveFormModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.EditDetails"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="Edit" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tag"></i>
- @Loc["admin.marketing.InteractiveForms.EditDetails"] - @Model.Name
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["admin.marketing.InteractiveForms.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="InteractiveForm-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
-<admin-delete-confirmation button-id="InteractiveForm-delete"/>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/EditAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/EditAttribute.cshtml
deleted file mode 100644
index edded7e86..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/EditAttribute.cshtml
+++ /dev/null
@@ -1,30 +0,0 @@
-@model InteractiveFormAttributeModel
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.EditAttribute"];
-}
-<form asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="EditAttribute" method="post" id="attribute-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-code-fork"></i>
- @Loc["admin.marketing.InteractiveForms.EditAttribute"] - @Model.Name
- <small>@Html.ActionLink("(" + Loc["admin.marketing.InteractiveForms.BackToForm"] + ")", "Edit", new { Id = Model.FormId })</small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateAttribute" model="Model" />
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/List.cshtml
deleted file mode 100644
index 7582f6953..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/List.cshtml
+++ /dev/null
@@ -1,77 +0,0 @@
-@{
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms"];
-}
-
-
-<div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tags"></i>
- @Loc["admin.marketing.InteractiveForms"]
- </div>
- <div class="actions btn-group btn-group-devided">
- <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span></a>
- </div>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="x_content">
- <div id="interactiveForms-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-
-
-<script>
- $(document).ready(function () {
- $("#interactiveForms-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("List", "InteractiveForm", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors"
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["admin.marketing.InteractiveForms.Fields.Name"]",
- template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>',
- }]
- });
- });
-</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabInfo.cshtml
deleted file mode 100644
index 001d7ca99..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabInfo.cshtml
+++ /dev/null
@@ -1,67 +0,0 @@
-@model InteractiveFormModel
-@using Microsoft.AspNetCore.Mvc.Razor;
-
-@{ Func<int, HelperResult>
- template = @<div class="form-body">
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Name" />
- <span asp-validation-for="@Model.Locales[item].Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Body" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Body" asp-template="Editor" />
- <span asp-validation-for="@Model.Locales[item].Body"></span>
- </div>
- </div>
- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />
-</div>;
-}
-<div class="form-horizontal">
- <localized-editor localized-template=@template name="InteractiveForm-localized" [email protected](c=>c.LanguageId).ToList()>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Body" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Body" asp-template="Editor" />
- <span asp-validation-for="Body"></span>
- </div>
- </div>
- </div>
- </localized-editor>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="SystemName" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SystemName" />
- <span asp-validation-for="SystemName"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="AvailableTokens" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">
- @Html.DisplayFor(model => model.AvailableTokens)
- </label>
- <span asp-validation-for="AvailableTokens"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="EmailAccountId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="EmailAccountId" asp-items="@(new SelectList(Model.AvailableEmailAccounts, "Id", "DisplayName"))" />
- <span asp-validation-for="EmailAccountId"></span>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabValues.cshtml
deleted file mode 100644
index 4e56de4af..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.TabValues.cshtml
+++ /dev/null
@@ -1,89 +0,0 @@
-@model InteractiveFormModel
-
-@{
- if (!String.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="interactiveformattributes-grid"></div>
- </div>
- <div class="panel-footer">
- <button type="submit" id="btnAddNewValue" onclick="javascript:setLocation('@(Url.Action("AddAttribute", "InteractiveForm", new { formId = Model.Id, area = Constants.AreaAdmin }))'); return false;" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["admin.marketing.InteractiveForms.Attribute.AddNew"]</button>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $("#interactiveformattributes-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("FormAttributesList", "InteractiveForm", new { formId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("FormAttributesDelete", "InteractiveForm", new { formId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id"
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Fields.Name"]"
- }, {
- field: "SystemName",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Fields.SystemName"]",
- template: '<a class="k-link" href="@Url.Action("EditAttribute", "InteractiveForm", new { area = Constants.AreaAdmin })/?formId=@(Model.Id)&aid=#=Id#">#=SystemName#</a>',
- }, {
- field: "Type",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Fields.FormControlTypeId"]",
- width: 200
- },
- {
- command: {name: "destroy", text: "@Loc["Admin.Common.Delete"]"},
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }]
- });
- });
- </script>
-
- }
- else
- {
- <div class="note note-info">
- @Loc["admin.marketing.InteractiveForms.SaveBeforeEdit"]
- </div>
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.cshtml
deleted file mode 100644
index 41f70f5b2..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdate.cshtml
+++ /dev/null
@@ -1,23 +0,0 @@
-@model InteractiveFormModel
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<admin-tabstrip name="interactiveform-edit">
- <items>
- <tabstrip-item text="@Loc["admin.marketing.InteractiveForms.Info"]" tab-index="0">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["admin.marketing.InteractiveForms.Attribute"]" tab-index="1">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.TabValues" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="interactiveform_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabInfo.cshtml
deleted file mode 100644
index 43e6b9f6d..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabInfo.cshtml
+++ /dev/null
@@ -1,129 +0,0 @@
-@model InteractiveFormAttributeModel
-@using Microsoft.AspNetCore.Mvc.Razor;
-
-<script>
-$(document).ready(function () {
- $("#@Html.IdFor(model => model.FormControlTypeId)").change(toggleAttributeControlType);
-
- toggleAttributeControlType();
-
- function toggleAttributeControlType() {
- var selectedAttributeControlTypeId = $("#@Html.IdFor(model => model.FormControlTypeId)").val();
- if (selectedAttributeControlTypeId == @(((int)Grand.Domain.Messages.FormControlType.TextBox).ToString())) {
- $('#pnlValidationMinLength').show();
- $('#pnlValidationMaxLength').show();
- $('#pnlDefaultValue').show();
- $('#pnlRegexValidation').show();
- $('#tab-values').hide();
- } else if (selectedAttributeControlTypeId == @(((int)Grand.Domain.Messages.FormControlType.MultilineTextbox).ToString())) {
- $('#pnlValidationMinLength').show();
- $('#pnlValidationMaxLength').show();
- $('#pnlDefaultValue').show();
- $('#pnlRegexValidation').show();
- $('#tab-values').hide();
- } else {
- $('#pnlValidationMinLength').hide();
- $('#pnlValidationMaxLength').hide();
- $('#pnlDefaultValue').hide();
- $('#pnlRegexValidation').hide();
- $('#tab-values').show();
- }
- }
-
- });
-</script>
-
-@{ Func<int, HelperResult>
- template = @<div class="form-body">
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Name" />
- <span asp-validation-for="@Model.Locales[item].Name"></span>
- </div>
- </div>
- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />
-</div>;
-}
-
-<div class="form-horizontal">
- <localized-editor localized-template=@template name="attribute-localized" [email protected](c=>c.LanguageId).ToList()>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- </div>
- </localized-editor>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="SystemName" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SystemName" />
- <span asp-validation-for="SystemName"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Style" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Style" />
- <span asp-validation-for="Style"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="Class" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Class" />
- <span asp-validation-for="Class"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="IsRequired" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="IsRequired" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="IsRequired"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="FormControlTypeId" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="FormControlTypeId" asp-items="((Grand.Domain.Messages.FormControlType)Model.FormControlTypeId).ToSelectList(Context)" />
- <span asp-validation-for="FormControlTypeId"></span>
- </div>
- </div>
- <div class="form-group" id="pnlRegexValidation">
- <admin-label asp-for="RegexValidation" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="RegexValidation" />
- <span asp-validation-for="RegexValidation"></span>
- </div>
- </div>
- <div class="form-group" id="pnlValidationMinLength">
- <admin-label asp-for="ValidationMinLength" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="ValidationMinLength" />
- <span asp-validation-for="ValidationMinLength"></span>
- </div>
- </div>
- <div class="form-group" id="pnlValidationMaxLength">
- <admin-label asp-for="ValidationMaxLength" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="ValidationMaxLength" />
- <span asp-validation-for="ValidationMaxLength"></span>
- </div>
- </div>
- <div class="form-group" id="pnlDefaultValue">
- <admin-label asp-for="DefaultValue" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="DefaultValue" />
- <span asp-validation-for="DefaultValue"></span>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabValues.cshtml
deleted file mode 100644
index 0d8eea076..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.TabValues.cshtml
+++ /dev/null
@@ -1,135 +0,0 @@
-@model InteractiveFormAttributeModel
-@{
-
- if (!string.IsNullOrEmpty(Model.Id))
- {
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="attributeValues-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewValues" href="@(Url.Action("ValueCreatePopup", "InteractiveForm", new { form = Model.FormId, aId = Model.Id, formId = "attribute-form", btnId = "btnRefreshValues", area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["admin.marketing.InteractiveForms.Attribute.Values.AddNew"]</a>
- <input type="submit" id="btnRefreshValues" style="display: none" />
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewValues').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#attributeValues-grid").kendoGrid({
- dataBound: function () {
- $('.editvalue').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- },
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("AttributeValuesList", "InteractiveForm", new { formId = Model.FormId, aId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("AttributeValuesDelete", "InteractiveForm", new { formId = Model.FormId, aId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken,
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "Name",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Values.Fields.Name"]",
- template: "<a class='k-link editvalue' href=\"@Url.Action("ValueEditPopup", "InteractiveForm", new { area = Constants.AreaAdmin })/#=Id#[email protected]&[email protected]&btnId=btnRefreshValues&formId=attribute-form\">#=kendo.htmlEncode(Name)#</a>",
- },
- {
- field: "IsPreSelected",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Values.Fields.IsPreSelected"]",
- width: 200,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(IsPreSelected) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- },
- {
- field: "DisplayOrder",
- title: "@Loc["admin.marketing.InteractiveForms.Attribute.Values.Fields.DisplayOrder"]",
- width: 150
- },
- {
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 150
- }]
- });
- });
- </script>
- <script>
- $(document).ready(function () {
- $('#btnRefreshValues').click(function () {
- var grid = $("#attributeValues-grid").data('kendoGrid');
- grid.dataSource.read();
- return false;
- });
- });
- </script>
-
- }
- else
- {
- <div class="note note-info">
- @Loc["admin.marketing.InteractiveForms.SaveBeforeEdit"]
- </div>
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.cshtml
deleted file mode 100644
index 246e58864..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttribute.cshtml
+++ /dev/null
@@ -1,24 +0,0 @@
-@model InteractiveFormAttributeModel
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<input asp-for="FormId" type="hidden" />
-<admin-tabstrip name="attribute-edit">
- <items>
- <tabstrip-item text="@Loc["admin.marketing.InteractiveForms.Attribute.Info"]" tab-index="0">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdateAttribute.TabInfo" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["admin.marketing.InteractiveForms.Attribute.Values"]" tab-index="1">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdateAttribute.TabValues" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <vc:admin-widget widget-zone="interactiveform_attribute_details_tabs" additional-data="Model" />
- </items>
-</admin-tabstrip>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttributeValue.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttributeValue.cshtml
deleted file mode 100644
index 64dc4a0c5..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/Partials/CreateOrUpdateAttributeValue.cshtml
+++ /dev/null
@@ -1,58 +0,0 @@
-@model InteractiveFormAttributeValueModel
-@using Microsoft.AspNetCore.Mvc.Razor;
-
-<div asp-validation-summary="All"></div>
-<input asp-for="Id" type="hidden" />
-<input asp-for="FormId" type="hidden" />
-<input asp-for="AttributeId" type="hidden" />
-
-@{ Func<int, HelperResult>
- template = @<div class="form-body">
- <div class="form-group">
- <admin-label asp-for="@Model.Locales[item].Name" class="control-label col-sm-3" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="@Model.Locales[item].Name" />
- <span asp-validation-for="@Model.Locales[item].Name"></span>
- </div>
- </div>
- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />
-</div>;
-}
-
-<div class="form-horizontal">
- <localized-editor localized-template=@template name="attributevalue-localized" [email protected](c=>c.LanguageId).ToList()>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="Name" class="control-label col-sm-3" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="Name" />
- <span asp-validation-for="Name"></span>
- </div>
- </div>
- </div>
- </localized-editor>
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="IsPreSelected" class="control-label col-sm-3" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="IsPreSelected" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="IsPreSelected"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="DisplayOrder" class="control-label col-sm-3" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="DisplayOrder" />
- <span asp-validation-for="DisplayOrder"></span>
- </div>
- </div>
- <div class="form-group">
- <div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">
- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueCreatePopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueCreatePopup.cshtml
deleted file mode 100644
index 4326e6684..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueCreatePopup.cshtml
+++ /dev/null
@@ -1,59 +0,0 @@
-@model InteractiveFormAttributeValueModel
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.Attribute.Values.AddNew"];
-}
-<form id="ValueCreatePopup" asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="ValueCreatePopup"
- asp-route-form="@Context.Request.Query["form"]"
- asp-route-aId="@Context.Request.Query["aId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-list-alt"></i>
- @Loc["admin.marketing.InteractiveForms.Attribute.Values.AddNew"]
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateAttributeValue" model="Model" />
- </div>
- </div>
- </div>
- </div>
- <script>
- var mfp = $.magnificPopup.instance;
- $("#ValueCreatePopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshValues').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueEditPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueEditPopup.cshtml
deleted file mode 100644
index 7490eeff0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/InteractiveForm/ValueEditPopup.cshtml
+++ /dev/null
@@ -1,60 +0,0 @@
-@model InteractiveFormAttributeValueModel
-@{
- Layout = "";
- //page title
- ViewBag.Title = Loc["admin.marketing.InteractiveForms.Attribute.Values.EditValue"];
-}
-<form id="ValueEditPopup" asp-area="@Constants.AreaAdmin" asp-controller="InteractiveForm" asp-action="ValueEditPopup"
- asp-route-form="@Context.Request.Query["form"]"
- asp-route-aId="@Context.Request.Query["aId"]"
- asp-route-btnId="@Context.Request.Query["btnId"]"
- asp-route-formId="@Context.Request.Query["formId"]">
-
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-list-alt"></i>
- @Loc["admin.marketing.InteractiveForms.Attribute.Values.EditValue"]
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdateAttributeValue" model="Model" />
- </div>
- </div>
- </div>
- </div>
- <script>
- var mfp = $.magnificPopup.instance;
- $("#ValueEditPopup").submit(function (e) {
- e.preventDefault();
- var form = $(this);
- var url = form.attr('action');
- $.ajax({
- type: "POST",
- url: url,
- data: form.serialize(),
- success: function (data) {
- if (data == "") {
- mfp.close();
- $('#btnRefreshValues').click();
- } else {
- $.magnificPopup.open({
- items: {
- src: data,
- type: 'inline'
- },
- callbacks: {
- open: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- }
- }
- });
- });
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/List.cshtml
index 6316702d0..b3382daca 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/List.cshtml
@@ -2,7 +2,7 @@
//page title
ViewBag.Title = Loc["Admin.Content.Knowledgebase.Manage"];
}
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/bootstrap-treeview.js"></script>
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/bootstrap-treeview.js"></script>
<div class="row">
<div class="col-md-12">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomCss.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomCss.cshtml
index f2698b8f5..1071a0626 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomCss.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomCss.cshtml
@@ -4,13 +4,13 @@
ViewBag.Title = Loc["Admin.System.CustomCss"];
}
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/show-hint.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/mode/css/css.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/show-hint.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/css-hint.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/edit/matchbrackets.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.css" />
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/show-hint.css" />
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/mode/css/css.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/show-hint.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/css-hint.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/edit/matchbrackets.js"></script>
<style>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomJs.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomJs.cshtml
index 145eaabaf..1559d8a1f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomJs.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/CustomJs.cshtml
@@ -4,14 +4,14 @@
ViewBag.Title = Loc["Admin.System.CustomJs"];
}
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/show-hint.css" />
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.css" />
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/show-hint.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/mode/javascript/javascript.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/show-hint.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/hint/javascript-hint.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/edit/matchbrackets.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/mode/javascript/javascript.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/show-hint.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/hint/javascript-hint.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/edit/matchbrackets.js"></script>
<style>
.CodeMirror {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/RobotsTxt.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/RobotsTxt.cshtml
index a0b317cb9..88dec9df1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/RobotsTxt.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Maintenance/RobotsTxt.cshtml
@@ -3,8 +3,8 @@
//page title
ViewBag.Title = Loc["Admin.System.RobotsTxt"];
}
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.css" />
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.js"></script>
<style>
.CodeMirror {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/MessageTemplate/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/MessageTemplate/Partials/CreateOrUpdate.TabInfo.cshtml
index 4f1d9401b..11c69f371 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/MessageTemplate/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/MessageTemplate/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -1,9 +1,9 @@
@model MessageTemplateModel
@using Microsoft.AspNetCore.Mvc.Razor;
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.css" />
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/codemirror.js"></script>
-<script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/codemirror/mode/xml/xml.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.css" />
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/codemirror.js"></script>
+<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/codemirror/mode/xml/xml.js"></script>
@{ Func<int, HelperResult>
template = @<div class="form-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsletterCategory/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsletterCategory/Create.cshtml
index ca4bebc7a..a70d35ad5 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsletterCategory/Create.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsletterCategory/Create.cshtml
@@ -18,7 +18,7 @@
<div class="btn-group btn-group-devided">
<button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Admin.Common.Save"] </button>
<button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="banner-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
+ <span id="newslettercategory-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
</div>
</div>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
index b07809fc1..f381a5355 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
@@ -309,7 +309,7 @@
}
</table>
<div style="padding-top: 15px;">
- <img alt="google maps" src="@Url.Content("/_content/Grand.Web.Admin/administration/build/images/google-maps.gif")" />
+ <img alt="google maps" src="@Url.Content("@(Common.WwwRoot)/administration/build/images/google-maps.gif")" />
<a href="@Html.Raw(Model.ShippingAddressGoogleMapsUrl)" target="_blank">@Loc["Admin.Orders.Fields.ShippingAddress.ViewOnGoogleMaps"]</a>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
index d0133aaf8..810d1deba 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
@@ -6,9 +6,9 @@
@using System.Text;
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.min.js"></script>
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.caret.min.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.min.js"></script>
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.caret.min.js"></script>
@{
//tags
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
index 914c8369a..0445b44d6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
@@ -4,9 +4,9 @@
@inject IPageHeadBuilder pagebuilder
@{
//resources for product tags input
- <link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.css" />
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.caret.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/tagEditor/jquery.tag-editor.min.js"></script>
+ <link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.caret.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.min.js"></script>
}
@using Grand.Domain.Catalog;
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
index 482bccb8b..f8554bf7f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
@@ -1,7 +1,7 @@
@model ProductModel
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_product_attributes_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
index 93433a4b1..205d61d38 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
@@ -2,8 +2,8 @@
@using Microsoft.AspNetCore.Mvc.Razor;
@model ProductModel.ProductAttributeValueModel
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
index bd35d97f4..69de7a5fd 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
@@ -7,7 +7,7 @@
}
@using Grand.Domain.Common
-<script asp-src="/_content/Grand.Web.Admin/administration/chart.min.js"></script>
+<script asp-src="@(Common.WwwRoot)/administration/chart.min.js"></script>
<div class="row">
<div class="col-md-12">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
index ee69690e9..98db4682d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
@@ -121,7 +121,7 @@ $(document).ready(function() {
@if (!(Model.Allowed == 0 && Model.Denied == 0))
{
- <script asp-src="/_content/Grand.Web.Admin/administration/chart.min.js"></script>
+ <script asp-src="@(Common.WwwRoot)/administration/chart.min.js"></script>
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/CustomerReportTimeChart/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/CustomerReportTimeChart/Default.cshtml
index 5e67eb94b..1bab0c13e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/CustomerReportTimeChart/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/CustomerReportTimeChart/Default.cshtml
@@ -2,7 +2,7 @@
<canvas id="canvasReportCustomerTimeChart"></canvas>
</div>
-<script src="/_content/Grand.Web.Admin/administration/chart.min.js" type="text/javascript"></script>
+<script src="@(Common.WwwRoot)/administration/chart.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
initReportCustomerTimeChart(true);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/OrderTimeChart/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/OrderTimeChart/Default.cshtml
index 0910c3a4f..2e48549f1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/OrderTimeChart/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/OrderTimeChart/Default.cshtml
@@ -10,7 +10,7 @@
<canvas id="canvasReportOrderTimeChart"></canvas>
</div>
-<script src="/_content/Grand.Web.Admin/administration/chart.min.js" type="text/javascript"></script>
+<script src="@(Common.WwwRoot)/administration/chart.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
initReportOrderTimeChart(true);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
index 4ed61c868..d7b27948e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
@@ -4,8 +4,8 @@
@inject Grand.Business.Core.Interfaces.Storage.IDownloadService downloadService
@inject IPageHeadBuilder pagebuilder
@{
- <link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/fineuploader-4.2.2.min.css" />
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
+ <link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
var randomNumber = CommonHelper.GenerateRandomInteger();
var clientId = "download" + randomNumber;
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
index b475d363a..e188a524c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
@@ -16,7 +16,7 @@
function elfinderDialog@(random)(context) { // <------------------ +context
var fm = $('<div/>').dialogelfinder({
url: '@Url.Action("Connector", "ElFinder")',
- baseUrl: '/_content/Grand.Web.Admin/administration/elfinder/',
+ baseUrl: '@(Common.WwwRoot)/administration/elfinder/',
lang: 'en',
width: 840,
height: 450,
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/MultiPicture.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/MultiPicture.cshtml
index ff275a91e..f2135aefc 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/MultiPicture.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/MultiPicture.cshtml
@@ -8,8 +8,8 @@
var endpoint = ViewData["Endpoint"];
var click = ViewData["Click"];
}
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/fineuploader-4.2.2.min.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
<div id="@clientId"></div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Picture.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Picture.cshtml
index c5ec42c6c..99aa30f8b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Picture.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Picture.cshtml
@@ -7,8 +7,8 @@
var targetPictureSize = 100;
}
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/fineuploader-4.2.2.min.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
<div id="@(clientId + "value")">
<input asp-for="@Model" type="hidden" />
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
index c41175782..81a19798d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
@@ -1,58 +1,61 @@
@using Grand.Infrastructure;
@inject Grand.Domain.Localization.LanguageSettings languageSettings
@inject IWorkContext workContext
+<script>
+ const wwwrootpath = '@(Common.WwwRoot)';
+</script>
@{
var supportRtl = workContext.WorkingLanguage.Rtl &&
!languageSettings.IgnoreRtlPropertyForAdminArea;
var kendoVersion = "2021.3.914";
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/bootstrap/css/daterangepicker.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/build/css/font-awesome.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/simple-line-icons/simple-line-icons.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/bootstrap/css/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/magnific-popup/magnific-popup.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/summernote/summernote.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/jquery-ui-themes/smoothness/jquery-ui-1.10.3.custom.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/elfinder/css/elfinder.full.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/elfinder/css/theme.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/bootstrap/css/daterangepicker.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/font-awesome.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/bootstrap/css/bootstrap.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/magnific-popup/magnific-popup.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/summernote/summernote.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/jquery-ui-themes/smoothness/jquery-ui-1.10.3.custom.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/elfinder/css/elfinder.full.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/elfinder/css/theme.css" />
- <link rel="stylesheet" type="text/css" href="@string.Format("/_content/Grand.Web.Admin/administration/kendo/styles/{0}/kendo.material.mobile.min.css", kendoVersion)" />
- <link rel="stylesheet" type="text/css" href="@string.Format("/_content/Grand.Web.Admin/administration/kendo/styles/{0}/kendo.material.min.css", kendoVersion)" />
- <link rel="stylesheet" type="text/css" href="@string.Format("/_content/Grand.Web.Admin/administration/kendo/styles/{0}/kendo.common-material.min.css", kendoVersion)" />
+ <link rel="stylesheet" type="text/css" href="@string.Format(Common.WwwRoot+"/administration/kendo/styles/{0}/kendo.material.mobile.min.css", kendoVersion)" />
+ <link rel="stylesheet" type="text/css" href="@string.Format(Common.WwwRoot+"/administration/kendo/styles/{0}/kendo.material.min.css", kendoVersion)" />
+ <link rel="stylesheet" type="text/css" href="@string.Format(Common.WwwRoot+"/administration/kendo/styles/{0}/kendo.common-material.min.css", kendoVersion)" />
//CSS
if (supportRtl)
{
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/bootstrap/css/bootstrap-rtl.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/build/css/custom-rtl.css" />
- <link rel="stylesheet" type="text/css" href="@string.Format("/_content/Grand.Web.Admin/administration/kendo/styles/{0}/kendo.rtl.min.css", kendoVersion)" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/bootstrap/css/bootstrap-rtl.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/custom-rtl.css" />
+ <link rel="stylesheet" type="text/css" href="@string.Format(Common.WwwRoot+"/administration/kendo/styles/{0}/kendo.rtl.min.css", kendoVersion)" />
}
else
{
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/build/css/custom.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/custom.css" />
}
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/build/js/jquery.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery-ui/jquery-ui.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/build/js/moment.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/bootstrap/js/daterangepicker.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/typeahead.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/admin.search.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery.validate.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery.validate.unobtrusive.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/admin.common.js"></script>
- <script asp-location="Head" asp-src="@string.Format("/_content/Grand.Web.Admin/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>
- <script asp-location="Head" asp-src="@string.Format("/_content/Grand.Web.Admin/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>
- <script asp-location="Head" asp-src="@string.Format("/_content/Grand.Web.Admin/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.min.js", kendoVersion, "en-US" )"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/jquery.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/moment.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/daterangepicker.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/typeahead.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/admin.search.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/admin.common.js"></script>
+ <script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>
+ <script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>
+ <script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.min.js", kendoVersion, "en-US" )"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/bootstrap/js/popper.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/bootstrap/js/bootstrap.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/build/js/smartresize.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/build/js/custom.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/summernote/summernote.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/elfinder/js/elfinder.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/magnific-popup/jquery.magnific-popup.min.js"></script>
- <script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/jquery.tmpl.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/build/js/smartresize.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/build/js/custom.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/summernote/summernote.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/elfinder/js/elfinder.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/magnific-popup/jquery.magnific-popup.min.js"></script>
+ <script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/jquery.tmpl.min.js"></script>
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
index 812c5cdc2..6c13d80ad 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
@@ -19,7 +19,7 @@
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title">
- <a href="~/Admin" class="site_title"><img src="/_content/Grand.Web.Admin/administration/build/images/grandLogo.png" width="35" height="35" /> <span>GrandNode</span></a>
+ <a href="~/Admin" class="site_title"><img src="@(Common.WwwRoot)/administration/build/images/grandLogo.png" width="35" height="35" /> <span>GrandNode</span></a>
</div>
<div class="clearfix"></div>
<div class="main_menu_side hidden-print main_menu" id="sidebar-menu">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
index 3b07a6daa..1514edc6c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
@@ -160,7 +160,7 @@
}
<li>
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
- <img src="/_content/Grand.Web.Admin/administration/build/images/avatar.png" alt="">
+ <img src="@(Common.WwwRoot)/administration/build/images/avatar.png" alt="">
@if (currentCustomer != null && await groupService.IsRegistered(currentCustomer))
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
index 2b54edf47..efe42ac89 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
@@ -21,18 +21,18 @@
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/build/css/font-awesome.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/simple-line-icons/simple-line-icons.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/bootstrap/css/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="/_content/Grand.Web.Admin/administration/build/css/custom.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/font-awesome.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/bootstrap/css/bootstrap.min.css" />
+ <link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/custom.css" />
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/build/js/jquery.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/build/js/moment.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery.validate.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery.validate.unobtrusive.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/jquery-ui/jquery-ui.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/bootstrap/js/popper.min.js"></script>
- <script asp-location="Head" asp-src="/_content/Grand.Web.Admin/administration/bootstrap/js/bootstrap.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/jquery.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/moment.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
+ <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml
index 7bf48973a..8b10ad443 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml
@@ -1,8 +1,8 @@
@model DeliveryDateModel
@using Microsoft.AspNetCore.Mvc.Razor;
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
@{ Func<int, HelperResult>
template = @<div class="form-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
index 00e53f943..ecd2e739d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
@@ -1,7 +1,7 @@
@model SpecificationAttributeModel
-<link rel="stylesheet" type="text/css" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.css" />
-<script asp-location="Footer" asp-src="/_content/Grand.Web.Admin/administration/farbtastic/farbtastic.js"></script>
+<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
+<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
@{
if (!String.IsNullOrEmpty(Model.Id))
diff --git a/src/Web/Grand.Web.Admin/Controllers/BannerController.cs b/src/Web/Grand.Web.Admin/Controllers/BannerController.cs
deleted file mode 100644
index 80bc040da..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/BannerController.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Marketing.Banners;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Models.Messages;
-using Grand.Web.Common.DataSource;
-using Grand.Web.Common.Filters;
-using Grand.Web.Common.Security.Authorization;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Grand.Web.Admin.Controllers
-{
- [PermissionAuthorize(PermissionSystemName.Banners)]
- public partial class BannerController : BaseAdminController
- {
- private readonly IBannerService _bannerService;
- private readonly ITranslationService _translationService;
- private readonly ILanguageService _languageService;
-
- public BannerController(IBannerService bannerService,
- ITranslationService translationService,
- ILanguageService languageService)
- {
- _bannerService = bannerService;
- _translationService = translationService;
- _languageService = languageService;
- }
-
- public IActionResult Index() => RedirectToAction("List");
-
- public IActionResult List() => View();
-
- [PermissionAuthorizeAction(PermissionActionName.List)]
- [HttpPost]
- public async Task<IActionResult> List(DataSourceRequest command)
- {
- var banners = await _bannerService.GetAllBanners();
- var gridModel = new DataSourceResult
- {
- Data = banners.Select(x =>
- {
- var model = x.ToModel();
- model.Body = "";
- return model;
- }),
- Total = banners.Count
- };
- return Json(gridModel);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Create)]
- public async Task<IActionResult> Create()
- {
- var model = new BannerModel();
- //locales
- await AddLocales(_languageService, model.Locales);
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Create(BannerModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var banner = model.ToEntity();
- banner.CreatedOnUtc = DateTime.UtcNow;
- await _bannerService.InsertBanner(banner);
-
- Success(_translationService.GetResource("admin.marketing.Banners.Added"));
- return continueEditing ? RedirectToAction("Edit", new { id = banner.Id }) : RedirectToAction("List");
- }
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Preview)]
- public async Task<IActionResult> Edit(string id)
- {
- var banner = await _bannerService.GetBannerById(id);
- if (banner == null)
- return RedirectToAction("List");
-
- var model = banner.ToModel();
-
- //locales
- await AddLocales(_languageService, model.Locales, (locale, languageId) =>
- {
- locale.Name = banner.GetTranslation(x => x.Name, languageId, false);
- locale.Body = banner.GetTranslation(x => x.Body, languageId, false);
- });
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Edit(BannerModel model, bool continueEditing)
- {
- var banner = await _bannerService.GetBannerById(model.Id);
- if (banner == null)
- return RedirectToAction("List");
-
- if (ModelState.IsValid)
- {
- banner = model.ToEntity(banner);
- await _bannerService.UpdateBanner(banner);
- Success(_translationService.GetResource("admin.marketing.Banners.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = banner.Id }) : RedirectToAction("List");
- }
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Delete)]
- [HttpPost]
- public async Task<IActionResult> Delete(string id)
- {
- var banner = await _bannerService.GetBannerById(id);
- if (banner == null)
- return RedirectToAction("List");
-
- if (ModelState.IsValid)
- {
- await _bannerService.DeleteBanner(banner);
- Success(_translationService.GetResource("admin.marketing.Banners.Deleted"));
- return RedirectToAction("List");
- }
- return RedirectToAction("Edit", new { id = id });
- }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerActionController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerActionController.cs
deleted file mode 100644
index c9eb502ee..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerActionController.cs
+++ /dev/null
@@ -1,925 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Categories;
-using Grand.Business.Core.Interfaces.Catalog.Collections;
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-using Grand.Web.Common.DataSource;
-using Grand.Web.Common.Filters;
-using Grand.Web.Common.Security.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace Grand.Web.Admin.Controllers
-{
- [PermissionAuthorize(PermissionSystemName.Actions)]
- public partial class CustomerActionController : BaseAdminController
- {
- #region Fields
- private readonly ICustomerActionViewModelService _customerActionViewModelService;
- private readonly ICustomerService _customerService;
- private readonly IGroupService _groupService;
- private readonly ICustomerAttributeService _customerAttributeService;
- private readonly ICustomerTagService _customerTagService;
- private readonly ITranslationService _translationService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly IProductService _productService;
- private readonly ICategoryService _categoryService;
- private readonly ICollectionService _collectionService;
- private readonly IStoreService _storeService;
- private readonly IVendorService _vendorService;
- private readonly ICustomerActionService _customerActionService;
- private readonly IProductAttributeService _productAttributeService;
- private readonly ISpecificationAttributeService _specificationAttributeService;
- private readonly IDateTimeService _dateTimeService;
-
- #endregion
-
- #region Constructors
-
- public CustomerActionController(
- ICustomerActionViewModelService customerActionViewModelService,
- ICustomerService customerService,
- IGroupService groupService,
- ICustomerAttributeService customerAttributeService,
- ICustomerTagService customerTagService,
- ITranslationService translationService,
- ICustomerActivityService customerActivityService,
- IProductService productService,
- ICategoryService categoryService,
- ICollectionService collectionService,
- IStoreService storeService,
- IVendorService vendorService,
- ICustomerActionService customerActionService,
- IProductAttributeService productAttributeService,
- ISpecificationAttributeService specificationAttributeService,
- IDateTimeService dateTimeService)
- {
- _customerActionViewModelService = customerActionViewModelService;
- _customerService = customerService;
- _groupService = groupService;
- _customerAttributeService = customerAttributeService;
- _customerTagService = customerTagService;
- _translationService = translationService;
- _customerActivityService = customerActivityService;
- _productService = productService;
- _categoryService = categoryService;
- _collectionService = collectionService;
- _storeService = storeService;
- _vendorService = vendorService;
- _customerActionService = customerActionService;
- _productAttributeService = productAttributeService;
- _specificationAttributeService = specificationAttributeService;
- _dateTimeService = dateTimeService;
- }
-
- #endregion
-
- #region Utilities
- protected void CheckValidateModel(CustomerActionModel model)
- {
- if ((model.ReactionType == CustomerReactionTypeEnum.Banner) && String.IsNullOrEmpty(model.BannerId))
- ModelState.AddModelError("error", "Banner is required");
- if ((model.ReactionType == CustomerReactionTypeEnum.InteractiveForm) && String.IsNullOrEmpty(model.InteractiveFormId))
- ModelState.AddModelError("error", "Interactive form is required");
- if ((model.ReactionType == CustomerReactionTypeEnum.Email) && String.IsNullOrEmpty(model.MessageTemplateId))
- ModelState.AddModelError("error", "Email is required");
- if ((model.ReactionType == CustomerReactionTypeEnum.AssignToCustomerGroup) && String.IsNullOrEmpty(model.CustomerGroupId))
- ModelState.AddModelError("error", "Customer group is required");
- if ((model.ReactionType == CustomerReactionTypeEnum.AssignToCustomerTag) && String.IsNullOrEmpty(model.CustomerTagId))
- ModelState.AddModelError("error", "Tag is required");
- }
- #endregion
-
- #region Customer Actions
-
- public IActionResult Index() => RedirectToAction("List");
-
- public IActionResult List() => View();
-
- [HttpPost]
- public async Task<IActionResult> List(DataSourceRequest command)
- {
- var customeractions = await _customerActionService.GetCustomerActions();
- var actions = await _customerActionService.GetCustomerActionType();
- var gridModel = new DataSourceResult
- {
- Data = customeractions.Select(x => new { Id = x.Id, Name = x.Name, Active = x.Active, ActionType = actions.FirstOrDefault(y => y.Id == x.ActionTypeId)?.Name }),
- Total = customeractions.Count()
- };
- return Json(gridModel);
- }
-
- public async Task<IActionResult> Create()
- {
- var model = await _customerActionViewModelService.PrepareCustomerActionModel();
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Create(CustomerActionModel model, bool continueEditing)
- {
- CheckValidateModel(model);
- if (ModelState.IsValid)
- {
- var customeraction = await _customerActionViewModelService.InsertCustomerActionModel(model);
- Success(_translationService.GetResource("Admin.Customers.CustomerAction.Added"));
- return continueEditing ? RedirectToAction("Edit", new { id = customeraction.Id }) : RedirectToAction("List");
- }
- await _customerActionViewModelService.PrepareReactObjectModel(model);
- return View(model);
- }
-
- public async Task<IActionResult> Edit(string id)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(id);
- if (customerAction == null)
- return RedirectToAction("List");
-
- var model = customerAction.ToModel(_dateTimeService);
- model.ConditionCount = customerAction.Conditions.Count();
- await _customerActionViewModelService.PrepareReactObjectModel(model);
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Edit(CustomerActionModel model, bool continueEditing)
- {
- CheckValidateModel(model);
-
- var customeraction = await _customerActionService.GetCustomerActionById(model.Id);
- if (customeraction == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- customeraction = await _customerActionViewModelService.UpdateCustomerActionModel(customeraction, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerAction.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = customeraction.Id }) : RedirectToAction("List");
- }
- await _customerActionViewModelService.PrepareReactObjectModel(model);
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = customeraction.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> History(DataSourceRequest command, string customerActionId)
- {
- var history = await _customerActionService.GetAllCustomerActionHistory(customerActionId,
- pageIndex: command.Page - 1,
- pageSize: command.PageSize);
- var items = new List<SerializeCustomerActionHistory>();
- foreach (var item in history)
- {
- items.Add(await _customerActionViewModelService.PrepareHistoryModelForList(item));
- }
- var gridModel = new DataSourceResult
- {
- Data = items,
- Total = history.TotalCount
- };
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> Delete(string id, [FromServices] IWorkContext workContext)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(id);
- if (customerAction == null)
- return RedirectToAction("List");
-
- try
- {
- //activity log
- _ = _customerActivityService.InsertActivity("DeleteCustomerAction", customerAction.Id,
- workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.DeleteCustomerAction"), customerAction.Name);
- await _customerActionService.DeleteCustomerAction(customerAction);
- Success(_translationService.GetResource("Admin.Customers.CustomerAction.Deleted"));
- return RedirectToAction("List");
- }
- catch (Exception exc)
- {
- Error(exc.Message);
- return RedirectToAction("Edit", new { id = customerAction.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> Conditions(string customerActionId)
- {
- var conditions = await _customerActionService.GetCustomerActionById(customerActionId);
- var gridModel = new DataSourceResult
- {
- Data = conditions.Conditions.Select(x => new { Id = x.Id, Name = x.Name, Condition = x.CustomerActionConditionTypeId.ToString() }),
- Total = conditions.Conditions.Count()
- };
- return Json(gridModel);
- }
-
- #endregion
-
- #region Conditions
-
- public async Task<IActionResult> AddCondition(string customerActionId)
- {
- var model = await _customerActionViewModelService.PrepareCustomerActionConditionModel(customerActionId);
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> AddCondition(CustomerActionConditionModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var customerAction = await _customerActionViewModelService.InsertCustomerActionConditionModel(model);
- Success(_translationService.GetResource("Admin.Customers.CustomerActionCondition.Added"));
- return continueEditing ? RedirectToAction("EditCondition", new { customerActionId = customerAction.customerActionId, cid = customerAction.conditionId }) : RedirectToAction("Edit", new { id = customerAction.customerActionId });
- }
- return View(model);
- }
-
- public async Task<IActionResult> EditCondition(string customerActionId, string cid)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);
- if (customerAction == null)
- return RedirectToAction("List");
- var actionType = await _customerActionService.GetCustomerActionTypeById(customerAction.ActionTypeId);
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == cid);
- if (condition == null)
- return RedirectToAction("List");
-
- var model = condition.ToModel();
- model.CustomerActionId = customerActionId;
-
- foreach (var item in actionType.ConditionType)
- {
- model.CustomerActionConditionType.Add(new SelectListItem()
- {
- Value = item.ToString(),
- Text = ((CustomerActionConditionTypeEnum)item).ToString()
- });
- }
-
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> EditCondition(string customerActionId, string cid, CustomerActionConditionModel model, bool continueEditing)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);
- if (customerAction == null)
- return RedirectToAction("List");
-
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == cid);
- if (condition == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- await _customerActionViewModelService.UpdateCustomerActionConditionModel(customerAction, condition, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerActionCondition.Updated"));
- return continueEditing ? RedirectToAction("EditCondition", new { customerActionId = customerAction.Id, cid = condition.Id }) : RedirectToAction("Edit", new { id = customerAction.Id });
- }
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = customerAction.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionDelete(string Id, string customerActionId)
- {
- await _customerActionViewModelService.ConditionDelete(Id, customerActionId);
- return new JsonResult("");
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionDeletePosition(string id, string customerActionId, string conditionId)
- {
- await _customerActionViewModelService.ConditionDeletePosition(id, customerActionId, conditionId);
-
- return new JsonResult("");
- }
- #endregion
-
- #region Condition Product
-
- [HttpPost]
- public async Task<IActionResult> ConditionProduct(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string ProductName)>();
- foreach (var item in condition.Products)
- {
- var product = (await _productService.GetProductById(item))?.Name;
- items.Add((item, product));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, ProductName = x.ProductName }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
-
- public async Task<IActionResult> ProductAddPopup(string customerActionId, string conditionId)
- {
- var model = await _customerActionViewModelService.PrepareAddProductToConditionModel(customerActionId, conditionId);
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> ProductAddPopupList(DataSourceRequest command, CustomerActionConditionModel.AddProductToConditionModel model)
- {
- var products = await _customerActionViewModelService.PrepareProductModel(model, command.Page, command.PageSize);
- var gridModel = new DataSourceResult();
- gridModel.Data = products.products.ToList();
- gridModel.Total = products.totalCount;
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ProductAddPopup(CustomerActionConditionModel.AddProductToConditionModel model)
- {
- if (model.SelectedProductIds != null)
- {
- await _customerActionViewModelService.InsertProductToConditionModel(model);
- }
- return Content("");
- }
- #endregion
-
- #region Condition Category
-
- [HttpPost]
- public async Task<IActionResult> ConditionCategory(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CategoryName)>();
- foreach (var item in condition.Categories)
- {
- var category = (await _categoryService.GetCategoryById(item))?.Name;
- items.Add((item, category));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CategoryName = x.CategoryName }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- public IActionResult CategoryAddPopup(string customerActionId, string conditionId)
- {
- var model = new CustomerActionConditionModel.AddCategoryConditionModel
- {
- CustomerActionConditionId = conditionId,
- CustomerActionId = customerActionId
- };
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> CategoryAddPopupList(DataSourceRequest command, CustomerActionConditionModel.AddCategoryConditionModel model)
- {
- var categories = await _categoryService.GetAllCategories(categoryName: model.SearchCategoryName,
- pageIndex: command.Page - 1, pageSize: command.PageSize, showHidden: true);
- var items = new List<CategoryModel>();
- foreach (var x in categories)
- {
- var categoryModel = x.ToModel();
- categoryModel.Breadcrumb = await _categoryService.GetFormattedBreadCrumb(x);
- items.Add(categoryModel);
- }
- var gridModel = new DataSourceResult
- {
- Data = items,
- Total = categories.TotalCount
- };
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> CategoryAddPopup(CustomerActionConditionModel.AddCategoryConditionModel model)
- {
- if (model.SelectedCategoryIds != null)
- {
- await _customerActionViewModelService.InsertCategoryConditionModel(model);
- }
- return Content("");
- }
-
- #endregion
-
- #region Condition Collection
- [HttpPost]
- public async Task<IActionResult> ConditionCollection(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var items = new List<(string Id, string CollectionName)>();
- foreach (var item in condition.Collections)
- {
- var collection = (await _collectionService.GetCollectionById(item))?.Name;
- items.Add((item, collection));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CollectionName = x.CollectionName }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- public IActionResult CollectionAddPopup(string customerActionId, string conditionId)
- {
- var model = new CustomerActionConditionModel.AddCollectionConditionModel
- {
- CustomerActionConditionId = conditionId,
- CustomerActionId = customerActionId
- };
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> CollectionAddPopupList(DataSourceRequest command, CustomerActionConditionModel.AddCollectionConditionModel model)
- {
- var collections = await _collectionService.GetAllCollections(model.SearchCollectionName, "",
- command.Page - 1, command.PageSize, true);
- var gridModel = new DataSourceResult
- {
- Data = collections.Select(x => x.ToModel()),
- Total = collections.TotalCount
- };
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> CollectionAddPopup(CustomerActionConditionModel.AddCollectionConditionModel model)
- {
- if (model.SelectedCollectionIds != null)
- {
- await _customerActionViewModelService.InsertCollectionConditionModel(model);
- }
- return Content("");
- }
-
- #endregion
-
- #region Condition Vendor
-
- [HttpPost]
- public async Task<IActionResult> ConditionVendor(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var vendors = await _vendorService.GetAllVendors();
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.Vendors.Select(z => new { Id = z, VendorName = vendors.FirstOrDefault(y => y.Id == z).Name }) : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionVendorInsert(CustomerActionConditionModel.AddVendorConditionModel model)
- {
- await _customerActionViewModelService.InsertVendorConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> Vendors()
- {
- var customerVendors = (await _vendorService.GetAllVendors()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerVendors);
- }
- #endregion
-
- #region Condition Customer group
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerGroup(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CustomerGroup)>();
- foreach (var item in condition.CustomerGroups)
- {
- var roles = (await _groupService.GetCustomerGroupById(item))?.Name;
- items.Add((item, roles));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CustomerGroup = x.CustomerGroup }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerGroupInsert(CustomerActionConditionModel.AddCustomerGroupConditionModel model)
- {
- await _customerActionViewModelService.InsertCustomerGroupConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> CustomerGroups()
- {
- var customerGroup = (await _groupService.GetAllCustomerGroups()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerGroup);
- }
-
- #endregion
-
- #region Stores
-
- [HttpGet]
- public async Task<IActionResult> Stores()
- {
- var stores = (await _storeService.GetAllStores()).Select(x => new { Id = x.Id, Name = x.Shortcut });
- return Json(stores);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionStore(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string Store)>();
- foreach (var item in condition.Stores)
- {
- var store = (await _storeService.GetStoreById(item))?.Shortcut;
- items.Add((item, store));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, Store = x.Store }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionStoreInsert(CustomerActionConditionModel.AddStoreConditionModel model)
- {
- await _customerActionViewModelService.InsertStoreConditionModel(model);
- return new JsonResult("");
- }
-
- #endregion
-
- #region Customer Tags
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerTag(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CustomerTag)>();
- foreach (var item in condition.CustomerTags)
- {
- var tag = (await _customerTagService.GetCustomerTagById(item))?.Name;
- items.Add((item, tag));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CustomerTag = x.CustomerTag }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerTagInsert(CustomerActionConditionModel.AddCustomerTagConditionModel model)
- {
- await _customerActionViewModelService.InsertCustomerTagConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> CustomerTags()
- {
- var customerTag = (await _customerTagService.GetAllCustomerTags()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerTag);
- }
- #endregion
-
- #region Condition Product Attributes
-
- [HttpPost]
- public async Task<IActionResult> ConditionProductAttribute(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string ProductAttributeId, string ProductAttributeName)>();
- foreach (var item in condition.ProductAttribute)
- {
- var pa = (await _productAttributeService.GetProductAttributeById(item.ProductAttributeId))?.Name;
- items.Add((item.Id, item.ProductAttributeId, pa));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, ProductAttributeId = x.ProductAttributeId, ProductAttributeName = x.ProductAttributeName }),
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionProductAttributeInsert(CustomerActionConditionModel.AddProductAttributeConditionModel model)
- {
- await _customerActionViewModelService.InsertProductAttributeConditionModel(model);
- return new JsonResult("");
- }
- [HttpPost]
- public async Task<IActionResult> ConditionProductAttributeUpdate(CustomerActionConditionModel.AddProductAttributeConditionModel model)
- {
- await _customerActionViewModelService.UpdateProductAttributeConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> ProductAttributes()
- {
- var customerAttr = (await _productAttributeService.GetAllProductAttributes()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerAttr);
- }
- #endregion
-
- #region Condition Product Specification
-
- [HttpPost]
- public async Task<IActionResult> ConditionProductSpecification(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var specs = await _specificationAttributeService.GetSpecificationAttributes();
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.ProductSpecifications
- .Select(z => new
- {
- Id = z.Id,
- SpecificationId = z.ProductSpecyficationId,
- SpecificationName = specs.FirstOrDefault(x => x.Id == z.ProductSpecyficationId)?.Name,
- SpecificationValueName = !String.IsNullOrEmpty(z.ProductSpecyficationValueId) ? specs.FirstOrDefault(x => x.Id == z.ProductSpecyficationId).SpecificationAttributeOptions.FirstOrDefault(x => x.Id == z.ProductSpecyficationValueId).Name : "Undefined"
- }) : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionProductSpecificationInsert(CustomerActionConditionModel.AddProductSpecificationConditionModel model)
- {
- await _customerActionViewModelService.InsertProductSpecificationConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> ProductSpecification()
- {
- var customerAttr = (await _specificationAttributeService.GetSpecificationAttributes()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerAttr);
- }
-
- [HttpGet]
- public async Task<IActionResult> ProductSpecificationValue(string specificationId)
- {
- if (String.IsNullOrEmpty(specificationId))
- return new JsonResult("");
-
- var customerSpec = (await _specificationAttributeService.GetSpecificationAttributeById(specificationId)).SpecificationAttributeOptions.Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerSpec);
- }
-
- #endregion
-
- #region Condition Customer Register
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegister(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.CustomerRegistration.Select(z => new
- {
- Id = z.Id,
- CustomerRegisterName = z.RegisterField,
- CustomerRegisterValue = z.RegisterValue
- })
- : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegisterInsert(CustomerActionConditionModel.AddCustomerRegisterConditionModel model)
- {
- await _customerActionViewModelService.InsertCustomerRegisterConditionModel(model);
- return new JsonResult("");
- }
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegisterUpdate(CustomerActionConditionModel.AddCustomerRegisterConditionModel model)
- {
- await _customerActionViewModelService.UpdateCustomerRegisterConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public IActionResult CustomerRegisterFields()
- {
- var list = new List<Tuple<string, string>>();
- list.Add(Tuple.Create("Gender", "Gender"));
- list.Add(Tuple.Create("Company", "Company"));
- list.Add(Tuple.Create("CountryId", "CountryId"));
- list.Add(Tuple.Create("City", "City"));
- list.Add(Tuple.Create("StateProvinceId", "StateProvinceId"));
- list.Add(Tuple.Create("StreetAddress", "StreetAddress"));
- list.Add(Tuple.Create("ZipPostalCode", "ZipPostalCode"));
- list.Add(Tuple.Create("Phone", "Phone"));
- list.Add(Tuple.Create("Fax", "Fax"));
-
- var customer = list.Select(x => new { Id = x.Item1, Name = x.Item2 });
- return Json(customer);
- }
- #endregion
-
- #region Condition Custom Customer Attribute
-
- private async Task<string> CustomerAttribute(string registerField)
- {
- string _field = registerField;
- var _rf = registerField.Split(':');
- if (_rf.Count() > 1)
- {
- var ca = await _customerAttributeService.GetCustomerAttributeById(_rf.FirstOrDefault());
- if (ca != null)
- {
- _field = ca.Name;
- if (ca.CustomerAttributeValues.FirstOrDefault(x => x.Id == _rf.LastOrDefault()) != null)
- {
- _field = ca.Name + "->" + ca.CustomerAttributeValues.FirstOrDefault(x => x.Id == _rf.LastOrDefault()).Name;
- }
- }
-
- }
-
- return _field;
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttribute(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.CustomCustomerAttributes.Select(z => new
- {
- Id = z.Id,
- CustomerAttributeId = CustomerAttribute(z.RegisterField),
- CustomerAttributeName = z.RegisterField,
- CustomerAttributeValue = z.RegisterValue
- })
- : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttributeInsert(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- await _customerActionViewModelService.InsertCustomCustomerAttributeConditionModel(model);
- return new JsonResult("");
- }
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttributeUpdate(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- await _customerActionViewModelService.UpdateCustomCustomerAttributeConditionModel(model);
- return new JsonResult("");
- }
-
- [HttpGet]
- public async Task<IActionResult> CustomCustomerAttributeFields()
- {
- var list = new List<Tuple<string, string>>();
- foreach (var item in await _customerAttributeService.GetAllCustomerAttributes())
- {
- if (item.AttributeControlTypeId == AttributeControlType.Checkboxes ||
- item.AttributeControlTypeId == AttributeControlType.DropdownList ||
- item.AttributeControlTypeId == AttributeControlType.RadioList)
- {
- foreach (var value in item.CustomerAttributeValues)
- {
- list.Add(Tuple.Create(string.Format("{0}:{1}", item.Id, value.Id), item.Name + "->" + value.Name));
- }
- }
- }
- var customer = list.Select(x => new { Id = x.Item1, Name = x.Item2 });
- return Json(customer);
- }
- #endregion
-
- #region Url Referrer
-
- [HttpPost]
- public async Task<IActionResult> ConditionUrlReferrer(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.UrlReferrer.Select(z => new { Id = z.Id, Name = z.Name }) : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionUrlReferrerInsert(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- await _customerActionViewModelService.InsertUrlConditionModel(model);
- return new JsonResult("");
- }
- [HttpPost]
- public async Task<IActionResult> ConditionUrlReferrerUpdate(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- await _customerActionViewModelService.UpdateUrlConditionModel(model);
- return new JsonResult("");
- }
-
- #endregion
-
- #region Url Current
-
- [HttpPost]
- public async Task<IActionResult> ConditionUrlCurrent(string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.UrlCurrent.Select(z => new { Id = z.Id, Name = z.Name }) : null,
- Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionUrlCurrentInsert(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- await _customerActionViewModelService.InsertUrlCurrentConditionModel(model);
- return new JsonResult("");
- }
- [HttpPost]
- public async Task<IActionResult> ConditionUrlCurrentUpdate(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- await _customerActionViewModelService.UpdateUrlCurrentConditionModel(model);
- return new JsonResult("");
- }
-
- #endregion
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerActionTypeController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerActionTypeController.cs
deleted file mode 100644
index c025f9ce3..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerActionTypeController.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Web.Common.Security.Authorization;
-using Grand.Web.Admin.Extensions;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Grand.Web.Admin.Controllers
-{
- [PermissionAuthorize(PermissionSystemName.Actions)]
- public partial class CustomerActionTypeController : BaseAdminController
- {
- #region Fields
- private readonly ICustomerActionService _customerActionService;
- private readonly ITranslationService _translationService;
- #endregion Fields
-
- #region Constructors
-
- public CustomerActionTypeController(
- ITranslationService translationService,
- ICustomerActionService customerActionService
- )
- {
- _customerActionService = customerActionService;
- _translationService = translationService;
- }
-
- #endregion
-
- #region Action types
-
- public async Task<IActionResult> ListTypes()
- {
- var model = (await _customerActionService.GetCustomerActionType())
- .Select(x => x.ToModel())
- .ToList();
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> SaveTypes(IFormCollection form)
- {
- string formKey = "checkbox_action_types";
- var checkedActionTypes = form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToList() : new List<string>();
-
- var activityTypes = await _customerActionService.GetCustomerActionType();
- foreach (var actionType in activityTypes)
- {
- actionType.Enabled = checkedActionTypes.Contains(actionType.Id);
- await _customerActionService.UpdateCustomerActionType(actionType);
- }
- Success(_translationService.GetResource("Admin.Customers.ActionType.Updated"));
- return RedirectToAction("ListTypes");
- }
-
- #endregion
-
-
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerReminderController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerReminderController.cs
deleted file mode 100644
index 46f3842fc..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerReminderController.cs
+++ /dev/null
@@ -1,824 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Categories;
-using Grand.Business.Core.Interfaces.Catalog.Collections;
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Domain.Catalog;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-using Grand.Web.Common.DataSource;
-using Grand.Web.Common.Filters;
-using Grand.Web.Common.Security.Authorization;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Grand.Web.Admin.Controllers
-{
- [PermissionAuthorize(PermissionSystemName.Reminders)]
- public partial class CustomerReminderController : BaseAdminController
- {
- #region Fields
-
- private readonly ICustomerReminderViewModelService _customerReminderViewModelService;
- private readonly ICustomerService _customerService;
- private readonly IGroupService _groupService;
- private readonly ICustomerAttributeService _customerAttributeService;
- private readonly ICustomerTagService _customerTagService;
- private readonly ITranslationService _translationService;
- private readonly ICollectionService _collectionService;
- private readonly IStoreService _storeService;
- private readonly IVendorService _vendorService;
- private readonly ICustomerReminderService _customerReminderService;
- private readonly IEmailAccountService _emailAccountService;
- private readonly IDateTimeService _dateTimeService;
-
- #endregion
-
- #region Constructors
-
- public CustomerReminderController(
- ICustomerReminderViewModelService customerReminderViewModelService,
- ICustomerService customerService,
- IGroupService groupService,
- ICustomerAttributeService customerAttributeService,
- ICustomerTagService customerTagService,
- ITranslationService translationService,
- ICollectionService collectionService,
- IStoreService storeService,
- IVendorService vendorService,
- ICustomerReminderService customerReminderService,
- IEmailAccountService emailAccountService,
- IDateTimeService dateTimeService)
- {
- _customerReminderViewModelService = customerReminderViewModelService;
- _customerService = customerService;
- _groupService = groupService;
- _customerAttributeService = customerAttributeService;
- _customerTagService = customerTagService;
- _translationService = translationService;
- _collectionService = collectionService;
- _storeService = storeService;
- _vendorService = vendorService;
- _customerReminderService = customerReminderService;
- _emailAccountService = emailAccountService;
- _dateTimeService = dateTimeService;
- }
-
- #endregion
-
- #region Customer reminders
-
- public IActionResult Index() => RedirectToAction("List");
-
- public IActionResult List() => View();
-
- [HttpPost]
- public async Task<IActionResult> List(DataSourceRequest command)
- {
- var customeractions = await _customerReminderService.GetCustomerReminders();
- var gridModel = new DataSourceResult
- {
- Data = customeractions.Select(x => new { Id = x.Id, Name = x.Name, Active = x.Active, Rule = x.ReminderRuleId.ToString() }),
- Total = customeractions.Count()
- };
- return Json(gridModel);
- }
-
- public IActionResult Create()
- {
- var model = _customerReminderViewModelService.PrepareCustomerReminderModel();
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Create(CustomerReminderModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var customerreminder = await _customerReminderViewModelService.InsertCustomerReminderModel(model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminder.Added"));
- return continueEditing ? RedirectToAction("Edit", new { id = customerreminder.Id }) : RedirectToAction("List");
- }
- //If we got this far, something failed, redisplay form
- return View(model);
- }
-
- public async Task<IActionResult> Edit(string id)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(id);
- if (customerReminder == null)
- return RedirectToAction("List");
- var model = customerReminder.ToModel(_dateTimeService);
- model.ConditionCount = customerReminder.Conditions.Count();
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Edit(CustomerReminderModel model, bool continueEditing)
- {
- var customerreminder = await _customerReminderService.GetCustomerReminderById(model.Id);
- if (customerreminder == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- customerreminder = await _customerReminderViewModelService.UpdateCustomerReminderModel(customerreminder, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminder.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = customerreminder.Id }) : RedirectToAction("List");
- }
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = customerreminder.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> Run(string Id)
- {
- var reminder = await _customerReminderService.GetCustomerReminderById(Id);
- if (reminder == null)
- return RedirectToAction("List");
-
- await _customerReminderViewModelService.RunReminder(reminder);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminder.Run"));
- return RedirectToAction("Edit", new { id = Id });
- }
-
- [HttpPost]
- public async Task<IActionResult> Delete(string id)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(id);
- if (customerReminder == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.DeleteCustomerReminder(customerReminder);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminder.Deleted"));
- return RedirectToAction("List");
- }
- else
- {
- return RedirectToAction("Edit", new { id = id });
- }
- }
- catch (Exception exc)
- {
- Error(exc.Message);
- return RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> History(DataSourceRequest command, string customerReminderId)
- {
- //we use own own binder for searchCustomerGroupIds property
- var history = await _customerReminderService.GetAllCustomerReminderHistory(customerReminderId,
- pageIndex: command.Page - 1,
- pageSize: command.PageSize);
- var items = new List<SerializeCustomerReminderHistoryModel>();
- foreach (var item in history)
- {
- items.Add(await _customerReminderViewModelService.PrepareHistoryModelForList(item));
- }
- var gridModel = new DataSourceResult
- {
- Data = items,
- Total = history.TotalCount
- };
- return Json(gridModel);
- }
-
- #endregion
-
- #region Condition
-
- [HttpPost]
- public async Task<IActionResult> Conditions(string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var gridModel = new DataSourceResult
- {
- Data = customerReminder.Conditions.Select(x => new
- { Id = x.Id, Name = x.Name, Condition = x.ConditionId.ToString() }),
- Total = customerReminder.Conditions.Count()
- };
- return Json(gridModel);
- }
-
- public async Task<IActionResult> AddCondition(string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder == null)
- return RedirectToAction("Edit", new { id = customerReminderId });
-
- var model = _customerReminderViewModelService.PrepareConditionModel(customerReminder);
- return View(model);
-
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> AddCondition(CustomerReminderModel.ConditionModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder == null)
- {
- return RedirectToAction("List");
- }
- var condition = await _customerReminderViewModelService.InsertConditionModel(customerReminder, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminder.Condition.Added"));
-
- return continueEditing ? RedirectToAction("EditCondition", new { customerReminderId = customerReminder.Id, cid = condition.Id }) : RedirectToAction("Edit", new { id = customerReminder.Id });
- }
-
- return View(model);
- }
-
- public async Task<IActionResult> EditCondition(string customerReminderId, string cid)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder == null)
- return RedirectToAction("List");
-
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == cid);
- if (condition == null)
- return RedirectToAction("List");
- var model = _customerReminderViewModelService.PrepareConditionModel(customerReminder, condition);
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> EditCondition(string customerReminderId, string cid, CustomerReminderModel.ConditionModel model, bool continueEditing)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder == null)
- return RedirectToAction("List");
-
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == cid);
- if (condition == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- condition = await _customerReminderViewModelService.UpdateConditionModel(customerReminder, condition, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminderCondition.Updated"));
- return continueEditing ? RedirectToAction("EditCondition", new { customerReminderId = customerReminder.Id, cid = condition.Id }) : RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionDelete(string Id, string customerReminderId)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.ConditionDelete(Id, customerReminderId);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
-
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionDeletePosition(string id, string customerReminderId, string conditionId)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.ConditionDeletePosition(id, customerReminderId, conditionId);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
-
- #region Condition Category
-
- [HttpPost]
- public async Task<IActionResult> ConditionCategory(string customerReminderId, string conditionId, [FromServices] ICategoryService categoryService)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CategoryName)>();
- foreach (var item in condition.Categories)
- {
- var category = await categoryService.GetCategoryById(item);
- items.Add((item, category?.Name));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CategoryName = x.CategoryName }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- public IActionResult CategoryAddPopup(string customerReminderId, string conditionId)
- {
- var model = new CustomerReminderModel.ConditionModel.AddCategoryConditionModel
- {
- ConditionId = conditionId,
- CustomerReminderId = customerReminderId
- };
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> CategoryAddPopupList(DataSourceRequest command, CustomerReminderModel.ConditionModel.AddCategoryConditionModel model, [FromServices] ICategoryService categoryService)
- {
- var categories = await categoryService.GetAllCategories(categoryName: model.SearchCategoryName,
- pageIndex: command.Page - 1, pageSize: command.PageSize, showHidden: true);
- var items = new List<CategoryModel>();
- foreach (var item in categories)
- {
- var categoryModel = item.ToModel();
- categoryModel.Breadcrumb = await categoryService.GetFormattedBreadCrumb(item);
- items.Add(categoryModel);
- }
- var gridModel = new DataSourceResult
- {
- Data = items,
- Total = categories.TotalCount
- };
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> CategoryAddPopup(CustomerReminderModel.ConditionModel.AddCategoryConditionModel model)
- {
- if (model.SelectedCategoryIds != null)
- {
- await _customerReminderViewModelService.InsertCategoryConditionModel(model);
- }
- return Content("");
- }
-
- #endregion
-
- #region Condition Collection
- [HttpPost]
- public async Task<IActionResult> ConditionCollection(string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CollectionName)>();
- foreach (var item in condition.Collections)
- {
- var manuf = await _collectionService.GetCollectionById(item);
- items.Add((item, manuf?.Name));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CollectionName = x.CollectionName }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- public IActionResult CollectionAddPopup(string customerReminderId, string conditionId)
- {
- var model = new CustomerReminderModel.ConditionModel.AddCollectionConditionModel
- {
- ConditionId = conditionId,
- CustomerReminderId = customerReminderId
- };
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> CollectionAddPopupList(DataSourceRequest command, CustomerReminderModel.ConditionModel.AddCollectionConditionModel model)
- {
- var collections = await _collectionService.GetAllCollections(model.SearchCollectionName, "",
- command.Page - 1, command.PageSize, true);
- var gridModel = new DataSourceResult
- {
- Data = collections.Select(x => x.ToModel()),
- Total = collections.TotalCount
- };
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> CollectionAddPopup(CustomerReminderModel.ConditionModel.AddCollectionConditionModel model)
- {
- if (model.SelectedCollectionIds != null)
- {
- await _customerReminderViewModelService.InsertCollectionConditionModel(model);
- }
- return Content("");
- }
- #endregion
-
- #region Condition Product
-
- [HttpPost]
- public async Task<IActionResult> ConditionProduct(string customerReminderId, string conditionId, [FromServices] IProductService productService)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string ProductName)>();
- foreach (var item in condition.Products)
- {
- var prod = await productService.GetProductById(item);
- items.Add((item, prod?.Name));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, ProductName = x.ProductName }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- public async Task<IActionResult> ProductAddPopup(string customerReminderId, string conditionId)
- {
- var model = await _customerReminderViewModelService.PrepareProductToConditionModel(customerReminderId, conditionId);
- return View(model);
- }
-
- [HttpPost]
- public async Task<IActionResult> ProductAddPopupList(DataSourceRequest command, CustomerActionConditionModel.AddProductToConditionModel model)
- {
- var gridModel = new DataSourceResult();
- var products = await _customerReminderViewModelService.PrepareProductModel(model, command.Page, command.PageSize);
- gridModel.Data = products.products.ToList();
- gridModel.Total = products.totalCount;
-
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ProductAddPopup(CustomerReminderModel.ConditionModel.AddProductToConditionModel model)
- {
- if (model.SelectedProductIds != null)
- {
- await _customerReminderViewModelService.InsertProductToConditionModel(model);
- }
- return Content("");
- }
-
-
- #endregion
-
- #region Customer Tags
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerTag(string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CustomerTag)>();
- foreach (var item in condition.CustomerTags)
- {
- var tag = await _customerTagService.GetCustomerTagById(item);
- items.Add((item, tag?.Name));
- }
-
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CustomerTag = x.CustomerTag }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerTagInsert(CustomerReminderModel.ConditionModel.AddCustomerTagConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.InsertCustomerTagConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
-
-
- [HttpGet]
- public async Task<IActionResult> CustomerTags()
- {
- var customerTag = (await _customerTagService.GetAllCustomerTags()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerTag);
- }
- #endregion
-
- #region Condition Customer group
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerGroup(string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CustomerGroup)>();
- foreach (var item in condition.CustomerGroups)
- {
- var role = await _groupService.GetCustomerGroupById(item);
- items.Add((item, role?.Name));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CustomerGroup = x.CustomerGroup }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerGroupInsert(CustomerReminderModel.ConditionModel.AddCustomerGroupConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.InsertCustomerGroupConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
-
- [HttpGet]
- public async Task<IActionResult> CustomerGroups()
- {
- var customerGroup = (await _groupService.GetAllCustomerGroups()).Select(x => new { Id = x.Id, Name = x.Name });
- return Json(customerGroup);
- }
-
- #endregion
-
- #region Condition Customer Register
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegister(string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- var gridModel = new DataSourceResult
- {
- Data = condition != null ? condition.CustomerRegistration.Select(z => new
- {
- Id = z.Id,
- CustomerRegisterName = z.RegisterField,
- CustomerRegisterValue = z.RegisterValue
- })
- : null,
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegisterInsert(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.InsertCustomerRegisterConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
- [HttpPost]
- public async Task<IActionResult> ConditionCustomerRegisterUpdate(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.UpdateCustomerRegisterConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
-
- [HttpGet]
- public IActionResult CustomerRegisterFields()
- {
- var list = new List<Tuple<string, string>>();
- list.Add(Tuple.Create("Gender", "Gender"));
- list.Add(Tuple.Create("Company", "Company"));
- list.Add(Tuple.Create("CountryId", "CountryId"));
- list.Add(Tuple.Create("City", "City"));
- list.Add(Tuple.Create("StateProvinceId", "StateProvinceId"));
- list.Add(Tuple.Create("StreetAddress", "StreetAddress"));
- list.Add(Tuple.Create("ZipPostalCode", "ZipPostalCode"));
- list.Add(Tuple.Create("Phone", "Phone"));
- list.Add(Tuple.Create("Fax", "Fax"));
-
- var customer = list.Select(x => new { Id = x.Item1, Name = x.Item2 });
- return Json(customer);
- }
- #endregion
-
- #region Condition Custom Customer Attribute
-
- private async Task<string> CustomerAttribute(string registerField)
- {
- string _field = registerField;
- var _rf = registerField.Split(':');
- if (_rf.Count() > 1)
- {
- var ca = await _customerAttributeService.GetCustomerAttributeById(_rf.FirstOrDefault());
- if (ca != null)
- {
- _field = ca.Name;
- if (ca.CustomerAttributeValues.FirstOrDefault(x => x.Id == _rf.LastOrDefault()) != null)
- {
- _field = ca.Name + "->" + ca.CustomerAttributeValues.FirstOrDefault(x => x.Id == _rf.LastOrDefault()).Name;
- }
- }
-
- }
-
- return _field;
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttribute(string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
- var items = new List<(string Id, string CustomerAttributeId, string CustomerAttributeName, string CustomerAttributeValue)>();
- foreach (var item in condition.CustomCustomerAttributes)
- {
- items.Add((item.Id, await CustomerAttribute(item.RegisterField), item.RegisterField, item.RegisterValue));
- }
- var gridModel = new DataSourceResult
- {
- Data = items.Select(x => new { Id = x.Id, CustomerAttributeId = x.CustomerAttributeId, CustomerAttributeName = x.CustomerAttributeName, CustomerAttributeValue = x.CustomerAttributeValue }),
- Total = customerReminder.Conditions.Where(x => x.Id == conditionId).Count()
- };
- return Json(gridModel);
- }
-
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttributeInsert(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.InsertCustomCustomerAttributeConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
- [HttpPost]
- public async Task<IActionResult> ConditionCustomCustomerAttributeUpdate(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.UpdateCustomCustomerAttributeConditionModel(model);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
-
- [HttpGet]
- public async Task<IActionResult> CustomCustomerAttributeFields()
- {
- var list = new List<Tuple<string, string>>();
- foreach (var item in await _customerAttributeService.GetAllCustomerAttributes())
- {
- if (item.AttributeControlTypeId == AttributeControlType.Checkboxes ||
- item.AttributeControlTypeId == AttributeControlType.DropdownList ||
- item.AttributeControlTypeId == AttributeControlType.RadioList)
- {
- foreach (var value in item.CustomerAttributeValues)
- {
- list.Add(Tuple.Create(string.Format("{0}:{1}", item.Id, value.Id), item.Name + "->" + value.Name));
- }
- }
- }
- var customer = list.Select(x => new { Id = x.Item1, Name = x.Item2 });
- return Json(customer);
- }
- #endregion
-
- #endregion
-
- #region Levels
-
- [HttpPost]
- public async Task<IActionResult> Levels(string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var gridModel = new DataSourceResult
- {
- Data = customerReminder.Levels.Select(x => new
- { Id = x.Id, Name = x.Name, Level = x.Level }).OrderBy(x => x.Level),
- Total = customerReminder.Levels.Count()
- };
- return Json(gridModel);
- }
-
- public async Task<IActionResult> AddLevel(string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var model = new CustomerReminderModel.ReminderLevelModel();
- model.CustomerReminderId = customerReminderId;
- await _customerReminderViewModelService.PrepareReminderLevelModel(model, customerReminder);
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> AddLevel(CustomerReminderModel.ReminderLevelModel model, bool continueEditing)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder == null)
- {
- return RedirectToAction("List");
- }
- if (customerReminder.Levels.Where(x => x.Level == model.Level).Count() > 0)
- {
- ModelState.AddModelError("Error-LevelExists", _translationService.GetResource("Admin.Customers.CustomerReminderLevel.Exists"));
- }
-
- if (ModelState.IsValid)
- {
- var level = _customerReminderViewModelService.InsertReminderLevel(customerReminder, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminderLevel.Added"));
- return continueEditing ? RedirectToAction("EditLevel", new { customerReminderId = customerReminder.Id, cid = level.Id }) : RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- await _customerReminderViewModelService.PrepareReminderLevelModel(model, customerReminder);
- return View(model);
- }
-
- public async Task<IActionResult> EditLevel(string customerReminderId, string cid)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder == null)
- {
- return RedirectToAction("List");
- }
-
- var level = customerReminder.Levels.FirstOrDefault(x => x.Id == cid);
- if (level == null)
- return RedirectToAction("List");
-
- var model = level.ToModel();
- model.CustomerReminderId = customerReminderId;
- await _customerReminderViewModelService.PrepareReminderLevelModel(model, customerReminder);
- return View(model);
- }
-
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> EditLevel(string customerReminderId, string cid, CustomerReminderModel.ReminderLevelModel model, bool continueEditing)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder == null)
- return RedirectToAction("List");
-
- var level = customerReminder.Levels.FirstOrDefault(x => x.Id == cid);
- if (level == null)
- return RedirectToAction("List");
-
- if (level.Level != model.Level)
- {
- if (customerReminder.Levels.Where(x => x.Level == model.Level).Count() > 0)
- {
- ModelState.AddModelError("Error-LevelExists", _translationService.GetResource("Admin.Customers.CustomerReminderLevel.Exists"));
- }
- }
- try
- {
- if (ModelState.IsValid)
- {
- level = await _customerReminderViewModelService.UpdateReminderLevel(customerReminder, level, model);
- Success(_translationService.GetResource("Admin.Customers.CustomerReminderLevel.Updated"));
- return continueEditing ? RedirectToAction("EditLevel", new { customerReminderId = customerReminder.Id, cid = level.Id }) : RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- await _customerReminderViewModelService.PrepareReminderLevelModel(model, customerReminder);
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = customerReminder.Id });
- }
- }
-
- [HttpPost]
- public async Task<IActionResult> DeleteLevel(string Id, string customerReminderId)
- {
- if (ModelState.IsValid)
- {
- await _customerReminderViewModelService.DeleteLevel(Id, customerReminderId);
- return new JsonResult("");
- }
- return ErrorForKendoGridJson(ModelState);
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Controllers/InteractiveFormController.cs b/src/Web/Grand.Web.Admin/Controllers/InteractiveFormController.cs
deleted file mode 100644
index 8b0bc5aa0..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/InteractiveFormController.cs
+++ /dev/null
@@ -1,500 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Web.Common.DataSource;
-using Grand.Web.Common.Filters;
-using Grand.Web.Common.Security.Authorization;
-using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Models.Messages;
-using Microsoft.AspNetCore.Mvc;
-using Grand.Infrastructure;
-
-namespace Grand.Web.Admin.Controllers
-{
- [PermissionAuthorize(PermissionSystemName.InteractiveForms)]
- public partial class InteractiveFormController : BaseAdminController
- {
- private readonly IInteractiveFormService _interactiveFormService;
- private readonly ITranslationService _translationService;
- private readonly ILanguageService _languageService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly IEmailAccountService _emailAccountService;
- private readonly IWorkContext _workContext;
-
- public InteractiveFormController(IInteractiveFormService interactiveFormService,
- ITranslationService translationService,
- ILanguageService languageService,
- ICustomerActivityService customerActivityService,
- IEmailAccountService emailAccountService,
- IWorkContext workContext)
- {
- _interactiveFormService = interactiveFormService;
- _translationService = translationService;
- _languageService = languageService;
- _customerActivityService = customerActivityService;
- _emailAccountService = emailAccountService;
- _workContext = workContext;
- }
-
- #region Utilities
-
- private string FormatTokens(string[] tokens)
- {
- var sb = new StringBuilder();
- for (int i = 0; i < tokens.Length; i++)
- {
- string token = tokens[i];
- sb.Append(token);
- if (i != tokens.Length - 1)
- sb.Append(", ");
- }
- sb.Append(", %sendbutton%");
- sb.Append(", %errormessage%");
- return sb.ToString();
- }
- #endregion
-
- #region List forms
-
- public IActionResult Index() => RedirectToAction("List");
-
- public IActionResult List() => View();
-
- [PermissionAuthorizeAction(PermissionActionName.List)]
- [HttpPost]
- public async Task<IActionResult> List(DataSourceRequest command)
- {
- var forms = await _interactiveFormService.GetAllForms();
- var gridModel = new DataSourceResult
- {
- Data = forms.Select(x =>
- {
- var model = x.ToModel();
- model.Body = "";
- return model;
- }),
- Total = forms.Count
- };
- return Json(gridModel);
- }
- #endregion
-
- #region Update form
-
- [PermissionAuthorizeAction(PermissionActionName.Create)]
- public async Task<IActionResult> Create()
- {
- var model = new InteractiveFormModel();
- //locales
- await AddLocales(_languageService, model.Locales);
- //available email accounts
- foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
- model.AvailableEmailAccounts.Add(ea.ToModel());
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Create(InteractiveFormModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var form = model.ToEntity();
- form.CreatedOnUtc = DateTime.UtcNow;
-
- await _interactiveFormService.InsertForm(form);
- _ = _customerActivityService.InsertActivity("InteractiveFormAdd", form.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormAdd"), form.Name);
-
- Success(_translationService.GetResource("admin.marketing.InteractiveForms.Added"));
- return continueEditing ? RedirectToAction("Edit", new { id = form.Id }) : RedirectToAction("List");
- }
- //locales
- await AddLocales(_languageService, model.Locales);
- //available email accounts
- foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
- model.AvailableEmailAccounts.Add(ea.ToModel());
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Preview)]
- public async Task<IActionResult> Edit(string id)
- {
- var form = await _interactiveFormService.GetFormById(id);
- if (form == null)
- return RedirectToAction("List");
-
- var model = form.ToModel();
-
- await AddLocales(_languageService, model.Locales, (locale, languageId) =>
- {
- locale.Name = form.GetTranslation(x => x.Name, languageId, false);
- locale.Body = form.GetTranslation(x => x.Body, languageId, false);
- });
- //available email accounts
- foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
- model.AvailableEmailAccounts.Add(ea.ToModel());
-
- //available tokens
- model.AvailableTokens = FormatTokens(form.FormAttributes.Select(x => "%" + x.SystemName + "%").ToArray());
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> Edit(InteractiveFormModel model, bool continueEditing)
- {
- var form = await _interactiveFormService.GetFormById(model.Id);
- if (form == null)
- return RedirectToAction("List");
-
- if (ModelState.IsValid)
- {
- form = model.ToEntity(form);
- await _interactiveFormService.UpdateForm(form);
-
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", form.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormUpdate"), form.Name);
-
- Success(_translationService.GetResource("admin.marketing.InteractiveForms.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = form.Id }) : RedirectToAction("List");
- }
-
- await AddLocales(_languageService, model.Locales, (locale, languageId) =>
- {
- locale.Name = form.GetTranslation(x => x.Name, languageId, false);
- locale.Body = form.GetTranslation(x => x.Body, languageId, false);
- });
- //available email accounts
- foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
- model.AvailableEmailAccounts.Add(ea.ToModel());
-
- //available tokens
- model.AvailableTokens = FormatTokens(form.FormAttributes.Select(x => "%" + x.SystemName + "%").ToArray());
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Delete)]
- [HttpPost]
- public async Task<IActionResult> Delete(string id)
- {
- var form = await _interactiveFormService.GetFormById(id);
- if (form == null)
- return RedirectToAction("List");
-
- await _interactiveFormService.DeleteForm(form);
- _ = _customerActivityService.InsertActivity("InteractiveFormDelete", form.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormDeleted"), form.Name);
-
- Success(_translationService.GetResource("admin.marketing.InteractiveForms.Deleted"));
- return RedirectToAction("List");
- }
- #endregion
-
- #region Form attributes
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- public async Task<IActionResult> FormAttributesList(string formId)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
-
- var gridModel = new DataSourceResult
- {
- Data = form.FormAttributes.Select(x => new
- {
- Id = x.Id,
- Name = x.Name,
- SystemName = x.SystemName,
- Type = ((FormControlType)x.FormControlTypeId).ToString()
- }),
- Total = form.FormAttributes.Count()
- };
- return Json(gridModel);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Delete)]
- [HttpPost]
- public async Task<IActionResult> FormAttributesDelete(string id, string formId)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
-
- form.FormAttributes.Remove(form.FormAttributes.FirstOrDefault(x => x.Id == id));
- await _interactiveFormService.UpdateForm(form);
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", form.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormDeleteAttribute"), form.Name);
-
- return new JsonResult("");
- }
-
- #region Form Attributes
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- public async Task<IActionResult> AddAttribute(string formId)
- {
- InteractiveFormAttributeModel model = new InteractiveFormAttributeModel
- {
- FormId = formId
- };
-
- await AddLocales(_languageService, model.Locales);
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> AddAttribute(InteractiveFormAttributeModel model, bool continueEditing)
- {
- if (ModelState.IsValid)
- {
- var form = await _interactiveFormService.GetFormById(model.FormId);
- if (form == null)
- {
- return RedirectToAction("List");
- }
- var attribute = model.ToEntity();
- form.FormAttributes.Add(attribute);
- await _interactiveFormService.UpdateForm(form);
-
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", attribute.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormAddAttribute"), attribute.Name);
-
- Success(_translationService.GetResource("admin.marketing.InteractiveForms.Attribute.Added"));
-
- return continueEditing ? RedirectToAction("EditAttribute", new { formId = form.Id, aid = attribute.Id }) : RedirectToAction("Edit", new { id = form.Id });
- }
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- public async Task<IActionResult> EditAttribute(string formId, string aid)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
-
- var attribute = form.FormAttributes.FirstOrDefault(x => x.Id == aid);
- if (attribute == null)
- return RedirectToAction("List");
-
- var model = attribute.ToModel();
- model.FormId = formId;
-
- await AddLocales(_languageService, model.Locales, (locale, languageId) =>
- {
- locale.Name = attribute.GetTranslation(x => x.Name, languageId, false);
- });
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]
- public async Task<IActionResult> EditAttribute(string formId, InteractiveFormAttributeModel model, bool continueEditing)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
-
- var attribute = form.FormAttributes.FirstOrDefault(x => x.Id == model.Id);
- if (attribute == null)
- return RedirectToAction("List");
- try
- {
- if (ModelState.IsValid)
- {
- attribute = model.ToEntity(attribute);
- await _interactiveFormService.UpdateForm(form);
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", attribute.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormUpdateAttribute"), attribute.Name);
- Success(_translationService.GetResource("admin.marketing.InteractiveForms.Attribute.Updated"));
- return continueEditing ? RedirectToAction("EditAttribute", new { formId = form.Id, aid = attribute.Id }) : RedirectToAction("Edit", new { id = form.Id });
- }
- return View(model);
- }
- catch (Exception exc)
- {
- Error(exc);
- return RedirectToAction("Edit", new { id = form.Id });
- }
- }
-
- #endregion
-
- #region Attribute Value
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- public async Task<IActionResult> AttributeValuesList(string formId, string aId)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
- var values = form.FormAttributes.FirstOrDefault(x => x.Id == aId).FormAttributeValues;
- var gridModel = new DataSourceResult
- {
- Data = values.Select(x => new
- {
- Id = x.Id,
- Name = x.Name,
- IsPreSelected = x.IsPreSelected,
- DisplayOrder = x.DisplayOrder,
- }).OrderBy(x => x.DisplayOrder),
- Total = values.Count()
- };
- return Json(gridModel);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- public async Task<IActionResult> ValueCreatePopup(string form, string aId, string btnId, string formId)
- {
- var fo = await _interactiveFormService.GetFormById(form);
- if (fo == null)
- return RedirectToAction("List");
- var attribute = fo.FormAttributes.FirstOrDefault(x => x.Id == aId);
- if (attribute == null)
- return RedirectToAction("List");
-
- var model = new InteractiveFormAttributeValueModel
- {
- FormId = fo.Id,
- AttributeId = aId
- };
-
- ViewBag.RefreshPage = false;
- ViewBag.btnId = btnId;
- ViewBag.formId = formId;
-
- await AddLocales(_languageService, model.Locales);
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- public async Task<IActionResult> ValueCreatePopup(string btnId, string formId, string form, string aId, InteractiveFormAttributeValueModel model)
- {
- var fo = await _interactiveFormService.GetFormById(form);
- if (fo == null)
- return RedirectToAction("List");
- var attribute = fo.FormAttributes.FirstOrDefault(x => x.Id == aId);
- if (attribute == null)
- return RedirectToAction("List");
-
- if (ModelState.IsValid)
- {
- var vaf = model.ToEntity();
- attribute.FormAttributeValues.Add(vaf);
- await _interactiveFormService.UpdateForm(fo);
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", vaf.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormAddAttributeValue"), vaf.Name);
-
- return Content("");
- }
-
- return View(model);
- }
-
- //edit
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- public async Task<IActionResult> ValueEditPopup(string id, string form, string aId, string formId, string btnId)
- {
- var fo = await _interactiveFormService.GetFormById(form);
- if (fo == null)
- return RedirectToAction("List");
- var attribute = fo.FormAttributes.FirstOrDefault(x => x.Id == aId);
- if (attribute == null)
- return RedirectToAction("List");
-
- var vaf = attribute.FormAttributeValues.Where(x => x.Id == id).FirstOrDefault();
- if (vaf == null)
- return RedirectToAction("List");
-
- var model = vaf.ToModel();
- model.FormId = fo.Id;
- model.AttributeId = aId;
- await AddLocales(_languageService, model.Locales, (locale, languageId) =>
- {
- locale.Name = vaf.GetTranslation(x => x.Name, languageId, false);
- });
- ViewBag.RefreshPage = false;
- ViewBag.btnId = btnId;
- ViewBag.formId = formId;
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Edit)]
- [HttpPost]
- public async Task<IActionResult> ValueEditPopup(string btnId, string formId, string form, string aId, InteractiveFormAttributeValueModel model)
- {
- var fo = await _interactiveFormService.GetFormById(form);
- if (fo == null)
- return RedirectToAction("List");
- var attribute = fo.FormAttributes.FirstOrDefault(x => x.Id == aId);
- if (attribute == null)
- return RedirectToAction("List");
-
- var vaf = attribute.FormAttributeValues.Where(x => x.Id == model.Id).FirstOrDefault();
- if (vaf == null)
- return RedirectToAction("List");
-
- if (ModelState.IsValid)
- {
- vaf = model.ToEntity();
- await _interactiveFormService.UpdateForm(fo);
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", vaf.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormUpdateAttributeValue"), vaf.Name);
- return Content("");
- }
-
- return View(model);
- }
-
- [PermissionAuthorizeAction(PermissionActionName.Delete)]
- [HttpPost]
- public async Task<IActionResult> AttributeValuesDelete(string id, string formId, string aId)
- {
- var form = await _interactiveFormService.GetFormById(formId);
- if (form == null)
- return RedirectToAction("List");
- var attribute = form.FormAttributes.FirstOrDefault(x => x.Id == aId);
- if (attribute == null)
- return RedirectToAction("List");
-
- var vaf = attribute.FormAttributeValues.Where(x => x.Id == id).FirstOrDefault();
- if (vaf == null)
- return RedirectToAction("List");
-
- attribute.FormAttributeValues.Remove(vaf);
- await _interactiveFormService.UpdateForm(form);
- _ = _customerActivityService.InsertActivity("InteractiveFormEdit", vaf.Id,
- _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.InteractiveFormDeleteAttributeValue"), vaf.Name);
- return new JsonResult("");
- }
-
- #endregion
-
-
- #endregion
-
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
index 64e6fe9fb..4cd82888b 100644
--- a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
@@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Stores;
using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Knowledgebase;
@@ -12,6 +11,7 @@ using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
+using Grand.Business.Core.Interfaces.Cms;
namespace Grand.Web.Admin.Controllers
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Common.cs b/src/Web/Grand.Web.Admin/Extensions/Common.cs
new file mode 100644
index 000000000..3f565dfec
--- /dev/null
+++ b/src/Web/Grand.Web.Admin/Extensions/Common.cs
@@ -0,0 +1,7 @@
+namespace Grand.Web.Admin.Extensions
+{
+ public static class Common
+ {
+ public static string WwwRoot { get; set; } = "/_content/Grand.Web.Admin";
+ }
+}
diff --git a/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs
new file mode 100644
index 000000000..cf9dab8a7
--- /dev/null
+++ b/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs
@@ -0,0 +1,91 @@
+using Grand.Business.Core.Extensions;
+using Grand.Domain.Knowledgebase;
+
+namespace Grand.Web.Admin.Extensions
+{
+ /// <summary>
+ /// Extensions
+ /// </summary>
+ public static class KnowledgebaseExtensions
+ {
+ /// <summary>
+ /// Get formatted category breadcrumb
+ /// Note: ACL and store acl is ignored
+ /// </summary>
+ /// <param name="category">Category</param>
+ /// <param name="allCategories">All categories</param>
+ /// <param name="separator">Separator</param>
+ /// <param name="languageId">Language identifier for localization</param>
+ /// <returns>Formatted breadcrumb</returns>
+ public static string GetFormattedBreadCrumb(this KnowledgebaseCategory category,
+ IList<KnowledgebaseCategory> allCategories,
+ string separator = ">>", string languageId = "")
+ {
+ string result = string.Empty;
+
+ var breadcrumb = GetCategoryBreadCrumb(category, allCategories);
+ for (int i = 0; i <= breadcrumb.Count - 1; i++)
+ {
+ var categoryName = breadcrumb[i].GetTranslation(x => x.Name, languageId);
+ result = String.IsNullOrEmpty(result)
+ ? categoryName
+ : string.Format("{0} {1} {2}", result, separator, categoryName);
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Get category breadcrumb
+ /// </summary>
+ /// <param name="category">Category</param>
+ /// <param name="allCategories">All categories</param>
+ /// <returns>Category breadcrumb </returns>
+ public static IList<KnowledgebaseCategory> GetCategoryBreadCrumb(this KnowledgebaseCategory category, IList<KnowledgebaseCategory> allCategories)
+ {
+ if (category == null)
+ throw new ArgumentNullException(nameof(category));
+
+ var result = new List<KnowledgebaseCategory>();
+
+ //used to prevent circular references
+ var alreadyProcessedCategoryIds = new List<string>();
+
+ while (category != null && !alreadyProcessedCategoryIds.Contains(category.Id)) //prevent circular references
+ {
+ result.Add(category);
+
+ alreadyProcessedCategoryIds.Add(category.Id);
+
+ category = (from c in allCategories
+ where c.Id == category.ParentCategoryId
+ select c).FirstOrDefault();
+ }
+
+ result.Reverse();
+ return result;
+ }
+ public static List<KnowledgebaseCategory> SortCategoriesForTree(this IList<KnowledgebaseCategory> source, string parentId = null,
+ bool ignoreCategoriesWithoutExistingParent = false)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ var result = new List<KnowledgebaseCategory>();
+
+ foreach (var cat in source.Where(c => c.ParentCategoryId == parentId).ToList())
+ {
+ result.Add(cat);
+ result.AddRange(SortCategoriesForTree(source, cat.Id, true));
+ }
+ if (!ignoreCategoriesWithoutExistingParent && result.Count != source.Count)
+ {
+ //find categories without parent in provided category source and insert them into result
+ foreach (var cat in source)
+ if (result.FirstOrDefault(x => x.Id == cat.Id) == null)
+ result.Add(cat);
+ }
+ return result;
+ }
+ }
+}
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
index 58146583c..7c1ec266c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Common.Addresses;
+using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Domain.Catalog;
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/BannerMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/BannerMappingExtensions.cs
deleted file mode 100644
index 5085e922a..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/BannerMappingExtensions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class BannerMappingExtensions
- {
- public static BannerModel ToModel(this Banner entity)
- {
- return entity.MapTo<Banner, BannerModel>();
- }
-
- public static Banner ToEntity(this BannerModel model)
- {
- return model.MapTo<BannerModel, Banner>();
- }
-
- public static Banner ToEntity(this BannerModel model, Banner destination)
- {
- return model.MapTo(destination);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionMappingExtensions.cs
deleted file mode 100644
index 3eec57b86..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionMappingExtensions.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class CustomerActionMappingExtensions
- {
- public static CustomerActionModel ToModel(this CustomerAction entity, IDateTimeService dateTimeService)
- {
- var action = entity.MapTo<CustomerAction, CustomerActionModel>();
- action.StartDateTime = entity.StartDateTimeUtc.ConvertToUserTime(dateTimeService);
- action.EndDateTime = entity.EndDateTimeUtc.ConvertToUserTime(dateTimeService);
- return action;
- }
-
- public static CustomerAction ToEntity(this CustomerActionModel model, IDateTimeService dateTimeService)
- {
- var action = model.MapTo<CustomerActionModel, CustomerAction>();
- action.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);
- action.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);
- return action;
- }
-
- public static CustomerAction ToEntity(this CustomerActionModel model, CustomerAction destination, IDateTimeService dateTimeService)
- {
- var action = model.MapTo(destination);
- action.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);
- action.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);
- return action;
- }
-
- public static CustomerActionConditionModel ToModel(this CustomerAction.ActionCondition entity)
- {
- return entity.MapTo<CustomerAction.ActionCondition, CustomerActionConditionModel>();
- }
-
- public static CustomerAction.ActionCondition ToEntity(this CustomerActionConditionModel model)
- {
- return model.MapTo<CustomerActionConditionModel, CustomerAction.ActionCondition>();
- }
-
- public static CustomerAction.ActionCondition ToEntity(this CustomerActionConditionModel model, CustomerAction.ActionCondition destination)
- {
- return model.MapTo(destination);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionTypeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionTypeMappingExtensions.cs
deleted file mode 100644
index 3b244dc62..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerActionTypeMappingExtensions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class CustomerActionTypeMappingExtensions
- {
- public static CustomerActionTypeModel ToModel(this CustomerActionType entity)
- {
- return entity.MapTo<CustomerActionType, CustomerActionTypeModel>();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerReminderMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerReminderMappingExtensions.cs
deleted file mode 100644
index 96b50e036..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerReminderMappingExtensions.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class CustomerReminderMappingExtensions
- {
- public static CustomerReminderModel ToModel(this CustomerReminder entity, IDateTimeService dateTimeService)
- {
- var reminder = entity.MapTo<CustomerReminder, CustomerReminderModel>();
- reminder.StartDateTime = entity.StartDateTimeUtc.ConvertToUserTime(dateTimeService);
- reminder.EndDateTime = entity.EndDateTimeUtc.ConvertToUserTime(dateTimeService);
- reminder.LastUpdateDate = entity.LastUpdateDate.ConvertToUserTime(dateTimeService);
- return reminder;
-
- }
-
- public static CustomerReminder ToEntity(this CustomerReminderModel model, IDateTimeService dateTimeService)
- {
- var reminder = model.MapTo<CustomerReminderModel, CustomerReminder>();
- reminder.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);
- reminder.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);
- reminder.LastUpdateDate = model.LastUpdateDate.ConvertToUtcTime(dateTimeService);
- return reminder;
-
- }
-
- public static CustomerReminder ToEntity(this CustomerReminderModel model, CustomerReminder destination, IDateTimeService dateTimeService)
- {
- var reminder = model.MapTo(destination);
- reminder.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);
- reminder.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);
- reminder.LastUpdateDate = model.LastUpdateDate.ConvertToUtcTime(dateTimeService);
- return reminder;
- }
-
- public static CustomerReminderModel.ReminderLevelModel ToModel(this CustomerReminder.ReminderLevel entity)
- {
- return entity.MapTo<CustomerReminder.ReminderLevel, CustomerReminderModel.ReminderLevelModel>();
- }
-
- public static CustomerReminder.ReminderLevel ToEntity(this CustomerReminderModel.ReminderLevelModel model)
- {
- return model.MapTo<CustomerReminderModel.ReminderLevelModel, CustomerReminder.ReminderLevel>();
- }
-
- public static CustomerReminder.ReminderLevel ToEntity(this CustomerReminderModel.ReminderLevelModel model, CustomerReminder.ReminderLevel destination)
- {
- return model.MapTo(destination);
- }
-
- public static CustomerReminderModel.ConditionModel ToModel(this CustomerReminder.ReminderCondition entity)
- {
- return entity.MapTo<CustomerReminder.ReminderCondition, CustomerReminderModel.ConditionModel>();
- }
-
- public static CustomerReminder.ReminderCondition ToEntity(this CustomerReminderModel.ConditionModel model)
- {
- return model.MapTo<CustomerReminderModel.ConditionModel, CustomerReminder.ReminderCondition>();
- }
-
- public static CustomerReminder.ReminderCondition ToEntity(this CustomerReminderModel.ConditionModel model, CustomerReminder.ReminderCondition destination)
- {
- return model.MapTo(destination);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/InteractiveFormMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/InteractiveFormMappingExtensions.cs
deleted file mode 100644
index 53cfa11de..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/InteractiveFormMappingExtensions.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class InteractiveFormMappingExtensions
- {
- public static InteractiveFormModel ToModel(this InteractiveForm entity)
- {
- return entity.MapTo<InteractiveForm, InteractiveFormModel>();
- }
-
- public static InteractiveForm ToEntity(this InteractiveFormModel model)
- {
- return model.MapTo<InteractiveFormModel, InteractiveForm>();
- }
-
- public static InteractiveForm ToEntity(this InteractiveFormModel model, InteractiveForm destination)
- {
- return model.MapTo(destination);
- }
-
- public static InteractiveFormAttributeModel ToModel(this InteractiveForm.FormAttribute entity)
- {
- return entity.MapTo<InteractiveForm.FormAttribute, InteractiveFormAttributeModel>();
- }
-
- public static InteractiveForm.FormAttribute ToEntity(this InteractiveFormAttributeModel model)
- {
- return model.MapTo<InteractiveFormAttributeModel, InteractiveForm.FormAttribute>();
- }
-
- public static InteractiveForm.FormAttribute ToEntity(this InteractiveFormAttributeModel model, InteractiveForm.FormAttribute destination)
- {
- return model.MapTo(destination);
- }
-
- public static InteractiveFormAttributeValueModel ToModel(this InteractiveForm.FormAttributeValue entity)
- {
- return entity.MapTo<InteractiveForm.FormAttributeValue, InteractiveFormAttributeValueModel>();
- }
-
- public static InteractiveForm.FormAttributeValue ToEntity(this InteractiveFormAttributeValueModel model)
- {
- return model.MapTo<InteractiveFormAttributeValueModel, InteractiveForm.FormAttributeValue>();
- }
-
- public static InteractiveForm.FormAttributeValue ToEntity(this InteractiveFormAttributeValueModel model, InteractiveForm.FormAttributeValue destination)
- {
- return model.MapTo(destination);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs
new file mode 100644
index 000000000..dfc4452bb
--- /dev/null
+++ b/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs
@@ -0,0 +1,78 @@
+using Grand.Business.Core.Interfaces.Catalog.Products;
+using Grand.Business.Core.Interfaces.Storage;
+using Grand.Domain.Catalog;
+using Grand.Domain.Common;
+using Grand.Domain.Media;
+
+namespace Grand.Web.Admin.Extensions
+{
+ public static class ProductExtensions
+ {
+ /// <summary>
+ /// Get product picture (for shopping cart and order details pages)
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Atributes </param>
+ /// <param name="pictureService">Picture service</param>
+ /// <returns>Picture</returns>
+ public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,
+ IProductService productService, IPictureService pictureService)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+ if (pictureService == null)
+ throw new ArgumentNullException(nameof(pictureService));
+
+ Picture picture = null;
+
+ if (attributes != null && attributes.Any())
+ {
+
+ var comb = product.FindProductAttributeCombination(attributes);
+ if (comb != null)
+ {
+ if (!string.IsNullOrEmpty(comb.PictureId))
+ {
+ var combPicture = await pictureService.GetPictureById(comb.PictureId);
+ if (combPicture != null)
+ {
+ picture = combPicture;
+ }
+ }
+ }
+ if (picture == null)
+ {
+ var attributeValues = product.ParseProductAttributeValues(attributes);
+ foreach (var attributeValue in attributeValues)
+ {
+ var attributePicture = await pictureService.GetPictureById(attributeValue.PictureId);
+ if (attributePicture != null)
+ {
+ picture = attributePicture;
+ break;
+ }
+ }
+ }
+ }
+ if (picture == null)
+ {
+ var pp = product.ProductPictures.OrderBy(x => x.DisplayOrder).FirstOrDefault();
+ if (pp != null)
+ picture = await pictureService.GetPictureById(pp.PictureId);
+ }
+
+ if (picture == null && !product.VisibleIndividually && !string.IsNullOrEmpty(product.ParentGroupedProductId))
+ {
+ var parentProduct = await productService.GetProductById(product.ParentGroupedProductId);
+ if (parentProduct != null)
+ if (parentProduct.ProductPictures.Any())
+ {
+ picture = await pictureService.GetPictureById(parentProduct.ProductPictures.FirstOrDefault().PictureId);
+
+ }
+ }
+
+ return picture;
+ }
+ }
+}
diff --git a/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj b/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
index 3b3b85c6c..15ce3ed01 100644
--- a/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
+++ b/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
@@ -1,7 +1,8 @@
-<Project Sdk="Microsoft.NET.Sdk.Razor">
+<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\Build\Grand.Common.props" />
<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
+ <ServerGarbageCollection>false</ServerGarbageCollection>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
@@ -14,12 +15,27 @@
<PackageReference Include="elFinder.Net.Drivers.FileSystem" Version="1.5.0" />
<PackageReference Include="Google.Apis" Version="1.57.0" />
<PackageReference Include="Google.Apis.AnalyticsReporting.v4" Version="1.57.0.2484" />
+ <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Business\Grand.Business.Core\Grand.Business.Core.csproj" />
<ProjectReference Include="..\..\Core\Grand.Domain\Grand.Domain.csproj" />
<ProjectReference Include="..\..\Core\Grand.Infrastructure\Grand.Infrastructure.csproj" />
<ProjectReference Include="..\..\Core\Grand.SharedKernel\Grand.SharedKernel.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Authentication\Grand.Business.Authentication.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Catalog\Grand.Business.Catalog.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Checkout\Grand.Business.Checkout.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Cms\Grand.Business.Cms.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Common\Grand.Business.Common.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Customers\Grand.Business.Customers.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Marketing\Grand.Business.Marketing.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Messages\Grand.Business.Messages.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Storage\Grand.Business.Storage.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.System\Grand.Business.System.csproj" />
<ProjectReference Include="..\Grand.Web.Common\Grand.Web.Common.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="logs\" />
+ <Folder Include="Themes\" />
+ </ItemGroup>
</Project>
diff --git a/src/Web/Grand.Web.Admin/Interfaces/ICustomerActionViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/ICustomerActionViewModelService.cs
deleted file mode 100644
index 46b102c90..000000000
--- a/src/Web/Grand.Web.Admin/Interfaces/ICustomerActionViewModelService.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Interfaces
-{
- public interface ICustomerActionViewModelService
- {
- Task PrepareReactObjectModel(CustomerActionModel model);
- Task<CustomerActionModel> PrepareCustomerActionModel();
- Task<CustomerAction> InsertCustomerActionModel(CustomerActionModel model);
- Task<CustomerAction> UpdateCustomerActionModel(CustomerAction customeraction, CustomerActionModel model);
- Task<SerializeCustomerActionHistory> PrepareHistoryModelForList(CustomerActionHistory history);
- Task<CustomerActionConditionModel> PrepareCustomerActionConditionModel(string customerActionId);
- Task<(string customerActionId, string conditionId)> InsertCustomerActionConditionModel(CustomerActionConditionModel model);
- Task<CustomerAction> UpdateCustomerActionConditionModel(CustomerAction customeraction, CustomerAction.ActionCondition actionCondition, CustomerActionConditionModel model);
- Task ConditionDelete(string Id, string customerActionId);
- Task ConditionDeletePosition(string id, string customerActionId, string conditionId);
- Task<CustomerActionConditionModel.AddProductToConditionModel> PrepareAddProductToConditionModel(string customerActionId, string conditionId);
- Task InsertProductToConditionModel(CustomerActionConditionModel.AddProductToConditionModel model);
- Task InsertCategoryConditionModel(CustomerActionConditionModel.AddCategoryConditionModel model);
- Task InsertCollectionConditionModel(CustomerActionConditionModel.AddCollectionConditionModel model);
- Task InsertCustomerGroupConditionModel(CustomerActionConditionModel.AddCustomerGroupConditionModel model);
- Task InsertStoreConditionModel(CustomerActionConditionModel.AddStoreConditionModel model);
- Task InsertVendorConditionModel(CustomerActionConditionModel.AddVendorConditionModel model);
- Task InsertCustomerTagConditionModel(CustomerActionConditionModel.AddCustomerTagConditionModel model);
- Task InsertProductAttributeConditionModel(CustomerActionConditionModel.AddProductAttributeConditionModel model);
- Task UpdateProductAttributeConditionModel(CustomerActionConditionModel.AddProductAttributeConditionModel model);
- Task InsertProductSpecificationConditionModel(CustomerActionConditionModel.AddProductSpecificationConditionModel model);
- Task InsertCustomerRegisterConditionModel(CustomerActionConditionModel.AddCustomerRegisterConditionModel model);
- Task UpdateCustomerRegisterConditionModel(CustomerActionConditionModel.AddCustomerRegisterConditionModel model);
- Task InsertCustomCustomerAttributeConditionModel(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model);
- Task UpdateCustomCustomerAttributeConditionModel(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model);
- Task InsertUrlConditionModel(CustomerActionConditionModel.AddUrlConditionModel model);
- Task UpdateUrlConditionModel(CustomerActionConditionModel.AddUrlConditionModel model);
- Task InsertUrlCurrentConditionModel(CustomerActionConditionModel.AddUrlConditionModel model);
- Task UpdateUrlCurrentConditionModel(CustomerActionConditionModel.AddUrlConditionModel model);
- Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(CustomerActionConditionModel.AddProductToConditionModel model, int pageIndex, int pageSize);
-
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Interfaces/ICustomerReminderViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/ICustomerReminderViewModelService.cs
deleted file mode 100644
index d93eb33a7..000000000
--- a/src/Web/Grand.Web.Admin/Interfaces/ICustomerReminderViewModelService.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Grand.Business.Core.Utilities.Marketing;
-using Grand.Domain.Customers;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Interfaces
-{
- public interface ICustomerReminderViewModelService
- {
- CustomerReminderModel PrepareCustomerReminderModel();
- Task<CustomerReminder> InsertCustomerReminderModel(CustomerReminderModel model);
- Task<CustomerReminder> UpdateCustomerReminderModel(CustomerReminder customerReminder, CustomerReminderModel model);
- Task RunReminder(CustomerReminder customerReminder);
- Task DeleteCustomerReminder(CustomerReminder customerReminder);
- Task<SerializeCustomerReminderHistoryModel> PrepareHistoryModelForList(SerializeCustomerReminderHistory history);
- CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder);
- Task<CustomerReminder.ReminderCondition> InsertConditionModel(CustomerReminder customerReminder, CustomerReminderModel.ConditionModel model);
- CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition);
- Task<CustomerReminder.ReminderCondition> UpdateConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition, CustomerReminderModel.ConditionModel model);
- Task ConditionDelete(string Id, string customerReminderId);
- Task ConditionDeletePosition(string id, string customerReminderId, string conditionId);
- Task InsertCategoryConditionModel(CustomerReminderModel.ConditionModel.AddCategoryConditionModel model);
- Task InsertCollectionConditionModel(CustomerReminderModel.ConditionModel.AddCollectionConditionModel model);
- Task InsertProductToConditionModel(CustomerReminderModel.ConditionModel.AddProductToConditionModel model);
- Task InsertCustomerTagConditionModel(CustomerReminderModel.ConditionModel.AddCustomerTagConditionModel model);
- Task InsertCustomerGroupConditionModel(CustomerReminderModel.ConditionModel.AddCustomerGroupConditionModel model);
- Task InsertCustomerRegisterConditionModel(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model);
- Task UpdateCustomerRegisterConditionModel(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model);
- Task InsertCustomCustomerAttributeConditionModel(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model);
- Task UpdateCustomCustomerAttributeConditionModel(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model);
- Task PrepareReminderLevelModel(CustomerReminderModel.ReminderLevelModel model, CustomerReminder customerReminder);
- Task<CustomerReminder.ReminderLevel> InsertReminderLevel(CustomerReminder customerReminder, CustomerReminderModel.ReminderLevelModel model);
- Task<CustomerReminder.ReminderLevel> UpdateReminderLevel(CustomerReminder customerReminder, CustomerReminder.ReminderLevel customerReminderLevel, CustomerReminderModel.ReminderLevelModel model);
- Task DeleteLevel(string Id, string customerReminderId);
- Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(CustomerActionConditionModel.AddProductToConditionModel model, int pageIndex, int pageSize);
- Task<CustomerReminderModel.ConditionModel.AddProductToConditionModel> PrepareProductToConditionModel(string customerReminderId, string conditionId);
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Mapper/BannerProfile.cs b/src/Web/Grand.Web.Admin/Mapper/BannerProfile.cs
deleted file mode 100644
index 2ae9ff227..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/BannerProfile.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Messages;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class BannerProfile : Profile, IAutoMapperProfile
- {
- public BannerProfile()
- {
- CreateMap<Banner, BannerModel>()
- .ForMember(dest => dest.Locales, mo => mo.Ignore());
-
- CreateMap<BannerModel, Banner>()
- .ForMember(dest => dest.Id, mo => mo.Ignore())
- .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Mapper/CustomerActionProfile.cs b/src/Web/Grand.Web.Admin/Mapper/CustomerActionProfile.cs
deleted file mode 100644
index fc66e3c9b..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/CustomerActionProfile.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Customers;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class CustomerActionProfile : Profile, IAutoMapperProfile
- {
- public CustomerActionProfile()
- {
- CreateMap<CustomerAction, CustomerActionModel>()
- .ForMember(dest => dest.MessageTemplates, mo => mo.Ignore())
- .ForMember(dest => dest.Banners, mo => mo.Ignore());
-
- CreateMap<CustomerActionModel, CustomerAction>()
- .ForMember(dest => dest.Id, mo => mo.Ignore());
-
- CreateMap<CustomerAction.ActionCondition, CustomerActionConditionModel>()
- .ForMember(dest => dest.CustomerActionConditionType, mo => mo.Ignore());
- CreateMap<CustomerActionConditionModel, CustomerAction.ActionCondition>()
- .ForMember(dest => dest.Id, mo => mo.Ignore());
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Mapper/CustomerActionTypeProfile.cs b/src/Web/Grand.Web.Admin/Mapper/CustomerActionTypeProfile.cs
deleted file mode 100644
index 5592d3dae..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/CustomerActionTypeProfile.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Customers;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class CustomerActionTypeProfile : Profile, IAutoMapperProfile
- {
- public CustomerActionTypeProfile()
- {
- CreateMap<CustomerActionTypeModel, CustomerActionType>()
- .ForMember(dest => dest.Id, mo => mo.Ignore())
- .ForMember(dest => dest.SystemKeyword, mo => mo.Ignore());
- CreateMap<CustomerActionType, CustomerActionTypeModel>();
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Mapper/CustomerReminderProfile.cs b/src/Web/Grand.Web.Admin/Mapper/CustomerReminderProfile.cs
deleted file mode 100644
index bc9c2d5e5..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/CustomerReminderProfile.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Customers;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class CustomerReminderProfile : Profile, IAutoMapperProfile
- {
- public CustomerReminderProfile()
- {
- CreateMap<CustomerReminderModel, CustomerReminder>()
- .ForMember(dest => dest.Id, mo => mo.Ignore());
-
- CreateMap<CustomerReminder, CustomerReminderModel>();
-
- CreateMap<CustomerReminder.ReminderLevel, CustomerReminderModel.ReminderLevelModel>()
- .ForMember(dest => dest.EmailAccounts, mo => mo.Ignore());
- CreateMap<CustomerReminderModel.ReminderLevelModel, CustomerReminder.ReminderLevel>()
- .ForMember(dest => dest.Id, mo => mo.Ignore());
-
- CreateMap<CustomerReminder.ReminderCondition, CustomerReminderModel.ConditionModel>()
- .ForMember(dest => dest.ConditionType, mo => mo.Ignore());
- CreateMap<CustomerReminderModel.ConditionModel, CustomerReminder.ReminderCondition>()
- .ForMember(dest => dest.Id, mo => mo.Ignore());
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Mapper/InteractiveFormProfile.cs b/src/Web/Grand.Web.Admin/Mapper/InteractiveFormProfile.cs
deleted file mode 100644
index 552aeffa5..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/InteractiveFormProfile.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Messages;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class InteractiveFormProfile : Profile, IAutoMapperProfile
- {
- public InteractiveFormProfile()
- {
- CreateMap<InteractiveForm, InteractiveFormModel>()
- .ForMember(dest => dest.Locales, mo => mo.Ignore())
- .ForMember(dest => dest.AvailableEmailAccounts, mo => mo.Ignore())
- .ForMember(dest => dest.AvailableTokens, mo => mo.Ignore());
-
- CreateMap<InteractiveFormModel, InteractiveForm>()
- .ForMember(dest => dest.Id, mo => mo.Ignore())
- .ForMember(dest => dest.FormAttributes, mo => mo.Ignore())
- .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));
-
- CreateMap<InteractiveForm.FormAttribute, InteractiveFormAttributeModel>()
- .ForMember(dest => dest.Locales, mo => mo.Ignore());
-
- CreateMap<InteractiveFormAttributeModel, InteractiveForm.FormAttribute>()
- .ForMember(dest => dest.Id, mo => mo.Ignore())
- .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));
-
- CreateMap<InteractiveForm.FormAttributeValue, InteractiveFormAttributeValueModel>()
- .ForMember(dest => dest.Locales, mo => mo.Ignore());
-
- CreateMap<InteractiveFormAttributeValueModel, InteractiveForm.FormAttributeValue>()
- .ForMember(dest => dest.Id, mo => mo.Ignore())
- .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionConditionModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionConditionModel.cs
deleted file mode 100644
index 40d89bfa6..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionConditionModel.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-using Microsoft.AspNetCore.Mvc.Rendering;
-using System.ComponentModel.DataAnnotations;
-
-namespace Grand.Web.Admin.Models.Customers
-{
- public partial class CustomerActionConditionModel : BaseEntityModel
- {
- public CustomerActionConditionModel()
- {
- this.CustomerActionConditionType = new List<SelectListItem>();
- }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerActionCondition.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerActionCondition.Fields.CustomerConditionTypeId")]
- public CustomerActionConditionTypeEnum CustomerActionConditionTypeId { get; set; }
- public IList<SelectListItem> CustomerActionConditionType { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerActionCondition.Fields.ConditionId")]
- public CustomerActionConditionEnum ConditionId { get; set; }
-
- public string CustomerActionId { get; set; }
-
-
- public partial class AddProductToConditionModel
- {
- public AddProductToConditionModel()
- {
- AvailableStores = new List<SelectListItem>();
- AvailableVendors = new List<SelectListItem>();
- AvailableProductTypes = new List<SelectListItem>();
- }
-
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchProductName")]
-
- public string SearchProductName { get; set; }
- [UIHint("Category")]
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchCategory")]
- public string SearchCategoryId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.Brand")]
- [UIHint("Brand")]
- public string SearchBrandId { get; set; }
- [UIHint("Collection")]
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchCollection")]
- public string SearchCollectionId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchStore")]
- public string SearchStoreId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchVendor")]
- public string SearchVendorId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchProductType")]
- public int SearchProductTypeId { get; set; }
-
- public IList<SelectListItem> AvailableStores { get; set; }
- public IList<SelectListItem> AvailableVendors { get; set; }
- public IList<SelectListItem> AvailableProductTypes { get; set; }
-
- public string CustomerActionId { get; set; }
- public string CustomerActionConditionId { get; set; }
-
- public string[] SelectedProductIds { get; set; }
- }
-
- public partial class AddCategoryConditionModel
- {
- [GrandResourceDisplayName("Admin.Catalog.Categories.List.SearchCategoryName")]
-
- public string SearchCategoryName { get; set; }
-
- public string CustomerActionId { get; set; }
- public string CustomerActionConditionId { get; set; }
-
- public string[] SelectedCategoryIds { get; set; }
- }
-
- public partial class AddCollectionConditionModel
- {
- [GrandResourceDisplayName("Admin.Catalog.Collections.List.SearchCollectionName")]
-
- public string SearchCollectionName { get; set; }
-
- public string CustomerActionId { get; set; }
- public string CustomerActionConditionId { get; set; }
-
- public string[] SelectedCollectionIds { get; set; }
- }
-
- public partial class AddVendorConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
-
- public string VendorId { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddCustomerGroupConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
-
- public string CustomerGroupId { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddStoreConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
-
- public string StoreId { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddCustomerTagConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
-
- public string CustomerTagId { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddProductAttributeConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
- public string ProductAttributeId { get; set; }
- public string Name { get; set; }
- public string Id { get; set; }
- }
- public partial class AddUrlConditionModel
- {
- public string Id { get; set; }
- public string Name { get; set; }
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
- }
-
- public partial class AddCustomerRegisterConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
- public string CustomerRegisterName { get; set; }
- public string CustomerRegisterValue { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddCustomCustomerAttributeConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
- public string CustomerAttributeName { get; set; }
- public string CustomerAttributeValue { get; set; }
- public string Id { get; set; }
- }
-
- public partial class AddProductSpecificationConditionModel
- {
- public string CustomerActionId { get; set; }
- public string ConditionId { get; set; }
- public string SpecificationId { get; set; }
- public string SpecificationValueId { get; set; }
- public string Name { get; set; }
- public string Id { get; set; }
- }
-
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionModel.cs
deleted file mode 100644
index f614e65c1..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionModel.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-using Microsoft.AspNetCore.Mvc.Rendering;
-using System.ComponentModel.DataAnnotations;
-
-namespace Grand.Web.Admin.Models.Customers
-{
- public partial class CustomerActionModel : BaseEntityModel
- {
- public CustomerActionModel()
- {
- this.ActionType = new List<SelectListItem>();
- this.Banners = new List<SelectListItem>();
- this.InteractiveForms = new List<SelectListItem>();
- this.MessageTemplates = new List<SelectListItem>();
- this.CustomerGroups = new List<SelectListItem>();
- this.CustomerTags = new List<SelectListItem>();
-
- }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.Active")]
- public bool Active { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.ActionTypeId")]
- public string ActionTypeId { get; set; }
- public IList<SelectListItem> ActionType { get; set; }
-
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.ConditionId")]
- public int ConditionId { get; set; }
- public int ConditionCount { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.ReactionType")]
- public int ReactionTypeId { get; set; }
- public CustomerReactionTypeEnum ReactionType {
- get { return (CustomerReactionTypeEnum)ReactionTypeId; }
- set { this.ReactionTypeId = (int)value; }
- }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.Banner")]
- public string BannerId { get; set; }
- public IList<SelectListItem> Banners { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.InteractiveForm")]
- public string InteractiveFormId { get; set; }
- public IList<SelectListItem> InteractiveForms { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.MessageTemplate")]
- public string MessageTemplateId { get; set; }
- public IList<SelectListItem> MessageTemplates { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.CustomerGroup")]
- public string CustomerGroupId { get; set; }
- public IList<SelectListItem> CustomerGroups { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.CustomerTag")]
- public string CustomerTagId { get; set; }
- public IList<SelectListItem> CustomerTags { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.StartDateTime")]
- [UIHint("DateTimeNullable")]
- public DateTime StartDateTime { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerAction.Fields.EndDateTime")]
- [UIHint("DateTimeNullable")]
- public DateTime EndDateTime { get; set; }
-
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionTypeModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionTypeModel.cs
deleted file mode 100644
index 4995c3b00..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerActionTypeModel.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-
-namespace Grand.Web.Admin.Models.Customers
-{
- public partial class CustomerActionTypeModel : BaseEntityModel
- {
- [GrandResourceDisplayName("Admin.Customer.ActionType.Fields.Name")]
- public string Name { get; set; }
- [GrandResourceDisplayName("Admin.Customer.ActionType.Fields.Enabled")]
- public bool Enabled { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReminderModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerReminderModel.cs
deleted file mode 100644
index a3300aee3..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReminderModel.cs
+++ /dev/null
@@ -1,202 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-using Microsoft.AspNetCore.Mvc.Rendering;
-using System.ComponentModel.DataAnnotations;
-
-namespace Grand.Web.Admin.Models.Customers
-{
- public partial class CustomerReminderModel : BaseEntityModel
- {
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.StartDate")]
- public DateTime StartDateTime { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.EndDate")]
- public DateTime EndDateTime { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.LastUpdateDate")]
- public DateTime LastUpdateDate { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.AllowRenew")]
- public bool AllowRenew { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.RenewedDay")]
- public int RenewedDay { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.Active")]
- public bool Active { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.DisplayOrder")]
- public int DisplayOrder { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.ReminderRule")]
- public CustomerReminderRuleEnum ReminderRuleId { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Fields.ConditionId")]
- public int ConditionId { get; set; }
- public int ConditionCount { get; set; }
-
-
- public partial class ConditionModel : BaseEntityModel
- {
- public ConditionModel()
- {
- this.ConditionType = new List<SelectListItem>();
- }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Condition.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Condition.Fields.ConditionTypeId")]
- public CustomerReminderConditionTypeEnum ConditionTypeId { get; set; }
- public IList<SelectListItem> ConditionType { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Condition.Fields.ConditionId")]
- public CustomerReminderConditionEnum ConditionId { get; set; }
-
- public string CustomerReminderId { get; set; }
-
- public partial class AddProductToConditionModel
- {
- public AddProductToConditionModel()
- {
- AvailableStores = new List<SelectListItem>();
- AvailableVendors = new List<SelectListItem>();
- AvailableProductTypes = new List<SelectListItem>();
- }
-
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchProductName")]
-
- public string SearchProductName { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchCategory")]
- [UIHint("Category")]
- public string SearchCategoryId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.Brand")]
- [UIHint("Brand")]
- public string SearchBrandId { get; set; }
- [UIHint("Collection")]
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchCollection")]
- public string SearchCollectionId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchStore")]
- public string SearchStoreId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchVendor")]
- public string SearchVendorId { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Products.List.SearchProductType")]
- public int SearchProductTypeId { get; set; }
-
- public IList<SelectListItem> AvailableStores { get; set; }
- public IList<SelectListItem> AvailableVendors { get; set; }
- public IList<SelectListItem> AvailableProductTypes { get; set; }
-
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
-
- public string[] SelectedProductIds { get; set; }
- }
- public partial class AddCategoryConditionModel
- {
- [GrandResourceDisplayName("Admin.Catalog.Categories.List.SearchCategoryName")]
-
- public string SearchCategoryName { get; set; }
-
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
-
- public string[] SelectedCategoryIds { get; set; }
- }
- public partial class AddCollectionConditionModel
- {
- [GrandResourceDisplayName("Admin.Catalog.Collections.List.SearchCollectionName")]
-
- public string SearchCollectionName { get; set; }
-
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
-
- public string[] SelectedCollectionIds { get; set; }
- }
- public partial class AddCustomerGroupConditionModel
- {
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
-
- public string CustomerGroupId { get; set; }
- public string Id { get; set; }
- }
- public partial class AddCustomerTagConditionModel
- {
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
-
- public string CustomerTagId { get; set; }
- public string Id { get; set; }
- }
- public partial class AddCustomerRegisterConditionModel
- {
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
- public string CustomerRegisterName { get; set; }
- public string CustomerRegisterValue { get; set; }
- public string Id { get; set; }
- }
- public partial class AddCustomCustomerAttributeConditionModel
- {
- public string Id { get; set; }
- public string CustomerReminderId { get; set; }
- public string ConditionId { get; set; }
- public string CustomerAttributeName { get; set; }
- public string CustomerAttributeValue { get; set; }
- }
-
- }
-
- public partial class ReminderLevelModel : BaseEntityModel
- {
- public ReminderLevelModel()
- {
- EmailAccounts = new List<SelectListItem>();
- }
-
- public string CustomerReminderId { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.SendDay")]
- public int Day { get; set; }
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.SendHour")]
- public int Hour { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.SendMinutes")]
- public int Minutes { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.AllowedTokens")]
- public string[] AllowedTokens { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.Level")]
- public int Level { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.EmailAccountId")]
- public string EmailAccountId { get; set; }
- public IList<SelectListItem> EmailAccounts { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.BccEmailAddresses")]
- public string BccEmailAddresses { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.Subject")]
- public string Subject { get; set; }
-
- [GrandResourceDisplayName("Admin.Customers.CustomerReminder.Level.Fields.Body")]
-
- public string Body { get; set; }
- }
-
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerActionHistory.cs b/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerActionHistory.cs
deleted file mode 100644
index 923c491e8..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerActionHistory.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Grand.Web.Admin.Models.Customers
-{
- public class SerializeCustomerActionHistory
- {
- public string Email { get; set; }
- public DateTime CreateDate { get; set; }
-
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerReminderHistoryModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerReminderHistoryModel.cs
deleted file mode 100644
index 366d98bca..000000000
--- a/src/Web/Grand.Web.Admin/Models/Customers/SerializeCustomerReminderHistoryModel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Grand.Web.Admin.Models.Customers
-{
- public class SerializeCustomerReminderHistoryModel
- {
- public string Id { get; set; }
- public string Email { get; set; }
- public DateTime SendDate { get; set; }
- public int Level { get; set; }
- public bool OrderId { get; set; }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/BannerModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/BannerModel.cs
deleted file mode 100644
index e8bd36cfe..000000000
--- a/src/Web/Grand.Web.Admin/Models/Messages/BannerModel.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Grand.Web.Common.Models;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-
-namespace Grand.Web.Admin.Models.Messages
-{
- public partial class BannerModel : BaseEntityModel, ILocalizedModel<BannerLocalizedModel>
- {
- public BannerModel()
- {
- Locales = new List<BannerLocalizedModel>();
- }
-
- [GrandResourceDisplayName("admin.marketing.Banners.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.Banners.Fields.Body")]
-
- public string Body { get; set; }
-
- public IList<BannerLocalizedModel> Locales { get; set; }
-
- }
-
- public partial class BannerLocalizedModel : ILocalizedModelLocal
- {
- public string LanguageId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.Banners.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.Banners.Fields.Body")]
-
- public string Body { get; set; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeModel.cs
deleted file mode 100644
index 66e3046a4..000000000
--- a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeModel.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Grand.Web.Common.Models;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-using System.ComponentModel.DataAnnotations;
-
-namespace Grand.Web.Admin.Models.Messages
-{
- public partial class InteractiveFormAttributeModel : BaseEntityModel, ILocalizedModel<InteractiveFormAttributeLocalizedModel>
- {
- public InteractiveFormAttributeModel()
- {
- Locales = new List<InteractiveFormAttributeLocalizedModel>();
- }
- public string FormId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.SystemName")]
- public string SystemName { get; set; }
-
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.RegexValidation")]
- public string RegexValidation { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.IsRequired")]
- public bool IsRequired { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.FormControlTypeId")]
- public int FormControlTypeId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.ValidationMinLength")]
- [UIHint("Int32Nullable")]
- public int? ValidationMinLength { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.ValidationMaxLength")]
- [UIHint("Int32Nullable")]
- public int? ValidationMaxLength { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.DefaultValue")]
- public string DefaultValue { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.Style")]
- public string Style { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.Class")]
- public string Class { get; set; }
-
- public IList<InteractiveFormAttributeLocalizedModel> Locales { get; set; }
-
- }
-
- public partial class InteractiveFormAttributeLocalizedModel : ILocalizedModelLocal
- {
- public string LanguageId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Fields.Name")]
- public string Name { get; set; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeValueModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeValueModel.cs
deleted file mode 100644
index a6b8f7fad..000000000
--- a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormAttributeValueModel.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Grand.Web.Common.Models;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-
-namespace Grand.Web.Admin.Models.Messages
-{
- public partial class InteractiveFormAttributeValueModel : BaseEntityModel, ILocalizedModel<InteractiveFormAttributeValueLocalizedModel>
- {
- public InteractiveFormAttributeValueModel()
- {
- Locales = new List<InteractiveFormAttributeValueLocalizedModel>();
- }
- public string FormId { get; set; }
- public string AttributeId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Values.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Values.Fields.DisplayOrder")]
- public int DisplayOrder { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Values.Fields.IsPreSelected")]
- public bool IsPreSelected { get; set; }
-
- public IList<InteractiveFormAttributeValueLocalizedModel> Locales { get; set; }
-
- }
-
- public partial class InteractiveFormAttributeValueLocalizedModel : ILocalizedModelLocal
- {
- public string LanguageId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Attribute.Values.Fields.Name")]
- public string Name { get; set; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormModel.cs
deleted file mode 100644
index 0ce3b292a..000000000
--- a/src/Web/Grand.Web.Admin/Models/Messages/InteractiveFormModel.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Grand.Web.Common.Models;
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-
-namespace Grand.Web.Admin.Models.Messages
-{
- public partial class InteractiveFormModel : BaseEntityModel, ILocalizedModel<InteractiveFormLocalizedModel>
- {
- public InteractiveFormModel()
- {
- Locales = new List<InteractiveFormLocalizedModel>();
- AvailableEmailAccounts = new List<EmailAccountModel>();
- }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.SystemName")]
- public string SystemName { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.Body")]
- public string Body { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.EmailAccount")]
- public string EmailAccountId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.AvailableTokens")]
- public string AvailableTokens { get; set; }
- public IList<EmailAccountModel> AvailableEmailAccounts { get; set; }
-
- public IList<InteractiveFormLocalizedModel> Locales { get; set; }
-
- }
-
- public partial class InteractiveFormLocalizedModel : ILocalizedModelLocal
- {
- public string LanguageId { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.Name")]
- public string Name { get; set; }
-
- [GrandResourceDisplayName("admin.marketing.InteractiveForms.Fields.Body")]
-
- public string Body { get; set; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Program.cs b/src/Web/Grand.Web.Admin/Program.cs
new file mode 100644
index 000000000..bc19ef3f2
--- /dev/null
+++ b/src/Web/Grand.Web.Admin/Program.cs
@@ -0,0 +1,83 @@
+using Grand.Infrastructure.Configuration;
+using Grand.Web.Admin.Extensions;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Serilog;
+
+Common.WwwRoot = "";
+
+var builder = WebApplication.CreateBuilder(args);
+
+builder.Host.UseDefaultServiceProvider((context, options) =>
+{
+ options.ValidateScopes = false;
+ options.ValidateOnBuild = false;
+});
+
+//use serilog
+builder.Host.UseSerilog();
+
+//add configuration
+builder.Host.ConfigureAppConfiguration((hostingContext, config) =>
+{
+ config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
+ config.AddJsonFile("App_Data/appsettings.json", optional: false, reloadOnChange: true);
+ config.AddEnvironmentVariables();
+ if (args != null)
+ {
+ config.AddCommandLine(args);
+ var settings = config.Build();
+ var appsettings = settings["appsettings"];
+ var param = settings["Directory"];
+ if (!string.IsNullOrEmpty(appsettings) && !string.IsNullOrEmpty(param))
+ config.AddJsonFile($"App_Data/{param}/appsettings.json", optional: false, reloadOnChange: true);
+ }
+
+});
+
+//create logger
+Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(builder.Configuration).CreateLogger();
+
+//add services
+Grand.Infrastructure.StartupBase.ConfigureServices(builder.Services, builder.Configuration);
+
+//Allow non ASCII chars in headers
+var config = new AppConfig();
+builder.Configuration.GetSection("Application").Bind(config);
+if (config.AllowNonAsciiCharInHeaders)
+{
+ builder.WebHost.ConfigureKestrel(options =>
+ {
+ options.ResponseHeaderEncodingSelector = (_) => Encoding.UTF8;
+ });
+}
+if (config.MaxRequestBodySize.HasValue)
+{
+ builder.WebHost.ConfigureKestrel(host =>
+ {
+ host.Limits.MaxRequestBodySize = config.MaxRequestBodySize.Value;
+ });
+
+ builder.Services.Configure<Microsoft.AspNetCore.Http.Features.FormOptions>(opt =>
+ {
+ opt.MultipartBodyLengthLimit = config.MaxRequestBodySize.Value;
+ });
+
+}
+
+if (builder.Environment.IsDevelopment())
+{
+ builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
+}
+
+//build app
+var app = builder.Build();
+
+//request pipeline
+Grand.Infrastructure.StartupBase.ConfigureRequestPipeline(app, builder.Environment);
+
+//run app
+app.Run();
diff --git a/src/Web/Grand.Web.Admin/Properties/launchSettings.json b/src/Web/Grand.Web.Admin/Properties/launchSettings.json
index d11c06e7e..3a1050ae6 100644
--- a/src/Web/Grand.Web.Admin/Properties/launchSettings.json
+++ b/src/Web/Grand.Web.Admin/Properties/launchSettings.json
@@ -14,14 +14,15 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
- },
- "Grand.Web.Admin": {
+ },
+ "Kestrel": {
"commandName": "Project",
"launchBrowser": true,
+ "launchUrl": "https://localhost:5011/admin",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
- "applicationUrl": "https://localhost:5001;http://localhost:5000"
+ "applicationUrl": "https://localhost:5011;http://localhost:5010"
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
index 4aad20a33..b3188ffe2 100644
--- a/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
@@ -1,10 +1,10 @@
using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Catalog.Collections;
using Grand.Business.Core.Interfaces.Catalog.Products;
+using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Logging;
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerActionViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerActionViewModelService.cs
deleted file mode 100644
index 07a601712..000000000
--- a/src/Web/Grand.Web.Admin/Services/CustomerActionViewModelService.cs
+++ /dev/null
@@ -1,654 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Banners;
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-using Grand.Web.Common.Extensions;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace Grand.Web.Admin.Services
-{
- public partial class CustomerActionViewModelService : ICustomerActionViewModelService
- {
- private readonly ICustomerService _customerService;
- private readonly IGroupService _groupService;
- private readonly ICustomerTagService _customerTagService;
- private readonly ITranslationService _translationService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly IStoreService _storeService;
- private readonly IVendorService _vendorService;
- private readonly ICustomerActionService _customerActionService;
- private readonly IBannerService _bannerService;
- private readonly IInteractiveFormService _interactiveFormService;
- private readonly IMessageTemplateService _messageTemplateService;
- private readonly IDateTimeService _dateTimeService;
- private readonly IProductService _productService;
- private readonly IWorkContext _workContext;
- private readonly IHttpContextAccessor _httpContextAccessor;
-
- public CustomerActionViewModelService(ICustomerService customerService,
- IGroupService groupService,
- ICustomerTagService customerTagService,
- ITranslationService translationService,
- ICustomerActivityService customerActivityService,
- IStoreService storeService,
- IVendorService vendorService,
- ICustomerActionService customerActionService,
- IBannerService bannerService,
- IInteractiveFormService interactiveFormService,
- IMessageTemplateService messageTemplateService,
- IDateTimeService dateTimeService,
- IProductService productService,
- IWorkContext workContext,
- IHttpContextAccessor httpContextAccessor)
- {
- _customerService = customerService;
- _groupService = groupService;
- _customerTagService = customerTagService;
- _translationService = translationService;
- _customerActivityService = customerActivityService;
- _storeService = storeService;
- _vendorService = vendorService;
- _customerActionService = customerActionService;
- _bannerService = bannerService;
- _interactiveFormService = interactiveFormService;
- _messageTemplateService = messageTemplateService;
- _dateTimeService = dateTimeService;
- _productService = productService;
- _workContext = workContext;
- _httpContextAccessor = httpContextAccessor;
- }
-
- public virtual async Task PrepareReactObjectModel(CustomerActionModel model)
- {
- if (model == null)
- throw new ArgumentNullException(nameof(model));
-
- var banners = await _bannerService.GetAllBanners();
- foreach (var item in banners)
- {
- model.Banners.Add(new SelectListItem
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
-
- }
- var message = await _messageTemplateService.GetAllMessageTemplates("");
- foreach (var item in message)
- {
- model.MessageTemplates.Add(new SelectListItem
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
- }
- var customerGroup = await _groupService.GetAllCustomerGroups();
- foreach (var item in customerGroup)
- {
- model.CustomerGroups.Add(new SelectListItem
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
- }
-
- var customerTag = await _customerTagService.GetAllCustomerTags();
- foreach (var item in customerTag)
- {
- model.CustomerTags.Add(new SelectListItem
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
- }
-
- foreach (var item in await _customerActionService.GetCustomerActionType())
- {
- model.ActionType.Add(new SelectListItem()
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
- }
-
- foreach (var item in await _interactiveFormService.GetAllForms())
- {
- model.InteractiveForms.Add(new SelectListItem()
- {
- Text = item.Name,
- Value = item.Id.ToString()
- });
-
- }
-
-
- }
-
- public virtual async Task<SerializeCustomerActionHistory> PrepareHistoryModelForList(CustomerActionHistory history)
- {
- var customer = await _customerService.GetCustomerById(history.CustomerId);
- return new SerializeCustomerActionHistory
- {
- Email = customer != null ? String.IsNullOrEmpty(customer.Email) ? "(unknown)" : customer.Email : "(unknown)",
- CreateDate = _dateTimeService.ConvertToUserTime(history.CreateDateUtc, DateTimeKind.Utc),
- };
- }
-
- public virtual async Task<CustomerActionModel> PrepareCustomerActionModel()
- {
- var model = new CustomerActionModel();
- model.Active = true;
- model.StartDateTime = DateTime.Now;
- model.EndDateTime = DateTime.Now.AddMonths(1);
- model.ReactionTypeId = (int)CustomerReactionTypeEnum.Banner;
- await PrepareReactObjectModel(model);
- return model;
- }
- public virtual async Task<CustomerAction> InsertCustomerActionModel(CustomerActionModel model)
- {
- var customeraction = model.ToEntity(_dateTimeService);
- await _customerActionService.InsertCustomerAction(customeraction);
- _ = _customerActivityService.InsertActivity("AddNewCustomerAction", customeraction.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.AddNewCustomerAction"), customeraction.Name);
- return customeraction;
- }
- public virtual async Task<CustomerAction> UpdateCustomerActionModel(CustomerAction customeraction, CustomerActionModel model)
- {
- if (customeraction.Conditions.Count() > 0)
- model.ActionTypeId = customeraction.ActionTypeId;
- if (String.IsNullOrEmpty(model.ActionTypeId))
- model.ActionTypeId = customeraction.ActionTypeId;
-
- customeraction = model.ToEntity(customeraction, _dateTimeService);
- await _customerActionService.UpdateCustomerAction(customeraction);
- _ = _customerActivityService.InsertActivity("EditCustomerAction", customeraction.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.EditCustomerAction"), customeraction.Name);
- return customeraction;
- }
-
- public virtual async Task<CustomerActionConditionModel> PrepareCustomerActionConditionModel(string customerActionId)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);
- var actionType = await _customerActionService.GetCustomerActionTypeById(customerAction.ActionTypeId);
-
- var model = new CustomerActionConditionModel();
- model.CustomerActionId = customerActionId;
-
- foreach (var item in actionType.ConditionType)
- {
- model.CustomerActionConditionType.Add(new SelectListItem()
- {
- Value = item.ToString(),
- Text = ((CustomerActionConditionTypeEnum)item).ToString()
- });
- }
- return model;
- }
-
- public virtual async Task<(string customerActionId, string conditionId)> InsertCustomerActionConditionModel(CustomerActionConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction == null)
- {
- return (null, null);
- }
- var condition = new CustomerAction.ActionCondition()
- {
- Name = model.Name,
- CustomerActionConditionTypeId = model.CustomerActionConditionTypeId,
- ConditionId = model.ConditionId,
- };
- customerAction.Conditions.Add(condition);
- await _customerActionService.UpdateCustomerAction(customerAction);
-
- _ = _customerActivityService.InsertActivity("AddNewCustomerActionCondition", customerAction.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.AddNewCustomerAction"), customerAction.Name);
- return (customerAction.Id, condition.Id);
- }
-
- public virtual async Task<CustomerAction> UpdateCustomerActionConditionModel(CustomerAction customeraction, CustomerAction.ActionCondition condition, CustomerActionConditionModel model)
- {
- condition = model.ToEntity(condition);
- await _customerActionService.UpdateCustomerAction(customeraction);
- //activity log
- _ = _customerActivityService.InsertActivity("EditCustomerActionCondition", customeraction.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.EditCustomerActionCondition"), customeraction.Name);
- return customeraction;
- }
-
- public virtual async Task ConditionDelete(string Id, string customerActionId)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == Id);
- customerAction.Conditions.Remove(condition);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
-
- public virtual async Task ConditionDeletePosition(string id, string customerActionId, string conditionId)
- {
- var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
- var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Product)
- {
- condition.Products.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Category)
- {
- condition.Categories.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Collection)
- {
- condition.Collections.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Vendor)
- {
- condition.Vendors.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.ProductAttribute)
- {
- condition.ProductAttribute.Remove(condition.ProductAttribute.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.ProductSpecification)
- {
- condition.ProductSpecifications.Remove(condition.ProductSpecifications.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerGroup)
- {
- condition.CustomerGroups.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerTag)
- {
- condition.CustomerTags.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
-
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomCustomerAttribute)
- {
- condition.CustomCustomerAttributes.Remove(condition.CustomCustomerAttributes.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.CustomerRegisterField)
- {
- condition.CustomerRegistration.Remove(condition.CustomerRegistration.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.UrlCurrent)
- {
- condition.UrlCurrent.Remove(condition.UrlCurrent.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.UrlReferrer)
- {
- condition.UrlReferrer.Remove(condition.UrlReferrer.FirstOrDefault(x => x.Id == id));
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
- if (condition.CustomerActionConditionTypeId == CustomerActionConditionTypeEnum.Store)
- {
- condition.Stores.Remove(id);
- await _customerActionService.UpdateCustomerAction(customerActions);
- }
-
- }
-
- public virtual async Task<CustomerActionConditionModel.AddProductToConditionModel> PrepareAddProductToConditionModel(string customerActionId, string conditionId)
- {
- var model = new CustomerActionConditionModel.AddProductToConditionModel();
- model.CustomerActionConditionId = conditionId;
- model.CustomerActionId = customerActionId;
-
- //stores
- model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
-
- //vendors
- model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
-
- //product types
- model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
- model.AvailableProductTypes.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
-
- return model;
- }
- public virtual async Task InsertProductToConditionModel(CustomerActionConditionModel.AddProductToConditionModel model)
- {
- foreach (string id in model.SelectedProductIds)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.CustomerActionConditionId);
- if (condition != null)
- {
- if (condition.Products.Where(x => x == id).Count() == 0)
- {
- condition.Products.Add(id);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- }
- public virtual async Task InsertCategoryConditionModel(CustomerActionConditionModel.AddCategoryConditionModel model)
- {
- foreach (string id in model.SelectedCategoryIds)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.CustomerActionConditionId);
- if (condition != null)
- {
- if (condition.Categories.Where(x => x == id).Count() == 0)
- {
- condition.Categories.Add(id);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- }
- public virtual async Task InsertCollectionConditionModel(CustomerActionConditionModel.AddCollectionConditionModel model)
- {
- foreach (string id in model.SelectedCollectionIds)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.CustomerActionConditionId);
- if (condition != null)
- {
- if (condition.Collections.Where(x => x == id).Count() == 0)
- {
- condition.Collections.Add(id);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- }
- public virtual async Task InsertCustomerGroupConditionModel(CustomerActionConditionModel.AddCustomerGroupConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.CustomerGroups.Where(x => x == model.CustomerGroupId).Count() == 0)
- {
- condition.CustomerGroups.Add(model.CustomerGroupId);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
-
- public virtual async Task InsertStoreConditionModel(CustomerActionConditionModel.AddStoreConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.Stores.Where(x => x == model.StoreId).Count() == 0)
- {
- condition.Stores.Add(model.StoreId);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- public virtual async Task InsertVendorConditionModel(CustomerActionConditionModel.AddVendorConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.Vendors.Where(x => x == model.VendorId).Count() == 0)
- {
- condition.Vendors.Add(model.VendorId);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
-
- public virtual async Task InsertCustomerTagConditionModel(CustomerActionConditionModel.AddCustomerTagConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.CustomerTags.Where(x => x == model.CustomerTagId).Count() == 0)
- {
- condition.CustomerTags.Add(model.CustomerTagId);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- public virtual async Task InsertProductAttributeConditionModel(CustomerActionConditionModel.AddProductAttributeConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _pv = new CustomerAction.ActionCondition.ProductAttributeValue()
- {
- ProductAttributeId = model.ProductAttributeId,
- Name = model.Name
- };
- condition.ProductAttribute.Add(_pv);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task UpdateProductAttributeConditionModel(CustomerActionConditionModel.AddProductAttributeConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var pva = condition.ProductAttribute.FirstOrDefault(x => x.Id == model.Id);
- pva.ProductAttributeId = model.ProductAttributeId;
- pva.Name = model.Name;
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task InsertProductSpecificationConditionModel(CustomerActionConditionModel.AddProductSpecificationConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.ProductSpecifications.Where(x => x.ProductSpecyficationId == model.SpecificationId && x.ProductSpecyficationValueId == model.SpecificationValueId).Count() == 0)
- {
- var _ps = new CustomerAction.ActionCondition.ProductSpecification()
- {
- ProductSpecyficationId = model.SpecificationId,
- ProductSpecyficationValueId = model.SpecificationValueId
- };
- condition.ProductSpecifications.Add(_ps);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- }
- public virtual async Task InsertCustomerRegisterConditionModel(CustomerActionConditionModel.AddCustomerRegisterConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _cr = new CustomerAction.ActionCondition.CustomerRegister()
- {
- RegisterField = model.CustomerRegisterName,
- RegisterValue = model.CustomerRegisterValue,
- };
- condition.CustomerRegistration.Add(_cr);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task UpdateCustomerRegisterConditionModel(CustomerActionConditionModel.AddCustomerRegisterConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var cr = condition.CustomerRegistration.FirstOrDefault(x => x.Id == model.Id);
- cr.RegisterField = model.CustomerRegisterName;
- cr.RegisterValue = model.CustomerRegisterValue;
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task InsertCustomCustomerAttributeConditionModel(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _cr = new CustomerAction.ActionCondition.CustomerRegister()
- {
- RegisterField = model.CustomerAttributeName,
- RegisterValue = model.CustomerAttributeValue,
- };
- condition.CustomCustomerAttributes.Add(_cr);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task UpdateCustomCustomerAttributeConditionModel(CustomerActionConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var cr = condition.CustomCustomerAttributes.FirstOrDefault(x => x.Id == model.Id);
- cr.RegisterField = model.CustomerAttributeName;
- cr.RegisterValue = model.CustomerAttributeValue;
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
-
- public virtual async Task InsertUrlConditionModel(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _url = new CustomerAction.ActionCondition.Url()
- {
- Name = model.Name
- };
- condition.UrlReferrer.Add(_url);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
-
- public virtual async Task UpdateUrlConditionModel(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _url = condition.UrlReferrer.FirstOrDefault(x => x.Id == model.Id);
- _url.Name = model.Name;
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task InsertUrlCurrentConditionModel(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _url = new CustomerAction.ActionCondition.Url()
- {
- Name = model.Name
- };
- condition.UrlCurrent.Add(_url);
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task UpdateUrlCurrentConditionModel(CustomerActionConditionModel.AddUrlConditionModel model)
- {
- var customerAction = await _customerActionService.GetCustomerActionById(model.CustomerActionId);
- if (customerAction != null)
- {
- var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _url = condition.UrlCurrent.FirstOrDefault(x => x.Id == model.Id);
- _url.Name = model.Name;
- await _customerActionService.UpdateCustomerAction(customerAction);
- }
- }
- }
- public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(CustomerActionConditionModel.AddProductToConditionModel model, int pageIndex, int pageSize)
- {
- var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId, model.SearchCollectionId, model.SearchStoreId, model.SearchVendorId, model.SearchProductTypeId, model.SearchProductName, pageIndex, pageSize);
- return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);
- }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerReminderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerReminderViewModelService.cs
deleted file mode 100644
index 7336690b6..000000000
--- a/src/Web/Grand.Web.Admin/Services/CustomerReminderViewModelService.cs
+++ /dev/null
@@ -1,509 +0,0 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Domain.Catalog;
-using Grand.Domain.Customers;
-using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
-using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Catalog;
-using Grand.Web.Admin.Models.Customers;
-using Grand.Web.Common.Extensions;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.Extensions.DependencyInjection;
-using Grand.Business.Core.Utilities.Marketing;
-
-namespace Grand.Web.Admin.Services
-{
- public partial class CustomerReminderViewModelService : ICustomerReminderViewModelService
- {
- private readonly ICustomerService _customerService;
- private readonly ITranslationService _translationService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly ICustomerReminderService _customerReminderService;
- private readonly IEmailAccountService _emailAccountService;
- private readonly IDateTimeService _dateTimeService;
- private readonly IWorkContext _workContext;
- private readonly IHttpContextAccessor _httpContextAccessor;
- private readonly IServiceProvider _serviceProvider;
-
- #region Constructors
-
- public CustomerReminderViewModelService(ICustomerService customerService,
- ITranslationService translationService,
- ICustomerActivityService customerActivityService,
- ICustomerReminderService customerReminderService,
- IEmailAccountService emailAccountService,
- IDateTimeService dateTimeService,
- IWorkContext workContext,
- IHttpContextAccessor httpContextAccessor,
- IServiceProvider serviceProvider)
- {
- _customerService = customerService;
- _translationService = translationService;
- _customerActivityService = customerActivityService;
- _customerReminderService = customerReminderService;
- _emailAccountService = emailAccountService;
- _dateTimeService = dateTimeService;
- _workContext = workContext;
- _httpContextAccessor = httpContextAccessor;
- _serviceProvider = serviceProvider;
- }
-
- #endregion
-
- #region Utilities
- #endregion
- public virtual CustomerReminderModel PrepareCustomerReminderModel()
- {
- var model = new CustomerReminderModel();
- model.StartDateTime = DateTime.Now;
- model.EndDateTime = DateTime.Now.AddMonths(1);
- model.LastUpdateDate = DateTime.Now.AddDays(-7);
- model.Active = true;
- return model;
- }
-
- public virtual async Task<CustomerReminder> InsertCustomerReminderModel(CustomerReminderModel model)
- {
- var customerreminder = model.ToEntity(_dateTimeService);
- await _customerReminderService.InsertCustomerReminder(customerreminder);
- //activity log
- _ = _customerActivityService.InsertActivity("AddNewCustomerReminder", customerreminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.AddNewCustomerReminder"), customerreminder.Name);
- return customerreminder;
- }
- public virtual async Task<CustomerReminder> UpdateCustomerReminderModel(CustomerReminder customerReminder, CustomerReminderModel model)
- {
- if (customerReminder.Conditions.Count() > 0)
- model.ReminderRuleId = customerReminder.ReminderRuleId;
- if (model.ReminderRuleId == 0)
- model.ReminderRuleId = customerReminder.ReminderRuleId;
-
- customerReminder = model.ToEntity(customerReminder, _dateTimeService);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- _ = _customerActivityService.InsertActivity("EditCustomerReminder", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.EditCustomerReminder"), customerReminder.Name);
- return customerReminder;
- }
- public virtual async Task RunReminder(CustomerReminder customerReminder)
- {
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.AbandonedCart)
- await _customerReminderService.Task_AbandonedCart(customerReminder.Id);
-
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.Birthday)
- await _customerReminderService.Task_Birthday(customerReminder.Id);
-
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.LastActivity)
- await _customerReminderService.Task_LastActivity(customerReminder.Id);
-
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.LastPurchase)
- await _customerReminderService.Task_LastPurchase(customerReminder.Id);
-
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.RegisteredCustomer)
- await _customerReminderService.Task_RegisteredCustomer(customerReminder.Id);
- }
- public virtual async Task DeleteCustomerReminder(CustomerReminder customerReminder)
- {
- _ = _customerActivityService.InsertActivity("DeleteCustomerReminder", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.DeleteCustomerReminder"), customerReminder.Name);
- await _customerReminderService.DeleteCustomerReminder(customerReminder);
-
- }
-
- public virtual async Task<SerializeCustomerReminderHistoryModel> PrepareHistoryModelForList(SerializeCustomerReminderHistory history)
- {
- return new SerializeCustomerReminderHistoryModel {
- Id = history.Id,
- Email = (await _customerService.GetCustomerById(history.CustomerId)).Email,
- SendDate = _dateTimeService.ConvertToUserTime(history.SendDate, DateTimeKind.Utc),
- Level = history.Level,
- OrderId = !String.IsNullOrEmpty(history.OrderId)
- };
- }
-
- public virtual CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder)
- {
- var model = new CustomerReminderModel.ConditionModel();
- model.CustomerReminderId = customerReminder.Id;
- foreach (CustomerReminderConditionTypeEnum item in Enum.GetValues(typeof(CustomerReminderConditionTypeEnum)))
- {
- if (customerReminder.ReminderRuleId == CustomerReminderRuleEnum.AbandonedCart || customerReminder.ReminderRuleId == CustomerReminderRuleEnum.CompletedOrder
- || customerReminder.ReminderRuleId == CustomerReminderRuleEnum.UnpaidOrder)
- model.ConditionType.Add(new SelectListItem() {
- Value = ((int)item).ToString(),
- Text = item.ToString()
- });
- else
- {
- if (item != CustomerReminderConditionTypeEnum.Product &&
- item != CustomerReminderConditionTypeEnum.Collection &&
- item != CustomerReminderConditionTypeEnum.Category)
- {
- model.ConditionType.Add(new SelectListItem() {
- Value = ((int)item).ToString(),
- Text = item.ToString()
- });
-
- }
- }
- }
- return model;
- }
- public virtual async Task<CustomerReminder.ReminderCondition> InsertConditionModel(CustomerReminder customerReminder, CustomerReminderModel.ConditionModel model)
- {
- var condition = new CustomerReminder.ReminderCondition() {
- Name = model.Name,
- ConditionTypeId = model.ConditionTypeId,
- ConditionId = model.ConditionId,
- };
- customerReminder.Conditions.Add(condition);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
-
- _ = _customerActivityService.InsertActivity("AddNewCustomerReminderCondition", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.AddNewCustomerReminder"), customerReminder.Name);
-
- return condition;
- }
-
- public virtual CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition)
- {
- var model = condition.ToModel();
- model.CustomerReminderId = customerReminder.Id;
- foreach (CustomerReminderConditionTypeEnum item in Enum.GetValues(typeof(CustomerReminderConditionTypeEnum)))
- {
- model.ConditionType.Add(new SelectListItem() {
- Value = ((int)item).ToString(),
- Text = item.ToString()
- });
- }
- return model;
- }
- public virtual async Task<CustomerReminder.ReminderCondition> UpdateConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition, CustomerReminderModel.ConditionModel model)
- {
- condition = model.ToEntity(condition);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- _ = _customerActivityService.InsertActivity("EditCustomerReminderCondition", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.EditCustomerReminderCondition"), customerReminder.Name);
- return condition;
- }
- public virtual async Task ConditionDelete(string Id, string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == Id);
- if (condition != null)
- {
- customerReminder.Conditions.Remove(condition);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task ConditionDeletePosition(string id, string customerReminderId, string conditionId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == conditionId);
-
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.Product)
- {
- condition.Products.Remove(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.Category)
- {
- condition.Categories.Remove(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.Collection)
- {
- condition.Collections.Remove(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
-
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerGroup)
- {
- condition.CustomerGroups.Remove(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerTag)
- {
- condition.CustomerTags.Remove(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
-
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomCustomerAttribute)
- {
- condition.CustomCustomerAttributes.Remove(condition.CustomCustomerAttributes.FirstOrDefault(x => x.Id == id));
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- if (condition.ConditionTypeId == CustomerReminderConditionTypeEnum.CustomerRegisterField)
- {
- condition.CustomerRegistration.Remove(condition.CustomerRegistration.FirstOrDefault(x => x.Id == id));
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- public virtual async Task InsertCategoryConditionModel(CustomerReminderModel.ConditionModel.AddCategoryConditionModel model)
- {
- foreach (string id in model.SelectedCategoryIds)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.Categories.Where(x => x == id).Count() == 0)
- {
- condition.Categories.Add(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- }
- }
- public virtual async Task InsertCollectionConditionModel(CustomerReminderModel.ConditionModel.AddCollectionConditionModel model)
- {
- foreach (string id in model.SelectedCollectionIds)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.Collections.Where(x => x == id).Count() == 0)
- {
- condition.Collections.Add(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- }
- }
- public virtual async Task InsertProductToConditionModel(CustomerReminderModel.ConditionModel.AddProductToConditionModel model)
- {
- foreach (string id in model.SelectedProductIds)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.Products.Where(x => x == id).Count() == 0)
- {
- condition.Products.Add(id);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- }
- }
- public virtual async Task InsertCustomerTagConditionModel(CustomerReminderModel.ConditionModel.AddCustomerTagConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.CustomerTags.Where(x => x == model.CustomerTagId).Count() == 0)
- {
- condition.CustomerTags.Add(model.CustomerTagId);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- }
- public virtual async Task InsertCustomerGroupConditionModel(CustomerReminderModel.ConditionModel.AddCustomerGroupConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- if (condition.CustomerGroups.Where(x => x == model.CustomerGroupId).Count() == 0)
- {
- condition.CustomerGroups.Add(model.CustomerGroupId);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- }
- public virtual async Task InsertCustomerRegisterConditionModel(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _cr = new CustomerReminder.ReminderCondition.CustomerRegister() {
- RegisterField = model.CustomerRegisterName,
- RegisterValue = model.CustomerRegisterValue,
- };
- condition.CustomerRegistration.Add(_cr);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task UpdateCustomerRegisterConditionModel(CustomerReminderModel.ConditionModel.AddCustomerRegisterConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var cr = condition.CustomerRegistration.FirstOrDefault(x => x.Id == model.Id);
- cr.RegisterField = model.CustomerRegisterName;
- cr.RegisterValue = model.CustomerRegisterValue;
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task InsertCustomCustomerAttributeConditionModel(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var _cr = new CustomerReminder.ReminderCondition.CustomerRegister() {
- RegisterField = model.CustomerAttributeName,
- RegisterValue = model.CustomerAttributeValue,
- };
- condition.CustomCustomerAttributes.Add(_cr);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task UpdateCustomCustomerAttributeConditionModel(CustomerReminderModel.ConditionModel.AddCustomCustomerAttributeConditionModel model)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId);
- if (customerReminder != null)
- {
- var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId);
- if (condition != null)
- {
- var cr = condition.CustomCustomerAttributes.FirstOrDefault(x => x.Id == model.Id);
- cr.RegisterField = model.CustomerAttributeName;
- cr.RegisterValue = model.CustomerAttributeValue;
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task PrepareReminderLevelModel(CustomerReminderModel.ReminderLevelModel model, CustomerReminder customerReminder)
- {
- if (model == null)
- throw new ArgumentNullException(nameof(model));
-
- var emailAccounts = await _emailAccountService.GetAllEmailAccounts();
- foreach (var item in emailAccounts)
- {
- model.EmailAccounts.Add(new SelectListItem {
- Text = item.Email,
- Value = item.Id.ToString()
- });
- }
- var messageTokenProvider = _serviceProvider.GetRequiredService<IMessageTokenProvider>();
- model.AllowedTokens = messageTokenProvider.GetListOfCustomerReminderAllowedTokens(customerReminder.ReminderRuleId);
- }
- public virtual async Task<CustomerReminder.ReminderLevel> InsertReminderLevel(CustomerReminder customerReminder, CustomerReminderModel.ReminderLevelModel model)
- {
- var level = new CustomerReminder.ReminderLevel() {
- Name = model.Name,
- Level = model.Level,
- BccEmailAddresses = model.BccEmailAddresses,
- Body = model.Body,
- EmailAccountId = model.EmailAccountId,
- Subject = model.Subject,
- Day = model.Day,
- Hour = model.Hour,
- Minutes = model.Minutes,
- };
-
- customerReminder.Levels.Add(level);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- _ = _customerActivityService.InsertActivity("AddNewCustomerReminderLevel", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.AddNewCustomerReminderLevel"), customerReminder.Name);
- return level;
- }
- public virtual async Task<CustomerReminder.ReminderLevel> UpdateReminderLevel(CustomerReminder customerReminder, CustomerReminder.ReminderLevel customerReminderLevel, CustomerReminderModel.ReminderLevelModel model)
- {
- customerReminderLevel.Level = model.Level;
- customerReminderLevel.Name = model.Name;
- customerReminderLevel.Subject = model.Subject;
- customerReminderLevel.BccEmailAddresses = model.BccEmailAddresses;
- customerReminderLevel.Body = model.Body;
- customerReminderLevel.EmailAccountId = model.EmailAccountId;
- customerReminderLevel.Day = model.Day;
- customerReminderLevel.Hour = model.Hour;
- customerReminderLevel.Minutes = model.Minutes;
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- _ = _customerActivityService.InsertActivity("EditCustomerReminderCondition", customerReminder.Id,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
- _translationService.GetResource("ActivityLog.EditCustomerReminderLevel"), customerReminder.Name);
- return customerReminderLevel;
- }
- public virtual async Task DeleteLevel(string Id, string customerReminderId)
- {
- var customerReminder = await _customerReminderService.GetCustomerReminderById(customerReminderId);
- if (customerReminder != null)
- {
- var level = customerReminder.Levels.FirstOrDefault(x => x.Id == Id);
- if (level != null)
- {
- customerReminder.Levels.Remove(level);
- await _customerReminderService.UpdateCustomerReminder(customerReminder);
- }
- }
- }
- public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(CustomerActionConditionModel.AddProductToConditionModel model, int pageIndex, int pageSize)
- {
- var productService = _serviceProvider.GetRequiredService<IProductService>();
- var products = await productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId, model.SearchCollectionId, model.SearchStoreId, model.SearchVendorId, model.SearchProductTypeId, model.SearchProductName, pageIndex, pageSize);
- return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);
- }
- public virtual async Task<CustomerReminderModel.ConditionModel.AddProductToConditionModel> PrepareProductToConditionModel(string customerReminderId, string conditionId)
- {
- var storeService = _serviceProvider.GetRequiredService<IStoreService>();
- var vendorService = _serviceProvider.GetRequiredService<IVendorService>();
-
- var model = new CustomerReminderModel.ConditionModel.AddProductToConditionModel();
- model.ConditionId = conditionId;
- model.CustomerReminderId = customerReminderId;
-
- //stores
- model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- foreach (var s in await storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
-
- //vendors
- model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- foreach (var v in await vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
-
- //product types
- model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
- model.AvailableProductTypes.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
-
- return model;
- }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs b/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
index d8f4ca0b5..67b2db7b7 100644
--- a/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
@@ -1,10 +1,10 @@
using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Domain.Knowledgebase;
using Grand.Domain.Seo;
using Grand.Infrastructure;
@@ -75,7 +75,7 @@ namespace Grand.Web.Admin.Services
{
model.Categories.Add(new SelectListItem { Text = "[None]", Value = "" });
var categories = await _knowledgebaseService.GetKnowledgebaseCategories();
- foreach (var category in categories)
+ foreach (var category in categories.SortCategoriesForTree())
{
model.Categories.Add(new SelectListItem
{
@@ -88,7 +88,7 @@ namespace Grand.Web.Admin.Services
{
model.Categories.Add(new SelectListItem { Text = "[None]", Value = "" });
var categories = await _knowledgebaseService.GetKnowledgebaseCategories();
- foreach (var category in categories)
+ foreach (var category in categories.SortCategoriesForTree())
{
model.Categories.Add(new SelectListItem
{
@@ -104,7 +104,7 @@ namespace Grand.Web.Admin.Services
List<TreeNode> nodeList = new List<TreeNode>();
List<ITreeNode> list = new List<ITreeNode>();
- list.AddRange(categories);
+ list.AddRange(categories.SortCategoriesForTree());
list.AddRange(articles);
foreach (var node in list)
diff --git a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
index a06697b50..b21047734 100644
--- a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
@@ -16,7 +16,6 @@ using Grand.Business.Core.Interfaces.Common.Stores;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Business.Core.Interfaces.Storage;
-using Grand.Business.Core.Interfaces.System.Reports;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
@@ -43,7 +42,6 @@ namespace Grand.Web.Admin.Services
#region Fields
private readonly IOrderService _orderService;
- private readonly IOrderReportService _orderReportService;
private readonly IPricingService _pricingService;
private readonly IDateTimeService _dateTimeService;
private readonly IPriceFormatter _priceFormatter;
@@ -58,7 +56,6 @@ namespace Grand.Web.Admin.Services
private readonly IProductService _productService;
private readonly IMessageProviderService _messageProviderService;
private readonly IProductAttributeService _productAttributeService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IGiftVoucherService _giftVoucherService;
private readonly IDownloadService _downloadService;
private readonly IStoreService _storeService;
@@ -86,7 +83,6 @@ namespace Grand.Web.Admin.Services
#region Ctor
public OrderViewModelService(IOrderService orderService,
- IOrderReportService orderReportService,
IPricingService priceCalculationService,
IDateTimeService dateTimeService,
IPriceFormatter priceFormatter,
@@ -101,7 +97,6 @@ namespace Grand.Web.Admin.Services
IProductService productService,
IMessageProviderService messageProviderService,
IProductAttributeService productAttributeService,
- IProductAttributeParser productAttributeParser,
IGiftVoucherService giftVoucherService,
IDownloadService downloadService,
IStoreService storeService,
@@ -126,7 +121,6 @@ namespace Grand.Web.Admin.Services
IMediator mediator)
{
_orderService = orderService;
- _orderReportService = orderReportService;
_pricingService = priceCalculationService;
_dateTimeService = dateTimeService;
_priceFormatter = priceFormatter;
@@ -141,7 +135,6 @@ namespace Grand.Web.Admin.Services
_productService = productService;
_messageProviderService = messageProviderService;
_productAttributeService = productAttributeService;
- _productAttributeParser = productAttributeParser;
_giftVoucherService = giftVoucherService;
_downloadService = downloadService;
_storeService = storeService;
@@ -725,7 +718,7 @@ namespace Grand.Web.Admin.Services
Id = orderItem.Id,
ProductId = orderItem.ProductId,
ProductName = product.Name,
- Sku = product.FormatSku(orderItem.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(orderItem.Attributes),
Quantity = orderItem.Quantity,
OpenQty = orderItem.OpenQty,
CancelQty = orderItem.CancelQty,
@@ -737,7 +730,7 @@ namespace Grand.Web.Admin.Services
IsDownloadActivated = orderItem.IsDownloadActivated,
};
//picture
- var orderItemPicture = await product.GetProductPicture(orderItem.Attributes, _productService, _pictureService, _productAttributeParser);
+ var orderItemPicture = await product.GetProductPicture(orderItem.Attributes, _productService, _pictureService);
orderItemModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(orderItemPicture, 75, true);
//license file
@@ -1061,7 +1054,7 @@ namespace Grand.Web.Admin.Services
form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, ctrlAttributes).ToList();
}
}
@@ -1073,7 +1066,7 @@ namespace Grand.Web.Admin.Services
{
foreach (var item in ctrlAttributes.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, item).ToList();
}
}
@@ -1088,7 +1081,7 @@ namespace Grand.Web.Admin.Services
.Select(v => v.Id)
.ToList())
{
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, selectedAttributeId.ToString()).ToList();
}
}
@@ -1100,7 +1093,7 @@ namespace Grand.Web.Admin.Services
if (!String.IsNullOrEmpty(ctrlAttributes))
{
string enteredText = ctrlAttributes.ToString().Trim();
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, enteredText).ToList();
}
}
@@ -1118,7 +1111,7 @@ namespace Grand.Web.Admin.Services
catch { }
if (selectedDate.HasValue)
{
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, selectedDate.Value.ToString("D")).ToList();
}
}
@@ -1130,7 +1123,7 @@ namespace Grand.Web.Admin.Services
var download = await _downloadService.GetDownloadByGuid(downloadGuid);
if (download != null)
{
- customattributes = _productAttributeParser.AddProductAttribute(customattributes,
+ customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, download.DownloadGuid.ToString()).ToList();
}
}
@@ -1142,10 +1135,10 @@ namespace Grand.Web.Admin.Services
//validate conditional attributes (if specified)
foreach (var attribute in attributes)
{
- var conditionMet = _productAttributeParser.IsConditionMet(product, attribute, customattributes);
+ var conditionMet = product.IsConditionMet(attribute, customattributes);
if (conditionMet.HasValue && !conditionMet.Value)
{
- customattributes = _productAttributeParser.RemoveProductAttribute(customattributes, attribute).ToList();
+ customattributes = Domain.Catalog.ProductExtensions.RemoveProductAttribute(customattributes, attribute).ToList();
}
}
@@ -1188,8 +1181,7 @@ namespace Grand.Web.Admin.Services
continue;
}
}
-
- customattributes = _productAttributeParser.AddGiftVoucherAttribute(customattributes,
+ customattributes = GiftVoucherExtensions.AddGiftVoucherAttribute(customattributes,
recipientName, recipientEmail, senderName, senderEmail, giftVoucherMessage).ToList();
}
@@ -1221,7 +1213,7 @@ namespace Grand.Web.Admin.Services
ProductId = product.Id,
VendorId = product.VendorId,
WarehouseId = product.WarehouseId,
- Sku = product.FormatSku(customattributes, _productAttributeParser),
+ Sku = product.FormatSku(customattributes),
SeId = order.SeId,
UnitPriceInclTax = unitPriceInclTax,
UnitPriceExclTax = unitPriceExclTax,
diff --git a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
index 538393512..26cdf55e4 100644
--- a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
@@ -1,4 +1,5 @@
-using Grand.Business.Core.Interfaces.Catalog.Categories;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Catalog.Collections;
using Grand.Business.Core.Interfaces.Catalog.Directory;
using Grand.Business.Core.Interfaces.Catalog.Discounts;
@@ -7,7 +8,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Catalog.Tax;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
@@ -65,7 +65,6 @@ namespace Grand.Web.Admin.Services
private readonly ICustomerActivityService _customerActivityService;
private readonly IOutOfStockSubscriptionService _outOfStockSubscriptionService;
private readonly IDownloadService _downloadService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IStockQuantityService _stockQuantityService;
private readonly ILanguageService _languageService;
private readonly IProductAttributeFormatter _productAttributeFormatter;
@@ -104,7 +103,6 @@ namespace Grand.Web.Admin.Services
ICustomerActivityService customerActivityService,
IOutOfStockSubscriptionService outOfStockSubscriptionService,
IDownloadService downloadService,
- IProductAttributeParser productAttributeParser,
ILanguageService languageService,
IProductAttributeFormatter productAttributeFormatter,
IStockQuantityService stockQuantityService,
@@ -142,7 +140,6 @@ namespace Grand.Web.Admin.Services
_customerActivityService = customerActivityService;
_outOfStockSubscriptionService = outOfStockSubscriptionService;
_downloadService = downloadService;
- _productAttributeParser = productAttributeParser;
_stockQuantityService = stockQuantityService;
_languageService = languageService;
_productAttributeFormatter = productAttributeFormatter;
@@ -244,7 +241,7 @@ namespace Grand.Web.Admin.Services
}
}
- protected virtual async Task<T> PrepareAddProductModel<T>() where T : ProductModel.AddProductModel, new()
+ protected virtual async Task<T> PrepareAddProductModel<T>() where T : ProductModel.AddProductModel, new()
{
var model = new T {
//a vendor should have access only to his products
@@ -1104,7 +1101,7 @@ namespace Grand.Web.Admin.Services
var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId, model.SearchCollectionId, model.SearchStoreId, model.SearchVendorId, model.SearchProductTypeId, model.SearchProductName, pageIndex, pageSize);
return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);
}
-
+
public virtual async Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product)
{
var productCategories = product.ProductCategories.OrderBy(x => x.DisplayOrder);
@@ -1895,8 +1892,8 @@ namespace Grand.Web.Admin.Services
//currenty any attribute can have condition. why not?
attributeModel.ConditionAllowed = true;
- var conditionAttribute = _productAttributeParser.ParseProductAttributeMappings(product, x.ConditionAttribute).FirstOrDefault();
- var conditionValue = _productAttributeParser.ParseProductAttributeValues(product, x.ConditionAttribute).FirstOrDefault();
+ var conditionAttribute = product.ParseProductAttributeMappings(x.ConditionAttribute).FirstOrDefault();
+ var conditionValue = product.ParseProductAttributeValues(x.ConditionAttribute).FirstOrDefault();
if (conditionAttribute != null && conditionValue != null)
{
var productAttribute = await _productAttributeService.GetProductAttributeById(conditionAttribute.ProductAttributeId);
@@ -1981,8 +1978,7 @@ namespace Grand.Web.Admin.Services
ProductId = product.Id
};
//pre-select attribute and values
- var selectedPva = _productAttributeParser
- .ParseProductAttributeMappings(product, productAttributeMapping.ConditionAttribute)
+ var selectedPva = product.ParseProductAttributeMappings(productAttributeMapping.ConditionAttribute)
.FirstOrDefault();
var attributes = product.ProductAttributeMappings
@@ -2039,7 +2035,7 @@ namespace Grand.Web.Admin.Services
item.IsPreSelected = false;
//select new values
- var selectedValues = _productAttributeParser.ParseProductAttributeValues(product, productAttributeMapping.ConditionAttribute);
+ var selectedValues = product.ParseProductAttributeValues(productAttributeMapping.ConditionAttribute);
foreach (var attributeValue in selectedValues)
foreach (var item in attributeModel.Values)
if (attributeValue.Id == item.Id)
@@ -2079,15 +2075,15 @@ namespace Grand.Web.Admin.Services
case AttributeControlType.ColorSquares:
case AttributeControlType.ImageSquares:
{
- form.TryGetValue(controlId, out string ctrlAttributes);
+ form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, ctrlAttributes).ToList();
}
else
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, "").ToList();
}
}
@@ -2102,20 +2098,20 @@ namespace Grand.Web.Admin.Services
{
if (!string.IsNullOrEmpty(item))
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, item).ToList();
anyValueSelected = true;
}
}
if (!anyValueSelected)
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, "").ToList();
}
}
else
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, "").ToList();
}
}
@@ -2413,10 +2409,10 @@ namespace Grand.Web.Admin.Services
case AttributeControlType.ColorSquares:
case AttributeControlType.ImageSquares:
{
- form.TryGetValue(controlId, out string ctrlAttributes);
+ form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, ctrlAttributes).ToList();
}
}
@@ -2429,7 +2425,7 @@ namespace Grand.Web.Admin.Services
foreach (var item in cblAttributes.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
if (!string.IsNullOrEmpty(item))
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, item).ToList();
}
}
@@ -2444,7 +2440,7 @@ namespace Grand.Web.Admin.Services
.Select(v => v.Id)
.ToList())
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
attribute, selectedAttributeId).ToList();
}
}
@@ -2457,10 +2453,10 @@ namespace Grand.Web.Admin.Services
//validate conditional attributes (if specified)
foreach (var attribute in attributes)
{
- var conditionMet = _productAttributeParser.IsConditionMet(product, attribute, customAttributes);
+ var conditionMet = product.IsConditionMet(attribute, customAttributes);
if (conditionMet.HasValue && !conditionMet.Value)
{
- customAttributes = _productAttributeParser.RemoveProductAttribute(customAttributes, attribute).ToList();
+ customAttributes = Domain.Catalog.ProductExtensions.RemoveProductAttribute(customAttributes, attribute).ToList();
}
}
@@ -2479,7 +2475,7 @@ namespace Grand.Web.Admin.Services
}
#endregion
- if (_productAttributeParser.FindProductAttributeCombination(product, customAttributes) != null)
+ if (product.FindProductAttributeCombination(customAttributes) != null)
{
warnings.Add("This combination attributes exists!");
}
@@ -2555,14 +2551,14 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task GenerateAllAttributeCombinations(Product product)
{
- var allAttributesComb = _productAttributeParser.GenerateAllCombinations(product);
+ var allAttributesComb = product.GenerateAllCombinations();
if (allAttributesComb == null || allAttributesComb.Count == 0)
return;
var id = 1;
foreach (var attributes in allAttributesComb)
{
- var existingCombination = _productAttributeParser.FindProductAttributeCombination(product, attributes.ToList());
+ var existingCombination = product.FindProductAttributeCombination(attributes.ToList());
//already exists?
if (existingCombination != null)
diff --git a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
index 78eb6e5dc..1927c1cc1 100644
--- a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
@@ -1,8 +1,8 @@
-using Grand.Business.Core.Interfaces.Catalog.Directory;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Catalog.Directory;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
@@ -30,7 +30,6 @@ namespace Grand.Web.Admin.Services
private readonly IWarehouseService _warehouseService;
private readonly IMeasureService _measureService;
private readonly IDateTimeService _dateTimeService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ICountryService _countryService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
@@ -51,7 +50,6 @@ namespace Grand.Web.Admin.Services
IWarehouseService warehouseService,
IMeasureService measureService,
IDateTimeService dateTimeService,
- IProductAttributeParser productAttributeParser,
ICountryService countryService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
@@ -71,7 +69,6 @@ namespace Grand.Web.Admin.Services
_warehouseService = warehouseService;
_measureService = measureService;
_dateTimeService = dateTimeService;
- _productAttributeParser = productAttributeParser;
_countryService = countryService;
_customerActivityService = customerActivityService;
_translationService = translationService;
@@ -138,7 +135,7 @@ namespace Grand.Web.Admin.Services
OrderItemId = orderItem.Id,
ProductId = orderItem.ProductId,
ProductName = product.Name,
- Sku = product.FormatSku(orderItem.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(orderItem.Attributes),
AttributeInfo = orderItem.AttributeDescription,
ShippedFromWarehouse = warehouse != null ? warehouse.Name : null,
ShipSeparately = product.ShipSeparately,
@@ -290,7 +287,7 @@ namespace Grand.Web.Admin.Services
public virtual Task LogShipment(string shipmentId, string message)
{
- _ = _customerActivityService.InsertActivity("EditShipment", shipmentId,
+ _ = _customerActivityService.InsertActivity("EditShipment", shipmentId,
_workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(), message);
return Task.CompletedTask;
}
@@ -378,7 +375,7 @@ namespace Grand.Web.Admin.Services
ProductId = orderItem.ProductId,
ProductName = product.Name,
WarehouseId = orderItem.WarehouseId,
- Sku = product.FormatSku(orderItem.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(orderItem.Attributes),
AttributeInfo = orderItem.AttributeDescription,
ShipSeparately = product.ShipSeparately,
ItemWeight = orderItem.ItemWeight.HasValue ? string.Format("{0:F2} [{1}]", orderItem.ItemWeight, baseWeightIn) : "",
@@ -432,7 +429,7 @@ namespace Grand.Web.Admin.Services
{
//multiple warehouses supported
shipmentItemModel.AllowToChooseWarehouse = true;
- var comb = _productAttributeParser.FindProductAttributeCombination(product, orderItem.Attributes);
+ var comb = product.FindProductAttributeCombination(orderItem.Attributes);
if (comb != null)
{
foreach (var pwi in comb.WarehouseInventory
@@ -519,7 +516,7 @@ namespace Grand.Web.Admin.Services
}
if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(product, item.Attributes);
+ var combination = product.FindProductAttributeCombination(item.Attributes);
if (combination == null)
return (false, $"Can't find combination for product {product.Name}");
diff --git a/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs b/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
index cba0aded8..d48cfbb1e 100644
--- a/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
+++ b/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
@@ -32,11 +32,9 @@ namespace Grand.Web.Admin.Startup
services.AddScoped<ICountryViewModelService, CountryViewModelService>();
services.AddScoped<ICourseViewModelService, CourseViewModelService>();
services.AddScoped<ICurrencyViewModelService, CurrencyViewModelService>();
- services.AddScoped<ICustomerActionViewModelService, CustomerActionViewModelService>();
services.AddScoped<ICustomerAttributeViewModelService, CustomerAttributeViewModelService>();
services.AddScoped<ICustomerViewModelService, CustomerViewModelService>();
services.AddScoped<ICustomerReportViewModelService, CustomerReportViewModelService>();
- services.AddScoped<ICustomerReminderViewModelService, CustomerReminderViewModelService>();
services.AddScoped<ICustomerGroupViewModelService, CustomerGroupViewModelService>();
services.AddScoped<ICustomerTagViewModelService, CustomerTagViewModelService>();
services.AddScoped<IDiscountViewModelService, DiscountViewModelService>();
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionConditionValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionConditionValidator.cs
deleted file mode 100644
index f28f2823c..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionConditionValidator.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Validators.Customers
-{
- public class CustomerActionConditionValidator : BaseGrandValidator<CustomerActionConditionModel>
- {
- public CustomerActionConditionValidator(
- IEnumerable<IValidatorConsumer<CustomerActionConditionModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerActionCondition.Fields.Name.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionValidator.cs
deleted file mode 100644
index df51846ef..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerActionValidator.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Validators.Customers
-{
- public class CustomerActionValidator : BaseGrandValidator<CustomerActionModel>
- {
- public CustomerActionValidator(
- IEnumerable<IValidatorConsumer<CustomerActionModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerAction.Fields.Name.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerReminderValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/CustomerReminderValidator.cs
deleted file mode 100644
index 8b96088e8..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerReminderValidator.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Customers;
-
-namespace Grand.Web.Admin.Validators.Customers
-{
- public class CustomerReminderValidator : BaseGrandValidator<CustomerReminderModel>
- {
- public CustomerReminderValidator(
- IEnumerable<IValidatorConsumer<CustomerReminderModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerReminder.Fields.Name.Required"));
- }
- }
- public class CustomerReminderLevelValidator : BaseGrandValidator<CustomerReminderModel.ReminderLevelModel>
- {
- public CustomerReminderLevelValidator(
- IEnumerable<IValidatorConsumer<CustomerReminderModel.ReminderLevelModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerReminder.Level.Fields.Name.Required"));
- RuleFor(x => x.Subject).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerReminder.Level.Fields.Subject.Required"));
- RuleFor(x => x.Body).NotEmpty().WithMessage(translationService.GetResource("Admin.Customers.CustomerReminder.Level.Fields.Body.Required"));
- RuleFor(x => x.Hour+x.Day+ x.Minutes).NotEqual(0).WithMessage(translationService.GetResource("Admin.Customers.CustomerReminder.Level.Fields.DayHourMin.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs
index 8d1d3d27c..d97cdac81 100644
--- a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs
@@ -1,6 +1,6 @@
using FluentValidation;
+using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Knowledgebase;
diff --git a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
index 7a75e776c..011894998 100644
--- a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
@@ -1,6 +1,6 @@
using FluentValidation;
+using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Knowledgebase;
diff --git a/src/Web/Grand.Web.Admin/Validators/Messages/BannerValidator.cs b/src/Web/Grand.Web.Admin/Validators/Messages/BannerValidator.cs
deleted file mode 100644
index d5a3d6410..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Messages/BannerValidator.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Validators.Messages
-{
- public class BannerValidator : BaseGrandValidator<BannerModel>
- {
- public BannerValidator(
- IEnumerable<IValidatorConsumer<BannerModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.Banners.Fields.Name.Required"));
- RuleFor(x => x.Body).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.Banners.Fields.Body.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValidator.cs b/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValidator.cs
deleted file mode 100644
index ff053b39b..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValidator.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Validators.Messages
-{
- public class InteractiveFormAttributeValidator : BaseGrandValidator<InteractiveFormAttributeModel>
- {
- public InteractiveFormAttributeValidator(
- IEnumerable<IValidatorConsumer<InteractiveFormAttributeModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Attribute.Fields.Name.Required"));
- RuleFor(x => x.SystemName).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Attribute.Fields.SystemName.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValueValidator.cs b/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValueValidator.cs
deleted file mode 100644
index 5ce4085b4..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormAttributeValueValidator.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Validators.Messages
-{
- public class InteractiveFormAttributeValueValidator : BaseGrandValidator<InteractiveFormAttributeValueModel>
- {
- public InteractiveFormAttributeValueValidator(
- IEnumerable<IValidatorConsumer<InteractiveFormAttributeValueModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Attribute.Values.Fields.Name.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormValidator.cs b/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormValidator.cs
deleted file mode 100644
index 5ea738989..000000000
--- a/src/Web/Grand.Web.Admin/Validators/Messages/InteractiveFormValidator.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using FluentValidation;
-using Grand.Infrastructure.Validators;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Models.Messages;
-
-namespace Grand.Web.Admin.Validators.Messages
-{
- public class InteractiveFormValidator : BaseGrandValidator<InteractiveFormModel>
- {
- public InteractiveFormValidator(
- IEnumerable<IValidatorConsumer<InteractiveFormModel>> validators,
- ITranslationService translationService)
- : base(validators)
- {
- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Fields.Name.Required"));
- RuleFor(x => x.SystemName).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Fields.SystemName.Required"));
- RuleFor(x => x.Body).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.InteractiveForms.Fields.Body.Required"));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/wwwroot/administration/admin.common.js b/src/Web/Grand.Web.Admin/wwwroot/administration/admin.common.js
index 1401bdba2..40153189f 100644
--- a/src/Web/Grand.Web.Admin/wwwroot/administration/admin.common.js
+++ b/src/Web/Grand.Web.Admin/wwwroot/administration/admin.common.js
@@ -123,14 +123,13 @@ $(document).ajaxStart(function () {
}).ajaxStop(function () {
StopPageLoading();
});
-
function StartPageLoading(options) {
if (options && options.animate) {
$('.page-spinner-bar').remove();
$('body').append('<div class="page-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>');
} else {
$('.page-loading').remove();
- $('body').append('<div class="page-loading"><img src="/_content/Grand.Web.Admin/administration/build/images/loading.gif"/>&nbsp;&nbsp;<span>' + (options && options.message ? options.message : 'Loading...') + '</span></div>');
+ $('body').append('<div class="page-loading"><img src="' + wwwrootpath +'/administration/build/images/loading.gif"/>&nbsp;&nbsp;<span>' + (options && options.message ? options.message : 'Loading...') + '</span></div>');
}
}
diff --git a/src/Web/Grand.Web.Admin/wwwroot/assets/images/no-image.png b/src/Web/Grand.Web.Admin/wwwroot/assets/images/no-image.png
new file mode 100644
index 000000000..62b4406f7
Binary files /dev/null and b/src/Web/Grand.Web.Admin/wwwroot/assets/images/no-image.png differ
diff --git a/src/Web/Grand.Web.Admin/wwwroot/favicon.ico b/src/Web/Grand.Web.Admin/wwwroot/favicon.ico
new file mode 100644
index 000000000..3cf896f33
Binary files /dev/null and b/src/Web/Grand.Web.Admin/wwwroot/favicon.ico differ
diff --git a/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs b/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs
index 5945c09a6..116e087b6 100644
--- a/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs
+++ b/src/Web/Grand.Web.Common/Filters/CustomerActivityAttribute.cs
@@ -2,7 +2,6 @@
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Domain.Common;
using Grand.Domain.Customers;
using Grand.Domain.Data;
@@ -11,7 +10,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.Net.Http.Headers;
namespace Grand.Web.Common.Filters
{
@@ -40,7 +38,6 @@ namespace Grand.Web.Common.Filters
private readonly IWorkContext _workContext;
private readonly IUserFieldService _userFieldService;
private readonly ICustomerActivityService _customerActivityService;
- private readonly ICustomerActionEventService _customerActionEventService;
private readonly CustomerSettings _customerSettings;
#endregion
@@ -52,14 +49,12 @@ namespace Grand.Web.Common.Filters
IWorkContext workContext,
IUserFieldService userFieldService,
ICustomerActivityService customerActivityService,
- ICustomerActionEventService customerActionEventService,
CustomerSettings customerSettings)
{
_customerService = customerService;
_workContext = workContext;
_userFieldService = userFieldService;
_customerActivityService = customerActivityService;
- _customerActionEventService = customerActionEventService;
_customerSettings = customerSettings;
}
@@ -131,8 +126,6 @@ namespace Grand.Web.Common.Filters
//activity
_ = _customerActivityService.InsertActivity("PublicStore.Url", pageUrl, _workContext.CurrentCustomer,
context.HttpContext?.Connection?.RemoteIpAddress?.ToString(), pageUrl);
- //action
- await _customerActionEventService.Url(_workContext.CurrentCustomer, context.HttpContext?.Request?.Path.ToString(), context.HttpContext?.Request?.Headers["Referer"]);
}
}
}
diff --git a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
index 90fc83e20..fcd147c41 100644
--- a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
+++ b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
@@ -12,7 +12,6 @@ using Grand.Infrastructure;
using Grand.Infrastructure.Configuration;
using Grand.Infrastructure.Plugins;
using Grand.Infrastructure.TypeSearchers;
-using Grand.Infrastructure.Validators;
using Grand.SharedKernel.Extensions;
using Grand.Web.Common.Themes;
using Microsoft.AspNetCore.Builder;
@@ -26,7 +25,6 @@ using Microsoft.Extensions.WebEncoders;
using Newtonsoft.Json.Serialization;
using StackExchange.Redis;
using System.IO.Compression;
-using System.Reflection;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using WebMarkupMin.AspNet.Common.Compressors;
diff --git a/src/Web/Grand.Web.Common/StoreHelper.cs b/src/Web/Grand.Web.Common/StoreHelper.cs
index da3a8a10e..97c5b01ee 100644
--- a/src/Web/Grand.Web.Common/StoreHelper.cs
+++ b/src/Web/Grand.Web.Common/StoreHelper.cs
@@ -3,7 +3,6 @@ using Grand.Domain.Stores;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using Microsoft.AspNetCore.Http;
-using Microsoft.Net.Http.Headers;
namespace Grand.Web.Common
{
@@ -85,32 +84,31 @@ namespace Grand.Web.Common
}
public DomainHost DomainHost {
- get
+ get {
+ if (_cachedDomainHost == null)
{
+ //try to determine the current HOST header
+ var host = _httpContextAccessor.HttpContext?.Request?.GetTypedHeaders().Host.ToString();
+ if (StoreHost != null)
+ {
+ _cachedDomainHost = StoreHost.HostValue(host) ?? new DomainHost() {
+ Id = int.MinValue.ToString(),
+ Url = StoreHost.SslEnabled ? StoreHost.SecureUrl : StoreHost.Url,
+ HostName = "temporary-store"
+ };
+ }
if (_cachedDomainHost == null)
{
- //try to determine the current HOST header
- var host = _httpContextAccessor.HttpContext?.Request?.GetTypedHeaders().Host.ToString();
- if (StoreHost != null)
- {
- _cachedDomainHost = StoreHost.HostValue(host) ?? new DomainHost() {
- Id = int.MinValue.ToString(),
- Url = StoreHost.SslEnabled ? StoreHost.SecureUrl : StoreHost.Url,
- HostName = "temporary-store"
- };
- }
- if (_cachedDomainHost == null)
- {
- _cachedDomainHost = new DomainHost() {
- Id = int.MinValue.ToString(),
- Url = host,
- HostName = "temporary"
- };
- }
- return _cachedDomainHost;
+ _cachedDomainHost = new DomainHost() {
+ Id = int.MinValue.ToString(),
+ Url = host,
+ HostName = "temporary"
+ };
}
return _cachedDomainHost;
}
+ return _cachedDomainHost;
+ }
}
/// <summary>
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
index 6350d1738..679a78e8c 100644
--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
@@ -903,18 +903,9 @@
<Resource Name="ActivityLog.AddNewCustomer" Area="Front">
<Value>Added a new customer (ID = {0})</Value>
</Resource>
- <Resource Name="ActivityLog.AddNewCustomerAction" Area="Front">
- <Value>Added a new customer action (ID = {0})</Value>
- </Resource>
<Resource Name="ActivityLog.AddNewCustomerGroup" Area="Front">
<Value>Added a new customer group ('{0}')</Value>
- </Resource>
- <Resource Name="activitylog.addnewcustomerreminder" Area="Front">
- <Value>Add new customer reminder</Value>
- </Resource>
- <Resource Name="activitylog.addnewcustomerreminderlevel" Area="Front">
- <Value>Add new customer reminder Level</Value>
- </Resource>
+ </Resource>
<Resource Name="ActivityLog.AddNewCustomerTag" Area="Front">
<Value>Added a new customer tag ('{0}')</Value>
</Resource>
@@ -990,15 +981,9 @@
<Resource Name="ActivityLog.DeleteCustomer" Area="Front">
<Value>Deleted a customer (ID = {0})</Value>
</Resource>
- <Resource Name="ActivityLog.DeleteCustomerAction" Area="Front">
- <Value>Deleted a customer action</Value>
- </Resource>
<Resource Name="ActivityLog.DeleteCustomerGroup" Area="Front">
<Value>Deleted a customer group ('{0}')</Value>
</Resource>
- <Resource Name="activitylog.deletecustomerreminder" Area="Front">
- <Value>Delete customer reminder</Value>
- </Resource>
<Resource Name="ActivityLog.DeleteCustomerTag" Area="Front">
<Value>Deleted a customer group ('{0}')</Value>
</Resource>
@@ -1068,24 +1053,9 @@
<Resource Name="ActivityLog.EditCustomer" Area="Front">
<Value>Edited a customer (ID = {0})</Value>
</Resource>
- <Resource Name="ActivityLog.editcustomeraction" Area="Front">
- <Value>Edit customer action ('{0}')</Value>
- </Resource>
- <Resource Name="ActivityLog.editcustomeractioncondition" Area="Front">
- <Value>Edit customer action condition ('{0}')</Value>
- </Resource>
<Resource Name="ActivityLog.EditCustomerGroup" Area="Front">
<Value>Edited a customer group ('{0}')</Value>
</Resource>
- <Resource Name="activitylog.editcustomerreminder" Area="Front">
- <Value>Edit customer reminder</Value>
- </Resource>
- <Resource Name="activitylog.editcustomerremindercondition" Area="Front">
- <Value>Edit Customer Reminder Condition</Value>
- </Resource>
- <Resource Name="activitylog.editcustomerreminderlevel" Area="Front">
- <Value>Edit Customer Reminder Level</Value>
- </Resource>
<Resource Name="ActivityLog.EditCustomerTag" Area="Front">
<Value>Edited a customer group ('{0}')</Value>
</Resource>
@@ -1131,33 +1101,6 @@
<Resource Name="ActivityLog.EditWidget" Area="Front">
<Value>Edited a widget (ID = {0})</Value>
</Resource>
- <Resource Name="ActivityLog.InteractiveFormAdd" Area="Front">
- <Value>Add Interactive form - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormAddAttribute" Area="Front">
- <Value>Add interactive form attribute - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormAddAttributeValue" Area="Front">
- <Value>Add Interactive Form Attribute Value - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormDeleteAttribute" Area="Front">
- <Value>Delete Interactive Form Attribute - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormDeleteAttributeValue" Area="Front">
- <Value>Delete Interactive Form Attribute Value - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormDeleted" Area="Front">
- <Value>Deleted Interactive form - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormUpdate" Area="Front">
- <Value>Update Interactive form - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormUpdateAttribute" Area="Front">
- <Value>Update Interactive Form Attribute - {0}</Value>
- </Resource>
- <Resource Name="ActivityLog.InteractiveFormUpdateAttributeValue" Area="Front">
- <Value>Update Interactive Form Attribute Value - {0}</Value>
- </Resource>
<Resource Name="Activitylog.lastactivity" Area="Front">
<Value>Public store. Last Activity </Value>
</Resource>
@@ -1197,9 +1140,6 @@
<Resource Name="ActivityLog.PublicStore.ContactUs" Area="Front">
<Value>Used contact us form</Value>
</Resource>
- <Resource Name="ActivityLog.PublicStore.InteractiveForm" Area="Front">
- <Value>PublicStore - Sent interactive form - {0}</Value>
- </Resource>
<Resource Name="ActivityLog.PublicStore.Login" Area="Front">
<Value>Login</Value>
</Resource>
@@ -6327,9 +6267,6 @@
<Resource Name="admin.customers.actiontype.helpText.AllOfThem" Area="Admin">
<Value>All of them – All of the conditions must be met.</Value>
</Resource>
- <Resource Name="admin.customers.actiontype.helpText.Banner" Area="Admin">
- <Value>Banner – Store automatically view banner which is assigned to a particular action.</Value>
- </Resource>
<Resource Name="admin.customers.actiontype.helpText.Customergroup" Area="Admin">
<Value>Assign to customer group – Store automatically assign customer to specified customer group.</Value>
</Resource>
@@ -6339,9 +6276,6 @@
<Resource Name="admin.customers.actiontype.helpText.Email" Area="Admin">
<Value>Email – Store automatically send email to customer, who made particular action.</Value>
</Resource>
- <Resource Name="Admin.Customers.Actiontype.helptext.interactiveform" Area="Admin">
- <Value>Interactive form – Store automatically view form which is assigned to a particular action.</Value>
- </Resource>
<Resource Name="admin.customers.actiontype.helpText.OneOfThem" Area="Admin">
<Value>One of them – One of condition must be met.</Value>
</Resource>
@@ -6363,228 +6297,6 @@
<Resource Name="admin.customers.attributes.customer" Area="Admin">
<Value>Customer attributes</Value>
</Resource>
- <Resource Name="admin.customers.customeraction.addcustomeractioncondition" Area="Admin">
- <Value>Add new condition</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.added" Area="Admin">
- <Value>Action added</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.addnew" Area="Admin">
- <Value>Add new action</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.backtoaction" Area="Admin">
- <Value>Back to Action</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.backtolist" Area="Admin">
- <Value>Back to customer action list</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.conditions" Area="Admin">
- <Value>Conditions</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.conditions.addnew" Area="Admin">
- <Value>Add new condition</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.Deleted" Area="Admin">
- <Value>The customer action has been deleted successfully.</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.editcustomeraction" Area="Admin">
- <Value>Edit action</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.editcustomeractioncondition" Area="Admin">
- <Value>Edit condition</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.actionTypeId" Area="Admin">
- <Value>Action Type</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.active" Area="Admin">
- <Value>Active</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.Banner" Area="Admin">
- <Value>Display banner</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.conditionId" Area="Admin">
- <Value>Condition</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.conditiontype" Area="Admin">
- <Value>Condition type</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.CustomerGroup" Area="Admin">
- <Value>Customer group</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.CustomerTag" Area="Admin">
- <Value>Customer tag</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.endDateTime" Area="Admin">
- <Value>End datetime</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.InteractiveForm" Area="Admin">
- <Value>Interactive forms</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.MessageTemplate" Area="Admin">
- <Value>Send email</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.name" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.name.required" Area="Admin">
- <Value>Field name is required</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerAction.Fields.ReactionType" Area="Admin">
- <Value>Reaction type</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.fields.startDateTime" Area="Admin">
- <Value>Start DateTime</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.history" Area="Admin">
- <Value>History</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.history.fields.createdate" Area="Admin">
- <Value>Create date</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.history.fields.customer" Area="Admin">
- <Value>Customer</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.info" Area="Admin">
- <Value>Action Info</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.reaction" Area="Admin">
- <Value>Reaction</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.saveBeforeEdit" Area="Admin">
- <Value>You need to save the before you can add values for this page</Value>
- </Resource>
- <Resource Name="admin.customers.customeraction.updated" Area="Admin">
- <Value>Action updated</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.added" Area="Admin">
- <Value>Added condition</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.categories" Area="Admin">
- <Value>Categories</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.category.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.collections" Area="Admin">
- <Value>Collections</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.collections.addnew" Area="Admin">
- <Value>Add new collection</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.customCustomerAttribute" Area="Admin">
- <Value>Custom Customer Attributes</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.customergroup" Area="Admin">
- <Value>Customer group</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.customerregister" Area="Admin">
- <Value>Customer register</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.customertag" Area="Admin">
- <Value>Customer tag</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.categoryname" Area="Admin">
- <Value>Add category</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.collection" Area="Admin">
- <Value>Collection</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.conditionId" Area="Admin">
- <Value>Condition</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionCondition.Fields.CustomCustomerAttributeName" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionCondition.Fields.CustomCustomerAttributeValue" Area="Admin">
- <Value>Value</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.customerconditionTypeId" Area="Admin">
- <Value>Condition Type</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.fields.customerGroupName" Area="Admin">
- <Value>Customer group</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.fields.customerRegisterName" Area="Admin">
- <Value>Customer registration - field name</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.fields.customerRegisterValue" Area="Admin">
- <Value>Customer registration - field value</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.fields.customerTagName" Area="Admin">
- <Value>Tag name</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.name" Area="Admin">
- <Value>Condition name</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.name.required" Area="Admin">
- <Value>Field name is required</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.productattributename" Area="Admin">
- <Value>Product attribute</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.productattributevaluename" Area="Admin">
- <Value>Product attribute value</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.productname" Area="Admin">
- <Value>Product name</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.specificationname" Area="Admin">
- <Value>Product Specification</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.specificationvaluename" Area="Admin">
- <Value>Product specification value</Value>
- </Resource>
- <Resource Name="admin.customers.customerActionCondition.fields.storeName" Area="Admin">
- <Value>Store name</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionCondition.Fields.UrlCurrentName" Area="Admin">
- <Value>Current Url</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionCondition.Fields.UrlReferrerName" Area="Admin">
- <Value>Url Referrer</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.fields.vendorname" Area="Admin">
- <Value>Vendor name</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.info" Area="Admin">
- <Value>Condition info</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.productattributes" Area="Admin">
- <Value>Product attributes</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.products" Area="Admin">
- <Value>Products</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.products.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.productspecifications" Area="Admin">
- <Value>Product specifications</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.saveBeforeEdit" Area="Admin">
- <Value>You need to save the before you can add values for this page</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionCondition.Store" Area="Admin">
- <Value>Store</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.updated" Area="Admin">
- <Value>Condition updated</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.urlcurrent" Area="Admin">
- <Value>Current URL</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.urlreferrer" Area="Admin">
- <Value>Url referrer</Value>
- </Resource>
- <Resource Name="admin.customers.customeractioncondition.vendors" Area="Admin">
- <Value>Vendors</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActions" Area="Admin">
- <Value>Customer actions</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerActionType" Area="Admin">
- <Value>Customer Action Type</Value>
- </Resource>
<Resource Name="Admin.Customers.CustomerAttributes" Area="Admin">
<Value>Custom customer attributes</Value>
</Resource>
@@ -6776,265 +6488,7 @@
</Resource>
<Resource Name="Admin.Customers.CustomerNotes.Fields.Title" Area="Admin">
<Value>Title</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Addcondition" Area="Admin">
- <Value>Add condition</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.added" Area="Admin">
- <Value>Reminder added</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Addlevel" Area="Admin">
- <Value>Add level</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.backtoaction" Area="Admin">
- <Value>Back to action</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.backtolist" Area="Admin">
- <Value>Back to customer reminder list</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.added" Area="Admin">
- <Value>Condition added</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.categories" Area="Admin">
- <Value>Categories</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.category.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.collections" Area="Admin">
- <Value>Collections</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.collections.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.customcustomerattribute" Area="Admin">
- <Value>Customer attribute</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.customergroup" Area="Admin">
- <Value>Customer Group</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.customerregister" Area="Admin">
- <Value>Customer register</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.customertag" Area="Admin">
- <Value>Customer tag</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.categoryname" Area="Admin">
- <Value>Category name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.collection" Area="Admin">
- <Value>Collection</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Condition.Fields.ConditionId" Area="Admin">
- <Value>Condition</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Condition.Fields.ConditionTypeId" Area="Admin">
- <Value>Condition type</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customcustomerattributename" Area="Admin">
- <Value>Customer Attribute Name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customcustomerattributevalue" Area="Admin">
- <Value>Customer Attribute Value</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customergroupname" Area="Admin">
- <Value>Customer Group Name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customerregistername" Area="Admin">
- <Value>Customer Register Name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customerregistervalue" Area="Admin">
- <Value>Customer Register Value</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.customertagname" Area="Admin">
- <Value>Customer Tag Name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.name" Area="Admin">
- <Value>Condition name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.fields.productname" Area="Admin">
- <Value>Product Name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.info" Area="Admin">
- <Value>Condition info</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Condition.Products.Addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.condition.savebeforeedit" Area="Admin">
- <Value>You must save it before edit.</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.conditions" Area="Admin">
- <Value>Reminder Conditions</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.conditions.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.deleted" Area="Admin">
- <Value>Customer Reminder Deleted</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Edit" Area="Admin">
- <Value>Reminder Edit</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminder.Editcondition" Area="Admin">
- <Value>Edit condition</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.editlevel" Area="Admin">
- <Value>Edit level</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.fields.active" Area="Admin">
- <Value>Active</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.AllowRenew" Area="Admin">
- <Value>Allow renew</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.ConditionId" Area="Admin">
- <Value>Condition</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.fields.conditiontype" Area="Admin">
- <Value>Condition Type</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.DisplayOrder" Area="Admin">
- <Value>Display Order</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.EndDate" Area="Admin">
- <Value>End date</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.LastUpdateDate" Area="Admin">
- <Value>Activity date for rule</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.fields.level" Area="Admin">
- <Value>Reminder level</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.fields.name" Area="Admin">
- <Value>Reminder name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.fields.name.required" Area="Admin">
- <Value>Reminder name requires</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.ReminderRule" Area="Admin">
- <Value>Reminder Rule</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.RenewedDay" Area="Admin">
- <Value>Renewed Days</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Fields.StartDate" Area="Admin">
- <Value>Date start</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.history" Area="Admin">
- <Value>History mailings</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.history.fields.customer" Area="Admin">
- <Value>Email</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.history.fields.level" Area="Admin">
- <Value>Level</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.history.fields.order" Area="Admin">
- <Value>Ordered</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.history.fields.senddate" Area="Admin">
- <Value>Sent on</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.info" Area="Admin">
- <Value>Reminder Info</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.AllowedTokens" Area="Admin">
- <Value>Allowed Tokens</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.BccEmailAddresses" Area="Admin">
- <Value>BCC</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.Body" Area="Admin">
- <Value>Body</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.level.fields.body.required" Area="Admin">
- <Value>Body is required</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.level.fields.DayHourMin.required" Area="Admin">
- <Value>You must enter Day or Hour or Minutes.</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.level.fields.emailaccountid" Area="Admin">
- <Value>Email Account</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.Level" Area="Admin">
- <Value>Level</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.Name" Area="Admin">
- <Value>Level name</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.level.fields.name.required" Area="Admin">
- <Value>Level name required</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.SendDay" Area="Admin">
- <Value>Send after days</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.SendHour" Area="Admin">
- <Value>Send after hours</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.SendMinutes" Area="Admin">
- <Value>Send after minutes</Value>
- </Resource>
- <Resource Name="Admin.Customers.CustomerReminder.Level.Fields.Subject" Area="Admin">
- <Value>Subject</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.level.fields.subject.required" Area="Admin">
- <Value>Subject required</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.levels" Area="Admin">
- <Value>Reminder Levels</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.levels.addnew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.run" Area="Admin">
- <Value>Completed the process of customer reminder</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.savebeforeedit" Area="Admin">
- <Value>You must save it before edit</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text1" Area="Admin">
- <Value>Abandoned cart – You can set custom reminder to customers who left their carts without confirming order. Activity date is counting "from this date".</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text2" Area="Admin">
- <Value>Registered customer – You can set custom reminder to customers who just register in your store. Activity date is counting from this date.</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text3" Area="Admin">
- <Value>Last purchase – You can set custom reminder to customers who made last purchase to specified date. Activity date is counting "to this date"</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text4" Area="Admin">
- <Value>Last activity – You can set custom reminder to customers who made last activity to specified date. Activity date is counting "to this date".</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text5" Area="Admin">
- <Value>Birthday – You can set custom reminder related to customers birthday (field Activity date is not used).</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text6" Area="Admin">
- <Value>Completed order – You can set custom reminder related to completed order (Activity date is counting from this order date).</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.text7" Area="Admin">
- <Value>Unpaid order – You can set custom reminder related to unpaid order (Activity date is counting from this order date).</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminder.updated" Area="Admin">
- <Value>Reminder updated</Value>
- </Resource>
- <Resource Name="admin.customers.customerremindercondition.updated" Area="Admin">
- <Value>Condition updated</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminderlevel.added" Area="Admin">
- <Value>Level added</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminderlevel.exists" Area="Admin">
- <Value>This level exist</Value>
- </Resource>
- <Resource Name="admin.customers.customerreminderlevel.updated" Area="Admin">
- <Value>Reminder level updated</Value>
- </Resource>
- <Resource Name="Admin.Customers.Customerreminders" Area="Admin">
- <Value>Customer reminders</Value>
- </Resource>
+ </Resource>
<Resource Name="Admin.Customers.Customers" Area="Admin">
<Value>Customers</Value>
</Resource>
@@ -8181,42 +7635,6 @@
<Resource Name="Admin.Marketing" Area="Admin">
<Value>Marketing</Value>
</Resource>
- <Resource Name="Admin.Marketing.Banners" Area="Admin">
- <Value>Banners</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Added" Area="Admin">
- <Value>The new banner has been added successfully.</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.AddNew" Area="Admin">
- <Value>Add a new banner</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.BackToList" Area="Admin">
- <Value>back to banner list</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Deleted" Area="Admin">
- <Value>The banner has been deleted successfully.</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.EditBannerDetails" Area="Admin">
- <Value>Edit banner</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Fields.Body" Area="Admin">
- <Value>Body</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Fields.Body.Required" Area="Admin">
- <Value>Body is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Fields.CreatedOn" Area="Admin">
- <Value>Created on</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Fields.Name" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Fields.Name.Required" Area="Admin">
- <Value>Banner name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.Banners.Updated" Area="Admin">
- <Value>The banner has been updated successfully.</Value>
- </Resource>
<Resource Name="Admin.Marketing.Campaigns" Area="Admin">
<Value>Mailing Campaigns</Value>
</Resource>
@@ -8589,138 +8007,6 @@
<Resource Name="Admin.Marketing.Documents" Area="Admin">
<Value>Documents</Value>
</Resource>
- <Resource Name="Admin.Marketing.InteractiveForms" Area="Admin">
- <Value>Interactive Forms</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.AddAttribute" Area="Admin">
- <Value>Add Attribute</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Added" Area="Admin">
- <Value>Interactive Form Added</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.AddNew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute" Area="Admin">
- <Value>Attribute</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Added" Area="Admin">
- <Value>Attribute added</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.AddNew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.Class" Area="Admin">
- <Value>Css class</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.DefaultValue" Area="Admin">
- <Value>Default Value</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.FormControlTypeId" Area="Admin">
- <Value>Choose Form Control</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.IsRequired" Area="Admin">
- <Value>Is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.Name" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.Name.Required" Area="Admin">
- <Value>Name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.RegexValidation" Area="Admin">
- <Value>Regex Expression</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.Style" Area="Admin">
- <Value>CSS style</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.SystemName" Area="Admin">
- <Value>System Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.SystemName.Required" Area="Admin">
- <Value>System name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.ValidationMaxLength" Area="Admin">
- <Value>Validation Max. Length</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Fields.ValidationMinLength" Area="Admin">
- <Value>Validation Min. Length</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Info" Area="Admin">
- <Value>Info</Value>
- </Resource>
- <Resource Name="Admin.Marketing.interactiveforms.attribute.updated" Area="Admin">
- <Value>Attribute has been updated</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values" Area="Admin">
- <Value>Values</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.AddNew" Area="Admin">
- <Value>Add new</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.EditValue" Area="Admin">
- <Value>Edit</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.Fields.DisplayOrder" Area="Admin">
- <Value>Display Order</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.Fields.IsPreSelected" Area="Admin">
- <Value>Is pre selected</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.Fields.Name" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Attribute.Values.Fields.Name.Required" Area="Admin">
- <Value>Name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.BackToForm" Area="Admin">
- <Value>Back to form</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.BackToList" Area="Admin">
- <Value>Back to list</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Deleted" Area="Admin">
- <Value>Interactive form deleted</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.EditAttribute" Area="Admin">
- <Value>Edit Attribute</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.EditDetails" Area="Admin">
- <Value>Edit Details</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.AvailableTokens" Area="Admin">
- <Value>Available tokens</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.Body" Area="Admin">
- <Value>Body</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.Body.Required" Area="Admin">
- <Value>Body is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.EmailAccount" Area="Admin">
- <Value>Email Accounts</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.Name" Area="Admin">
- <Value>Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.Name.Required" Area="Admin">
- <Value>Name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.SystemName" Area="Admin">
- <Value>System Name</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Fields.SystemName.Required" Area="Admin">
- <Value>System name is required</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Info" Area="Admin">
- <Value>Info</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.SaveBeforeEdit" Area="Admin">
- <Value>You need to save form before edit</Value>
- </Resource>
- <Resource Name="Admin.Marketing.InteractiveForms.Updated" Area="Admin">
- <Value>Updated</Value>
- </Resource>
<Resource Name="Admin.Marketing.Newsletter" Area="Admin">
<Value>Newsletter</Value>
</Resource>
@@ -15325,25 +14611,7 @@
</Resource>
<Resource Name="Permission.PublicStoreAllowNavigation" Area="Admin">
<Value>Public store. Allow navigation</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.EmailForm" Area="Admin">
- <Value>Message from form {0}</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.Fields.IsRequired" Area="Front">
- <Value>The value of the field {0} is required</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.Fields.Regex" Area="Front">
- <Value>The value of the {0} does not meet the requirements</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.Fields.TextboxMaximumLength" Area="Front">
- <Value>{0} : maximum length is {1} chars</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.Fields.TextboxMinimumLength" Area="Front">
- <Value>{0} : minimum length is {1} chars</Value>
- </Resource>
- <Resource Name="PopupInteractiveForm.Send" Area="Front">
- <Value>SEND</Value>
- </Resource>
+ </Resource>
<Resource Name="PrivacyPreference" Area="Front">
<Value>Privacy Settings</Value>
</Resource>
diff --git a/src/Web/Grand.Web/Commands/Handler/Common/ContactUsCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/Common/ContactUsCommandHandler.cs
index 4af4ceb72..dd42f3446 100644
--- a/src/Web/Grand.Web/Commands/Handler/Common/ContactUsCommandHandler.cs
+++ b/src/Web/Grand.Web/Commands/Handler/Common/ContactUsCommandHandler.cs
@@ -2,8 +2,9 @@
using Grand.Business.Core.Interfaces.Marketing.Contacts;
using Grand.Domain.Common;
using Grand.Domain.Customers;
-using Grand.Web.Common.Security.Captcha;
+using Grand.Domain.Messages;
using Grand.Web.Commands.Models.Common;
+using Grand.Web.Common.Security.Captcha;
using Grand.Web.Models.Common;
using MediatR;
@@ -26,8 +27,7 @@ namespace Grand.Web.Commands.Handler.Common
public async Task<ContactUsModel> Handle(ContactUsCommand request, CancellationToken cancellationToken)
{
- var model = request.Model ?? new ContactUsModel
- {
+ var model = request.Model ?? new ContactUsModel {
Email = request.Customer.Email,
FullName = request.Customer.GetFullName(),
};
@@ -47,8 +47,7 @@ namespace Grand.Web.Commands.Handler.Common
var contactAttributes = await _contactAttributeService.GetAllContactAttributes(request.Store.Id);
foreach (var attribute in contactAttributes)
{
- var attributeModel = new ContactUsModel.ContactAttributeModel
- {
+ var attributeModel = new ContactUsModel.ContactAttributeModel {
Id = attribute.Id,
Name = attribute.GetTranslation(x => x.Name, request.Language.Id),
TextPrompt = attribute.GetTranslation(x => x.TextPrompt, request.Language.Id),
@@ -85,8 +84,7 @@ namespace Grand.Web.Commands.Handler.Common
foreach (var attributeValue in attributeValues)
{
var preSelected = request.Form?[$"contact_attribute_{attribute.Id}"].ToString();
- var attributeValueModel = new ContactUsModel.ContactAttributeValueModel
- {
+ var attributeValueModel = new ContactUsModel.ContactAttributeValueModel {
Id = attributeValue.Id,
Name = attributeValue.GetTranslation(x => x.Name, request.Language.Id),
ColorSquaresRgb = attributeValue.ColorSquaresRgb,
diff --git a/src/Web/Grand.Web/Commands/Handler/Common/ContactUsSendCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/Common/ContactUsSendCommandHandler.cs
index 666fba664..0cdeebf3c 100644
--- a/src/Web/Grand.Web/Commands/Handler/Common/ContactUsSendCommandHandler.cs
+++ b/src/Web/Grand.Web/Commands/Handler/Common/ContactUsSendCommandHandler.cs
@@ -6,6 +6,7 @@ using Grand.Business.Core.Interfaces.Messages;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
+using Grand.Domain.Messages;
using Grand.Domain.Stores;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
@@ -286,8 +287,7 @@ namespace Grand.Web.Commands.Handler.Common
var contactAttributes = await _contactAttributeService.GetAllContactAttributes(storeId);
foreach (var attribute in contactAttributes)
{
- var attributeModel = new ContactUsModel.ContactAttributeModel
- {
+ var attributeModel = new ContactUsModel.ContactAttributeModel {
Id = attribute.Id,
Name = attribute.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),
TextPrompt = attribute.GetTranslation(x => x.TextPrompt, _workContext.WorkingLanguage.Id),
@@ -308,8 +308,7 @@ namespace Grand.Web.Commands.Handler.Common
var attributeValues = attribute.ContactAttributeValues;
foreach (var attributeValue in attributeValues)
{
- var attributeValueModel = new ContactUsModel.ContactAttributeValueModel
- {
+ var attributeValueModel = new ContactUsModel.ContactAttributeValueModel {
Id = attributeValue.Id,
Name = attributeValue.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),
ColorSquaresRgb = attributeValue.ColorSquaresRgb,
@@ -410,7 +409,7 @@ namespace Grand.Web.Commands.Handler.Common
var body = FormatText.ConvertText(request.Model.Enquiry);
await _messageProviderService.SendContactUsMessage
- (_workContext.CurrentCustomer, store, _workContext.WorkingLanguage.Id, request.Model.Email.Trim(), request.Model.FullName, subject,
+ (_workContext.CurrentCustomer, store, _workContext.WorkingLanguage.Id, request.Model.Email.Trim(), request.Model.FullName, subject,
body, request.Model.ContactAttributeInfo, request.Model.ContactAttribute, request.IpAddress);
request.Model.SuccessfullySent = true;
diff --git a/src/Web/Grand.Web/Commands/Handler/Common/PopupInteractiveCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/Common/PopupInteractiveCommandHandler.cs
deleted file mode 100644
index 34ebf5fc8..000000000
--- a/src/Web/Grand.Web/Commands/Handler/Common/PopupInteractiveCommandHandler.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Business.Core.Interfaces.Messages;
-using Grand.Infrastructure;
-using Grand.Domain.Messages;
-using Grand.Web.Commands.Models.Common;
-using Grand.Web.Events;
-using MediatR;
-using System.Text.RegularExpressions;
-
-namespace Grand.Web.Commands.Handler.Common
-{
- public class PopupInteractiveCommandHandler : IRequestHandler<PopupInteractiveCommand, IList<string>>
- {
- private readonly IInteractiveFormService _interactiveFormService;
- private readonly ITranslationService _translationService;
- private readonly IWorkContext _workContext;
- private readonly IEmailAccountService _emailAccountService;
- private readonly IQueuedEmailService _queuedEmailService;
- private readonly ICustomerActivityService _customerActivityService;
- private readonly IMediator _mediator;
-
- public PopupInteractiveCommandHandler(IInteractiveFormService interactiveFormService,
- ITranslationService translationService,
- IWorkContext workContext,
- IEmailAccountService emailAccountService,
- IQueuedEmailService queuedEmailService,
- ICustomerActivityService customerActivityService,
- IMediator mediator)
- {
- _interactiveFormService = interactiveFormService;
- _translationService = translationService;
- _workContext = workContext;
- _emailAccountService = emailAccountService;
- _queuedEmailService = queuedEmailService;
- _customerActivityService = customerActivityService;
- _mediator = mediator;
- }
-
- public async Task<IList<string>> Handle(PopupInteractiveCommand request, CancellationToken cancellationToken)
- {
- var errors = new List<string>();
- var formid = request.Form["Id"];
- var form = await _interactiveFormService.GetFormById(formid);
- if (form == null)
- return errors;
-
- string enquiry = "";
- var enquiryForm = new List<(string attrName, string attrValue)>();
- foreach (var item in form.FormAttributes)
- {
- enquiry += string.Format("{0}: {1} <br />", item.Name, request.Form[item.SystemName]);
- enquiryForm.Add((item.Name, request.Form[item.SystemName]));
- if (!string.IsNullOrEmpty(item.RegexValidation))
- {
- var valuesStr = request.Form[item.SystemName];
- Regex regex = new Regex(item.RegexValidation);
- Match match = regex.Match(valuesStr);
- if (!match.Success)
- {
- errors.Add(string.Format(_translationService.GetResource("PopupInteractiveForm.Fields.Regex"), item.GetTranslation(a => a.Name, _workContext.WorkingLanguage.Id)));
- }
- }
- if (item.IsRequired)
- {
- var valuesStr = request.Form[item.SystemName];
- if (string.IsNullOrEmpty(valuesStr))
- errors.Add(string.Format(_translationService.GetResource("PopupInteractiveForm.Fields.IsRequired"), item.GetTranslation(a => a.Name, _workContext.WorkingLanguage.Id)));
- }
- if (item.ValidationMinLength.HasValue)
- {
- if (item.FormControlTypeId == FormControlType.TextBox ||
- item.FormControlTypeId == FormControlType.MultilineTextbox)
- {
- var valuesStr = request.Form[item.SystemName].ToString();
- int enteredTextLength = String.IsNullOrEmpty(valuesStr) ? 0 : valuesStr.Length;
- if (item.ValidationMinLength.Value > enteredTextLength)
- {
- errors.Add(string.Format(_translationService.GetResource("PopupInteractiveForm.Fields.TextboxMinimumLength"), item.GetTranslation(a => a.Name, _workContext.WorkingLanguage.Id), item.ValidationMinLength.Value));
- }
- }
- }
- if (item.ValidationMaxLength.HasValue)
- {
- if (item.FormControlTypeId == FormControlType.TextBox ||
- item.FormControlTypeId == FormControlType.MultilineTextbox)
- {
- var valuesStr = request.Form[item.SystemName].ToString();
- int enteredTextLength = String.IsNullOrEmpty(valuesStr) ? 0 : valuesStr.Length;
- if (item.ValidationMaxLength.Value < enteredTextLength)
- {
- errors.Add(string.Format(_translationService.GetResource("PopupInteractiveForm.Fields.TextboxMaximumLength"), item.GetTranslation(a => a.Name, _workContext.WorkingLanguage.Id), item.ValidationMaxLength.Value));
- }
- }
- }
-
- }
-
- if (!errors.Any())
- {
- var emailAccount = await _emailAccountService.GetEmailAccountById(form.EmailAccountId);
- if (emailAccount == null)
- emailAccount = (await _emailAccountService.GetAllEmailAccounts()).FirstOrDefault();
- if (emailAccount == null)
- throw new Exception("No email account could be loaded");
-
- string from;
- string fromName;
- string subject = string.Format(_translationService.GetResource("PopupInteractiveForm.EmailForm"), form.Name);
- from = emailAccount.Email;
- fromName = emailAccount.DisplayName;
-
- await _queuedEmailService.InsertQueuedEmail(new QueuedEmail
- {
- From = from,
- FromName = fromName,
- To = emailAccount.Email,
- ToName = emailAccount.DisplayName,
- PriorityId = QueuedEmailPriority.High,
- Subject = subject,
- Body = enquiry,
- CreatedOnUtc = DateTime.UtcNow,
- EmailAccountId = emailAccount.Id
- });
-
- //notification
- await _mediator.Publish(new PopupInteractiveEvent(_workContext.CurrentCustomer, request.Form, enquiryForm));
-
- //activity log
- _ = _customerActivityService.InsertActivity("PublicStore.InteractiveForm", form.Id,
- _workContext.CurrentCustomer, "",
- string.Format(_translationService.GetResource("ActivityLog.PublicStore.InteractiveForm"), form.Name));
- }
-
- return errors;
- }
- }
-}
diff --git a/src/Web/Grand.Web/Commands/Handler/Customers/CustomerRegisteredCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/Customers/CustomerRegisteredCommandHandler.cs
index 90b6c86b9..163021d0d 100644
--- a/src/Web/Grand.Web/Commands/Handler/Customers/CustomerRegisteredCommandHandler.cs
+++ b/src/Web/Grand.Web/Commands/Handler/Customers/CustomerRegisteredCommandHandler.cs
@@ -2,7 +2,6 @@
using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Business.Core.Interfaces.Marketing.Newsletters;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Common;
@@ -24,7 +23,6 @@ namespace Grand.Web.Commands.Handler.Customers
private readonly IAddressAttributeService _addressAttributeService;
private readonly ICustomerService _customerService;
private readonly ICountryService _countryService;
- private readonly ICustomerActionEventService _customerActionEventService;
private readonly TaxSettings _taxSettings;
private readonly CustomerSettings _customerSettings;
@@ -39,7 +37,6 @@ namespace Grand.Web.Commands.Handler.Customers
IAddressAttributeService addressAttributeService,
ICountryService countryService,
ICustomerService customerService,
- ICustomerActionEventService customerActionEventService,
TaxSettings taxSettings,
CustomerSettings customerSettings,
AddressSettings addressSettings,
@@ -52,7 +49,6 @@ namespace Grand.Web.Commands.Handler.Customers
_addressAttributeService = addressAttributeService;
_countryService = countryService;
_customerService = customerService;
- _customerActionEventService = customerActionEventService;
_taxSettings = taxSettings;
_customerSettings = customerSettings;
_addressSettings = addressSettings;
@@ -194,8 +190,6 @@ namespace Grand.Web.Commands.Handler.Customers
if (_customerSettings.RegistrationFreeShipping)
await _customerService.UpdateCustomerField(request.Customer, x => x.FreeShipping, true);
- await _customerActionEventService.Registration(request.Customer);
-
return true;
}
diff --git a/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
index f35a50320..6e7548a04 100644
--- a/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
+++ b/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
@@ -1,10 +1,10 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
+using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
+using Grand.Domain.Orders;
using Grand.Web.Commands.Models.ShoppingCart;
using MediatR;
diff --git a/src/Web/Grand.Web/Commands/Models/Common/PopupInteractiveCommand.cs b/src/Web/Grand.Web/Commands/Models/Common/PopupInteractiveCommand.cs
deleted file mode 100644
index dfc19af38..000000000
--- a/src/Web/Grand.Web/Commands/Models/Common/PopupInteractiveCommand.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using MediatR;
-using Microsoft.AspNetCore.Http;
-
-namespace Grand.Web.Commands.Models.Common
-{
- public class PopupInteractiveCommand : IRequest<IList<string>>
- {
- public IFormCollection Form { get; set; }
- }
-}
diff --git a/src/Web/Grand.Web/Components/CrossSellProducts.cs b/src/Web/Grand.Web/Components/CrossSellProducts.cs
index 6b1db8919..137763bec 100644
--- a/src/Web/Grand.Web/Components/CrossSellProducts.cs
+++ b/src/Web/Grand.Web/Components/CrossSellProducts.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Domain.Orders;
using Grand.Infrastructure;
diff --git a/src/Web/Grand.Web/Components/InteractiveForm.cs b/src/Web/Grand.Web/Components/InteractiveForm.cs
deleted file mode 100644
index 5df6345e6..000000000
--- a/src/Web/Grand.Web/Components/InteractiveForm.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Grand.Web.Common.Components;
-using Grand.Web.Features.Models.Messages;
-using MediatR;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Grand.Web.Components
-{
- public class InteractiveFormViewComponent : BaseViewComponent
- {
- #region Fields
-
- private readonly IMediator _mediator;
-
- #endregion
-
- #region Constructors
-
- public InteractiveFormViewComponent(
- IMediator mediator)
- {
- _mediator = mediator;
- }
-
- #endregion
-
- #region Invoker
-
- public async Task<IViewComponentResult> InvokeAsync(string systemName)
- {
- var model = await _mediator.Send(new GetInteractiveForm() { SystemName = systemName });
- if (model == null)
- return Content("");
-
- return View(model);
- }
-
- #endregion
-
- }
-}
diff --git a/src/Web/Grand.Web/Components/KnowledgebaseCategories.cs b/src/Web/Grand.Web/Components/KnowledgebaseCategories.cs
index e4ef68b1e..8c08ce87e 100644
--- a/src/Web/Grand.Web/Components/KnowledgebaseCategories.cs
+++ b/src/Web/Grand.Web/Components/KnowledgebaseCategories.cs
@@ -1,10 +1,10 @@
using Grand.Infrastructure;
using Grand.Domain.Knowledgebase;
using Grand.Web.Common.Components;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Web.Models.Knowledgebase;
using Microsoft.AspNetCore.Mvc;
using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Cms;
namespace Grand.Web.ViewComponents
{
diff --git a/src/Web/Grand.Web/Components/KnowledgebaseHomepageArticles.cs b/src/Web/Grand.Web/Components/KnowledgebaseHomepageArticles.cs
index 30763aa90..3586fca80 100644
--- a/src/Web/Grand.Web/Components/KnowledgebaseHomepageArticles.cs
+++ b/src/Web/Grand.Web/Components/KnowledgebaseHomepageArticles.cs
@@ -1,10 +1,10 @@
using Grand.Infrastructure;
using Grand.Domain.Knowledgebase;
using Grand.Web.Common.Components;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Web.Models.Knowledgebase;
using Microsoft.AspNetCore.Mvc;
using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Cms;
namespace Grand.Web.Components
{
diff --git a/src/Web/Grand.Web/Components/PopupAction.cs b/src/Web/Grand.Web/Components/PopupAction.cs
deleted file mode 100644
index c18a64674..000000000
--- a/src/Web/Grand.Web/Components/PopupAction.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure;
-using Grand.Web.Common.Components;
-using Grand.Web.Events;
-using Grand.Web.Models.Common;
-using MediatR;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Grand.Web.ViewComponents
-{
- public class PopupActionViewComponent : BaseViewComponent
- {
- private readonly IPopupService _popupService;
- private readonly IWorkContext _workContext;
- private readonly IMediator _mediator;
-
- public PopupActionViewComponent(IPopupService popupService, IWorkContext workContext, IMediator mediator)
- {
- _popupService = popupService;
- _workContext = workContext;
- _mediator = mediator;
- }
-
- public async Task<IViewComponentResult> InvokeAsync()
- {
- var result = await _popupService.GetActivePopupByCustomerId(_workContext.CurrentCustomer.Id);
- if (result == null)
- return Content("");
-
- var model = new PopupModel();
- model.Id = result.Id;
- model.Body = result.Body;
- model.Name = result.Name;
- model.PopupType = (Domain.Messages.PopupType)result.PopupTypeId;
- model.CustomerActionId = result.CustomerActionId;
-
- await _popupService.MovepopupToArchive(result.Id, _workContext.CurrentCustomer.Id);
-
- //notification
- await _mediator.Publish(new PopupRenderEvent(_workContext.CurrentCustomer, result));
-
- return View(model);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Controllers/CatalogController.cs b/src/Web/Grand.Web/Controllers/CatalogController.cs
index f023003e4..482e59f9e 100644
--- a/src/Web/Grand.Web/Controllers/CatalogController.cs
+++ b/src/Web/Grand.Web/Controllers/CatalogController.cs
@@ -10,7 +10,6 @@ using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Events.Customers;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Domain.Catalog;
using Grand.Domain.Customers;
using Grand.Domain.Orders;
@@ -44,7 +43,6 @@ namespace Grand.Web.Controllers
private readonly IAclService _aclService;
private readonly IPermissionService _permissionService;
private readonly ICustomerActivityService _customerActivityService;
- private readonly ICustomerActionEventService _customerActionEventService;
private readonly IMediator _mediator;
private readonly VendorSettings _vendorSettings;
@@ -64,7 +62,6 @@ namespace Grand.Web.Controllers
IAclService aclService,
IPermissionService permissionService,
ICustomerActivityService customerActivityService,
- ICustomerActionEventService customerActionEventService,
IMediator mediator,
VendorSettings vendorSettings)
{
@@ -79,7 +76,6 @@ namespace Grand.Web.Controllers
_aclService = aclService;
_permissionService = permissionService;
_customerActivityService = customerActivityService;
- _customerActionEventService = customerActionEventService;
_mediator = mediator;
_vendorSettings = vendorSettings;
}
@@ -143,7 +139,6 @@ namespace Grand.Web.Controllers
_ = _customerActivityService.InsertActivity("PublicStore.ViewCategory", category.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewCategory"), category.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
//model
var model = await _mediator.Send(new GetCategory() {
@@ -197,7 +192,6 @@ namespace Grand.Web.Controllers
_ = _customerActivityService.InsertActivity("PublicStore.ViewBrand", brand.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewBrand"), brand.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
//model
var model = await _mediator.Send(new GetBrand() {
@@ -261,7 +255,6 @@ namespace Grand.Web.Controllers
_ = _customerActivityService.InsertActivity("PublicStore.ViewCollection", collection.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewCollection"), collection.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
//model
var model = await _mediator.Send(new GetCollection() {
diff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.cs
index f4016878c..dfd332d7e 100644
--- a/src/Web/Grand.Web/Controllers/CommonController.cs
+++ b/src/Web/Grand.Web/Controllers/CommonController.cs
@@ -642,19 +642,6 @@ namespace Grand.Web.Controllers
});
}
-
- [HttpPost, ActionName("PopupInteractiveForm")]
- [DenySystemAccount]
- public virtual async Task<IActionResult> PopupInteractiveForm(IFormCollection formCollection)
- {
- var result = await _mediator.Send(new PopupInteractiveCommand() { Form = formCollection });
- return Json(new
- {
- success = !result.Any(),
- errors = result
- });
- }
-
[HttpPost]
[ClosedStore(true)]
[PublicStore(true)]
diff --git a/src/Web/Grand.Web/Controllers/CourseController.cs b/src/Web/Grand.Web/Controllers/CourseController.cs
index 0a9828924..fa6d90852 100644
--- a/src/Web/Grand.Web/Controllers/CourseController.cs
+++ b/src/Web/Grand.Web/Controllers/CourseController.cs
@@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Marketing.Courses;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Courses;
using Grand.Domain.Customers;
@@ -25,7 +24,6 @@ namespace Grand.Web.Controllers
private readonly IGroupService _groupService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
- private readonly ICustomerActionEventService _customerActionEventService;
private readonly ICourseService _courseService;
private readonly ICourseLessonService _courseLessonService;
private readonly IDownloadService _downloadService;
@@ -39,7 +37,6 @@ namespace Grand.Web.Controllers
IGroupService groupService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
- ICustomerActionEventService customerActionEventService,
ICourseService courseService,
ICourseLessonService courseLessonService,
IDownloadService downloadService,
@@ -52,7 +49,6 @@ namespace Grand.Web.Controllers
_groupService = groupService;
_customerActivityService = customerActivityService;
_translationService = translationService;
- _customerActionEventService = customerActionEventService;
_courseService = courseService;
_courseLessonService = courseLessonService;
_downloadService = downloadService;
@@ -108,7 +104,6 @@ namespace Grand.Web.Controllers
_ = _customerActivityService.InsertActivity("PublicStore.ViewCourse", course.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewCourse"), course.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
//model
var model = await _mediator.Send(new GetCourse() {
@@ -142,7 +137,6 @@ namespace Grand.Web.Controllers
_ = _customerActivityService.InsertActivity("PublicStore.ViewLesson", lesson.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewLesson"), lesson.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path, Request.GetTypedHeaders().Referer?.ToString());
//model
var model = await _mediator.Send(new GetLesson() {
diff --git a/src/Web/Grand.Web/Controllers/DownloadController.cs b/src/Web/Grand.Web/Controllers/DownloadController.cs
index 40372c5ac..71747423c 100644
--- a/src/Web/Grand.Web/Controllers/DownloadController.cs
+++ b/src/Web/Grand.Web/Controllers/DownloadController.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Business.Core.Interfaces.Common.Localization;
@@ -8,6 +7,7 @@ using Grand.Business.Core.Interfaces.Marketing.Documents;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Catalog;
using Grand.Domain.Customers;
+using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Common.Filters;
using Microsoft.AspNetCore.Mvc;
diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.cs
index 0f08d0835..a7d384758 100644
--- a/src/Web/Grand.Web/Controllers/InstallController.cs
+++ b/src/Web/Grand.Web/Controllers/InstallController.cs
@@ -1,6 +1,5 @@
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Security;
-using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Commands.System.Security;
using Grand.Business.Core.Interfaces.System.Installation;
using Grand.Domain.Data;
diff --git a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs
index ee46bb549..4b6615cdb 100644
--- a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs
+++ b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs
@@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Customers;
using Grand.Domain.Knowledgebase;
@@ -17,6 +16,8 @@ using Grand.Web.Common.Security.Captcha;
using Grand.Web.Events.Cache;
using Grand.Web.Models.Knowledgebase;
using Microsoft.AspNetCore.Mvc;
+using Grand.Web.Extensions;
+using Grand.Business.Core.Interfaces.Cms;
namespace Grand.Web.Controllers
{
diff --git a/src/Web/Grand.Web/Controllers/PixelController.cs b/src/Web/Grand.Web/Controllers/PixelController.cs
index a60e35f9e..faf3f341c 100644
--- a/src/Web/Grand.Web/Controllers/PixelController.cs
+++ b/src/Web/Grand.Web/Controllers/PixelController.cs
@@ -4,7 +4,6 @@ using Grand.Web.Common.Controllers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Net.Http.Headers;
namespace Grand.Web.Controllers
{
diff --git a/src/Web/Grand.Web/Controllers/ProductController.cs b/src/Web/Grand.Web/Controllers/ProductController.cs
index 5dd171e39..453f52e3a 100644
--- a/src/Web/Grand.Web/Controllers/ProductController.cs
+++ b/src/Web/Grand.Web/Controllers/ProductController.cs
@@ -8,7 +8,6 @@ using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Catalog;
using Grand.Domain.Media;
@@ -40,7 +39,6 @@ namespace Grand.Web.Controllers
private readonly IAclService _aclService;
private readonly IPermissionService _permissionService;
private readonly ICustomerActivityService _customerActivityService;
- private readonly ICustomerActionEventService _customerActionEventService;
private readonly IMediator _mediator;
private readonly CatalogSettings _catalogSettings;
private readonly ShoppingCartSettings _shoppingCartSettings;
@@ -59,7 +57,6 @@ namespace Grand.Web.Controllers
IAclService aclService,
IPermissionService permissionService,
ICustomerActivityService customerActivityService,
- ICustomerActionEventService customerActionEventService,
IMediator mediator,
CatalogSettings catalogSettings,
ShoppingCartSettings shoppingCartSettings,
@@ -74,7 +71,6 @@ namespace Grand.Web.Controllers
_aclService = aclService;
_permissionService = permissionService;
_customerActivityService = customerActivityService;
- _customerActionEventService = customerActionEventService;
_mediator = mediator;
_catalogSettings = catalogSettings;
_shoppingCartSettings = shoppingCartSettings;
@@ -171,7 +167,7 @@ namespace Grand.Web.Controllers
//activity log
_ = _customerActivityService.InsertActivity("PublicStore.ViewProduct", product.Id, _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewProduct"), product.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
+
await _productService.UpdateMostView(product);
return View(productLayoutViewPath, model);
@@ -418,7 +414,7 @@ namespace Grand.Web.Controllers
//activity log
_ = _customerActivityService.InsertActivity("PublicStore.ViewProduct", product.Id, _workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.PublicStore.ViewProduct"), product.Name);
- await _customerActionEventService.Viewed(customer, HttpContext.Request.Path.ToString(), Request.GetTypedHeaders().Referer?.ToString());
+
await _productService.UpdateMostView(product);
return Json(new
diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
index c2c80a3e2..ffbabb4a2 100644
--- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
+++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Catalog.Discounts;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
using Grand.Business.Core.Interfaces.Checkout.GiftVouchers;
using Grand.Business.Core.Interfaces.Checkout.Orders;
diff --git a/src/Web/Grand.Web/Controllers/WishlistController.cs b/src/Web/Grand.Web/Controllers/WishlistController.cs
index cd0ad7ce9..6a9cf790c 100644
--- a/src/Web/Grand.Web/Controllers/WishlistController.cs
+++ b/src/Web/Grand.Web/Controllers/WishlistController.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Checkout.Orders;
+using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Security;
diff --git a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
index 68d91aa3f..e26c2d2ae 100644
--- a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
+++ b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
@@ -328,11 +328,6 @@ namespace Grand.Web.Endpoints
pattern + "contactus",
new { controller = "Common", action = "ContactUs" });
- //interactive form
- endpointRouteBuilder.MapControllerRoute("PopupInteractiveForm",
- pattern + "popupinteractiveform",
- new { controller = "Common", action = "PopupInteractiveForm" });
-
//change currency
endpointRouteBuilder.MapControllerRoute("ChangeCurrency",
pattern + "changecurrency/{currencycode}",
diff --git a/src/Web/Grand.Web/Events/PopupInteractiveEvent.cs b/src/Web/Grand.Web/Events/PopupInteractiveEvent.cs
deleted file mode 100644
index 37b658f47..000000000
--- a/src/Web/Grand.Web/Events/PopupInteractiveEvent.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Grand.Domain.Customers;
-using MediatR;
-using Microsoft.AspNetCore.Http;
-
-namespace Grand.Web.Events
-{
- public class PopupInteractiveEvent : INotification
- {
- public IFormCollection Form { get; private set; }
- public IList<(string attrName, string attrValue)> EnquiryForm { get; private set; }
- public Customer Customer { get; private set; }
- public PopupInteractiveEvent(
- Customer customer,
- IFormCollection form,
- IList<(string attrName, string attrValue)> enquiryForm)
- {
- Customer = customer;
- Form = form;
- EnquiryForm = enquiryForm;
- }
- }
-}
diff --git a/src/Web/Grand.Web/Events/PopupRenderEvent.cs b/src/Web/Grand.Web/Events/PopupRenderEvent.cs
deleted file mode 100644
index 51ecb8dd1..000000000
--- a/src/Web/Grand.Web/Events/PopupRenderEvent.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Grand.Domain.Customers;
-using Grand.Domain.Messages;
-using MediatR;
-
-namespace Grand.Web.Events
-{
- public class PopupRenderEvent : INotification
- {
- public Customer Customer { get; private set; }
- public PopupActive PopupActive { get; private set; }
- public PopupRenderEvent(Customer customer, PopupActive popupActive)
- {
- Customer = customer;
- PopupActive = popupActive;
- }
- }
-}
diff --git a/src/Business/Grand.Business.Core/Extensions/KnowledgebaseExtensions.cs b/src/Web/Grand.Web/Extensions/KnowledgebaseExtensions.cs
similarity index 67%
rename from src/Business/Grand.Business.Core/Extensions/KnowledgebaseExtensions.cs
rename to src/Web/Grand.Web/Extensions/KnowledgebaseExtensions.cs
index 7b7c40178..8adaee306 100644
--- a/src/Business/Grand.Business.Core/Extensions/KnowledgebaseExtensions.cs
+++ b/src/Web/Grand.Web/Extensions/KnowledgebaseExtensions.cs
@@ -1,15 +1,53 @@
-using Grand.Business.Core.Interfaces.Common.Security;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Cms;
+using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Domain.Knowledgebase;
using Grand.Infrastructure;
-namespace Grand.Business.Core.Extensions
+namespace Grand.Web.Extensions
{
- /// <summary>
- /// Extensions
- /// </summary>
public static class KnowledgebaseExtensions
{
+ /// <summary>
+ /// Get category breadcrumb
+ /// </summary>
+ /// <param name="category">Category</param>
+ /// <param name="knowledgebaseService">Knowledgebase Service</param>
+ /// <param name="aclService">ACL service</param>
+ /// <param name="workContext">WorkContext</param>
+ /// <param name="showHidden">A value indicating whether to load hidden records</param>
+ /// <returns>Category breadcrumb </returns>
+ public static async Task<IList<KnowledgebaseCategory>> GetCategoryBreadCrumb(this KnowledgebaseCategory category,
+ IKnowledgebaseService knowledgebaseService,
+ IAclService aclService,
+ IWorkContext workContext,
+ bool showHidden = false)
+ {
+ if (category == null)
+ throw new ArgumentNullException(nameof(category));
+
+ var result = new List<KnowledgebaseCategory>();
+
+ //used to prevent circular references
+ var alreadyProcessedCategoryIds = new List<string>();
+
+ while (category != null && //not null
+ (showHidden || category.Published) && //published
+ (showHidden || aclService.Authorize(category, workContext.CurrentCustomer)) && //ACL
+ (showHidden || aclService.Authorize(category, workContext.CurrentStore.Id)) && //Store acl
+ !alreadyProcessedCategoryIds.Contains(category.Id)) //prevent circular references
+ {
+ result.Add(category);
+
+ alreadyProcessedCategoryIds.Add(category.Id);
+
+ category = await knowledgebaseService.GetKnowledgebaseCategory(category.ParentCategoryId);
+ }
+
+ result.Reverse();
+ return result;
+ }
+
/// <summary>
/// Get formatted category breadcrumb
/// Note: ACL and store acl is ignored
@@ -36,16 +74,6 @@ namespace Grand.Business.Core.Extensions
return result;
}
-
- /// <summary>
- /// Get category breadcrumb
- /// </summary>
- /// <param name="category">Category</param>
- /// <param name="allCategories">All categories</param>
- /// <param name="aclService">ACL service</param>
- /// <param name="storeLinkService">Store link service</param>
- /// <param name="showHidden">A value indicating whether to load hidden records</param>
- /// <returns>Category breadcrumb </returns>
public static IList<KnowledgebaseCategory> GetCategoryBreadCrumb(this KnowledgebaseCategory category, IList<KnowledgebaseCategory> allCategories)
{
if (category == null)
@@ -70,68 +98,5 @@ namespace Grand.Business.Core.Extensions
result.Reverse();
return result;
}
-
- /// <summary>
- /// Get category breadcrumb
- /// </summary>
- /// <param name="category">Category</param>
- /// <param name="categoryService">Category service</param>
- /// <param name="aclService">ACL service</param>
- /// <param name="storeLinkService">Store link service</param>
- /// <param name="showHidden">A value indicating whether to load hidden records</param>
- /// <returns>Category breadcrumb </returns>
- public static async Task<IList<KnowledgebaseCategory>> GetCategoryBreadCrumb(this KnowledgebaseCategory category,
- IKnowledgebaseService knowledgebaseService,
- IAclService aclService,
- IWorkContext workContext,
- bool showHidden = false)
- {
- if (category == null)
- throw new ArgumentNullException(nameof(category));
-
- var result = new List<KnowledgebaseCategory>();
-
- //used to prevent circular references
- var alreadyProcessedCategoryIds = new List<string>();
-
- while (category != null && //not null
- (showHidden || category.Published) && //published
- (showHidden || aclService.Authorize(category, workContext.CurrentCustomer)) && //ACL
- (showHidden || aclService.Authorize(category, workContext.CurrentStore.Id)) && //Store acl
- !alreadyProcessedCategoryIds.Contains(category.Id)) //prevent circular references
- {
- result.Add(category);
-
- alreadyProcessedCategoryIds.Add(category.Id);
-
- category = await knowledgebaseService.GetKnowledgebaseCategory(category.ParentCategoryId);
- }
-
- result.Reverse();
- return result;
- }
-
- public static List<KnowledgebaseCategory> SortCategoriesForTree(this IList<KnowledgebaseCategory> source, string parentId = null,
- bool ignoreCategoriesWithoutExistingParent = false)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
-
- var result = new List<KnowledgebaseCategory>();
-
- foreach (var cat in source.Where(c => c.ParentCategoryId == parentId).ToList())
- {
- result.Add(cat);
- result.AddRange(SortCategoriesForTree(source, cat.Id, true));
- }
- if (!ignoreCategoriesWithoutExistingParent && result.Count != source.Count)
- {
- //find categories without parent in provided category source and insert them into result
- foreach (var cat in source)
- if (result.FirstOrDefault(x => x.Id == cat.Id) == null)
- result.Add(cat);
- }
- return result;
- }
}
}
diff --git a/src/Web/Grand.Web/Extensions/ProductExtensions.cs b/src/Web/Grand.Web/Extensions/ProductExtensions.cs
new file mode 100644
index 000000000..b7edcfa77
--- /dev/null
+++ b/src/Web/Grand.Web/Extensions/ProductExtensions.cs
@@ -0,0 +1,78 @@
+using Grand.Business.Core.Interfaces.Catalog.Products;
+using Grand.Business.Core.Interfaces.Storage;
+using Grand.Domain.Catalog;
+using Grand.Domain.Common;
+using Grand.Domain.Media;
+
+namespace Grand.Web.Extensions
+{
+ public static class ProductExtensions
+ {
+ /// <summary>
+ /// Get product picture (for shopping cart and order details pages)
+ /// </summary>
+ /// <param name="product">Product</param>
+ /// <param name="attributes">Atributes </param>
+ /// <param name="pictureService">Picture service</param>
+ /// <returns>Picture</returns>
+ public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,
+ IProductService productService, IPictureService pictureService)
+ {
+ if (product == null)
+ throw new ArgumentNullException(nameof(product));
+ if (pictureService == null)
+ throw new ArgumentNullException(nameof(pictureService));
+
+ Picture picture = null;
+
+ if (attributes != null && attributes.Any())
+ {
+
+ var comb = product.FindProductAttributeCombination(attributes);
+ if (comb != null)
+ {
+ if (!string.IsNullOrEmpty(comb.PictureId))
+ {
+ var combPicture = await pictureService.GetPictureById(comb.PictureId);
+ if (combPicture != null)
+ {
+ picture = combPicture;
+ }
+ }
+ }
+ if (picture == null)
+ {
+ var attributeValues = product.ParseProductAttributeValues(attributes);
+ foreach (var attributeValue in attributeValues)
+ {
+ var attributePicture = await pictureService.GetPictureById(attributeValue.PictureId);
+ if (attributePicture != null)
+ {
+ picture = attributePicture;
+ break;
+ }
+ }
+ }
+ }
+ if (picture == null)
+ {
+ var pp = product.ProductPictures.OrderBy(x => x.DisplayOrder).FirstOrDefault();
+ if (pp != null)
+ picture = await pictureService.GetPictureById(pp.PictureId);
+ }
+
+ if (picture == null && !product.VisibleIndividually && !string.IsNullOrEmpty(product.ParentGroupedProductId))
+ {
+ var parentProduct = await productService.GetProductById(product.ParentGroupedProductId);
+ if (parentProduct != null)
+ if (parentProduct.ProductPictures.Any())
+ {
+ picture = await pictureService.GetPictureById(parentProduct.ProductPictures.FirstOrDefault().PictureId);
+
+ }
+ }
+
+ return picture;
+ }
+ }
+}
diff --git a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostYearHandler.cs b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostYearHandler.cs
index 0ebbed44e..fbb97e6c6 100644
--- a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostYearHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostYearHandler.cs
@@ -1,11 +1,11 @@
-using Grand.Infrastructure;
+using Grand.Business.Core.Interfaces.Cms;
+using Grand.Domain.Blogs;
+using Grand.Infrastructure;
using Grand.Infrastructure.Caching;
-using Grand.Business.Core.Interfaces.Cms;
-using Grand.Web.Features.Models.Blogs;
using Grand.Web.Events.Cache;
+using Grand.Web.Features.Models.Blogs;
using Grand.Web.Models.Blogs;
using MediatR;
-using Grand.Business.Core.Extensions;
namespace Grand.Web.Features.Handlers.Blogs
{
diff --git a/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs b/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
index f742a7581..c4c29a238 100644
--- a/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Commands.Checkout.Orders;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
diff --git a/src/Web/Grand.Web/Features/Handlers/Common/GetPrivacyPreferenceModelHandler.cs b/src/Web/Grand.Web/Features/Handlers/Common/GetPrivacyPreferenceModelHandler.cs
index 4ee2cf403..0683455e5 100644
--- a/src/Web/Grand.Web/Features/Handlers/Common/GetPrivacyPreferenceModelHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Common/GetPrivacyPreferenceModelHandler.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Cms;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Common;
using Grand.Domain.Customers;
using Grand.Web.Features.Models.Common;
diff --git a/src/Web/Grand.Web/Features/Handlers/Common/GetRobotsTextFileHandler.cs b/src/Web/Grand.Web/Features/Handlers/Common/GetRobotsTextFileHandler.cs
index 1cc46f0bf..9a8fc2d01 100644
--- a/src/Web/Grand.Web/Features/Handlers/Common/GetRobotsTextFileHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Common/GetRobotsTextFileHandler.cs
@@ -1,5 +1,4 @@
using Grand.Business.Core.Interfaces.Cms;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Web.Features.Models.Common;
using MediatR;
diff --git a/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs b/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs
index 45b1695d6..c68b9c73d 100644
--- a/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs
@@ -2,7 +2,6 @@
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Marketing.Knowledgebase;
using Grand.Infrastructure.Caching;
using Grand.Domain.Blogs;
using Grand.Domain.Common;
diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetCustomAttributesHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetCustomAttributesHandler.cs
index 92087e25a..2ab8eb91d 100644
--- a/src/Web/Grand.Web/Features/Handlers/Customers/GetCustomAttributesHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetCustomAttributesHandler.cs
@@ -1,6 +1,7 @@
using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Domain.Catalog;
+using Grand.Domain.Customers;
using Grand.Web.Features.Models.Customers;
using Grand.Web.Models.Customer;
using MediatR;
@@ -25,8 +26,7 @@ namespace Grand.Web.Features.Handlers.Customers
var customerAttributes = await _customerAttributeService.GetAllCustomerAttributes();
foreach (var attribute in customerAttributes)
{
- var attributeModel = new CustomerAttributeModel
- {
+ var attributeModel = new CustomerAttributeModel {
Id = attribute.Id,
Name = attribute.GetTranslation(x => x.Name, request.Language.Id),
IsRequired = attribute.IsRequired,
@@ -40,8 +40,7 @@ namespace Grand.Web.Features.Handlers.Customers
var attributeValues = attribute.CustomerAttributeValues;
foreach (var attributeValue in attributeValues)
{
- var valueModel = new CustomerAttributeValueModel
- {
+ var valueModel = new CustomerAttributeValueModel {
Id = attributeValue.Id,
Name = attributeValue.GetTranslation(x => x.Name, request.Language.Id),
IsPreSelected = attributeValue.IsPreSelected
diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetDownloadableProductsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetDownloadableProductsHandler.cs
index b7cfb1505..cc76d8456 100644
--- a/src/Web/Grand.Web/Features/Handlers/Customers/GetDownloadableProductsHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetDownloadableProductsHandler.cs
@@ -1,7 +1,8 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Queries.Checkout.Orders;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Common.Directory;
+using Grand.Business.Core.Queries.Checkout.Orders;
+using Grand.Domain.Orders;
using Grand.Web.Features.Models.Customers;
using Grand.Web.Models.Customer;
using MediatR;
@@ -31,8 +32,7 @@ namespace Grand.Web.Features.Handlers.Customers
{
var model = new CustomerDownloadableProductsModel();
- var query = new GetOrderQuery
- {
+ var query = new GetOrderQuery {
StoreId = request.Store.Id
};
@@ -50,8 +50,7 @@ namespace Grand.Web.Features.Handlers.Customers
var product = await _productService.GetProductByIdIncludeArch(orderitem.ProductId);
if (product != null && product.IsDownload)
{
- var itemModel = new CustomerDownloadableProductsModel.DownloadableProductsModel
- {
+ var itemModel = new CustomerDownloadableProductsModel.DownloadableProductsModel {
OrderItemGuid = orderitem.OrderItemGuid,
OrderId = order.Id,
OrderNumber = order.OrderNumber,
diff --git a/src/Web/Grand.Web/Features/Handlers/Messages/GetInteractiveFormHandler.cs b/src/Web/Grand.Web/Features/Handlers/Messages/GetInteractiveFormHandler.cs
deleted file mode 100644
index 8731e709b..000000000
--- a/src/Web/Grand.Web/Features/Handlers/Messages/GetInteractiveFormHandler.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure;
-using Grand.Domain.Messages;
-using Grand.Web.Features.Models.Messages;
-using Grand.Web.Models.Messages;
-using MediatR;
-
-namespace Grand.Web.Features.Handlers.Messages
-{
- public class GetInteractiveFormHandler : IRequestHandler<GetInteractiveForm, InteractiveFormModel>
- {
- private readonly IInteractiveFormService _interactiveFormService;
- private readonly IWorkContext _workContext;
-
- public GetInteractiveFormHandler(IInteractiveFormService interactiveFormService, IWorkContext workContext)
- {
- _interactiveFormService = interactiveFormService;
- _workContext = workContext;
- }
-
- public async Task<InteractiveFormModel> Handle(GetInteractiveForm request, CancellationToken cancellationToken)
- {
- var form = await _interactiveFormService.GetFormBySystemName(request.SystemName);
- if (form == null)
- return await Task.FromResult<InteractiveFormModel>(null);
-
- var model = new InteractiveFormModel
- {
- InteractiveForm = form,
- Body = PrepareDataInteractiveForm(form)
- };
-
- return model;
- }
- protected string PrepareDataInteractiveForm(InteractiveForm form)
- {
- var body = form.GetTranslation(x => x.Body, _workContext.WorkingLanguage.Id);
- body += $"<input type='hidden' name='Id' value='{form.Id}'>";
- foreach (var item in form.FormAttributes)
- {
- if (item.FormControlTypeId == FormControlType.TextBox)
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control", item.Class);
- string _value = item.DefaultValue;
- var textbox = string.Format("<input type='text' name='{0}' class='{1}' style='{2}' value='{3}' {4}>", item.SystemName, _class, _style, _value, item.IsRequired ? "required" : "");
- body = body.Replace(string.Format("%{0}%", item.SystemName), textbox);
- }
- if (item.FormControlTypeId == FormControlType.MultilineTextbox)
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control", item.Class);
- string _value = item.DefaultValue;
- var textarea = string.Format("<textarea name='{0}' class='{1}' style='{2}' {3}> {4} </textarea>", item.SystemName, _class, _style, item.IsRequired ? "required" : "", _value);
- body = body.Replace(string.Format("%{0}%", item.SystemName), textarea);
- }
- if (item.FormControlTypeId == FormControlType.Checkboxes)
- {
- var checkbox = "<div class='custom-controls-stacked'>";
- foreach (var itemcheck in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "custom-control-input", item.Class);
-
- checkbox += "<div class='custom-control custom-checkbox'>";
- checkbox += string.Format("<input type='checkbox' class='{0}' style='{1}' {2} id='{3}' name='{4}' value='{5}'>", _class, _style,
- itemcheck.IsPreSelected ? "checked" : "", itemcheck.Id, item.SystemName, itemcheck.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- checkbox += string.Format("<label class='custom-control-label' for='{0}'>{1}</label>", itemcheck.Id, itemcheck.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- checkbox += "</div>";
- }
- checkbox += "</div>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), checkbox);
- }
-
- if (item.FormControlTypeId == FormControlType.DropdownList)
- {
- var dropdown = string.Empty;
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "form-control custom-select", item.Class);
-
- dropdown = string.Format("<select name='{0}' class='{1}' style='{2}'>", item.SystemName, _class, _style);
- foreach (var itemdropdown in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- dropdown += string.Format("<option value='{0}' {1}>{2}</option>", itemdropdown.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id), itemdropdown.IsPreSelected ? "selected" : "", itemdropdown.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- }
- dropdown += "</select>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), dropdown);
- }
- if (item.FormControlTypeId == FormControlType.RadioList)
- {
- var radio = "<div class='custom-controls-stacked'>";
- foreach (var itemradio in item.FormAttributeValues.OrderBy(x => x.DisplayOrder))
- {
- string _style = string.Format("{0}", item.Style);
- string _class = string.Format("{0} {1}", "custom-control-input", item.Class);
-
- radio += "<div class='custom-control custom-radio'>";
- radio += string.Format("<input type='radio' class='{0}' style='{1}' {2} id='{3}' name='{4}' value='{5}'>", _class, _style,
- itemradio.IsPreSelected ? "checked" : "", itemradio.Id, item.SystemName, itemradio.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- radio += string.Format("<label class='custom-control-label' for='{0}'>{1}</label>", itemradio.Id, itemradio.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id));
- radio += "</div>";
- }
- radio += "</div>";
- body = body.Replace(string.Format("%{0}%", item.SystemName), radio);
- }
- }
- body = body.Replace("%sendbutton%", "<input type='submit' id='send-interactive-form' class='btn btn-success interactive-form-button' value='Send' />");
- body = body.Replace("%errormessage%", "<div class='message-error'><div class='validation-summary-errors'><div id='errorMessages'></div></div></div>");
-
- return body;
- }
- }
-}
diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs
index 99a19e323..531c6db8a 100644
--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs
@@ -5,15 +5,16 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Queries.Checkout.Orders;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Storage;
+using Grand.Business.Core.Queries.Checkout.Orders;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using Grand.Domain.Tax;
+using Grand.Web.Extensions;
using Grand.Web.Features.Models.Common;
using Grand.Web.Features.Models.Orders;
using Grand.Web.Models.Media;
@@ -26,7 +27,6 @@ namespace Grand.Web.Features.Handlers.Orders
{
private readonly IDateTimeService _dateTimeService;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ITranslationService _translationService;
private readonly IShipmentService _shipmentService;
private readonly IPaymentService _paymentService;
@@ -35,7 +35,6 @@ namespace Grand.Web.Features.Handlers.Orders
private readonly IGiftVoucherService _giftVoucherService;
private readonly IOrderService _orderService;
private readonly IPictureService _pictureService;
- private readonly IDownloadService _downloadService;
private readonly IOrderStatusService _orderStatusService;
private readonly IMediator _mediator;
private readonly CatalogSettings _catalogSettings;
@@ -46,7 +45,6 @@ namespace Grand.Web.Features.Handlers.Orders
public GetOrderDetailsHandler(
IDateTimeService dateTimeService,
IProductService productService,
- IProductAttributeParser productAttributeParser,
ITranslationService translationService,
IShipmentService shipmentService,
IPaymentService paymentService,
@@ -55,7 +53,6 @@ namespace Grand.Web.Features.Handlers.Orders
IGiftVoucherService giftVoucherService,
IOrderService orderService,
IPictureService pictureService,
- IDownloadService downloadService,
IOrderStatusService orderStatusService,
IMediator mediator,
CatalogSettings catalogSettings,
@@ -65,7 +62,6 @@ namespace Grand.Web.Features.Handlers.Orders
{
_dateTimeService = dateTimeService;
_productService = productService;
- _productAttributeParser = productAttributeParser;
_translationService = translationService;
_shipmentService = shipmentService;
_paymentService = paymentService;
@@ -74,7 +70,6 @@ namespace Grand.Web.Features.Handlers.Orders
_giftVoucherService = giftVoucherService;
_orderService = orderService;
_pictureService = pictureService;
- _downloadService = downloadService;
_orderStatusService = orderStatusService;
_mediator = mediator;
_orderSettings = orderSettings;
@@ -101,8 +96,7 @@ namespace Grand.Web.Features.Handlers.Orders
await PrepareShippingInfo(request, model);
//billing info
- model.BillingAddress = await _mediator.Send(new GetAddressModel()
- {
+ model.BillingAddress = await _mediator.Send(new GetAddressModel() {
Language = request.Language,
Model = null,
Address = request.Order.BillingAddress,
@@ -159,8 +153,7 @@ namespace Grand.Web.Features.Handlers.Orders
model.PickUpInStore = request.Order.PickUpInStore;
if (!request.Order.PickUpInStore)
{
- model.ShippingAddress = await _mediator.Send(new GetAddressModel()
- {
+ model.ShippingAddress = await _mediator.Send(new GetAddressModel() {
Language = request.Language,
Model = null,
Address = request.Order.ShippingAddress,
@@ -173,8 +166,7 @@ namespace Grand.Web.Features.Handlers.Orders
{
if (request.Order.PickupPoint.Address != null)
{
- model.PickupAddress = await _mediator.Send(new GetAddressModel()
- {
+ model.PickupAddress = await _mediator.Send(new GetAddressModel() {
Language = request.Language,
Address = request.Order.PickupPoint.Address,
ExcludeProperties = false,
@@ -188,8 +180,7 @@ namespace Grand.Web.Features.Handlers.Orders
var shipments = (await _shipmentService.GetShipmentsByOrder(request.Order.Id)).Where(x => x.ShippedDateUtc.HasValue).OrderBy(x => x.CreatedOnUtc).ToList();
foreach (var shipment in shipments)
{
- var shipmentModel = new OrderDetailsModel.ShipmentBriefModel
- {
+ var shipmentModel = new OrderDetailsModel.ShipmentBriefModel {
Id = shipment.Id,
ShipmentNumber = shipment.ShipmentNumber,
TrackingNumber = shipment.TrackingNumber,
@@ -287,8 +278,7 @@ namespace Grand.Web.Features.Handlers.Orders
foreach (var tr in request.Order.OrderTaxes)
{
- model.TaxRates.Add(new OrderDetailsModel.TaxRate
- {
+ model.TaxRates.Add(new OrderDetailsModel.TaxRate {
Rate = _priceFormatter.FormatTaxRate(tr.Percent),
Value = await _priceFormatter.FormatPrice(tr.Amount, request.Order.CustomerCurrencyCode, false, request.Language),
});
@@ -312,8 +302,7 @@ namespace Grand.Web.Features.Handlers.Orders
foreach (var gcuh in await _giftVoucherService.GetAllGiftVoucherUsageHistory(request.Order.Id))
{
var giftVoucher = await _giftVoucherService.GetGiftVoucherById(gcuh.GiftVoucherId);
- model.GiftVouchers.Add(new OrderDetailsModel.GiftVoucher
- {
+ model.GiftVouchers.Add(new OrderDetailsModel.GiftVoucher {
CouponCode = giftVoucher.Code,
Amount = await _priceFormatter.FormatPrice(-gcuh.UsedValue, request.Order.CustomerCurrencyCode, false, request.Language),
});
@@ -338,8 +327,7 @@ namespace Grand.Web.Features.Handlers.Orders
.OrderByDescending(on => on.CreatedOnUtc)
.ToList())
{
- model.OrderNotes.Add(new OrderDetailsModel.OrderNote
- {
+ model.OrderNotes.Add(new OrderDetailsModel.OrderNote {
Id = orderNote.Id,
OrderId = orderNote.OrderId,
HasDownload = !string.IsNullOrEmpty(orderNote.DownloadId),
@@ -356,11 +344,10 @@ namespace Grand.Web.Features.Handlers.Orders
foreach (var orderItem in request.Order.OrderItems)
{
var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);
- var orderItemModel = new OrderDetailsModel.OrderItemModel
- {
+ var orderItemModel = new OrderDetailsModel.OrderItemModel {
Id = orderItem.Id,
OrderItemGuid = orderItem.OrderItemGuid,
- Sku = product.FormatSku(orderItem.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(orderItem.Attributes),
ProductId = product.Id,
ProductName = product.GetTranslation(x => x.Name, request.Language.Id),
ProductSeName = product.SeName,
@@ -415,9 +402,8 @@ namespace Grand.Web.Features.Handlers.Orders
private async Task<PictureModel> PrepareOrderItemPicture(Product product, IList<CustomAttribute> attributes, string productName)
{
- var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
- return new PictureModel
- {
+ var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService);
+ return new PictureModel {
Id = sciPicture?.Id,
ImageUrl = await _pictureService.GetPictureUrl(sciPicture, 80),
Title = string.Format(_translationService.GetResource("Media.Product.ImageLinkTitleFormat"), productName),
diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetShipmentDetailsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetShipmentDetailsHandler.cs
index 9c9248688..2fa391670 100644
--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetShipmentDetailsHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetShipmentDetailsHandler.cs
@@ -17,7 +17,6 @@ namespace Grand.Web.Features.Handlers.Orders
private readonly IShippingService _shippingService;
private readonly IShipmentService _shipmentService;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IMediator _mediator;
private readonly ShippingSettings _shippingSettings;
@@ -27,7 +26,6 @@ namespace Grand.Web.Features.Handlers.Orders
public GetShipmentDetailsHandler(
IDateTimeService dateTimeService,
IProductService productService,
- IProductAttributeParser productAttributeParser,
IShippingService shippingService,
IShipmentService shipmentService,
IMediator mediator,
@@ -37,7 +35,6 @@ namespace Grand.Web.Features.Handlers.Orders
{
_dateTimeService = dateTimeService;
_productService = productService;
- _productAttributeParser = productAttributeParser;
_shippingService = shippingService;
_shipmentService = shipmentService;
_mediator = mediator;
@@ -99,10 +96,9 @@ namespace Grand.Web.Features.Handlers.Orders
if (orderItem == null)
continue;
var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);
- var shipmentItemModel = new ShipmentDetailsModel.ShipmentItemModel
- {
+ var shipmentItemModel = new ShipmentDetailsModel.ShipmentItemModel {
Id = shipmentItem.Id,
- Sku = product.FormatSku(orderItem.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(orderItem.Attributes),
ProductId = orderItem.ProductId,
ProductName = product.GetTranslation(x => x.Name, request.Language.Id),
ProductSeName = product.GetSeName(request.Language.Id),
@@ -130,8 +126,7 @@ namespace Grand.Web.Features.Handlers.Orders
.OrderByDescending(on => on.CreatedOnUtc)
.ToList())
{
- notes.Add(new ShipmentDetailsModel.ShipmentNote
- {
+ notes.Add(new ShipmentDetailsModel.ShipmentNote {
Id = shipmentNote.Id,
ShipmentId = shipmentNote.ShipmentId,
HasDownload = !string.IsNullOrEmpty(shipmentNote.DownloadId),
@@ -153,8 +148,7 @@ namespace Grand.Web.Features.Handlers.Orders
model.PickUpInStore = order.PickUpInStore;
if (!order.PickUpInStore)
{
- model.ShippingAddress = await _mediator.Send(new GetAddressModel()
- {
+ model.ShippingAddress = await _mediator.Send(new GetAddressModel() {
Language = request.Language,
Address = order.ShippingAddress,
ExcludeProperties = false,
@@ -166,8 +160,7 @@ namespace Grand.Web.Features.Handlers.Orders
{
if (order.PickupPoint.Address != null)
{
- model.PickupAddress = await _mediator.Send(new GetAddressModel()
- {
+ model.PickupAddress = await _mediator.Send(new GetAddressModel() {
Language = request.Language,
Address = order.PickupPoint.Address,
ExcludeProperties = false,
diff --git a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsAttributeChangeHandler.cs b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsAttributeChangeHandler.cs
index 817623a8b..e3b258247 100644
--- a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsAttributeChangeHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsAttributeChangeHandler.cs
@@ -1,5 +1,4 @@
-using Grand.Business.Core.Extensions;
-using Grand.Business.Core.Interfaces.Catalog.Prices;
+using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Catalog.Tax;
using Grand.Business.Core.Utilities.Catalog;
@@ -23,7 +22,6 @@ namespace Grand.Web.Features.Handlers.Products
public class GetProductDetailsAttributeChangeHandler : IRequestHandler<GetProductDetailsAttributeChange, ProductDetailsAttributeChangeModel>
{
private readonly IMediator _mediator;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IStockQuantityService _stockQuantityService;
private readonly IPermissionService _permissionService;
private readonly IPricingService _pricingService;
@@ -37,7 +35,6 @@ namespace Grand.Web.Features.Handlers.Products
public GetProductDetailsAttributeChangeHandler(
IMediator mediator,
- IProductAttributeParser productAttributeParser,
IStockQuantityService stockQuantityService,
IPermissionService permissionService,
IPricingService priceCalculationService,
@@ -50,7 +47,6 @@ namespace Grand.Web.Features.Handlers.Products
MediaSettings mediaSettings)
{
_mediator = mediator;
- _productAttributeParser = productAttributeParser;
_stockQuantityService = stockQuantityService;
_permissionService = permissionService;
_pricingService = priceCalculationService;
@@ -82,9 +78,9 @@ namespace Grand.Web.Features.Handlers.Products
request.Product.ParseReservationDates(request.Form, out rentalStartDate, out rentalEndDate);
}
- model.Sku = request.Product.FormatSku(customAttributes, _productAttributeParser);
- model.Mpn = request.Product.FormatMpn(customAttributes, _productAttributeParser);
- model.Gtin = request.Product.FormatGtin(customAttributes, _productAttributeParser);
+ model.Sku = request.Product.FormatSku(customAttributes);
+ model.Mpn = request.Product.FormatMpn(customAttributes);
+ model.Gtin = request.Product.FormatGtin(customAttributes);
if (await _permissionService.Authorize(StandardPermission.DisplayPrices) && !request.Product.EnteredPrice && request.Product.ProductTypeId != ProductType.Auction)
{
@@ -114,7 +110,7 @@ namespace Grand.Web.Features.Handlers.Products
request.Product.BackorderModeId == BackorderMode.NoBackorders &&
request.Product.AllowOutOfStockSubscriptions)
{
- var combination = _productAttributeParser.FindProductAttributeCombination(request.Product, customAttributes);
+ var combination = request.Product.FindProductAttributeCombination(customAttributes);
if (combination != null)
if (_stockQuantityService.GetTotalStockQuantityForCombination(request.Product, combination, warehouseId: warehouseId) <= 0)
@@ -147,7 +143,7 @@ namespace Grand.Web.Features.Handlers.Products
var attributes = request.Product.ProductAttributeMappings;
foreach (var attribute in attributes)
{
- var conditionMet = _productAttributeParser.IsConditionMet(request.Product, attribute, customAttributes);
+ var conditionMet = request.Product.IsConditionMet(attribute, customAttributes);
if (conditionMet.HasValue)
{
if (conditionMet.Value)
@@ -162,10 +158,10 @@ namespace Grand.Web.Features.Handlers.Products
{
//first, try to get product attribute combination picture
- var pictureId = _productAttributeParser.FindProductAttributeCombination(request.Product, customAttributes)?.PictureId;
+ var pictureId = request.Product.FindProductAttributeCombination(customAttributes)?.PictureId;
if (string.IsNullOrEmpty(pictureId))
{
- pictureId = _productAttributeParser.ParseProductAttributeValues(request.Product, customAttributes)
+ pictureId = request.Product.ParseProductAttributeValues(customAttributes)
.FirstOrDefault(attributeValue => !string.IsNullOrEmpty(attributeValue.PictureId))?.PictureId ?? "";
}
@@ -187,7 +183,7 @@ namespace Grand.Web.Features.Handlers.Products
{
var model = new List<string>();
- var combination = _productAttributeParser.FindProductAttributeCombination(request.Product, customAttributes);
+ var combination = request.Product.FindProductAttributeCombination(customAttributes);
foreach (var customAttribute in customAttributes)
{
//find all combinations with attributes
diff --git a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs
index 3dfb23914..e83eb3bfa 100644
--- a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs
@@ -50,7 +50,6 @@ namespace Grand.Web.Features.Handlers.Products
private readonly IMeasureService _measureService;
private readonly ICacheBase _cacheBase;
private readonly IPictureService _pictureService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IStockQuantityService _stockQuantityService;
private readonly IWarehouseService _warehouseService;
private readonly IDeliveryDateService _deliveryDateService;
@@ -85,7 +84,6 @@ namespace Grand.Web.Features.Handlers.Products
IMeasureService measureService,
ICacheBase cacheBase,
IPictureService pictureService,
- IProductAttributeParser productAttributeParser,
IStockQuantityService stockQuantityService,
IWarehouseService warehouseService,
IDeliveryDateService deliveryDateService,
@@ -118,7 +116,6 @@ namespace Grand.Web.Features.Handlers.Products
_measureService = measureService;
_cacheBase = cacheBase;
_pictureService = pictureService;
- _productAttributeParser = productAttributeParser;
_stockQuantityService = stockQuantityService;
_warehouseService = warehouseService;
_deliveryDateService = deliveryDateService;
@@ -770,7 +767,7 @@ namespace Grand.Web.Features.Handlers.Products
else
{
string giftVoucherRecipientName, giftVoucherRecipientEmail, giftVoucherSenderName, giftVoucherSenderEmail, giftVoucherMessage;
- _productAttributeParser.GetGiftVoucherAttribute(updatecartitem.Attributes,
+ GiftVoucherExtensions.GetGiftVoucherAttribute(updatecartitem.Attributes,
out giftVoucherRecipientName, out giftVoucherRecipientEmail,
out giftVoucherSenderName, out giftVoucherSenderEmail, out giftVoucherMessage);
@@ -835,7 +832,7 @@ namespace Grand.Web.Features.Handlers.Products
&& product.ProductAttributeCombinations.Any()
&& product.ProductAttributeMappings.Count == 1)
{
- var customattributes = _productAttributeParser.AddProductAttribute(null, attribute, attributeValue.Id);
+ var customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(null, attribute, attributeValue.Id);
stockAvailability = _stockQuantityService.FormatStockMessage(product, string.Empty, customattributes);
}
var valueModel = new ProductDetailsModel.ProductAttributeValueModel {
@@ -912,7 +909,7 @@ namespace Grand.Web.Features.Handlers.Products
item.IsPreSelected = false;
//select new values
- var selectedValues = _productAttributeParser.ParseProductAttributeValues(product, updatecartitem.Attributes);
+ var selectedValues = product.ParseProductAttributeValues(updatecartitem.Attributes);
foreach (var attributeValue in selectedValues)
foreach (var item in attributeModel.Values)
if (attributeValue.Id == item.Id)
@@ -932,7 +929,7 @@ namespace Grand.Web.Features.Handlers.Products
{
if (updatecartitem.Attributes != null && updatecartitem.Attributes.Any())
{
- var enteredText = _productAttributeParser.ParseValues(updatecartitem.Attributes, attribute.Id);
+ var enteredText = Domain.Catalog.ProductExtensions.ParseValues(updatecartitem.Attributes, attribute.Id);
if (enteredText.Any())
attributeModel.DefaultValue = enteredText[0];
}
@@ -941,7 +938,7 @@ namespace Grand.Web.Features.Handlers.Products
case AttributeControlType.Datepicker:
{
//keep in mind my that the code below works only in the current culture
- var selectedDateStr = _productAttributeParser.ParseValues(updatecartitem.Attributes, attribute.Id);
+ var selectedDateStr = Domain.Catalog.ProductExtensions.ParseValues(updatecartitem.Attributes, attribute.Id);
if (selectedDateStr.Any())
{
DateTime selectedDate;
@@ -961,7 +958,7 @@ namespace Grand.Web.Features.Handlers.Products
{
if (updatecartitem.Attributes != null && updatecartitem.Attributes.Any())
{
- var downloadGuidStr = _productAttributeParser.ParseValues(updatecartitem.Attributes, attribute.Id).FirstOrDefault();
+ var downloadGuidStr = Domain.Catalog.ProductExtensions.ParseValues(updatecartitem.Attributes, attribute.Id).FirstOrDefault();
Guid downloadGuid;
Guid.TryParse(downloadGuidStr, out downloadGuid);
var download = await _downloadService.GetDownloadByGuid(downloadGuid);
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs
index 67aa109fe..a614cdc7b 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs
@@ -14,6 +14,7 @@ using Grand.Web.Features.Models.ShoppingCart;
using Grand.Web.Models.Media;
using Grand.Web.Models.ShoppingCart;
using MediatR;
+using Grand.Web.Extensions;
namespace Grand.Web.Features.Handlers.ShoppingCart
{
@@ -28,7 +29,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private readonly IOrderCalculationService _orderTotalCalculationService;
private readonly IPictureService _pictureService;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IAuctionService _auctionService;
private readonly ShoppingCartSettings _shoppingCartSettings;
private readonly TaxSettings _taxSettings;
@@ -44,7 +44,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
IOrderCalculationService orderTotalCalculationService,
IPictureService pictureService,
IProductService productService,
- IProductAttributeParser productAttributeParser,
IAuctionService auctionService,
ShoppingCartSettings shoppingCartSettings,
TaxSettings taxSettings,
@@ -59,7 +58,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
_orderTotalCalculationService = orderTotalCalculationService;
_pictureService = pictureService;
_productService = productService;
- _productAttributeParser = productAttributeParser;
_auctionService = auctionService;
_shoppingCartSettings = shoppingCartSettings;
_taxSettings = taxSettings;
@@ -175,7 +173,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private async Task<PictureModel> PrepareCartItemPicture(GetAddToCart request)
{
- var sciPicture = await request.Product.GetProductPicture(request.Attributes, _productService, _pictureService, _productAttributeParser);
+ var sciPicture = await request.Product.GetProductPicture(request.Attributes, _productService, _pictureService);
return new PictureModel
{
Id = sciPicture?.Id,
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs
index 310bbbd9d..d3d03851a 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs
@@ -2,6 +2,7 @@
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Domain.Directory;
+using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using Grand.Web.Features.Models.ShoppingCart;
using Grand.Web.Models.ShoppingCart;
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs
index c80080501..4022841f1 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs
@@ -1,13 +1,12 @@
using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Tax;
-using Grand.Business.Core.Utilities.Catalog;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Utilities.Checkout;
-using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Business.Core.Utilities.Catalog;
+using Grand.Business.Core.Utilities.Checkout;
using Grand.Domain.Common;
+using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using Grand.Web.Features.Models.ShoppingCart;
using Grand.Web.Models.ShoppingCart;
@@ -21,7 +20,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private readonly IPickupPointService _pickupPointService;
private readonly IOrderCalculationService _orderTotalCalculationService;
private readonly ITaxService _taxService;
- private readonly ICurrencyService _currencyService;
private readonly ITranslationService _translationService;
private readonly IPriceFormatter _priceFormatter;
@@ -32,7 +30,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
IPickupPointService pickupPointService,
IOrderCalculationService orderTotalCalculationService,
ITaxService taxService,
- ICurrencyService currencyService,
ITranslationService translationService,
IPriceFormatter priceFormatter,
ShippingSettings shippingSettings)
@@ -41,7 +38,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
_pickupPointService = pickupPointService;
_orderTotalCalculationService = orderTotalCalculationService;
_taxService = taxService;
- _currencyService = currencyService;
_translationService = translationService;
_priceFormatter = priceFormatter;
_shippingSettings = shippingSettings;
@@ -53,8 +49,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
if (request.Cart.RequiresShipping())
{
- var address = new Address
- {
+ var address = new Address {
CountryId = request.CountryId,
StateProvinceId = request.StateProvinceId,
ZipPostalCode = request.ZipPostalCode,
@@ -72,8 +67,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
{
foreach (var shippingOption in getShippingOptionResponse.ShippingOptions)
{
- var soModel = new EstimateShippingResultModel.ShippingOptionModel
- {
+ var soModel = new EstimateShippingResultModel.ShippingOptionModel {
Name = shippingOption.Name,
Description = shippingOption.Description,
@@ -95,8 +89,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
var pickupPoints = await _pickupPointService.GetAllPickupPoints();
if (pickupPoints.Count > 0)
{
- var soModel = new EstimateShippingResultModel.ShippingOptionModel
- {
+ var soModel = new EstimateShippingResultModel.ShippingOptionModel {
Name = _translationService.GetResource("Checkout.PickUpInStore"),
Description = _translationService.GetResource("Checkout.PickUpInStore.Description"),
};
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs
index be09afb8d..0b04f8a36 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs
@@ -20,6 +20,7 @@ using Grand.Web.Models.ShoppingCart;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
+using Grand.Web.Extensions;
namespace Grand.Web.Features.Handlers.ShoppingCart
{
@@ -32,7 +33,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private readonly ICheckoutAttributeService _checkoutAttributeService;
private readonly IProductService _productService;
private readonly IProductAttributeFormatter _productAttributeFormatter;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ITranslationService _translationService;
private readonly IPricingService _pricingService;
private readonly IPictureService _pictureService;
@@ -53,7 +53,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
ICheckoutAttributeService checkoutAttributeService,
IProductService productService,
IProductAttributeFormatter productAttributeFormatter,
- IProductAttributeParser productAttributeParser,
ITranslationService translationService,
IPricingService priceCalculationService,
IGroupService groupService,
@@ -73,7 +72,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
_checkoutAttributeService = checkoutAttributeService;
_productService = productService;
_productAttributeFormatter = productAttributeFormatter;
- _productAttributeParser = productAttributeParser;
_translationService = translationService;
_pricingService = priceCalculationService;
_groupService = groupService;
@@ -204,7 +202,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private async Task<PictureModel> PrepareCartItemPicture(Product product, IList<CustomAttribute> attributes)
{
- var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
+ var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService);
return new PictureModel
{
Id = sciPicture?.Id,
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniWishlistHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniWishlistHandler.cs
index 861a08424..86629d218 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniWishlistHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniWishlistHandler.cs
@@ -8,6 +8,7 @@ using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Media;
using Grand.Domain.Orders;
+using Grand.Web.Extensions;
using Grand.Web.Features.Models.ShoppingCart;
using Grand.Web.Models.Media;
using Grand.Web.Models.ShoppingCart;
@@ -20,7 +21,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
public class GetMiniWishlistHandler : IRequestHandler<GetMiniWishlist, MiniWishlistModel>
{
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IProductAttributeFormatter _productAttributeFormatter;
private readonly ITranslationService _translationService;
private readonly ITaxService _taxService;
@@ -34,7 +34,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
public GetMiniWishlistHandler(
IProductService productService,
- IProductAttributeParser productAttributeParser,
IProductAttributeFormatter productAttributeFormatter,
ITranslationService translationService,
ITaxService taxService,
@@ -47,7 +46,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
MediaSettings mediaSettings)
{
_productService = productService;
- _productAttributeParser = productAttributeParser;
_productAttributeFormatter = productAttributeFormatter;
_translationService = translationService;
_taxService = taxService;
@@ -82,7 +80,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
var sename = product.GetSeName(request.Language.Id);
var cartItemModel = new MiniWishlistModel.WishlistItemModel {
Id = sci.Id,
- Sku = product.FormatSku(sci.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(sci.Attributes),
ProductId = product.Id,
ProductName = product.GetTranslation(x => x.Name, request.Language.Id),
ProductSeName = sename,
@@ -123,7 +121,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private async Task<PictureModel> PrepareCartItemPicture(
Product product, IList<CustomAttribute> attributes)
{
- var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
+ var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService);
return new PictureModel {
Id = sciPicture?.Id,
ImageUrl = await _pictureService.GetPictureUrl(sciPicture, _mediaSettings.MiniCartThumbPictureSize, true),
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs
index 106b30014..a17f7cebb 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs
@@ -1,7 +1,6 @@
using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Tax;
using Grand.Business.Core.Commands.Checkout.Orders;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Business.Core.Utilities.Checkout;
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
index 270579b28..ff4cd4da4 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
@@ -1,24 +1,22 @@
-using Grand.Business.Core.Interfaces.Catalog.Products;
+using Grand.Domain.Catalog;
+using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Storage;
-using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Web.Features.Models.ShoppingCart;
using MediatR;
+using Grand.Domain.Orders;
namespace Grand.Web.Features.Handlers.ShoppingCart
{
public class GetParseProductAttributesHandler : IRequestHandler<GetParseProductAttributes, IList<CustomAttribute>>
{
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IDownloadService _downloadService;
private readonly IProductService _productService;
public GetParseProductAttributesHandler(
- IProductAttributeParser productAttributeParser,
IDownloadService downloadService,
IProductService productService)
{
- _productAttributeParser = productAttributeParser;
_downloadService = downloadService;
_productService = productService;
}
@@ -53,7 +51,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
request.Form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = ProductExtensions.AddProductAttribute(customAttributes,
attribute, ctrlAttributes).ToList();
}
}
@@ -65,8 +63,8 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
{
foreach (var item in cblAttributes)
{
- if (!String.IsNullOrEmpty(item))
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ if (!string.IsNullOrEmpty(item))
+ customAttributes = ProductExtensions.AddProductAttribute(customAttributes,
attribute, item).ToList();
}
}
@@ -81,7 +79,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
.Select(v => v.Id)
.ToList())
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = ProductExtensions.AddProductAttribute(customAttributes,
attribute, selectedAttributeId).ToList();
}
}
@@ -94,7 +92,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
if (!string.IsNullOrEmpty(ctrlAttributes))
{
var enteredText = ctrlAttributes.ToString().Trim();
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = ProductExtensions.AddProductAttribute(customAttributes,
attribute, enteredText).ToList();
}
}
@@ -106,7 +104,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
var download = await _downloadService.GetDownloadByGuid(downloadGuid);
if (download != null)
{
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
+ customAttributes = ProductExtensions.AddProductAttribute(customAttributes,
attribute, download.DownloadGuid.ToString()).ToList();
}
}
@@ -118,10 +116,10 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
//validate conditional attributes (if specified)
foreach (var attribute in productAttributes)
{
- var conditionMet = _productAttributeParser.IsConditionMet(request.Product, attribute, customAttributes);
+ var conditionMet = request.Product.IsConditionMet(attribute, customAttributes);
if (conditionMet.HasValue && !conditionMet.Value)
{
- customAttributes = _productAttributeParser.RemoveProductAttribute(customAttributes, attribute).ToList();
+ customAttributes = ProductExtensions.RemoveProductAttribute(customAttributes, attribute).ToList();
}
}
@@ -165,7 +163,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
}
}
- customAttributes = _productAttributeParser.AddGiftVoucherAttribute(customAttributes,
+ customAttributes = GiftVoucherExtensions.AddGiftVoucherAttribute(customAttributes,
recipientName, recipientEmail, senderName, senderEmail, giftVoucherMessage).ToList();
}
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
index 07bae6ca9..5c3fb2433 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
@@ -27,6 +27,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Routing;
using Grand.Business.Core.Utilities.Checkout;
+using Grand.Web.Extensions;
namespace Grand.Web.Features.Handlers.ShoppingCart
{
@@ -34,7 +35,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
{
private readonly IProductService _productService;
private readonly IPictureService _pictureService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly ITranslationService _translationService;
private readonly ICheckoutAttributeFormatter _checkoutAttributeFormatter;
private readonly ICurrencyService _currencyService;
@@ -64,7 +64,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
public GetShoppingCartHandler(
IProductService productService,
IPictureService pictureService,
- IProductAttributeParser productAttributeParser,
ITranslationService translationService,
ICheckoutAttributeFormatter checkoutAttributeFormatter,
ICurrencyService currencyService,
@@ -93,7 +92,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
{
_productService = productService;
_pictureService = pictureService;
- _productAttributeParser = productAttributeParser;
_translationService = translationService;
_checkoutAttributeFormatter = checkoutAttributeFormatter;
_currencyService = currencyService;
@@ -321,7 +319,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
var sename = product.GetSeName(request.Language.Id);
var cartItemModel = new ShoppingCartModel.ShoppingCartItemModel {
Id = sci.Id,
- Sku = product.FormatSku(sci.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(sci.Attributes),
IsCart = sci.ShoppingCartTypeId == ShoppingCartType.ShoppingCart,
ProductId = product.Id,
WarehouseId = sci.WarehouseId,
@@ -465,7 +463,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private async Task<PictureModel> PrepareCartItemPicture(Product product, IList<CustomAttribute> attributes)
{
- var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
+ var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService);
return new PictureModel {
Id = sciPicture?.Id,
ImageUrl = await _pictureService.GetPictureUrl(sciPicture, _mediaSettings.CartThumbPictureSize, true),
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetWishlistHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetWishlistHandler.cs
index 409b12b51..b95300423 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetWishlistHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetWishlistHandler.cs
@@ -21,20 +21,18 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Routing;
using Grand.Business.Core.Utilities.Checkout;
+using Grand.Web.Extensions;
namespace Grand.Web.Features.Handlers.ShoppingCart
{
public class GetWishlistHandler : IRequestHandler<GetWishlist, WishlistModel>
{
private readonly IPermissionService _permissionService;
- private readonly IShoppingCartService _shoppingCartService;
private readonly IProductService _productService;
- private readonly IProductAttributeParser _productAttributeParser;
private readonly IProductAttributeFormatter _productAttributeFormatter;
private readonly ITranslationService _translationService;
private readonly ITaxService _taxService;
private readonly IPricingService _pricingService;
- private readonly IAclService _aclService;
private readonly IPriceFormatter _priceFormatter;
private readonly IPictureService _pictureService;
private readonly IShoppingCartValidator _shoppingCartValidator;
@@ -46,14 +44,11 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
public GetWishlistHandler(
IPermissionService permissionService,
- IShoppingCartService shoppingCartService,
IProductService productService,
- IProductAttributeParser productAttributeParser,
IProductAttributeFormatter productAttributeFormatter,
ITranslationService translationService,
ITaxService taxService,
IPricingService priceCalculationService,
- IAclService aclService,
IPriceFormatter priceFormatter,
IPictureService pictureService,
IShoppingCartValidator shoppingCartValidator,
@@ -64,14 +59,11 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
MediaSettings mediaSettings)
{
_permissionService = permissionService;
- _shoppingCartService = shoppingCartService;
_productService = productService;
- _productAttributeParser = productAttributeParser;
_productAttributeFormatter = productAttributeFormatter;
_translationService = translationService;
_taxService = taxService;
_pricingService = priceCalculationService;
- _aclService = aclService;
_priceFormatter = priceFormatter;
_pictureService = pictureService;
_shoppingCartValidator = shoppingCartValidator;
@@ -120,7 +112,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
var cartItemModel = new WishlistModel.ShoppingCartItemModel
{
Id = sci.Id,
- Sku = product.FormatSku(sci.Attributes, _productAttributeParser),
+ Sku = product.FormatSku(sci.Attributes),
ProductId = product.Id,
ProductName = product.GetTranslation(x => x.Name, request.Language.Id),
ProductSeName = sename,
@@ -209,7 +201,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private async Task<PictureModel> PrepareCartItemPicture(GetWishlist request,
Product product, IList<CustomAttribute> attributes)
{
- var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
+ var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService);
return new PictureModel
{
Id = sciPicture?.Id,
diff --git a/src/Web/Grand.Web/Features/Models/Catalog/GetCompareProducts.cs b/src/Web/Grand.Web/Features/Models/Catalog/GetCompareProducts.cs
index 5c9baf857..3e63775d6 100644
--- a/src/Web/Grand.Web/Features/Models/Catalog/GetCompareProducts.cs
+++ b/src/Web/Grand.Web/Features/Models/Catalog/GetCompareProducts.cs
@@ -1,5 +1,4 @@
-using Grand.Domain.Customers;
-using Grand.Web.Models.Catalog;
+using Grand.Web.Models.Catalog;
using MediatR;
namespace Grand.Web.Features.Models.Catalog
diff --git a/src/Web/Grand.Web/Features/Models/Messages/GetInteractiveForm.cs b/src/Web/Grand.Web/Features/Models/Messages/GetInteractiveForm.cs
deleted file mode 100644
index 7b436383e..000000000
--- a/src/Web/Grand.Web/Features/Models/Messages/GetInteractiveForm.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Grand.Web.Models.Messages;
-using MediatR;
-
-namespace Grand.Web.Features.Models.Messages
-{
- public class GetInteractiveForm : IRequest<InteractiveFormModel>
- {
- public string SystemName { get; set; }
- }
-}
diff --git a/src/Web/Grand.Web/Models/Common/PopupModel.cs b/src/Web/Grand.Web/Models/Common/PopupModel.cs
deleted file mode 100644
index 761efc4ca..000000000
--- a/src/Web/Grand.Web/Models/Common/PopupModel.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Grand.Domain.Messages;
-using Grand.Infrastructure.Models;
-
-namespace Grand.Web.Models.Common
-{
- public class PopupModel : BaseEntityModel
- {
- public string Name { get; set; }
- public string Body { get; set; }
- public string CustomerActionId { get; set; }
- public PopupType PopupType { get; set; }
- }
-}
diff --git a/src/Web/Grand.Web/Models/Messages/InteractiveFormModel.cs b/src/Web/Grand.Web/Models/Messages/InteractiveFormModel.cs
deleted file mode 100644
index 124eb22de..000000000
--- a/src/Web/Grand.Web/Models/Messages/InteractiveFormModel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Grand.Infrastructure.Models;
-using Grand.Domain.Messages;
-
-namespace Grand.Web.Models.Messages
-{
- public partial class InteractiveFormModel : BaseEntityModel
- {
- public InteractiveForm InteractiveForm { get; set; }
- public string Body { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Properties/launchSettings.json b/src/Web/Grand.Web/Properties/launchSettings.json
index f869b20a7..53e1ffea3 100644
--- a/src/Web/Grand.Web/Properties/launchSettings.json
+++ b/src/Web/Grand.Web/Properties/launchSettings.json
@@ -15,14 +15,15 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
- "Grand.Web": {
+ "Kestrel": {
"commandName": "Project",
"launchBrowser": true,
+ "launchUrl": "https://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
- "applicationUrl": "http://localhost:16593"
- },
+ "applicationUrl": "https://localhost:5001;http://localhost:5000"
+ },
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
diff --git a/src/Web/Grand.Web/Views/Shared/Components/InteractiveForm/Default.cshtml b/src/Web/Grand.Web/Views/Shared/Components/InteractiveForm/Default.cshtml
deleted file mode 100644
index 6fdc4a00d..000000000
--- a/src/Web/Grand.Web/Views/Shared/Components/InteractiveForm/Default.cshtml
+++ /dev/null
@@ -1,23 +0,0 @@
-@model Grand.Web.Models.Messages.InteractiveFormModel
-<form asp-route="PopupInteractiveForm" method="post" id="[email protected]">
- <div id="action-body-form">@Html.Raw(Model.Body)</div>
-</form>
-<script asp-location="Footer" asp-order="300">
- $("#[email protected]").submit(function (event) {
- event.preventDefault();
- var $form = $(this),
- url = $form.attr('action');
- var posting = $.post(url, $('#[email protected]').serialize());
- posting.done(function (result) {
- if (!result.success) {
- $('#errorMessages').empty();
- for (var error in result.errors) {
- $('#errorMessages').append(result.errors[error] + '<br/>');
- }
- }
- else {
- $("#[email protected]").html('');
- }
- });
- });
-</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Views/Shared/Components/PopupAction/Default.cshtml b/src/Web/Grand.Web/Views/Shared/Components/PopupAction/Default.cshtml
deleted file mode 100644
index 8f20ea35b..000000000
--- a/src/Web/Grand.Web/Views/Shared/Components/PopupAction/Default.cshtml
+++ /dev/null
@@ -1,73 +0,0 @@
-@model PopupModel
-@if (Model.PopupType == Grand.Domain.Messages.PopupType.Banner)
-{
- <b-modal id="ModalBanner" ref="ModalBanner" centered hide-footer hide-header>
- <button class="modal-close" @@click="$bvModal.hide('ModalBanner')"><b-icon icon="x"></b-icon></button>
- <div>
- @Html.Raw(Model.Body)
- </div>
- </b-modal>
-}
-@if (Model.PopupType == Grand.Domain.Messages.PopupType.InteractiveForm)
-{
- <b-modal id="ModalBanner" ref="ModalBanner" centered hide-footer hide-header>
- <button class="modal-close" @@click="$bvModal.hide('ModalBanner')"><b-icon icon="x"></b-icon></button>
- <form asp-route="PopupInteractiveForm" method="post" id="interactive-form">
- <div id="action-body-form">@Html.Raw(Model.Body)</div>
- </form>
- </b-modal>
-}
-<script asp-location="Footer" asp-order="300">
-
- var BannerMixin = {
- created: function () {
- this.showBanner();
- this.addEventListenerInteractiveForm();
- },
- methods: {
- showBanner: function () {
- setTimeout(function () {
- if (vm.$refs['ModalBanner']) {
- vm.$bvModal.show('ModalBanner');
- }
- }, 300);
- },
- addEventListenerInteractiveForm: function () {
- var interactiveform = document.getElementById('interactive-form');
- if(interactiveform) {
- document.addEventListener('submit', this.sendInteractiveForm);
- }
- },
- sendInteractiveForm: function () {
- var url = event.srcElement.action;
- var data = new FormData(event.srcElement);
- axios({
- method: "post",
- baseURL: url,
- data: data,
- }).then(function (response) {
- if (response.data.success == true) {
- vm.$bvModal.hide('ModalBanner')
- }
- else {
- var element = document.getElementById('errorMessages');
- if (element)
- element.innerHTML = ''
- for (var error in response.data.errors) {
- if (element)
- element.innerHTML += response.data.errors[error] + '<br />';
- }
- }
- }).catch(function (error) {
- alert(error);
- });
- event.preventDefault();
- }
- }
- }
- // define a component that uses this mixin
- var banner = new Vue({
- mixins: [BannerMixin]
- })
-
-</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Views/Shared/Partials/Notifications.cshtml b/src/Web/Grand.Web/Views/Shared/Partials/Notifications.cshtml
index 73ebff58e..a7828f301 100644
--- a/src/Web/Grand.Web/Views/Shared/Partials/Notifications.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/Partials/Notifications.cshtml
@@ -40,4 +40,3 @@
<div class="modal-place"></div>
<partial name="Partials/PopupAddToCart" />
<partial name="Partials/ProductQuickView" />
-@await Component.InvokeAsync("PopupAction")