Aggiunta modelli e migrazioni x confdata

This commit is contained in:
Samuele Locatelli
2025-10-02 15:48:48 +02:00
parent 5d41e98c07
commit a6b72068f4
14 changed files with 5781 additions and 47 deletions
@@ -8,6 +8,7 @@ using NLog;
using NLog.LayoutRenderers;
using static EgwCoreLib.Lux.Core.Enums;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Config;
namespace EgwCoreLib.Lux.Data.Controllers
{
@@ -17,6 +18,78 @@ namespace EgwCoreLib.Lux.Data.Controllers
#region Internal Methods
/// <summary>
/// Elenco completo Config Glass
/// </summary>
/// <returns></returns>
internal async Task<List<GlassModel>> ConfGlassGetAllAsync()
{
List<GlassModel> dbResult = new List<GlassModel>();
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
dbResult = await dbCtx
.DbSetConfGlass
.ToListAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfGlassGetAllAsync{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco completo Config Profile
/// </summary>
/// <returns></returns>
internal async Task<List<ProfileModel>> ConfProfileGetAllAsync()
{
List<ProfileModel> dbResult = new List<ProfileModel>();
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
dbResult = await dbCtx
.DbSetConfProfile
.ToListAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfProfileGetAllAsync{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco completo Config Wood
/// </summary>
/// <returns></returns>
internal async Task<List<WoodModel>> ConfWoodGetAllAsync()
{
List<WoodModel> dbResult = new List<WoodModel>();
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
dbResult = await dbCtx
.DbSetConfWood
.ToListAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfWoodGetAllAsync{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco completo Customers da DB
/// </summary>
+13 -2
View File
@@ -1,4 +1,5 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
@@ -46,7 +47,10 @@ namespace EgwCoreLib.Lux.Data
}
public virtual DbSet<CounterModel> DbSetCounters { get; set; }
public virtual DbSet<GlassModel> DbSetConfGlass { get; set; }
public virtual DbSet<ProfileModel> DbSetConfProfile { get; set; }
public virtual DbSet<WoodModel> DbSetConfWood { get; set; }
public virtual DbSet<ItemGroupModel> DbSetItemGroup { get; set; }
public virtual DbSet<ItemModel> DbSetItem { get; set; }
public virtual DbSet<SellingItemModel> DbSetSellItem { get; set; }
@@ -113,6 +117,13 @@ namespace EgwCoreLib.Lux.Data
modelBuilder.Entity<CounterModel>()
.HasKey(c => new { c.RefYear, c.CountName});
modelBuilder.Entity<GlassModel>()
.HasKey(c => new { c.GlassID });
modelBuilder.Entity<ProfileModel>()
.HasKey(c => new { c.ProfileID });
modelBuilder.Entity<WoodModel>()
.HasKey(c => new { c.WoodID });
// fix valori timestamp
modelBuilder.Entity<StockMovModel>(entity =>
{
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Config
{
/// <summary>
/// Risorsa tipo di Glass x EF
/// </summary>
[Table("conf_glass")]
public class GlassModel : Egw.Window.Data.Glass
{
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Config
{
/// <summary>
/// Risorsa tipo di Hardware x EF
/// </summary>
[Table("conf_Hardware")]
public class HardwareModel : Egw.Window.Data.Hardware
{
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Config
{
/// <summary>
/// Risorsa tipo di Wood x EF
/// </summary>
[Table("conf_profile")]
public class ProfileModel : Egw.Window.Data.Profile
{
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Config
{
/// <summary>
/// Risorsa tipo di Wood x EF
/// </summary>
[Table("conf_wood")]
public class WoodModel : Egw.Window.Data.Wood
{
}
}
@@ -17,6 +17,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="DbModel\Config\HardwareModel.cs" />
<Compile Remove="DbModel\Cost\Enums.cs" />
<Compile Remove="Services\ExternalMessageProcessor.cs" />
<Compile Remove="Services\RedisSubscriberServiceOld.cs" />
@@ -41,7 +42,7 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NLog" Version="6.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="RestSharp" Version="112.1.0" />
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,279 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EgwCoreLib.Lux.Data.Migrations
{
/// <inheritdoc />
public partial class AddConfTables_01 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "conf_glass",
columns: table => new
{
GlassID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Thickness = table.Column<double>(type: "double", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_conf_glass", x => x.GlassID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "conf_profile",
columns: table => new
{
ProfileID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Thickness = table.Column<double>(type: "double", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_conf_profile", x => x.ProfileID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "conf_wood",
columns: table => new
{
WoodID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ExtId = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Type = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_conf_wood", x => x.WoodID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "Inserted", "Modified", "ValidUntil" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4627), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4629), new DateTime(2025, 11, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4624) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4753), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4755) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4768), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4770) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4780), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4782) });
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 1,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4289));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 2,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4363));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 3,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4367));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 4,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4370));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 5,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4374));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 6,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4378));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 7,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4381));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 8,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4385));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 9,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4389));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 10,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4392));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "conf_glass");
migrationBuilder.DropTable(
name: "conf_profile");
migrationBuilder.DropTable(
name: "conf_wood");
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "Inserted", "Modified", "ValidUntil" },
values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4738), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4739), new DateTime(2025, 10, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4735) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4848), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4850) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4862), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4864) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4874), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4875) });
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 1,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4416));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 2,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4475));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 3,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4479));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 4,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4482));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 5,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4486));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 6,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4490));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 7,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4493));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 8,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4497));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 9,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4501));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 10,
column: "DtCreate",
value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4504));
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,298 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace EgwCoreLib.Lux.Data.Migrations
{
/// <inheritdoc />
public partial class AddInitConfVal : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "conf_glass",
columns: new[] { "GlassID", "Code", "Description", "Thickness" },
values: new object[,]
{
{ 1, "", "Vetro BE 2S 4/12/4", 20.0 },
{ 2, "", "Vetro BE 3S 4/12/4/12/4", 36.0 },
{ 3, "", "Vetro BE 3S 4/16/4/16/4", 44.0 }
});
migrationBuilder.InsertData(
table: "conf_profile",
columns: new[] { "ProfileID", "Code", "Description", "Thickness" },
values: new object[,]
{
{ 1, "", "Profilo 32", 32.0 },
{ 2, "", "Profilo 48", 48.0 },
{ 3, "", "Profilo 58", 58.0 }
});
migrationBuilder.InsertData(
table: "conf_wood",
columns: new[] { "WoodID", "Description", "ExtId", "Type" },
values: new object[,]
{
{ 1, "Abete", "", 1 },
{ 2, "Acero", "", 1 },
{ 3, "Pino", "", 2 },
{ 4, "Tek", "", 3 }
});
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "Inserted", "Modified", "ValidUntil" },
values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9241), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9242), new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364) });
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 1,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8944));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 2,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8992));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 3,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8995));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 4,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8999));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 5,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9003));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 6,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9006));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 7,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9010));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 8,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9013));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 9,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9017));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 10,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9021));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 1);
migrationBuilder.DeleteData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 2);
migrationBuilder.DeleteData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 3);
migrationBuilder.DeleteData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 1);
migrationBuilder.DeleteData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 2);
migrationBuilder.DeleteData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 3);
migrationBuilder.DeleteData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 1);
migrationBuilder.DeleteData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 2);
migrationBuilder.DeleteData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 3);
migrationBuilder.DeleteData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 4);
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "Inserted", "Modified", "ValidUntil" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4627), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4629), new DateTime(2025, 11, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4624) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4753), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4755) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4768), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4770) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4780), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4782) });
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 1,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4289));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 2,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4363));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 3,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4367));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 4,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4370));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 5,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4374));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 6,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4378));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 7,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4381));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 8,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4385));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 9,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4389));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 10,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4392));
}
}
}
@@ -22,6 +22,148 @@ namespace EgwCoreLib.Lux.Data.Migrations
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b =>
{
b.Property<int>("GlassID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("GlassID"));
b.Property<string>("Code")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<double>("Thickness")
.HasColumnType("double");
b.HasKey("GlassID");
b.ToTable("conf_glass");
b.HasData(
new
{
GlassID = 1,
Code = "",
Description = "Vetro BE 2S 4/12/4",
Thickness = 20.0
},
new
{
GlassID = 2,
Code = "",
Description = "Vetro BE 3S 4/12/4/12/4",
Thickness = 36.0
},
new
{
GlassID = 3,
Code = "",
Description = "Vetro BE 3S 4/16/4/16/4",
Thickness = 44.0
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b =>
{
b.Property<int>("ProfileID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProfileID"));
b.Property<string>("Code")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<double>("Thickness")
.HasColumnType("double");
b.HasKey("ProfileID");
b.ToTable("conf_profile");
b.HasData(
new
{
ProfileID = 1,
Code = "",
Description = "Profilo 32",
Thickness = 32.0
},
new
{
ProfileID = 2,
Code = "",
Description = "Profilo 48",
Thickness = 48.0
},
new
{
ProfileID = 3,
Code = "",
Description = "Profilo 58",
Thickness = 58.0
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b =>
{
b.Property<int>("WoodID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("WoodID"));
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("ExtId")
.HasColumnType("longtext");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("WoodID");
b.ToTable("conf_wood");
b.HasData(
new
{
WoodID = 1,
Description = "Abete",
ExtId = "",
Type = 1
},
new
{
WoodID = 2,
Description = "Acero",
ExtId = "",
Type = 1
},
new
{
WoodID = 3,
Description = "Pino",
ExtId = "",
Type = 2
},
new
{
WoodID = 4,
Description = "Tek",
ExtId = "",
Type = 3
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b =>
{
b.Property<int>("CostDriverID")
@@ -948,13 +1090,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta per tre serramenti",
Discount = 0.0,
Envir = 1,
Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4738),
Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4739),
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9241),
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9242),
OffertState = 0,
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 10, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4735)
ValidUntil = new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238)
});
});
@@ -1049,11 +1191,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 950.0,
Envir = 1,
Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4848),
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4850),
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339),
Note = "Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF250000000001",
@@ -1073,11 +1215,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 200.0,
Envir = 1,
Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4862),
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4864),
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF250000000002",
@@ -1097,11 +1239,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 250.0,
Envir = 1,
Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4874),
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4875),
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364),
Note = "Installazione serramento",
OfferID = 1,
OfferRowUID = "OFF250000000003",
@@ -1284,8 +1426,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 1,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4416),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4472),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8944),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8989),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1297,8 +1439,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 2,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4475),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4476),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8992),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8993),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 8.0,
@@ -1310,8 +1452,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 3,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4479),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4480),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8995),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8997),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1323,8 +1465,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 4,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4482),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4484),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8999),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9000),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1336,8 +1478,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 5,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4486),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4487),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9003),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9004),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 10.0,
@@ -1349,8 +1491,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 6,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4490),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4491),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9006),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9008),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1362,8 +1504,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 7,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4493),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4495),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9010),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9011),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 50.0,
@@ -1375,8 +1517,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 8,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4497),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4498),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9013),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9015),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1388,8 +1530,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 9,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4501),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4502),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9017),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9018),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1401,8 +1543,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 10,
CodDoc = "",
DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4504),
DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4506),
DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9021),
DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9023),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
+19 -1
View File
@@ -1,4 +1,5 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.DbModel.Stock;
@@ -43,6 +44,23 @@ namespace EgwCoreLib.Lux.Data
new GenValueModel { GenValID = 6, Ordinal = 4, ClassCod = "WoodCol", ValString = "Nero" }
);
modelBuilder.Entity<GlassModel>().HasData(
new GlassModel { GlassID = 1, Description = "Vetro BE 2S 4/12/4", Thickness = 20 },
new GlassModel { GlassID = 2, Description = "Vetro BE 3S 4/12/4/12/4", Thickness = 36 },
new GlassModel { GlassID = 3, Description = "Vetro BE 3S 4/16/4/16/4", Thickness = 44 }
);
modelBuilder.Entity<ProfileModel>().HasData(
new ProfileModel { ProfileID = 1, Description = "Profilo 32", Thickness = 32 },
new ProfileModel { ProfileID = 2, Description = "Profilo 48", Thickness = 48 },
new ProfileModel { ProfileID = 3, Description = "Profilo 58", Thickness = 58 }
);
modelBuilder.Entity<WoodModel>().HasData(
new WoodModel { WoodID = 1, Description = "Abete", Type = 1 },
new WoodModel { WoodID = 2, Description = "Acero", Type = 1 },
new WoodModel { WoodID = 3, Description = "Pino", Type = 2 },
new WoodModel { WoodID = 4, Description = "Tek", Type = 3 }
);
// valori base classi generiche
+118 -14
View File
@@ -17,6 +17,7 @@ using System.Threading.Tasks;
using static EgwCoreLib.Lux.Core.Enums;
using static System.Runtime.InteropServices.JavaScript.JSType;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Config;
namespace EgwCoreLib.Lux.Data.Services
{
@@ -46,6 +47,108 @@ namespace EgwCoreLib.Lux.Data.Services
#region Public Methods
/// <summary>
/// Elenco completo Config Glass
/// </summary>
/// <returns></returns>
public async Task<List<GlassModel>> ConfGlassGetAllAsync()
{
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<GlassModel>? result = new List<GlassModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfGlass";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<GlassModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = await dbController.ConfGlassGetAllAsync();
// 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<GlassModel>();
}
sw.Stop();
Log.Debug($"ConfGlassGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco completo Config Profile
/// </summary>
/// <returns></returns>
public async Task<List<ProfileModel>> ConfProfileGetAllAsync()
{
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<ProfileModel>? result = new List<ProfileModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfProfile";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<ProfileModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = await dbController.ConfProfileGetAllAsync();
// 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<ProfileModel>();
}
sw.Stop();
Log.Debug($"ConfProfileGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco completo Config Wood
/// </summary>
/// <returns></returns>
public async Task<List<WoodModel>> ConfWoodGetAllAsync()
{
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<WoodModel>? result = new List<WoodModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfWood";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<WoodModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = await dbController.ConfWoodGetAllAsync();
// 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<WoodModel>();
}
sw.Stop();
Log.Debug($"ConfWoodGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco completo Customers
/// </summary>
@@ -158,6 +261,7 @@ namespace EgwCoreLib.Lux.Data.Services
Log.Debug($"FlushCacheOffersAsync in {sw.Elapsed.TotalMilliseconds} ms");
return answ;
}
/// <summary>
/// Reset cache sistema x Ordini modalità async
/// </summary>
@@ -246,20 +350,6 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Esegue spostamento nell'ordinamento relativo alla classe + refresh cache
/// </summary>
/// <param name="selRec"></param>
/// <param name="moveUp"></param>
/// <returns></returns>
public async Task<bool> GenValMoveAsync(GenValueModel selRec, bool moveUp)
{
bool result = await dbController.GenValMoveAsync(selRec, moveUp);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*");
return result;
}
/// <summary>
/// Elenco valori x classe richiesta
/// </summary>
@@ -295,6 +385,20 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Esegue spostamento nell'ordinamento relativo alla classe + refresh cache
/// </summary>
/// <param name="selRec"></param>
/// <param name="moveUp"></param>
/// <returns></returns>
public async Task<bool> GenValMoveAsync(GenValueModel selRec, bool moveUp)
{
bool result = await dbController.GenValMoveAsync(selRec, moveUp);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*");
return result;
}
/// <summary>
/// Esegue Upsert del record ricevuto
/// </summary>