Completata prima versione gestione conf parameters

This commit is contained in:
Samuele Locatelli
2025-10-02 18:33:50 +02:00
parent 38646b2a1b
commit b3e1ee4173
18 changed files with 3639 additions and 87 deletions
@@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Egw.Window.Data" Version="2.7.10.212" />
<PackageReference Include="Egw.Window.Data" Version="2.7.10.216" />
<PackageReference Include="EgwMultiEngineManager.Data" Version="2.7.10.1" />
</ItemGroup>
</Project>
@@ -18,6 +18,41 @@ namespace EgwCoreLib.Lux.Data.Controllers
#region Internal Methods
/// <summary>
/// Esegue eliminazione
/// </summary>
/// <param name="rec2del"></param>
/// <returns></returns>
internal async Task<bool> ConfGlassDeleteAsync(GlassModel rec2del)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var dbResult = dbCtx
.DbSetConfGlass
.Where(x => x.GlassID == rec2del.GlassID)
.FirstOrDefault();
// se trovato --> elimino e sposto i rimanenti...
if (dbResult != null)
{
// elimino
dbCtx.DbSetConfGlass.Remove(dbResult);
// salvo tutto
await dbCtx.SaveChangesAsync();
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfGlassDeleteAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Elenco completo Config Glass
/// </summary>
@@ -42,6 +77,83 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
/// <summary>
/// Upsert record ConfGlass
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
internal async Task<bool> ConfGlassUpsertAsync(GlassModel upsRec)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var currRec = dbCtx
.DbSetConfGlass
.Where(x => upsRec.GlassID > 0 && x.GlassID == upsRec.GlassID)
.FirstOrDefault();
// se trovato --> aggiorno
if (currRec != null)
{
currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.GlassID:0000}" : upsRec.Code;
currRec.Description = upsRec.Description;
currRec.Thickness = upsRec.Thickness;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
// se mancasse --> aggiungo
else
{
dbCtx.DbSetConfGlass.Add(upsRec);
}
// salvo...
int numAct = await dbCtx.SaveChangesAsync();
answ = numAct > 0;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfGlassUpsertAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Esegue eliminazione
/// </summary>
/// <param name="rec2del"></param>
/// <returns></returns>
internal async Task<bool> ConfProfileDeleteAsync(ProfileModel rec2del)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var dbResult = dbCtx
.DbSetConfProfile
.Where(x => x.ProfileID == rec2del.ProfileID)
.FirstOrDefault();
// se trovato --> elimino e sposto i rimanenti...
if (dbResult != null)
{
// elimino
dbCtx.DbSetConfProfile.Remove(dbResult);
// salvo tutto
await dbCtx.SaveChangesAsync();
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfProfileDeleteAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Elenco completo Config Profile
/// </summary>
@@ -66,6 +178,83 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
/// <summary>
/// Upsert record ConfProfile
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
internal async Task<bool> ConfProfileUpsertAsync(ProfileModel upsRec)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var currRec = dbCtx
.DbSetConfProfile
.Where(x => upsRec.ProfileID > 0 && x.ProfileID == upsRec.ProfileID)
.FirstOrDefault();
// se trovato --> aggiorno
if (currRec != null)
{
currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.ProfileID:0000}" : upsRec.Code;
currRec.Description = upsRec.Description;
currRec.Thickness = upsRec.Thickness;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
// se mancasse --> aggiungo
else
{
dbCtx.DbSetConfProfile.Add(upsRec);
}
// salvo...
int numAct = await dbCtx.SaveChangesAsync();
answ = numAct > 0;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfProfileUpsertAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Esegue eliminazione
/// </summary>
/// <param name="rec2del"></param>
/// <returns></returns>
internal async Task<bool> ConfWoodDeleteAsync(WoodModel rec2del)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var dbResult = dbCtx
.DbSetConfWood
.Where(x => x.WoodID == rec2del.WoodID)
.FirstOrDefault();
// se trovato --> elimino e sposto i rimanenti...
if (dbResult != null)
{
// elimino
dbCtx.DbSetConfWood.Remove(dbResult);
// salvo tutto
await dbCtx.SaveChangesAsync();
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfWoodDeleteAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Elenco completo Config Wood
/// </summary>
@@ -90,6 +279,48 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
/// <summary>
/// Upsert record ConfWood
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
internal async Task<bool> ConfWoodUpsertAsync(WoodModel upsRec)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
var currRec = dbCtx
.DbSetConfWood
.Where(x => upsRec.WoodID > 0 && x.WoodID == upsRec.WoodID)
.FirstOrDefault();
// se trovato --> aggiorno
if (currRec != null)
{
currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.WoodID:0000}" : upsRec.Code;
currRec.Description = upsRec.Description;
currRec.Type = upsRec.Type;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
// se mancasse --> aggiungo
else
{
dbCtx.DbSetConfWood.Add(upsRec);
}
// salvo...
int numAct = await dbCtx.SaveChangesAsync();
answ = numAct > 0;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ConfWoodUpsertAsync{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Elenco completo Customers da DB
/// </summary>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,365 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EgwCoreLib.Lux.Data.Migrations
{
/// <inheritdoc />
public partial class UpdateConfVal : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ExtId",
table: "conf_wood",
newName: "Code");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 1,
column: "Code",
value: "0001");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 2,
column: "Code",
value: "0002");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 3,
column: "Code",
value: "0003");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 1,
column: "Code",
value: "0001");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 2,
column: "Code",
value: "0002");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 3,
column: "Code",
value: "0003");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 1,
column: "Code",
value: "0001");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 2,
column: "Code",
value: "0002");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 3,
column: "Code",
value: "0003");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 4,
column: "Code",
value: "0004");
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "Inserted", "Modified", "ValidUntil" },
values: new object[] { new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(535), new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(537), new DateTime(2025, 11, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(530) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(636), new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(638) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(651), new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(652) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(662), new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(664) });
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 1,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(180));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 2,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(236));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 3,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(240));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 4,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(243));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 5,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(247));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 6,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(250));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 7,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(254));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 8,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(257));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 9,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(318));
migrationBuilder.UpdateData(
table: "stock_mov",
keyColumn: "StockMovID",
keyValue: 10,
column: "DtCreate",
value: new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(322));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Code",
table: "conf_wood",
newName: "ExtId");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 1,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 2,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_glass",
keyColumn: "GlassID",
keyValue: 3,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 1,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 2,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_profile",
keyColumn: "ProfileID",
keyValue: 3,
column: "Code",
value: "");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 1,
column: "ExtId",
value: "");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 2,
column: "ExtId",
value: "");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 3,
column: "ExtId",
value: "");
migrationBuilder.UpdateData(
table: "conf_wood",
keyColumn: "WoodID",
keyValue: 4,
column: "ExtId",
value: "");
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));
}
}
}
@@ -47,21 +47,21 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
GlassID = 1,
Code = "",
Code = "0001",
Description = "Vetro BE 2S 4/12/4",
Thickness = 20.0
},
new
{
GlassID = 2,
Code = "",
Code = "0002",
Description = "Vetro BE 3S 4/12/4/12/4",
Thickness = 36.0
},
new
{
GlassID = 3,
Code = "",
Code = "0003",
Description = "Vetro BE 3S 4/16/4/16/4",
Thickness = 44.0
});
@@ -92,21 +92,21 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ProfileID = 1,
Code = "",
Code = "0001",
Description = "Profilo 32",
Thickness = 32.0
},
new
{
ProfileID = 2,
Code = "",
Code = "0002",
Description = "Profilo 48",
Thickness = 48.0
},
new
{
ProfileID = 3,
Code = "",
Code = "0003",
Description = "Profilo 58",
Thickness = 58.0
});
@@ -120,10 +120,10 @@ namespace EgwCoreLib.Lux.Data.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("WoodID"));
b.Property<string>("Description")
b.Property<string>("Code")
.HasColumnType("longtext");
b.Property<string>("ExtId")
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<int>("Type")
@@ -137,29 +137,29 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
WoodID = 1,
Code = "0001",
Description = "Abete",
ExtId = "",
Type = 1
},
new
{
WoodID = 2,
Code = "0002",
Description = "Acero",
ExtId = "",
Type = 1
},
new
{
WoodID = 3,
Code = "0003",
Description = "Pino",
ExtId = "",
Type = 2
},
new
{
WoodID = 4,
Code = "0004",
Description = "Tek",
ExtId = "",
Type = 3
});
});
@@ -1090,13 +1090,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta per tre serramenti",
Discount = 0.0,
Envir = 1,
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),
Inserted = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(535),
Modified = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(537),
OffertState = 0,
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238)
ValidUntil = new DateTime(2025, 11, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(530)
});
});
@@ -1191,11 +1191,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 950.0,
Envir = 1,
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337),
Inserted = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(636),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339),
Modified = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(638),
Note = "Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF250000000001",
@@ -1215,11 +1215,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 200.0,
Envir = 1,
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350),
Inserted = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(651),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352),
Modified = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(652),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF250000000002",
@@ -1239,11 +1239,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = true,
BomPrice = 250.0,
Envir = 1,
Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362),
Inserted = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(662),
ItemBOM = "",
ItemOk = true,
ItemSteps = "{}",
Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364),
Modified = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(664),
Note = "Installazione serramento",
OfferID = 1,
OfferRowUID = "OFF250000000003",
@@ -1426,8 +1426,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 1,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(180),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(233),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1439,8 +1439,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 2,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(236),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(238),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 8.0,
@@ -1452,8 +1452,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 3,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(240),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(241),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1465,8 +1465,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 4,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(243),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(245),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1478,8 +1478,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 5,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(247),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(248),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 10.0,
@@ -1491,8 +1491,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 6,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(250),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(252),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1504,8 +1504,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 7,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(254),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(255),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 50.0,
@@ -1517,8 +1517,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 8,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(257),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(258),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1530,8 +1530,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 9,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(318),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(320),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1543,8 +1543,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 10,
CodDoc = "",
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),
DtCreate = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(322),
DtMod = new DateTime(2025, 10, 2, 17, 4, 30, 175, DateTimeKind.Local).AddTicks(324),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
+10 -10
View File
@@ -45,20 +45,20 @@ namespace EgwCoreLib.Lux.Data
);
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 }
new GlassModel { GlassID = 1, Code = "0001", Description = "Vetro BE 2S 4/12/4", Thickness = 20 },
new GlassModel { GlassID = 2, Code = "0002", Description = "Vetro BE 3S 4/12/4/12/4", Thickness = 36 },
new GlassModel { GlassID = 3, Code = "0003", 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 }
new ProfileModel { ProfileID = 1, Code = "0001", Description = "Profilo 32", Thickness = 32 },
new ProfileModel { ProfileID = 2, Code = "0002", Description = "Profilo 48", Thickness = 48 },
new ProfileModel { ProfileID = 3, Code = "0003", 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 }
new WoodModel { WoodID = 1, Code = "0001", Description = "Abete", Type = 1 },
new WoodModel { WoodID = 2, Code = "0002", Description = "Acero", Type = 1 },
new WoodModel { WoodID = 3, Code = "0003", Description = "Pino", Type = 2 },
new WoodModel { WoodID = 4, Code = "0004", Description = "Tek", Type = 3 }
);
@@ -47,6 +47,18 @@ namespace EgwCoreLib.Lux.Data.Services
#region Public Methods
/// <summary>
/// Esegue eliminazione + refresh cache
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
public async Task<bool> ConfGlassDeleteAsync(GlassModel selRec)
{
bool result = await dbController.ConfGlassDeleteAsync(selRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfGlass");
return result;
}
/// <summary>
/// Elenco completo Config Glass
/// </summary>
@@ -81,6 +93,30 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Esegue Upsert del record ricevuto
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
public async Task<bool> ConfGlassUpsertAsync(GlassModel upsRec)
{
bool result = await dbController.ConfGlassUpsertAsync(upsRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfGlass");
return result;
}
/// <summary>
/// Esegue eliminazione + refresh cache
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
public async Task<bool> ConfProfileDeleteAsync(ProfileModel selRec)
{
bool result = await dbController.ConfProfileDeleteAsync(selRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfProfile");
return result;
}
/// <summary>
/// Elenco completo Config Profile
/// </summary>
@@ -115,6 +151,30 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Esegue Upsert del record ricevuto
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
public async Task<bool> ConfProfileUpsertAsync(ProfileModel upsRec)
{
bool result = await dbController.ConfProfileUpsertAsync(upsRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfProfile");
return result;
}
/// <summary>
/// Esegue eliminazione + refresh cache
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
public async Task<bool> ConfWoodDeleteAsync(WoodModel selRec)
{
bool result = await dbController.ConfWoodDeleteAsync(selRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfWood");
return result;
}
/// <summary>
/// Elenco completo Config Wood
/// </summary>
@@ -149,6 +209,18 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Esegue Upsert del record ricevuto
/// </summary>
/// <param name="upsRec"></param>
/// <returns></returns>
public async Task<bool> ConfWoodUpsertAsync(WoodModel upsRec)
{
bool result = await dbController.ConfWoodUpsertAsync(upsRec);
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfWood");
return result;
}
/// <summary>
/// Elenco completo Customers
/// </summary>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.9.2510.0215</Version>
<Version>0.9.2510.0218</Version>
</PropertyGroup>
<ItemGroup>
+24 -14
View File
@@ -1,10 +1,8 @@
<div class="card shadow">
<div class="card shadow">
<div class="card-header">
<h5>Conf. Vetri</h5>
</div>
<div class="card-body">
<div class="card-body p-1">
@if (isLoading || ListRecords == null)
{
<LoadingData></LoadingData>
@@ -18,12 +16,13 @@
<table class="table table-sm table-striped">
<thead>
<tr>
<th class="text-nowrap">
<th class="text-nowrap text-center">
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
</th>
@* <th>ID</th> *@
<th class="text-nowrap text-center mx-2">Ord.</th>
<th class="w-100">Valore</th>
<th class="text-nowrap text-center mx-2">Cod.</th>
<th class="w-100">Descrizione</th>
<th class="text-nowrap text-end">Size mm</th>
<th class="text-nowrap text-end">
<button class="btn btn-sm btn-success" @onclick="DoAdd"><i class="fa-solid fa-plus"></i></button>
</th>
@@ -32,7 +31,24 @@
<tbody>
@foreach (var item in ListRecords)
{ }
{
<tr>
<td class="text-center">@item.GlassID</td>
<td class="">@item.Code</td>
<td class="w-100">@item.Description</td>
<td class="text-end">@($"{item.Thickness:N2}")</td>
<td class="text-nowrap text-end">
@if (false)
{
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary" disabled><i class="fa-solid fa-trash-can"></i></button>
}
</td>
</tr>
}
</tbody>
@if (totalCount >= numRecord)
{
@@ -47,10 +63,4 @@
</table>
}
</div>
<div class="card-footer">
paginatore
</div>
</div>
+10 -8
View File
@@ -35,10 +35,8 @@ namespace Lux.UI.Components.Compo
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.GlassID} | {selRec.Description} | {selRec.Thickness}"))
return;
#if false
// esegue eliminazione del record...
await DLService.GenValDeleteAsync(selRec);
#endif
await DLService.ConfGlassDeleteAsync(selRec);
EditRecord = null;
SelRecord = null;
@@ -72,6 +70,12 @@ namespace Lux.UI.Components.Compo
SelRecord = curRec;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
UpdateTable();
}
protected void SaveNumRec(int newNum)
{
numRecord = newNum;
@@ -107,7 +111,7 @@ namespace Lux.UI.Components.Compo
EditRecord = new GlassModel()
{
Description = "New Glass",
Code = "00000",
Code = "",
Thickness = 30
};
await DoSave(EditRecord);
@@ -115,10 +119,8 @@ namespace Lux.UI.Components.Compo
private async Task DoSave(GlassModel currRec)
{
#if false
// salvo
await DLService.GenValUpsertAsync(currRec);
#endif
// salvo
await DLService.ConfGlassUpsertAsync(currRec);
await ResetEdit();
UpdateTable();
EditRecord = null;
+65 -4
View File
@@ -1,5 +1,66 @@
<h3>ConfProfileMan</h3>
<div class="card shadow">
<div class="card-header">
<h5>Conf. Profili</h5>
</div>
<div class="card-body p-1">
@if (isLoading || ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-info text-center display-6">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped">
<thead>
<tr>
<th class="text-nowrap text-center">
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
</th>
@* <th>ID</th> *@
<th class="text-nowrap text-center mx-2">Cod.</th>
<th class="w-100">Descrizione</th>
<th class="text-nowrap text-end">Size mm</th>
<th class="text-nowrap text-end">
<button class="btn btn-sm btn-success" @onclick="DoAdd"><i class="fa-solid fa-plus"></i></button>
</th>
</tr>
</thead>
<tbody>
@code {
}
@foreach (var item in ListRecords)
{
<tr>
<td class="text-center">@item.ProfileID</td>
<td class="">@item.Code</td>
<td class="w-100">@item.Description</td>
<td class="text-end">@($"{item.Thickness:N2}")</td>
<td class="text-nowrap text-end">
@if (false)
{
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary" disabled><i class="fa-solid fa-trash-can"></i></button>
}
</td>
</tr>
}
</tbody>
@if (totalCount >= numRecord)
{
<tfoot>
<tr>
<td colspan="15">
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
</td>
</tr>
</tfoot>
}
</table>
}
</div>
</div>
@@ -0,0 +1,175 @@
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace Lux.UI.Components.Compo
{
public partial class ConfProfileMan
{
#region Public Properties
[Parameter]
public string SearchVal { get; set; } = string.Empty;
#endregion Public Properties
#region Protected Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// impossta record x eliminazione
/// </summary>
/// <param name="selRec"></param>
protected async Task DoDelete(ProfileModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ProfileID} | {selRec.Description} | {selRec.Thickness}"))
return;
// esegue eliminazione del record...
await DLService.ConfProfileDeleteAsync(selRec);
EditRecord = null;
SelRecord = null;
await ReloadData();
UpdateTable();
}
/// <summary>
/// Edit articolo selezionato
/// </summary>
/// <param name="curRec"></param>
protected void DoEdit(ProfileModel curRec)
{
EditRecord = curRec;
}
/// <summary>
/// Reset selezione
/// </summary>
protected void DoReset()
{
EditRecord = null;
}
/// <summary>
/// Selezione articolo x display info
/// </summary>
/// <param name="curRec"></param>
protected void DoSelect(ProfileModel curRec)
{
SelRecord = curRec;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
UpdateTable();
}
protected void SaveNumRec(int newNum)
{
numRecord = newNum;
UpdateTable();
}
protected void SavePage(int newNum)
{
currPage = newNum;
UpdateTable();
}
#endregion Protected Methods
#region Private Fields
private List<ProfileModel> AllRecords = new();
private int currPage = 1;
private ProfileModel? EditRecord = null;
private bool isLoading = false;
private List<ProfileModel> ListRecords = new();
private int numRecord = 10;
private ProfileModel? SelRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Methods
private async Task DoAdd()
{
// aggiungo un nuovo record in coda...
EditRecord = new ProfileModel()
{
Description = "New Glass",
Code = "",
Thickness = 30
};
await DoSave(EditRecord);
}
private async Task DoSave(ProfileModel currRec)
{
// salvo
await DLService.ConfProfileUpsertAsync(currRec);
await ResetEdit();
UpdateTable();
EditRecord = null;
SelRecord = null;
}
private async Task ReloadData()
{
isLoading = true;
AllRecords = await DLService.ConfProfileGetAllAsync();
// se ho ricerca testuale faccio filtro ulteriore...
if (string.IsNullOrEmpty(SearchVal))
{
AllRecords = AllRecords
.OrderBy(x => x.Description)
.ToList();
}
else
{
AllRecords = AllRecords
.Where(x =>
x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) ||
x.Code.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase))
.OrderBy(x => x.Description)
.ToList();
}
totalCount = AllRecords.Count;
}
private async Task ResetEdit()
{
// reset edit
EditRecord = null;
await ReloadData();
}
/// <summary>
/// Filtro e paginazione
/// </summary>
private void UpdateTable()
{
// fix paginazione
ListRecords = AllRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
isLoading = false;
}
#endregion Private Methods
}
}
+65 -4
View File
@@ -1,5 +1,66 @@
<h3>ConfWoodMan</h3>
<div class="card shadow">
<div class="card-header">
<h5>Conf. Legno</h5>
</div>
<div class="card-body p-1">
@if (isLoading || ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-info text-center display-6">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped">
<thead>
<tr>
<th class="text-nowrap text-center">
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
</th>
@* <th>ID</th> *@
<th class="text-nowrap text-center mx-2">Cod.</th>
<th class="w-100">Descrizione</th>
<th class="text-nowrap text-end">Tipo</th>
<th class="text-nowrap text-end">
<button class="btn btn-sm btn-success" @onclick="DoAdd"><i class="fa-solid fa-plus"></i></button>
</th>
</tr>
</thead>
<tbody>
@code {
}
@foreach (var item in ListRecords)
{
<tr>
<td class="text-center">@item.WoodID</td>
<td class="">@item.Code</td>
<td class="w-100">@item.Description</td>
<td class="text-end">item.Type</td>
<td class="text-nowrap text-end">
@if (false)
{
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary" disabled><i class="fa-solid fa-trash-can"></i></button>
}
</td>
</tr>
}
</tbody>
@if (totalCount >= numRecord)
{
<tfoot>
<tr>
<td colspan="15">
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
</td>
</tr>
</tfoot>
}
</table>
}
</div>
</div>
@@ -0,0 +1,175 @@
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace Lux.UI.Components.Compo
{
public partial class ConfWoodMan
{
#region Public Properties
[Parameter]
public string SearchVal { get; set; } = string.Empty;
#endregion Public Properties
#region Protected Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// impossta record x eliminazione
/// </summary>
/// <param name="selRec"></param>
protected async Task DoDelete(WoodModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.WoodID} | {selRec.Description} | Tipo: {selRec.Type}"))
return;
// esegue eliminazione del record...
await DLService.ConfWoodDeleteAsync(selRec);
EditRecord = null;
SelRecord = null;
await ReloadData();
UpdateTable();
}
/// <summary>
/// Edit articolo selezionato
/// </summary>
/// <param name="curRec"></param>
protected void DoEdit(WoodModel curRec)
{
EditRecord = curRec;
}
/// <summary>
/// Reset selezione
/// </summary>
protected void DoReset()
{
EditRecord = null;
}
/// <summary>
/// Selezione articolo x display info
/// </summary>
/// <param name="curRec"></param>
protected void DoSelect(WoodModel curRec)
{
SelRecord = curRec;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
UpdateTable();
}
protected void SaveNumRec(int newNum)
{
numRecord = newNum;
UpdateTable();
}
protected void SavePage(int newNum)
{
currPage = newNum;
UpdateTable();
}
#endregion Protected Methods
#region Private Fields
private List<WoodModel> AllRecords = new();
private int currPage = 1;
private WoodModel? EditRecord = null;
private bool isLoading = false;
private List<WoodModel> ListRecords = new();
private int numRecord = 10;
private WoodModel? SelRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Methods
private async Task DoAdd()
{
// aggiungo un nuovo record in coda...
EditRecord = new WoodModel()
{
Description = "New Wood",
Code = "",
Type = 1
};
await DoSave(EditRecord);
}
private async Task DoSave(WoodModel currRec)
{
// salvo
await DLService.ConfWoodUpsertAsync(currRec);
await ResetEdit();
UpdateTable();
EditRecord = null;
SelRecord = null;
}
private async Task ReloadData()
{
isLoading = true;
AllRecords = await DLService.ConfWoodGetAllAsync();
// se ho ricerca testuale faccio filtro ulteriore...
if (string.IsNullOrEmpty(SearchVal))
{
AllRecords = AllRecords
.OrderBy(x => x.Description)
.ToList();
}
else
{
AllRecords = AllRecords
.Where(x =>
x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) ||
x.Code.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase))
.OrderBy(x => x.Description)
.ToList();
}
totalCount = AllRecords.Count;
}
private async Task ResetEdit()
{
// reset edit
EditRecord = null;
await ReloadData();
}
/// <summary>
/// Filtro e paginazione
/// </summary>
private void UpdateTable()
{
// fix paginazione
ListRecords = AllRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
isLoading = false;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>0.9.2510.0215</Version>
<Version>0.9.2510.0218</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 0.9.2510.0215</h4>
<h4>Versione: 0.9.2510.0218</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2510.0215
0.9.2510.0218
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2510.0215</version>
<version>0.9.2510.0218</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>