From f3143573be781dfdc60f99e6c422fa22ed654fb8 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli (W11-AI)" Date: Wed, 25 Mar 2026 17:23:42 +0100 Subject: [PATCH] Continuo fix manuale interfacce e commenti --- .../Repository/Sales/IOfferRowRepository.cs | 50 +++++++++++- .../Repository/Sales/IOrderRepository.cs | 60 ++++++++++++++- .../Repository/Sales/IOrderRowRepository.cs | 77 +++++++++++++++++-- .../Repository/Sales/OfferRowRepository.cs | 9 +++ .../Repository/Sales/OrderRepository.cs | 16 ++-- .../Repository/Sales/OrderRowRepository.cs | 12 +++ .../Repository/Stats/IStatsAggrRepository.cs | 23 +++++- .../Stats/IStatsDetailRepository.cs | 27 ++++++- .../Repository/Stats/StatsAggrRepository.cs | 19 +---- .../Repository/Stats/StatsDetailRepository.cs | 23 +----- 10 files changed, 254 insertions(+), 62 deletions(-) diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRowRepository.cs index d8662fad..028638c3 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRowRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRowRepository.cs @@ -1,27 +1,69 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales { + /// + /// Interfaccia per la gestione delle righe delle offerte. + /// public interface IOfferRowRepository : IBaseRepository { - #region Public Methods - + /// + /// Inserisce una nuova riga d'offerta nel database e adegua i numeri di riga successivi. + /// + /// La riga d'offerta da inserire. + /// True se l'inserimento ha successo, false altrimenti. Task AddAsync(OfferRowModel entity); + /// + /// Elimina una riga d'offerta e adegua i numeri di riga successivi. + /// + /// La riga d'offerta da eliminare. + /// True se l'eliminazione ha successo, false altrimenti. Task DeleteAsync(OfferRowModel entity); + /// + /// Recupera l'elenco degli elementi BOM (Bill of Materials). + /// + /// L'elenco degli elementi BOM. Task> GetBomItemsAsync(); + /// + /// Recupera una riga d'offerta per il suo identificatore. + /// + /// L'identificatore della riga d'offerta. + /// La riga d'offerta corrispondente, o null se non esiste. Task GetByIdAsync(int offerRowId); + /// + /// Recupera tutte le righe d'offerta per un'offerta specifica. + /// + /// L'identificatore dell'offerta. + /// L'elenco delle righe d'offerta associate all'offerta. Task> GetByParentAsync(int offerId); + /// + /// Recupera una riga d'offerta per il suo UID. + /// + /// L'UID della riga d'offerta. + /// La riga d'offerta corrispondente, o null se non esiste. Task GetByUidAsync(string offerRowUid); + /// + /// Recupera l'elenco dei gruppi di articoli. + /// + /// L'elenco dei gruppi di articoli. Task> GetItemGroupsAsync(); + /// + /// Aggiorna in batch le righe d'offerta. + /// + /// L'elenco delle righe da aggiornare. + /// True se l'aggiornamento ha successo, false altrimenti. Task SaveRowsAsync(List rows); + /// + /// Aggiorna una riga d'offerta esistente. + /// + /// La riga d'offerta aggiornata. + /// True se l'aggiornamento ha successo, false altrimenti. Task UpdateAsync(OfferRowModel entity); - - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs index b5bbc3df..2632d50f 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs @@ -1,31 +1,83 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales { + /// + /// Interfaccia per la gestione degli ordini. + /// public interface IOrderRepository : IBaseRepository { - #region Public Methods - + /// + /// Inserisce un nuovo ordine nel database. + /// + /// L'ordine da inserire. + /// True se l'inserimento ha successo, false altrimenti. Task AddAsync(OrderModel entity); + /// + /// Esegue il cloning completo di un'Offerta e di tutte le relative righe. + /// + /// L'offerta da clonare. + /// L'ordine creato, o null se l'offerta non esiste. Task CloneOfferAsync(OfferModel rec2clone); + /// + /// Elimina un ordine dal database. + /// + /// L'ordine da eliminare. + /// True se l'eliminazione ha successo, false altrimenti. Task DeleteAsync(OrderModel entity); + /// + /// Recupera l'elenco di tutti gli ordini. + /// + /// L'elenco di tutti gli ordini con clienti, rivenditori e righe associate. Task> GetAllAsync(); + /// + /// Recupera l'elenco degli elementi BOM (Bill of Materials) utilizzati negli ordini. + /// + /// L'elenco degli elementi BOM. Task> GetBomItemsAsync(); + /// + /// Recupera un ordine per il suo identificatore. + /// + /// L'identificatore dell'ordine. + /// L'ordine corrispondente, o null se non esiste. Task GetByIdAsync(int recId); + /// + /// Recupera gli ordini inseriti in un intervallo di date specifico. + /// + /// La data di inizio del periodo. + /// La data di fine del periodo. + /// L'elenco degli ordini nell'intervallo specificato. Task> GetFiltAsync(DateTime inizio, DateTime fine); + /// + /// Recupera l'elenco dei gruppi di articoli. + /// + /// L'elenco dei gruppi di articoli. Task> GetItemGroupsAsync(); + /// + /// Recupera le righe dell'ordine per un ordine specifico. + /// + /// L'identificatore dell'ordine. + /// L'elenco delle righe dell'ordine. Task> GetRowsAsync(int recId); + /// + /// Aggiorna in batch le righe di un ordine. + /// + /// L'elenco delle righe da aggiornare. + /// True se l'aggiornamento ha successo, false altrimenti. Task SaveRowsAsync(List rows); + /// + /// Aggiorna un ordine esistente nel database. + /// + /// L'ordine aggiornato. + /// True se l'aggiornamento ha successo, false altrimenti. Task UpdateAsync(OrderModel entity); - - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRowRepository.cs index ea3b5f46..4e35e7d9 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRowRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRowRepository.cs @@ -1,35 +1,102 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales { + /// + /// Interfaccia per la gestione delle righe degli ordini. + /// public interface IOrderRowRepository : IBaseRepository { - #region Public Methods - + /// + /// Inserisce una nuova riga d'ordine nel database. + /// + /// La riga d'ordine da inserire. + /// True se l'inserimento ha successo, false altrimenti. Task AddAsync(OrderRowModel entity); + /// + /// Elimina una riga d'ordine e adegua i numeri di riga successivi. + /// + /// La riga d'ordine da eliminare. + /// True se l'eliminazione ha successo, false altrimenti. Task DeleteAsync(OrderRowModel entity); + /// + /// Recupera l'elenco degli elementi BOM (Bill of Materials). + /// + /// L'elenco degli elementi BOM. Task> GetBomItemsAsync(); + /// + /// Recupera una riga d'ordine per il suo identificatore. + /// + /// L'identificatore della riga d'ordine. + /// La riga d'ordine corrispondente, o null se non esiste. Task GetByIdAsync(int OrderRowId); - Task> GetByParentAsync(int offerId); + /// + /// Recupera tutte le righe d'ordine per un ordine specifico. + /// + /// L'identificatore dell'ordine. + /// L'elenco delle righe d'ordine associate all'ordine. + Task> GetByParentAsync(int orderId); + /// + /// Recupera le righe d'ordine per stato e intervallo di date. + /// + /// Lo stato richiesto della riga. + /// La data di inizio del periodo. + /// La data di fine del periodo. + /// L'elenco delle righe d'ordine con lo stato e le date specificate. Task> GetByStateAsync(OrderStates reqState, DateTime dtStart, DateTime dtEnd); + /// + /// Recupera le righe d'ordine per stato minimo e intervallo di date. + /// + /// Lo stato minimo richiesto. + /// La data di inizio del periodo. + /// La data di fine del periodo. + /// L'elenco delle righe d'ordine con stato >= a quello specificato. Task> GetByStateMinAsync(OrderStates reqState, DateTime dtStart, DateTime dtEnd); + /// + /// Recupera una riga d'ordine per il suo UID. + /// + /// L'UID della riga d'ordine. + /// La riga d'ordine corrispondente, o null se non esiste. Task GetByUidAsync(string OrderRowUid); + /// + /// Recupera l'elenco dei gruppi di articoli. + /// + /// L'elenco dei gruppi di articoli. Task> GetItemGroupsAsync(); + /// + /// Aggiorna la stima di produzione per una riga d'ordine. + /// + /// L'UID della riga d'ordine. + /// La nuova stima di produzione. + /// True se l'aggiornamento ha successo, false altrimenti. Task SaveProdEstAsync(string uID, string prodEstim); + /// + /// Aggiorna in batch le righe d'ordine. + /// + /// L'elenco delle righe da aggiornare. + /// True se l'aggiornamento ha successo, false altrimenti. Task SaveRowsAsync(List rows); + /// + /// Aggiorna una riga d'ordine esistente. + /// + /// La riga d'ordine aggiornata. + /// True se l'aggiornamento ha successo, false altrimenti. Task UpdateAsync(OrderRowModel entity); + /// + /// Convalida un elenco di righe d'ordine e aggiorna lo stato se necessario. + /// + /// L'elenco delle righe da convalidare. + /// Il numero di righe elaborate correttamente. Task ValidateAsync(List list2chk); - - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/OfferRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/OfferRowRepository.cs index 7de3ac86..326ce8d5 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/OfferRowRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/OfferRowRepository.cs @@ -12,6 +12,7 @@ #region Public Methods + /// public async Task AddAsync(OfferRowModel entity) { await using var dbCtx = await CreateContextAsync(); await using var tx = await dbCtx.Database.BeginTransactionAsync(); @@ -45,6 +46,7 @@ } } + /// public async Task DeleteAsync(OfferRowModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -89,6 +91,7 @@ } } + /// public async Task> GetBomItemsAsync() { await using var dbCtx = await CreateContextAsync(); @@ -97,6 +100,7 @@ .ToListAsync(); } + /// public async Task GetByIdAsync(int offerRowId) { await using var dbCtx = await CreateContextAsync(); @@ -105,6 +109,7 @@ .FirstOrDefaultAsync(x => x.OfferRowID == offerRowId); } + /// public async Task> GetByParentAsync(int offerId) { await using var dbCtx = await CreateContextAsync(); @@ -115,6 +120,7 @@ .ToListAsync(); } + /// public async Task GetByUidAsync(string offerRowUid) { await using var dbCtx = await CreateContextAsync(); @@ -123,12 +129,14 @@ .FirstOrDefaultAsync(x => x.OfferRowUID == offerRowUid); } + /// public async Task> GetItemGroupsAsync() { await using var dbCtx = await CreateContextAsync(); return await dbCtx.DbSetItemGroup.ToListAsync(); } + /// public async Task SaveRowsAsync(List rows) { // Add validation for null or empty list @@ -157,6 +165,7 @@ } } + /// public async Task UpdateAsync(OfferRowModel entity) { await using var dbCtx = await CreateContextAsync(); diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs index 79ae5765..4a5812cf 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs @@ -12,6 +12,7 @@ #region Public Methods + /// public async Task AddAsync(OrderModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -19,11 +20,7 @@ return await dbCtx.SaveChangesAsync() > 0; } - /// - /// Esegue il cloning completo di un Offerta e di TUTTE le relative righe... - /// - /// - /// + /// public async Task CloneOfferAsync(OfferModel rec2clone) { OrderModel? newRec = null; @@ -170,6 +167,7 @@ return newRec; } + /// public async Task DeleteAsync(OrderModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -177,6 +175,7 @@ return await dbCtx.SaveChangesAsync() > 0; } + /// public async Task> GetAllAsync() { await using var dbCtx = await CreateContextAsync(); @@ -188,6 +187,7 @@ .ToListAsync(); } + /// public async Task> GetBomItemsAsync() { await using var dbCtx = await CreateContextAsync(); @@ -196,12 +196,14 @@ .ToListAsync(); } + /// public async Task GetByIdAsync(int recId) { await using var dbCtx = await CreateContextAsync(); return await dbCtx.DbSetOrder.FirstOrDefaultAsync(x => x.OrderID == recId); } + /// public async Task> GetFiltAsync(DateTime inizio, DateTime fine) { await using var dbCtx = await CreateContextAsync(); @@ -214,12 +216,14 @@ .ToListAsync(); } + /// public async Task> GetItemGroupsAsync() { await using var dbCtx = await CreateContextAsync(); return await dbCtx.DbSetItemGroup.ToListAsync(); } + /// public async Task> GetRowsAsync(int recId) { await using var dbCtx = await CreateContextAsync(); @@ -228,6 +232,7 @@ .ToListAsync(); } + /// public async Task SaveRowsAsync(List rows) { // Add validation for null or empty list @@ -256,6 +261,7 @@ } } + /// public async Task UpdateAsync(OrderModel entity) { await using var dbCtx = await CreateContextAsync(); diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRowRepository.cs index 4922ab00..86c1a449 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRowRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRowRepository.cs @@ -14,6 +14,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales #region Public Methods + /// public async Task AddAsync(OrderRowModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -21,6 +22,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales return await dbCtx.SaveChangesAsync() > 0; } + /// public async Task DeleteAsync(OrderRowModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -65,6 +67,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales } } + /// public async Task> GetBomItemsAsync() { await using var dbCtx = await CreateContextAsync(); @@ -73,6 +76,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .ToListAsync(); } + /// public async Task GetByIdAsync(int OrderRowId) { await using var dbCtx = await CreateContextAsync(); @@ -81,6 +85,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .FirstOrDefaultAsync(x => x.OrderRowID == OrderRowId); } + /// public async Task> GetByParentAsync(int orderId) { await using var dbCtx = await CreateContextAsync(); @@ -91,6 +96,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .ToListAsync(); } + /// public async Task> GetByStateAsync(OrderStates reqState, DateTime dtStart, DateTime dtEnd) { await using var dbCtx = await CreateContextAsync(); @@ -101,6 +107,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .ToListAsync(); } + /// public async Task> GetByStateMinAsync(OrderStates reqState, DateTime dtStart, DateTime dtEnd) { await using var dbCtx = await CreateContextAsync(); @@ -111,6 +118,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .ToListAsync(); } + /// public async Task GetByUidAsync(string OrderRowUid) { await using var dbCtx = await CreateContextAsync(); @@ -119,12 +127,14 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales .FirstOrDefaultAsync(x => x.OrderRowUID == OrderRowUid); } + /// public async Task> GetItemGroupsAsync() { await using var dbCtx = await CreateContextAsync(); return await dbCtx.DbSetItemGroup.ToListAsync(); } + /// public async Task SaveRowsAsync(List rows) { await using var dbCtx = await CreateContextAsync(); @@ -150,6 +160,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales } } + /// public async Task UpdateAsync(OrderRowModel entity) { await using var dbCtx = await CreateContextAsync(); @@ -339,6 +350,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales } } + /// public async Task ValidateAsync(List list2chk) { int numDone = 0; diff --git a/EgwCoreLib.Lux.Data/Repository/Stats/IStatsAggrRepository.cs b/EgwCoreLib.Lux.Data/Repository/Stats/IStatsAggrRepository.cs index 76c96fc6..c5313f17 100644 --- a/EgwCoreLib.Lux.Data/Repository/Stats/IStatsAggrRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Stats/IStatsAggrRepository.cs @@ -2,16 +2,31 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats { + /// + /// Interfaccia per le statistiche aggregate. + /// public interface IStatsAggrRepository { - #region Public Methods - + /// + /// Recupera l'elenco delle statistiche aggregate per un periodo specifico. + /// + /// La data di inizio del periodo. + /// La data di fine del periodo. + /// L'elenco delle statistiche aggregate ordinate cronologicamente. Task> GetFiltAsync(DateTime dtStart, DateTime dtEnd); + /// + /// Recupera l'intervallo temporale disponibile nel database per le statistiche aggregate. + /// + /// L'intervallo di date (minima e massima ora presente). Task GetRangeAsync(); + /// + /// Inserisce o aggiorna in blocco le statistiche aggregate nel database. + /// + /// L'elenco dei record da inserire. + /// Se true, elimina preventivamente i record nel periodo richiesto. + /// Il numero di record inseriti. Task UpsertManyAsync(List listRecords, bool removeOld); - - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Stats/IStatsDetailRepository.cs b/EgwCoreLib.Lux.Data/Repository/Stats/IStatsDetailRepository.cs index b3256cdf..78b38fc4 100644 --- a/EgwCoreLib.Lux.Data/Repository/Stats/IStatsDetailRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Stats/IStatsDetailRepository.cs @@ -2,16 +2,35 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats { + /// + /// Interfaccia per le statistiche di dettaglio. + /// public interface IStatsDetailRepository { - #region Public Methods - + /// + /// Recupera l'elenco delle statistiche di dettaglio per un periodo specifico, con filtri opzionali. + /// + /// La data di inizio del periodo. + /// La data di fine del periodo. + /// Filtro opzionale per l'ambiente (es. "DEV", "PROD"). + /// Filtro opzionale per il tipo di statistica. + /// L'elenco delle statistiche di dettaglio ordinate cronologicamente. Task> GetFiltAsync(DateTime dtStart, DateTime dtEnd, string sEnvir = "", string sType = ""); + /// + /// Recupera l'intervallo temporale disponibile nel database per le statistiche di dettaglio. + /// + /// Filtro opzionale per l'ambiente. + /// Filtro opzionale per il tipo. + /// L'intervallo di date (minima e massima ora presente). Task GetRangeAsync(string sEnvir, string sType); + /// + /// Inserisce o aggiorna in blocco le statistiche di dettaglio nel database. + /// + /// L'elenco dei record da inserire. + /// Se true, elimina preventivamente i record nel periodo richiesto. + /// Il numero di record inseriti. Task UpsertManyAsync(List listRecords, bool removeOld); - - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Stats/StatsAggrRepository.cs b/EgwCoreLib.Lux.Data/Repository/Stats/StatsAggrRepository.cs index 433f9ab5..5503730c 100644 --- a/EgwCoreLib.Lux.Data/Repository/Stats/StatsAggrRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Stats/StatsAggrRepository.cs @@ -14,12 +14,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats #region Public Methods - /// - /// Elenco da DB delel stats aggregate dato periodo inizio/fine - /// - /// - /// - /// + /// public async Task> GetFiltAsync(DateTime dtStart, DateTime dtEnd) { await using var dbCtx = await CreateContextAsync(); @@ -31,10 +26,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats .ToListAsync(); } - /// - /// Range periodo per chiamate aggregate - /// - /// + /// public async Task GetRangeAsync() { await using var dbCtx = await CreateContextAsync(); @@ -48,12 +40,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats return answ; } - /// - /// Esegue insert statistiche aggregate sul DB - /// - /// Elenco dei record da inserire - /// Se true preventivamente elimina record nel periodo richiesto - /// + /// public async Task UpsertManyAsync(List listRecords, bool removeOld) { int answ = 0; diff --git a/EgwCoreLib.Lux.Data/Repository/Stats/StatsDetailRepository.cs b/EgwCoreLib.Lux.Data/Repository/Stats/StatsDetailRepository.cs index 363c43a7..77ffce36 100644 --- a/EgwCoreLib.Lux.Data/Repository/Stats/StatsDetailRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Stats/StatsDetailRepository.cs @@ -14,14 +14,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats #region Internal Methods - /// - /// Recupera dati stats di dettaglio dato filtro envir/tipo (opzionali) e periodo - /// - /// - /// - /// - /// - /// + /// public async Task> GetFiltAsync(DateTime dtStart, DateTime dtEnd, string sEnvir = "", string sType = "") { await using var dbCtx = await CreateContextAsync(); @@ -47,12 +40,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats return answ; } - /// - /// Range periodo x chiamate detail eventualmente filtrate - /// - /// - /// - /// + /// public async Task GetRangeAsync(string sEnvir, string sType) { await using var dbCtx = await CreateContextAsync(); @@ -73,12 +61,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Stats return answ; } - /// - /// Esegue insert statistiche di dettaglio sul DB - /// - /// Elenco dei record da inserire - /// Se true preventivamente elimina record nel periodo richiesto - /// + /// public async Task UpsertManyAsync(List listRecords, bool removeOld) { int answ = 0;