Continuo con fix manuali su correzioni
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione dei batch di produzione.
|
||||
/// </summary>
|
||||
public interface IProductionBatchRepository
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Creazione di un Batch con relativo Tag e info x creazione ODL correlati
|
||||
/// Crea un nuovo batch con relativo tag e informazioni per la creazione degli ODL correlati.
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="entity">Il batch da creare.</param>
|
||||
/// <returns>Il batch creato, o null se fallisce.</returns>
|
||||
Task<ProductionBatchModel?> CreateAsync(ProductionBatchModel entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione dei gruppi di produzione.
|
||||
/// </summary>
|
||||
public interface IProductionGroupRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Recupera l'elenco dei gruppi di produzione per un ordine specifico.
|
||||
/// </summary>
|
||||
/// <param name="orderRowID">L'identificatore della riga d'ordine.</param>
|
||||
/// <returns>L'elenco dei gruppi di produzione associati all'ordine.</returns>
|
||||
Task<List<ProductionGroupModel>> GetByOrderRowAsync(int orderRowID);
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco dei gruppi di produzione per stato dell'ordine.
|
||||
/// </summary>
|
||||
/// <param name="reqState">Lo stato richiesto della riga d'ordine.</param>
|
||||
/// <returns>L'elenco dei gruppi di produzione con lo stato specificato.</returns>
|
||||
Task<List<ProductionGroupModel>> GetByOrderStateAsync(OrderStates reqState);
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge o aggiorna un record di Production Group dalla fase Balance.
|
||||
/// </summary>
|
||||
/// <param name="uID">L'UID dell'articolo dell'offerta.</param>
|
||||
/// <param name="rGroup">Il gruppo di produzione di riferimento.</param>
|
||||
/// <param name="rawBalance">I dati di bilanciamento serializzati in JSON.</param>
|
||||
/// <returns>True se l'operazione ha successo, false altrimenti.</returns>
|
||||
Task<bool> UpsertBalanceAsync(string uID, string rGroup, string rawBalance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,39 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione degli articoli di produzione.
|
||||
/// </summary>
|
||||
public interface IProductionItemRepository
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'assegnazione bulk degli articoli di produzione a un unico batch di produzione.
|
||||
/// </summary>
|
||||
/// <param name="orderRowId">L'identificatore della riga d'ordine.</param>
|
||||
/// <param name="prodBatchId">L'identificatore del batch di produzione.</param>
|
||||
/// <returns>Il numero di articoli aggiornati.</returns>
|
||||
Task<int> BulkAssignProdBatchAsync(int orderRowId, int prodBatchId);
|
||||
|
||||
Task<int> BulkAssignProdGroupAsync(int OrderRowId, int ProdGroupId, Dictionary<string, double> itemsToAssign);
|
||||
/// <summary>
|
||||
/// Esegue l'assegnazione bulk degli articoli di produzione a un unico gruppo di produzione.
|
||||
/// </summary>
|
||||
/// <param name="orderRowId">L'identificatore della riga d'ordine.</param>
|
||||
/// <param name="prodGroupId">L'identificatore del gruppo di produzione.</param>
|
||||
/// <param name="itemsToAssign">Un dizionario che mappa i tag degli articoli ai tempi stimati.</param>
|
||||
/// <returns>Il numero di articoli aggiornati.</returns>
|
||||
Task<int> BulkAssignProdGroupAsync(int orderRowId, int prodGroupId, Dictionary<string, double> itemsToAssign);
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco degli articoli di produzione per una riga d'ordine.
|
||||
/// </summary>
|
||||
/// <param name="orderRowId">L'identificatore della riga d'ordine.</param>
|
||||
/// <returns>L'elenco degli articoli di produzione.</returns>
|
||||
Task<List<ProductionItemModel>> GetByOrderRowAsync(int orderRowId);
|
||||
|
||||
/// <summary>
|
||||
/// Resetta le assegnazioni degli articoli di produzione per una riga d'ordine.
|
||||
/// </summary>
|
||||
/// <param name="orderRowID">L'identificatore della riga d'ordine.</param>
|
||||
/// <returns>Il numero di articoli resettati.</returns>
|
||||
Task<int> ResetAssignAsync(int orderRowID);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -2,53 +2,57 @@
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione degli ODL (Ordini di Lavoro) di produzione.
|
||||
/// </summary>
|
||||
public interface IProductionOdlRepository
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo aggiunta record
|
||||
/// Inserisce un nuovo record ODL nel database.
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="entity">L'ODL da inserire.</param>
|
||||
/// <returns>True se l'inserimento ha successo, false altrimenti.</returns>
|
||||
Task<bool> AddAsync(ProductionODLModel entity);
|
||||
|
||||
/// <summary>
|
||||
/// Assegna in blocco gli articoli di produzione agli ODL corrispondenti.
|
||||
/// </summary>
|
||||
/// <param name="dbList">La lista degli ODL coinvolti.</param>
|
||||
/// <param name="dictParts">Un dizionario che mappa le chiavi (fase, risorsa, macchina, indice) ai tag degli articoli.</param>
|
||||
/// <returns>Il numero di relazioni create.</returns>
|
||||
Task<int> AssignProdItem2OdlAsync(List<ProductionODLModel> dbList, Dictionary<(int phaseId, int resId, string machine, int index), List<string>> dictParts);
|
||||
|
||||
/// <summary>
|
||||
/// Insert sul DB di un elenco ODL con calcolo della relativa KEY a cui poter, successivamente, collegare i record child (items)
|
||||
/// Inserisce in blocco un elenco di ODL nel database e calcola i tag automaticamente.
|
||||
/// </summary>
|
||||
/// <param name="listOdl2ins"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
/// <param name="listOdl2ins">La lista degli OL da inserire.</param>
|
||||
/// <returns>La lista degli ODL con gli identificatori aggiornati.</returns>
|
||||
Task<List<ProductionODLModel>> CreateAsync(List<ProductionODLModel> listOdl2ins);
|
||||
|
||||
/// <summary>
|
||||
/// Recupero record ProdOdl dato Tag/uID
|
||||
/// Recupera un record ODL dato il tag o l'UID.
|
||||
/// </summary>
|
||||
/// <param name="uID"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="uID">Il tag o UID dell'ODL.</param>
|
||||
/// <returns>L'ODL corrispondente, o null se non esiste.</returns>
|
||||
Task<ProductionODLModel?> GetByUidAsync(string uID);
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non assegnati
|
||||
/// Recupera l'elenco degli ODL non ancora assegnati.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>L'elenco degli ODL non assegnati.</returns>
|
||||
Task<List<ProductionODLModel>> GetUnassignAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non assegnati con struttura DTO appiattita
|
||||
/// Recupera l'elenco degli ODL non assegnati con struttura DTO appiattita.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>L'elenco dei DTO degli ODL non assegnati.</returns>
|
||||
Task<List<OdlAssignDto>> GetUnassignOdlDtoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Update generico record
|
||||
/// Aggiorna un record ODL esistente nel database.
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="entity">L'ODL aggiornato.</param>
|
||||
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
|
||||
Task<bool> UpdateAsync(ProductionODLModel entity);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,14 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione degli impianti di produzione.
|
||||
/// </summary>
|
||||
public interface IProductionPlantRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Recupera l'elenco di tutti gli impianti di produzione.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco di tutti gli impianti.</returns>
|
||||
Task<List<ProductionPlantModel>> GetAllAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Creazione di un Batch con relativo Tag e info x creazione ODL correlati
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<ProductionBatchModel?> CreateAsync(ProductionBatchModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
@@ -14,10 +14,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco record ProductionGroup dato OrderRow
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionGroupModel>> GetByOrderRowAsync(int orderRowID)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -28,10 +25,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco record ProductionGroup dato Stato dell'OrderRow
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionGroupModel>> GetByOrderStateAsync(OrderStates reqState)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -43,12 +37,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add record di un singolo ProdGroup da fase Balance
|
||||
/// </summary>
|
||||
/// <param name="uID">UID dell'item offerta di cui si è ricevuto l'oggetto Balance'</param>
|
||||
/// <param name="rGroup">Prod Group di riferimento</param>
|
||||
/// <param name="rawBalance"></param>
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> UpsertBalanceAsync(string uID, string rGroup, string rawBalance)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
@@ -12,12 +12,7 @@
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue assegnazione bulk dei ProdItem ad un unico ProdBatch parent (per ora totale x RigaOrd)
|
||||
/// </summary>
|
||||
/// <param name="orderRowId"></param>
|
||||
/// <param name="prodBatchId"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<int> BulkAssignProdBatchAsync(int orderRowId, int prodBatchId)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -42,13 +37,7 @@
|
||||
return totUpd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue assegnazione bulk dei ProdItem ad un unico ProdGroup parent
|
||||
/// </summary>
|
||||
/// <param name="orderRowId"></param>
|
||||
/// <param name="prodGroupId"></param>
|
||||
/// <param name="itemsToAssign"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<int> BulkAssignProdGroupAsync(int orderRowId, int prodGroupId, Dictionary<string, double> itemsToAssign)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -77,6 +66,7 @@
|
||||
return totUpd;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionItemModel>> GetByOrderRowAsync(int orderRowId)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -86,6 +76,7 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> ResetAssignAsync(int orderRowID)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> AddAsync(ProductionODLModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -22,12 +23,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assegnazione in blocco degli item agli ODL corrispondenti
|
||||
/// </summary>
|
||||
/// <param name="dbList"></param>
|
||||
/// <param name="dictParts"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<int> AssignProdItem2OdlAsync(List<ProductionODLModel> dbList, Dictionary<(int phaseId, int resId, string machine, int index), List<string>> dictParts)
|
||||
{
|
||||
int totalCreated = 0;
|
||||
@@ -99,12 +95,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
return totalCreated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert sul DB di un elenco ODL con calcolo della relativa KEY a cui poter, successivamente, collegare i record child (items)
|
||||
/// </summary>
|
||||
/// <param name="listOdl2ins"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionODLModel>> CreateAsync(List<ProductionODLModel> listOdl2ins)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -147,11 +138,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero record ProdOdl dato Tag/uID
|
||||
/// </summary>
|
||||
/// <param name="uID"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<ProductionODLModel?> GetByUidAsync(string uID)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -160,10 +147,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
.FirstOrDefaultAsync(x => x.OdlTag == uID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non assegnati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionODLModel>> GetUnassignAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -174,10 +158,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non assegnati con struttura DTO appiattita
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<List<OdlAssignDto>> GetUnassignOdlDtoAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -210,11 +191,7 @@ namespace EgwCoreLib.Lux.Data.Repository.Production
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update generico record
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> UpdateAsync(ProductionODLModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ProductionPlantModel>> GetAllAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<CustomerModel>> GetAllAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetCustomer
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<DealerModel>> GetAllAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetDealer
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Sales
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione dei clienti.
|
||||
/// </summary>
|
||||
public interface ICustomerRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Recupera l'elenco di tutti i clienti.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco di tutti i clienti.</returns>
|
||||
Task<List<CustomerModel>> GetAllAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Sales
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione dei rivenditori.
|
||||
/// </summary>
|
||||
public interface IDealerRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Recupera l'elenco di tutti i rivenditori.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco di tutti i rivenditori.</returns>
|
||||
Task<List<DealerModel>> GetAllAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,89 @@
|
||||
namespace EgwCoreLib.Lux.Data.Repository.Sales
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia per la gestione delle offerte.
|
||||
/// </summary>
|
||||
public interface IOfferRepository : IBaseRepository
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inserisce una nuova offerta nel database.
|
||||
/// </summary>
|
||||
/// <param name="entity">L'offerta da inserire.</param>
|
||||
/// <returns>True se l'inserimento ha successo, false altrimenti.</returns>
|
||||
Task<bool> AddAsync(OfferModel entity);
|
||||
|
||||
/// <summary>
|
||||
/// Segna come scadute le offerte la cui data di validità è passata e che sono ancora aperte.
|
||||
/// </summary>
|
||||
/// <returns>True se almeno un'offerta è stata aggiornata, false altrimenti.</returns>
|
||||
Task<bool> CheckExpiredAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Esegue il cloning completo di un'Offerta e di tutte le relative righe.
|
||||
/// </summary>
|
||||
/// <param name="rec2clone">L'offerta da clonare.</param>
|
||||
/// <returns>True se il cloning ha successo, false altrimenti.</returns>
|
||||
Task<bool> CloneAsync(OfferModel rec2clone);
|
||||
|
||||
/// <summary>
|
||||
/// Elimina un'offerta dal database.
|
||||
/// </summary>
|
||||
/// <param name="entity">L'offerta da eliminare.</param>
|
||||
/// <returns>True se l'eliminazione ha successo, false altrimenti.</returns>
|
||||
Task<bool> DeleteAsync(OfferModel entity);
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco di tutte le offerte.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco di tutte le offerte con clienti, rivenditori e righe associate.</returns>
|
||||
Task<List<OfferModel>> GetAllAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco degli elementi BOM (Bill of Materials) utilizzati nelle offerte.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco degli elementi BOM.</returns>
|
||||
Task<List<ItemModel>> GetBomItemsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Recupera un'offerta per il suo identificatore.
|
||||
/// </summary>
|
||||
/// <param name="recId">L'identificatore dell'offerta.</param>
|
||||
/// <returns>L'offerta corrispondente, o null se non esiste.</returns>
|
||||
Task<OfferModel?> GetByIdAsync(int recId);
|
||||
|
||||
/// <summary>
|
||||
/// Recupera le offerte inserite in un intervallo di date specifico.
|
||||
/// </summary>
|
||||
/// <param name="inizio">La data di inizio del periodo.</param>
|
||||
/// <param name="fine">La data di fine del periodo.</param>
|
||||
/// <returns>L'elenco delle offerte nell'intervallo specificato.</returns>
|
||||
Task<List<OfferModel>> GetFiltAsync(DateTime inizio, DateTime fine);
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco dei gruppi di articoli.
|
||||
/// </summary>
|
||||
/// <returns>L'elenco dei gruppi di articoli.</returns>
|
||||
Task<List<ItemGroupModel>> GetItemGroupsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Recupera le righe dell'offerta per un'offerta specifica.
|
||||
/// </summary>
|
||||
/// <param name="recId">L'identificatore dell'offerta.</param>
|
||||
/// <returns>L'elenco delle righe dell'offerta.</returns>
|
||||
Task<List<OfferRowModel>> GetRowsAsync(int recId);
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna in batch le righe di un'offerta.
|
||||
/// </summary>
|
||||
/// <param name="rows">L'elenco delle righe da aggiornare.</param>
|
||||
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
|
||||
Task<bool> SaveRowsAsync(List<OfferRowModel> rows);
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna un'offerta esistente nel database.
|
||||
/// </summary>
|
||||
/// <param name="entity">L'offerta aggiornata.</param>
|
||||
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
|
||||
Task<bool> UpdateAsync(OfferModel entity);
|
||||
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> AddAsync(OfferModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -19,6 +20,7 @@
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> CheckExpiredAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -47,11 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue il cloning completo di un Offerta e di TUTTE le relative righe...
|
||||
/// </summary>
|
||||
/// <param name="rec2clone"></param>
|
||||
/// <returns></returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> CloneAsync(OfferModel rec2clone)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -150,6 +148,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DeleteAsync(OfferModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -157,6 +156,7 @@
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<OfferModel>> GetAllAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -168,6 +168,7 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ItemModel>> GetBomItemsAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -176,12 +177,14 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<OfferModel?> GetByIdAsync(int recId)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetOffer.FirstOrDefaultAsync(x => x.OfferID == recId);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<OfferModel>> GetFiltAsync(DateTime inizio, DateTime fine)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -194,12 +197,14 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ItemGroupModel>> GetItemGroupsAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetItemGroup.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<OfferRowModel>> GetRowsAsync(int recId)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -208,6 +213,7 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> SaveRowsAsync(List<OfferRowModel> rows)
|
||||
{
|
||||
// Add validation for null or empty list
|
||||
@@ -236,6 +242,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> UpdateAsync(OfferModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
Reference in New Issue
Block a user