diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
index 174b91d9..6db78a0d 100644
--- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
+++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
@@ -140,56 +140,6 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
-#if true
- ///
- /// Elenco completo ItemGroup gestiti
- ///
- ///
- internal List ItemGroupGetAll()
- {
- List dbResult = new List();
- //using (DataLayerContext dbCtx = new DataLayerContext(_config))
- using (DataLayerContext dbCtx = new DataLayerContext())
- {
- try
- {
- dbResult = dbCtx
- .DbSetItemGroup
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ItemGroupGetAllAsync{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
- ///
- /// Elenco completo ItemGroup gestiti async
- ///
- ///
- internal async Task> ItemGroupGetAllAsync()
- {
- List dbResult = new List();
- //using (DataLayerContext dbCtx = new DataLayerContext(_config))
- using (DataLayerContext dbCtx = new DataLayerContext())
- {
- try
- {
- dbResult = await dbCtx
- .DbSetItemGroup
- .ToListAsync();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ItemGroupGetAllAsync{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-#endif
-
internal async Task OffersCheckExpired()
{
bool answ = false;
diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
index ba3315a4..6cd73db1 100644
--- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
+++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
@@ -2,7 +2,6 @@
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.Controllers;
using EgwCoreLib.Lux.Data.DbModel.Cost;
-using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
@@ -167,41 +166,6 @@ namespace EgwCoreLib.Lux.Data.Services
return answ;
}
-#if true
- ///
- /// Elenco completo ItemGroup gestiti
- ///
- ///
- public async Task> ItemGroupGetAllAsync()
- {
- using var activity = StartActivity();
- string source = "DB";
- List? result = new List();
- // cerco in redis...
- string currKey = $"{redisBaseKey}:ItemGroup:ALL";
- RedisValue rawData = await _redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await dbController.ItemGroupGetAllAsync();
- // serializzo e salvo con config x evitare loop...
- rawData = JsonConvert.SerializeObject(result, JSSettings);
- await _redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (result == null)
- {
- result = new List();
- }
- activity?.SetTag("data.source", source);
- LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
- return result;
- }
-#endif
-
///
/// Verifica offerte scadute, con update sul DB
///
diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs
index 8c004992..a7eb7aa0 100644
--- a/Lux.API/Program.cs
+++ b/Lux.API/Program.cs
@@ -183,6 +183,7 @@ builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
@@ -208,6 +209,7 @@ builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
diff --git a/Lux.UI/Components/Compo/Item/DataFilter.razor.cs b/Lux.UI/Components/Compo/Item/DataFilter.razor.cs
index cc6df0f2..03792e42 100644
--- a/Lux.UI/Components/Compo/Item/DataFilter.razor.cs
+++ b/Lux.UI/Components/Compo/Item/DataFilter.razor.cs
@@ -1,6 +1,7 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.Services;
+using EgwCoreLib.Lux.Data.Services.Items;
using Microsoft.AspNetCore.Components;
namespace Lux.UI.Components.Compo.Item
@@ -57,6 +58,9 @@ namespace Lux.UI.Components.Compo.Item
[Inject]
private DataLayerServices DLService { get; set; } = null!;
+ [Inject]
+ private IItemGroupService IGService { get; set; } = null!;
+
private string SearchVal
{
get => CurrFilt.SearchVal;
@@ -120,7 +124,7 @@ namespace Lux.UI.Components.Compo.Item
private async Task ReloadBaseData()
{
- ListItemGroup = await DLService.ItemGroupGetAllAsync();
+ ListItemGroup = await IGService.GetAllAsync();
}
private void ResetSearch()
diff --git a/Lux.UI/Components/Pages/Items.razor.cs b/Lux.UI/Components/Pages/Items.razor.cs
index ef2d8647..6c16fd54 100644
--- a/Lux.UI/Components/Pages/Items.razor.cs
+++ b/Lux.UI/Components/Pages/Items.razor.cs
@@ -39,6 +39,9 @@ namespace Lux.UI.Components.Pages
[Inject]
private DataLayerServices DLService { get; set; } = null!;
+ [Inject]
+ private IItemGroupService IGService { get; set; } = null!;
+
[Inject]
private IItemService IService { get; set; } = null!;
@@ -93,7 +96,7 @@ namespace Lux.UI.Components.Pages
private async Task ReloadBaseData()
{
- ListItemGroup = await DLService.ItemGroupGetAllAsync();
+ ListItemGroup = await IGService.GetAllAsync();
ListJobTask = await JTService.GetAllAsync();
isLoading = false;
}
diff --git a/Lux.UI/Components/Pages/SellItems.razor.cs b/Lux.UI/Components/Pages/SellItems.razor.cs
index 53305777..4058053b 100644
--- a/Lux.UI/Components/Pages/SellItems.razor.cs
+++ b/Lux.UI/Components/Pages/SellItems.razor.cs
@@ -39,6 +39,9 @@ namespace Lux.UI.Components.Pages
[Inject]
private DataLayerServices DLService { get; set; } = null!;
+ [Inject]
+ private IItemGroupService IGService { get; set; } = null!;
+
[Inject]
private IItemService IService { get; set; } = null!;
@@ -90,7 +93,7 @@ namespace Lux.UI.Components.Pages
private async Task ReloadBaseData()
{
- ListItemGroup = await DLService.ItemGroupGetAllAsync();
+ ListItemGroup = await IGService.GetAllAsync();
ListJobTask = await JTService.GetAllAsync();
isLoading = false;
}
diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs
index 66e03194..cb09035e 100644
--- a/Lux.UI/Program.cs
+++ b/Lux.UI/Program.cs
@@ -221,6 +221,7 @@ builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
@@ -246,6 +247,7 @@ builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();