Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Grand.Domain.Catalog;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Common;
namespace Grand.Business.Messages.Commands.Handlers.Common;

public class ClearMostViewedCommandHandler : IRequestHandler<ClearMostViewedCommand, bool>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Text.RegularExpressions;
using System.Xml;

namespace Grand.Business.System.Commands.Handlers.Common;
namespace Grand.Business.Messages.Commands.Handlers.Common;

public class GetSitemapXmlCommandHandler : IRequestHandler<GetSitemapXmlCommand, string>
{
Expand Down Expand Up @@ -216,8 +216,11 @@ private async Task<IEnumerable<SitemapUrl>> GetCategoryUrls(string parentCategor
var imageurl = string.Empty;
if (_commonSettings.SitemapIncludeImage)
if (!string.IsNullOrEmpty(category.PictureId))
{
imageurl = await _pictureService.GetPictureUrl(category.PictureId, showDefaultPicture: false,
storeLocation: storeLocation);
}

categories.Add(new SitemapUrl(url, imageurl, UpdateFrequency.Weekly,
category.UpdatedOnUtc ?? category.CreatedOnUtc));
categories.AddRange(await GetCategoryUrls(category.Id, language));
Expand All @@ -244,8 +247,11 @@ private async Task<IEnumerable<SitemapUrl>> GetBrandUrls(Language language, Stor
var imageUrl = string.Empty;
if (_commonSettings.SitemapIncludeImage)
if (!string.IsNullOrEmpty(brand.PictureId))
{
imageUrl = await _pictureService.GetPictureUrl(brand.PictureId, showDefaultPicture: false,
storeLocation: storeLocation);
}

brandUrls.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly,
brand.UpdatedOnUtc ?? brand.CreatedOnUtc));
}
Expand All @@ -272,8 +278,11 @@ private async Task<IEnumerable<SitemapUrl>> GetProductUrls(Language language, St
var imageUrl = string.Empty;
if (_commonSettings.SitemapIncludeImage)
if (!string.IsNullOrEmpty(product.ProductPictures.FirstOrDefault()?.PictureId))
{
imageUrl = await _pictureService.GetPictureUrl(product.ProductPictures.FirstOrDefault()?.PictureId,
showDefaultPicture: false, storeLocation: storeLocation);
}

products.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly,
product.UpdatedOnUtc ?? product.CreatedOnUtc));
}
Expand Down Expand Up @@ -319,8 +328,11 @@ private async Task<IEnumerable<SitemapUrl>> GetBlogPostsUrls(Language language,
var imageurl = string.Empty;
if (_commonSettings.SitemapIncludeImage)
if (!string.IsNullOrEmpty(blogpost.PictureId))
{
imageurl = await _pictureService.GetPictureUrl(blogpost.PictureId, showDefaultPicture: false,
storeLocation: storeLocation);
}

blog.Add(new SitemapUrl(url, imageurl, UpdateFrequency.Weekly, DateTime.UtcNow));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
using Grand.Domain.Catalog;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class
GetAttributeCombinationTokensCommandHandler : IRequestHandler<GetAttributeCombinationTokensCommand,
LiquidAttributeCombination>
public class GetAttributeCombinationTokensCommandHandler : IRequestHandler<GetAttributeCombinationTokensCommand, LiquidAttributeCombination>
{
private readonly IProductAttributeFormatter _productAttributeFormatter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using MediatR;
using System.Globalization;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetAuctionTokensCommandHandler : IRequestHandler<GetAuctionTokensCommand, LiquidAuctions>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetGiftVoucherTokensCommandHandler : IRequestHandler<GetGiftVoucherTokensCommand, LiquidGiftVoucher>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class
GetMerchandiseReturnTokensCommandHandler : IRequestHandler<GetMerchandiseReturnTokensCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System.Globalization;
using System.Net;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetOrderTokensCommandHandler : IRequestHandler<GetOrderTokensCommand, LiquidOrder>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetShipmentTokensCommandHandler : IRequestHandler<GetShipmentTokensCommand, LiquidShipment>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetShoppingCartTokensCommandHandler : IRequestHandler<GetShoppingCartTokensCommand, LiquidShoppingCart>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Grand.Domain.Stores;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetStoreTokensCommandHandler : IRequestHandler<GetStoreTokensCommand, LiquidStore>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;
using MediatR;

namespace Grand.Business.System.Commands.Handlers.Messages;
namespace Grand.Business.Messages.Commands.Handlers.Messages;

public class GetVendorTokensCommandHandler : IRequestHandler<GetVendorTokensCommand, LiquidVendor>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public async Task InsertTagToCustomerTest()
await _customerTagService.InsertTagToCustomer(customerTag.Id, customer.Id);

//Assert
Assert.IsTrue(_repositoryCustomer.Table.FirstOrDefault(x => x.Id == customer.Id).CustomerTags
.Contains(customerTag.Id));
Assert.Contains(customerTag.Id, _repositoryCustomer.Table.FirstOrDefault(x => x.Id == customer.Id).CustomerTags
);
}

[TestMethod]
Expand All @@ -198,8 +198,8 @@ public async Task DeleteTagFromCustomerTest()
await _customerTagService.DeleteTagFromCustomer(customerTag.Id, customer.Id);

//Assert
Assert.IsFalse(_repositoryCustomer.Table.FirstOrDefault(x => x.Id == customer.Id).CustomerTags
.Contains(customerTag.Id));
Assert.DoesNotContain(customerTag.Id, _repositoryCustomer.Table.FirstOrDefault(x => x.Id == customer.Id).CustomerTags
);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Grand.Domain.Catalog;
using Grand.Domain.Localization;
using Grand.Module.ScheduledTasks.Commands.Handlers.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace Grand.Modules.Tests.Commands;
Expand Down
1 change: 1 addition & 0 deletions src/Tests/Grand.Modules.Tests/Grand.Modules.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<ItemGroup>
<ProjectReference Include="..\..\Business\Grand.Business.Core\Grand.Business.Core.csproj" />
<ProjectReference Include="..\..\Business\Grand.Business.Messages\Grand.Business.Messages.csproj" />
<ProjectReference Include="..\..\Modules\Grand.Module.Migration\Grand.Module.Migration.csproj" />
<ProjectReference Include="..\..\Modules\Grand.Module.ScheduledTasks\Grand.Module.ScheduledTasks.csproj" />
</ItemGroup>
Expand Down
Loading