Compare commits

...

3 Commits

Author SHA1 Message Date
Loretta 705d43061d fixes 2025-10-23 06:34:46 +02:00
Loretta c63516e774 refactoring, cleanup v1.1... 2025-10-22 16:20:36 +02:00
Loretta 3719994ec4 refactoring, cleanup, etc... 2025-10-22 15:16:20 +02:00
25 changed files with 82 additions and 107 deletions

View File

@ -29,6 +29,7 @@ using Nop.Services.Orders;
using Nop.Services.Security; using Nop.Services.Security;
using Nop.Services.Seo; using Nop.Services.Seo;
using Nop.Services.Shipping; using Nop.Services.Shipping;
using Nop.Web.Areas.Admin.Controllers;
using Nop.Web.Areas.Admin.Factories; using Nop.Web.Areas.Admin.Factories;
using Nop.Web.Areas.Admin.Infrastructure.Mapper.Extensions; using Nop.Web.Areas.Admin.Infrastructure.Mapper.Extensions;
using Nop.Web.Areas.Admin.Models.Catalog; using Nop.Web.Areas.Admin.Models.Catalog;
@ -39,7 +40,7 @@ using Nop.Web.Framework.Mvc.ModelBinding;
using Nop.Web.Framework.Validators; using Nop.Web.Framework.Validators;
using System.Text; using System.Text;
namespace Nop.Web.Areas.Admin.Controllers; namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
public partial class CustomProductController : BaseAdminController public partial class CustomProductController : BaseAdminController
{ {
@ -2734,7 +2735,7 @@ public partial class CustomProductController : BaseAdminController
//fill entity from model //fill entity from model
var tierPrice = model.ToEntity<TierPrice>(); var tierPrice = model.ToEntity<TierPrice>();
tierPrice.ProductId = product.Id; tierPrice.ProductId = product.Id;
tierPrice.CustomerRoleId = model.CustomerRoleId > 0 ? model.CustomerRoleId : (int?)null; tierPrice.CustomerRoleId = model.CustomerRoleId > 0 ? model.CustomerRoleId : null;
await _productService.InsertTierPriceAsync(tierPrice); await _productService.InsertTierPriceAsync(tierPrice);
@ -2795,7 +2796,7 @@ public partial class CustomProductController : BaseAdminController
{ {
//fill entity from model //fill entity from model
tierPrice = model.ToEntity(tierPrice); tierPrice = model.ToEntity(tierPrice);
tierPrice.CustomerRoleId = model.CustomerRoleId > 0 ? model.CustomerRoleId : (int?)null; tierPrice.CustomerRoleId = model.CustomerRoleId > 0 ? model.CustomerRoleId : null;
await _productService.UpdateTierPriceAsync(tierPrice); await _productService.UpdateTierPriceAsync(tierPrice);
ViewBag.RefreshPage = true; ViewBag.RefreshPage = true;

View File

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DevExtreme.NETCore.Demos.Controllers namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{ {
public class FileManagerController : Controller public class FileManagerController : Controller
{ {

View File

@ -1,10 +1,8 @@
using DevExtreme.AspNet.Mvc.FileManagement; using DevExtreme.AspNet.Mvc.FileManagement;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using System.Collections.Generic;
namespace DevExtreme.NETCore.Demos.Controllers namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{ {
public class FileManagerScriptsApiController : Controller public class FileManagerScriptsApiController : Controller
{ {

View File

@ -1,12 +1,11 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models; using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models;
using Nop.Plugin.Misc.FruitBankPlugin;
using Nop.Services.Configuration; using Nop.Services.Configuration;
using Nop.Web.Framework.Controllers; using Nop.Web.Framework.Controllers;
using Nop.Services.Messages; using Nop.Services.Messages;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{ {
[Area("Admin")] [Area("Admin")]
public class FruitBankPluginAdminController : BasePluginController public class FruitBankPluginAdminController : BasePluginController

View File

@ -5,8 +5,6 @@ using FruitBank.Common.Entities;
using Mango.Nop.Core.Loggers; using Mango.Nop.Core.Loggers;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Azure;
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models; using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
using Nop.Plugin.Misc.FruitBankPlugin.Services; using Nop.Plugin.Misc.FruitBankPlugin.Services;

View File

@ -38,7 +38,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers
[SignalR(SignalRTags.GetMeasuringModels)] [SignalR(SignalRTags.GetMeasuringModels)]
public async Task<List<MeasuringModel>> GetMeasuringModels() public Task<List<MeasuringModel>> GetMeasuringModels()
{ {
throw new NotImplementedException("GetMeasuringModels"); throw new NotImplementedException("GetMeasuringModels");
} }

View File

@ -1,14 +1,14 @@
using FruitBank.Common.Entities; using FruitBank.Common.Entities;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Core.Repositories; using Mango.Nop.Core.Repositories;
using Nop.Core.Caching; using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class FilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<Files>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) public class FilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<Files>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -16,6 +16,7 @@ using Nop.Plugin.Misc.FruitBankPlugin.Services;
using Nop.Services.Catalog; using Nop.Services.Catalog;
using FruitBank.Common.Dtos; using FruitBank.Common.Dtos;
using Mango.Nop.Core.Extensions; using Mango.Nop.Core.Extensions;
using Mango.Nop.Core.Loggers;
using Nop.Core.Domain.Orders; using Nop.Core.Domain.Orders;
using WebMarkupMin.Core.Loggers; using WebMarkupMin.Core.Loggers;
@ -68,7 +69,7 @@ public class FruitBankDbContext : MgDbContextBase,
IRepository<Customer> customerRepository, IRepository<Customer> customerRepository,
IRepository<CustomerCustomerRoleMapping> customerCustomerRoleMappingRepository, IRepository<CustomerCustomerRoleMapping> customerCustomerRoleMappingRepository,
IRepository<CustomerRole> customerRoleRepository, IRepository<CustomerRole> customerRoleRepository,
IEnumerable<IAcLogWriterBase> logWriters) : base(dataProvider, lockService, logWriters) IEnumerable<IAcLogWriterBase> logWriters) : base(dataProvider, lockService, new Logger<FruitBankDbContext>(logWriters.ToArray()))
{ {
_storeContext = storeContext; _storeContext = storeContext;
_productService = productService; _productService = productService;

View File

@ -5,11 +5,11 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class MeasuringItemPalletBaseDbTable<TEntity>(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<TEntity>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) where TEntity public class MeasuringItemPalletBaseDbTable<TEntity>(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<TEntity>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings) where TEntity
: MgEntityBase, IMeasuringItemPalletBase : MgEntityBase, IMeasuringItemPalletBase
{ {
protected override void OnUpdate(TEntity entity) protected override void OnUpdate(TEntity entity)

View File

@ -7,14 +7,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Orders; using Nop.Core.Domain.Orders;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderDtoDbTable : MgDtoDbTableBase<OrderDto, Order> public class OrderDtoDbTable : MgDtoDbTableBase<OrderDto, Order>
{ {
public OrderDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public OrderDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -6,14 +6,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Orders; using Nop.Core.Domain.Orders;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderItemDtoDbTable : MgDtoDbTableBase<OrderItemDto, OrderItem> public class OrderItemDtoDbTable : MgDtoDbTableBase<OrderItemDto, OrderItem>
{ {
public OrderItemDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public OrderItemDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -4,14 +4,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPallet> public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPallet>
{ {
public OrderItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public OrderItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class PartnerDbTable : MgDbTableBase<Partner> public class PartnerDbTable : MgDbTableBase<Partner>
{ {
public PartnerDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public PartnerDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -6,14 +6,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Catalog; using Nop.Core.Domain.Catalog;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ProductDtoDbTable : MgDtoDbTableBase<ProductDto, Product> public class ProductDtoDbTable : MgDtoDbTableBase<ProductDto, Product>
{ {
public ProductDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public ProductDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDbTable : MgDbTableBase<Shipping> public class ShippingDbTable : MgDbTableBase<Shipping>
{ {
public ShippingDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public ShippingDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDocumentDbTable : MgDbTableBase<ShippingDocument> public class ShippingDocumentDbTable : MgDbTableBase<ShippingDocument>
{ {
public ShippingDocumentDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public ShippingDocumentDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -1,5 +1,5 @@
using FruitBank.Common.Entities; using FruitBank.Common.Entities;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
using Mango.Nop.Core.Repositories; using Mango.Nop.Core.Repositories;
using Nop.Core.Caching; using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
@ -8,7 +8,7 @@ using Nop.Data;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDocumentToFilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<ShippingDocumentToFiles>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) public class ShippingDocumentToFilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<ShippingDocumentToFiles>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -6,14 +6,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingItemDbTable : MgDbTableBase<ShippingItem> public class ShippingItemDbTable : MgDbTableBase<ShippingItem>
{ {
public ShippingItemDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public ShippingItemDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration; using Nop.Core.Configuration;
using Nop.Core.Events; using Nop.Core.Events;
using Nop.Data; using Nop.Data;
using Nop.Services.Logging; using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingItemPalletDbTable : MeasuringItemPalletBaseDbTable<ShippingItemPallet> public class ShippingItemPalletDbTable : MeasuringItemPalletBaseDbTable<ShippingItemPallet>
{ {
public ShippingItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) public ShippingItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{ {
} }

View File

@ -7,8 +7,8 @@ using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Interfaces; using FruitBank.Common.Server.Interfaces;
using FruitBank.Common.Server.Services.Loggers; using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs; using FruitBank.Common.Server.Services.SignalRs;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Services; using Mango.Nop.Services;
using Mango.Nop.Services.Loggers;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
@ -42,21 +42,20 @@ public class PluginNopStartup : INopStartup
/// <param name="configuration">Configuration of the application</param> /// <param name="configuration">Configuration of the application</param>
public void ConfigureServices(IServiceCollection services, IConfiguration configuration) public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{ {
services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
services.AddScoped<IAcLogWriterBase, NopLogWriter>();
services.AddSingleton<LoggerToLoggerApiController>();
//services.AddSingleton<SessionService>();
services.Configure<RazorViewEngineOptions>(options => services.Configure<RazorViewEngineOptions>(options =>
{ {
options.ViewLocationExpanders.Add(new ViewLocationExpander()); options.ViewLocationExpanders.Add(new ViewLocationExpander());
}); });
//register services and interfaces
services.AddSingleton<ILockService, LockService>(); services.AddSingleton<ILockService, LockService>();
services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
services.AddScoped<IAcLogWriterBase, NopLogWriter>();
services.AddScoped<LoggerToLoggerApiController2>();
//services.AddSingleton<SessionService>();
services.AddScoped<FruitBankAttributeService>(); services.AddScoped<FruitBankAttributeService>();
services.AddScoped<ProductDtoDbTable>(); services.AddScoped<ProductDtoDbTable>();
@ -125,7 +124,7 @@ public class PluginNopStartup : INopStartup
{ {
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapHub<LoggerSignalRHub2>(loggrHubEndPoint); endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint);
}); });
}); });
} }

View File

@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.10" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" Version="9.0.10" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.10" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" /> <!--<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />-->
<PackageReference Include="PdfPig" Version="0.1.11" /> <PackageReference Include="PdfPig" Version="0.1.11" />
<PackageReference Include="PdfPig.Rendering.Skia" Version="0.1.11.5" /> <PackageReference Include="PdfPig.Rendering.Skia" Version="0.1.11.5" />
<PackageReference Include="SendGrid" Version="9.29.3" /> <PackageReference Include="SendGrid" Version="9.29.3" />

View File

@ -21,7 +21,6 @@ public class CustomPriceCalculationService : PriceCalculationService
private readonly IProductAttributeService _productAttributeService; private readonly IProductAttributeService _productAttributeService;
private readonly ISpecificationAttributeService _specificationAttributeService; private readonly ISpecificationAttributeService _specificationAttributeService;
private readonly ILocalizationService _localizationService; private readonly ILocalizationService _localizationService;
private readonly IProductService _productService;
public CustomPriceCalculationService( public CustomPriceCalculationService(
IRepository<Product> productRepository, IRepository<Product> productRepository,
@ -34,7 +33,7 @@ public class CustomPriceCalculationService : PriceCalculationService
IProductAttributeParser productAttributeParser, IProductAttributeParser productAttributeParser,
IProductAttributeService productAttributeService, IProductAttributeService productAttributeService,
ISpecificationAttributeService specificationAttributeService, ISpecificationAttributeService specificationAttributeService,
IProductService productService, IProductService productService,
ICustomerService customerService, ICustomerService customerService,
IDiscountService discountService, IDiscountService discountService,
IDiscountPluginManager discountPluginManager, IDiscountPluginManager discountPluginManager,
@ -43,45 +42,41 @@ public class CustomPriceCalculationService : PriceCalculationService
IWorkContext workContext, IWorkContext workContext,
ILogger logger) ILogger logger)
: base(catalogSettings, currencySettings, categoryService, currencyService, customerService, discountService, manufacturerService, : base(catalogSettings, currencySettings, categoryService, currencyService, customerService, discountService, manufacturerService,
productAttributeParser, productService, productAttributeParser, productService,
cacheManager) cacheManager)
{ {
_productRepository = productRepository; _productRepository = productRepository;
// assign all base deps to local private vars if needed // assign all base deps to local private vars if needed
_productAttributeService = productAttributeService; _productAttributeService = productAttributeService;
_specificationAttributeService = specificationAttributeService; _specificationAttributeService = specificationAttributeService;
_localizationService = localizationService; _localizationService = localizationService;
_productService = productService;
} }
//decimal? overriddenProductPrice = null //decimal? overriddenProductPrice = null
public override async Task<(decimal priceWithoutDiscounts, decimal finalPrice, decimal appliedDiscountAmount, List<Discount> appliedDiscounts)> GetFinalPriceAsync( public override async Task<(decimal priceWithoutDiscounts, decimal finalPrice, decimal appliedDiscountAmount, List<Discount> appliedDiscounts)> GetFinalPriceAsync(
Product product, Customer customer, Store store, decimal? overriddenProductPrice, decimal additionalCharge = 0, bool includeDiscounts = true, Product product, Customer customer, Store store, decimal? overriddenProductPrice, decimal additionalCharge = 0, bool includeDiscounts = true,
int quantity = 1, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null) int quantity = 1, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
{ {
var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id); var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id);
//Product Attributes //Product Attributes
foreach (var pam in productAttributeMappings) foreach (var pam in productAttributeMappings)
{ {
//get option //get option
var attributeOtion = await _specificationAttributeService.GetSpecificationAttributeOptionByIdAsync(pam.SpecificationAttributeOptionId); var attributeOtion = await _specificationAttributeService.GetSpecificationAttributeOptionByIdAsync(pam.SpecificationAttributeOptionId);
//get attribute //get attribute
var attribute = await _specificationAttributeService.GetSpecificationAttributeByIdAsync(attributeOtion.SpecificationAttributeId); var attribute = await _specificationAttributeService.GetSpecificationAttributeByIdAsync(attributeOtion.SpecificationAttributeId);
// you can check for specific attribute by its name or id // you can check for specific attribute by its name or id
if (attribute.Name == "Needs to be measured for price") if (attribute.Name == "Needs to be measured for price")
{ {
return (0m, 0m, 0m, new List<Discount>()); return (0m, 0m, 0m, []);
} }
} }
return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate); return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);
} }
} }

View File

@ -37,7 +37,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
IGenericAttributeService genericAttributeService, IGenericAttributeService genericAttributeService,
IProductService productService, IProductService productService,
ISpecificationAttributeService specificationAttributeService, ISpecificationAttributeService specificationAttributeService,
IOrderService orderService, IOrderService orderService,
IProductAttributeService productAttributeService, IProductAttributeService productAttributeService,
IPluginManager<IPlugin> pluginManager, IPluginManager<IPlugin> pluginManager,
IWorkContext workContext, IWorkContext workContext,
@ -146,7 +146,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
{ {
var isMeasurable = form[nameof(IMeasurable.IsMeasurable)].ToString().Contains("true"); var isMeasurable = form[nameof(IMeasurable.IsMeasurable)].ToString().Contains("true");
//var isMeasurable = CommonHelper.To<bool>(form[nameof(IMeasurable.IsMeasurable)].ToString()); //var isMeasurable = CommonHelper.To<bool>(form[nameof(IMeasurable.IsMeasurable)].ToString());
await _fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Order, bool>(order.Id, nameof(IMeasurable.IsMeasurable), isMeasurable); await _fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Order, bool>(order.Id, nameof(IMeasurable.IsMeasurable), isMeasurable);
} }
@ -154,7 +154,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
if (form.ContainsKey(nameof(IOrderDto.DateOfReceipt))) if (form.ContainsKey(nameof(IOrderDto.DateOfReceipt)))
{ {
var dateOfReceipt = form[nameof(IOrderDto.DateOfReceipt)]; var dateOfReceipt = form[nameof(IOrderDto.DateOfReceipt)];
await _fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Order, DateTime>(order.Id, nameof(IOrderDto.DateOfReceipt), DateTime.Parse(dateOfReceipt)); await _fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Order, DateTime>(order.Id, nameof(IOrderDto.DateOfReceipt), DateTime.Parse(dateOfReceipt));
} }
@ -162,12 +162,12 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
public async Task HandleEventAsync(AdminMenuCreatedEvent eventMessage) public override async Task HandleEventAsync(AdminMenuCreatedEvent eventMessage)
{ {
var rootNode = eventMessage.RootMenuItem; var rootNode = eventMessage.RootMenuItem;
var ShippingsListMenuItem = new AdminMenuItem var shippingsListMenuItem = new AdminMenuItem
{ {
Visible = true, Visible = true,
SystemName = "FruitBank", SystemName = "FruitBank",
@ -196,18 +196,18 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
}; };
// Create a new top-level menu item // Create a new top-level menu item
var ShippingsMenuItem = new AdminMenuItem var shippingsMenuItem = new AdminMenuItem
{ {
Visible = true, Visible = true,
SystemName = "FruitBank", SystemName = "FruitBank",
Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Shippings"), // You can localize this with await _localizationService.GetResourceAsync("...") Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Shippings"), // You can localize this with await _localizationService.GetResourceAsync("...")
IconClass = "fas fa-shipping-fast", IconClass = "fas fa-shipping-fast",
//Url = _adminMenu.GetMenuItemUrl("Shipping", "List") //Url = _adminMenu.GetMenuItemUrl("Shipping", "List")
ChildNodes = new[] { ShippingsListMenuItem, createShippingMenuItem, editShippingMenuItem } ChildNodes = [shippingsListMenuItem, createShippingMenuItem, editShippingMenuItem]
}; };
var ShippingConfigurationItem = rootNode; var shippingConfigurationItem = rootNode;
ShippingConfigurationItem.ChildNodes.Insert(2, ShippingsMenuItem); shippingConfigurationItem.ChildNodes.Insert(2, shippingsMenuItem);
var invoiceListMenuItem = new AdminMenuItem var invoiceListMenuItem = new AdminMenuItem
@ -227,7 +227,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Invoices"), // You can localize this with await _localizationService.GetResourceAsync("...") Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Invoices"), // You can localize this with await _localizationService.GetResourceAsync("...")
IconClass = "fas fa-file-invoice", IconClass = "fas fa-file-invoice",
//Url = _adminMenu.GetMenuItemUrl("Shipping", "List") //Url = _adminMenu.GetMenuItemUrl("Shipping", "List")
ChildNodes = new[] { invoiceListMenuItem } ChildNodes = [invoiceListMenuItem]
}; };
var invoiceConfigurationItem = rootNode; var invoiceConfigurationItem = rootNode;
@ -257,18 +257,18 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.AI"), Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.AI"),
IconClass = "far fa-dot-circle", IconClass = "far fa-dot-circle",
ChildNodes = new List<AdminMenuItem> ChildNodes = new List<AdminMenuItem>
{
new()
{ {
new()
{
Visible = true, Visible = true,
SystemName = "FruitBank", SystemName = "FruitBank",
Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Configure"), Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.Configure"),
IconClass = "far fa-circle", IconClass = "far fa-circle",
Url = _adminMenu.GetMenuItemUrl("FruitBankPlugin", "Configure"), Url = _adminMenu.GetMenuItemUrl("FruitBankPlugin", "Configure"),
}
} }
}
}); });
} }

View File

@ -1,8 +0,0 @@
using AyCode.Services.Server.SignalRs;
using FruitBank.Common.Server.Services.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Services;
public class LoggerSignalRHub2(LoggerToLoggerApiController2 logger) : AcLoggerSignalRHub<LoggerToLoggerApiController2>(logger)
{ }

View File

@ -1,8 +0,0 @@
using AyCode.Core.Enums;
using AyCode.Core.Loggers;
using FruitBank.Common.Loggers;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Services;
public class LoggerToLoggerApiController2(IAcLogWriterBase[] logWriters) : Logger<LoggerToLoggerApiController2>(logWriters);