Merge branch '4.80' of https://git.aycode.com/Adam/Mango.Nop.Plugins into 4.80
This commit is contained in:
commit
236e2c6a03
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,9 @@ 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;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
||||||
|
|
||||||
|
|
@ -67,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;
|
||||||
|
|
@ -177,6 +179,9 @@ public class FruitBankDbContext : MgDbContextBase,
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//Logger.Warning($"UpdateShippingItemAsync");
|
||||||
|
//throw new Exception($"Teszt");
|
||||||
|
|
||||||
ProductDto? productDto = null;
|
ProductDto? productDto = null;
|
||||||
var productIsMeasurable = false;
|
var productIsMeasurable = false;
|
||||||
|
|
||||||
|
|
@ -313,6 +318,10 @@ public class FruitBankDbContext : MgDbContextBase,
|
||||||
if (!await SetupShippingItemPalletMeauringValues(shippingItemPallet)) return null;
|
if (!await SetupShippingItemPalletMeauringValues(shippingItemPallet)) return null;
|
||||||
|
|
||||||
await ShippingItemPallets.InsertAsync(shippingItemPallet);
|
await ShippingItemPallets.InsertAsync(shippingItemPallet);
|
||||||
|
|
||||||
|
var shippingItem = await ShippingItems.GetByIdAsync(shippingItemPallet.ShippingItemId, false);
|
||||||
|
await UpdateShippingItemAsync(shippingItem);
|
||||||
|
|
||||||
return shippingItemPallet;
|
return shippingItemPallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,6 +333,10 @@ public class FruitBankDbContext : MgDbContextBase,
|
||||||
if (!await SetupShippingItemPalletMeauringValues(shippingItemPallet)) return null;
|
if (!await SetupShippingItemPalletMeauringValues(shippingItemPallet)) return null;
|
||||||
|
|
||||||
await ShippingItemPallets.UpdateAsync(shippingItemPallet);
|
await ShippingItemPallets.UpdateAsync(shippingItemPallet);
|
||||||
|
|
||||||
|
var shippingItem = await ShippingItems.GetByIdAsync(shippingItemPallet.ShippingItemId, false);
|
||||||
|
await UpdateShippingItemAsync(shippingItem);
|
||||||
|
|
||||||
return shippingItemPallet;
|
return shippingItemPallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,14 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Core.Loggers;
|
|
||||||
using AyCode.Interfaces.Entities;
|
|
||||||
using FruitBank.Common.Dtos;
|
|
||||||
using FruitBank.Common.Entities;
|
using FruitBank.Common.Entities;
|
||||||
using FruitBank.Common.Interfaces;
|
using FruitBank.Common.Interfaces;
|
||||||
using FruitBank.Common.Loggers;
|
|
||||||
using FruitBank.Common.Server;
|
|
||||||
using Humanizer;
|
|
||||||
using Mango.Nop.Core.Loggers;
|
|
||||||
using Mango.Nop.Services;
|
using Mango.Nop.Services;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Core.Domain.Catalog;
|
using Nop.Core.Domain.Catalog;
|
||||||
using Nop.Core.Events;
|
using Nop.Core.Events;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
|
|
||||||
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;
|
||||||
using Nop.Services.Common;
|
|
||||||
using Nop.Services.Events;
|
using Nop.Services.Events;
|
||||||
using System.Globalization;
|
|
||||||
using Mango.Nop.Core.Extensions;
|
using Mango.Nop.Core.Extensions;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.EventConsumers;
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.EventConsumers;
|
||||||
|
|
@ -87,53 +77,62 @@ public class FruitBankEventConsumer(IHttpContextAccessor httpContextAcc, FruitBa
|
||||||
bool? isMeasurable = null;
|
bool? isMeasurable = null;
|
||||||
var isMeasurableChanged = false;
|
var isMeasurableChanged = false;
|
||||||
|
|
||||||
var productDto = product.Id > 0 ? await ctx.ProductDtos.GetByIdAsync(product.Id, false) : null;
|
try
|
||||||
|
|
||||||
//IsMeasurable
|
|
||||||
isMeasurable = form[nameof(IMeasurable.IsMeasurable)].ToString().Contains("true");
|
|
||||||
var productDtoIsMeasurable = productDto?.GenericAttributes.GetValueOrNull<bool>(nameof(IMeasurable.IsMeasurable));
|
|
||||||
|
|
||||||
if (productDtoIsMeasurable == null || productDtoIsMeasurable.Value != isMeasurable.Value)
|
|
||||||
{
|
{
|
||||||
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, bool>(product.Id, nameof(IMeasurable.IsMeasurable), isMeasurable.Value);
|
var productDto = product.Id > 0 ? await ctx.ProductDtos.GetByIdAsync(product.Id, false) : null;
|
||||||
isMeasurableChanged = true;
|
|
||||||
|
//IsMeasurable
|
||||||
|
isMeasurable = form[nameof(IMeasurable.IsMeasurable)].ToString().Contains("true");
|
||||||
|
var productDtoIsMeasurable = productDto?.GenericAttributes.GetValueOrNull<bool>(nameof(IMeasurable.IsMeasurable));
|
||||||
|
|
||||||
|
if (productDtoIsMeasurable == null || productDtoIsMeasurable.Value != isMeasurable.Value)
|
||||||
|
{
|
||||||
|
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, bool>(product.Id, nameof(IMeasurable.IsMeasurable), isMeasurable.Value);
|
||||||
|
isMeasurableChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//NetWeight
|
||||||
|
var netWeight = double.Round(CommonHelper.To<double>(form[nameof(IMeasuringNetWeight.NetWeight)].ToString()), 1);
|
||||||
|
var productDtoNetWeight = productDto?.GenericAttributes.GetValueOrNull<double>(nameof(IMeasuringNetWeight.NetWeight));
|
||||||
|
|
||||||
|
if (productDtoNetWeight == null || double.Round(productDtoNetWeight.Value, 1) != netWeight)
|
||||||
|
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, double>(product.Id, nameof(IMeasuringNetWeight.NetWeight), netWeight);
|
||||||
|
|
||||||
|
//Tára
|
||||||
|
var tare = double.Round(CommonHelper.To<double>(form[nameof(ITare.Tare)].ToString()), 1);
|
||||||
|
if (tare < 0) throw new Exception($"FruitBankEventConsumer->SaveProductCustomAttributesAsync(); (tare < 0); productId: {product.Id}; tare: {tare}");
|
||||||
|
|
||||||
|
if (productDto == null || productDto.Tare != tare)
|
||||||
|
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, double>(product.Id, nameof(ITare.Tare), tare);
|
||||||
|
|
||||||
|
//IncomingQuantity
|
||||||
|
var incomingQuantity = CommonHelper.To<int>(form[nameof(IIncomingQuantity.IncomingQuantity)].ToString());
|
||||||
|
if (incomingQuantity < 0) throw new Exception($"FruitBankEventConsumer->SaveProductCustomAttributesAsync(); (incomingQuantity < 0); productId: {product.Id}; incomingQuantity: {incomingQuantity}");
|
||||||
|
|
||||||
|
if (productDto == null || productDto.IncomingQuantity != incomingQuantity)
|
||||||
|
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, int>(product.Id, nameof(IIncomingQuantity.IncomingQuantity), incomingQuantity);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error($"FruitBankEventConsumer->SaveProductCustomAttributesAsync; {ex.Message}", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//NetWeight
|
|
||||||
var netWeight = double.Round(CommonHelper.To<double>(form[nameof(IMeasuringNetWeight.NetWeight)].ToString()), 1);
|
|
||||||
var productDtoNetWeight = productDto?.GenericAttributes.GetValueOrNull<double>(nameof(IMeasuringNetWeight.NetWeight));
|
|
||||||
|
|
||||||
if (productDtoNetWeight == null || double.Round(productDtoNetWeight.Value, 1) != netWeight)
|
|
||||||
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, double>(product.Id, nameof(IMeasuringNetWeight.NetWeight), netWeight);
|
|
||||||
|
|
||||||
//Tára
|
|
||||||
var tare = double.Round(CommonHelper.To<double>(form[nameof(ITare.Tare)].ToString()), 1);
|
|
||||||
if (tare < 0) throw new Exception($"FruitBankEventConsumer->SaveProductCustomAttributesAsync(); (tare < 0); productId: {product.Id}; tare: {tare}");
|
|
||||||
|
|
||||||
if (productDto == null || productDto.Tare != tare)
|
|
||||||
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, double>(product.Id, nameof(ITare.Tare), tare);
|
|
||||||
|
|
||||||
//IncomingQuantity
|
|
||||||
var incomingQuantity = CommonHelper.To<int>(form[nameof(IIncomingQuantity.IncomingQuantity)].ToString());
|
|
||||||
if (incomingQuantity < 0) throw new Exception($"FruitBankEventConsumer->SaveProductCustomAttributesAsync(); (incomingQuantity < 0); productId: {product.Id}; incomingQuantity: {incomingQuantity}");
|
|
||||||
|
|
||||||
if (productDto == null || productDto.IncomingQuantity != incomingQuantity)
|
|
||||||
await fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Product, int>(product.Id, nameof(IIncomingQuantity.IncomingQuantity), incomingQuantity);
|
|
||||||
|
|
||||||
return (isMeasurableChanged, isMeasurable);
|
return (isMeasurableChanged, isMeasurable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task HandleEventAsync(EntityInsertedEvent<ShippingItemPallet> eventMessage)
|
public async Task HandleEventAsync(EntityInsertedEvent<ShippingItemPallet> eventMessage)
|
||||||
{
|
{
|
||||||
Logger.Info($"HandleEventAsync EntityInsertedEvent<ShippingItemPallet>; id: {eventMessage.Entity.Id}");
|
return;
|
||||||
|
|
||||||
|
Logger.Info($"HandleEventAsync EntityInsertedEvent<ShippingItemPallet>; id: {eventMessage.Entity.Id}");
|
||||||
await UpdateShippingItemMeasuringValuesAsync(eventMessage.Entity);
|
await UpdateShippingItemMeasuringValuesAsync(eventMessage.Entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task HandleEventAsync(EntityUpdatedEvent<ShippingItemPallet> eventMessage)
|
public async Task HandleEventAsync(EntityUpdatedEvent<ShippingItemPallet> eventMessage)
|
||||||
{
|
{
|
||||||
Logger.Info($"HandleEventAsync EntityUpdatedEvent<ShippingItemPallet>; id: {eventMessage.Entity.Id}");
|
return;
|
||||||
|
|
||||||
|
Logger.Info($"HandleEventAsync EntityUpdatedEvent<ShippingItemPallet>; id: {eventMessage.Entity.Id}");
|
||||||
await UpdateShippingItemMeasuringValuesAsync(eventMessage.Entity);
|
await UpdateShippingItemMeasuringValuesAsync(eventMessage.Entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using DevExpress.AspNetCore;
|
using DevExpress.AspNetCore;
|
||||||
|
|
||||||
using FruitBank.Common;
|
using FruitBank.Common;
|
||||||
using FruitBank.Common.Interfaces;
|
using FruitBank.Common.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;
|
||||||
|
|
@ -16,6 +16,9 @@ using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
using Nop.Core.Infrastructure;
|
using Nop.Core.Infrastructure;
|
||||||
|
using Nop.Data;
|
||||||
|
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
|
||||||
|
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Factories;
|
using Nop.Plugin.Misc.FruitBankPlugin.Factories;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Filters;
|
using Nop.Plugin.Misc.FruitBankPlugin.Filters;
|
||||||
|
|
@ -27,9 +30,6 @@ using Nop.Services.Events;
|
||||||
using Nop.Web.Areas.Admin.Factories;
|
using Nop.Web.Areas.Admin.Factories;
|
||||||
using Nop.Web.Areas.Admin.Models.Catalog;
|
using Nop.Web.Areas.Admin.Models.Catalog;
|
||||||
using Nop.Web.Areas.Admin.Models.Orders;
|
using Nop.Web.Areas.Admin.Models.Orders;
|
||||||
using FruitBank.Common.Server.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
|
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Infrastructure;
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Infrastructure;
|
||||||
|
|
||||||
|
|
@ -42,20 +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.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>();
|
||||||
|
|
@ -124,7 +124,7 @@ public class PluginNopStartup : INopStartup
|
||||||
{
|
{
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapHub<LoggerSignalRHub2>(loggrHubEndPoint);
|
endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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" />
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"),
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
|
||||||
{ }
|
|
||||||
|
|
@ -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);
|
|
||||||
Loading…
Reference in New Issue