SPEC:
- aggiunta pagina operatori - completato fix
This commit is contained in:
@@ -11,27 +11,36 @@ namespace MP.Data.Repository.Dossier
|
||||
{
|
||||
public class DossierRepository : IDossierRepository
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public DossierRepository(IConfiguration configuration)
|
||||
public DossierRepository(
|
||||
IConfiguration configuration,
|
||||
IDbContextFactory<MoonPro_FluxContext> ctxFactoryFL)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_ctxFactoryFL = ctxFactoryFL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<string>> ArticleWithDossierAsync()
|
||||
{
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
return await dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Select(i => i.CodArticolo)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DossiersDeleteRecordAsync(DossierModel currRec)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
var currVal = await dbCtx
|
||||
.DbSetDossiers
|
||||
.Where(x => x.IdxDossier == currRec.IdxDossier)
|
||||
@@ -46,7 +55,7 @@ namespace MP.Data.Repository.Dossier
|
||||
/// <inheritdoc />
|
||||
public async Task<List<DossierModel>> DossiersGetLastFiltAsync(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd, int MaxRec)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
return await dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
@@ -61,7 +70,7 @@ namespace MP.Data.Repository.Dossier
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DossiersInsertAsync(DossierModel newRec)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
await dbCtx
|
||||
.DbSetDossiers
|
||||
.AddAsync(newRec);
|
||||
@@ -71,7 +80,7 @@ namespace MP.Data.Repository.Dossier
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DossiersTakeParamsSnapshotLastAsync(string idxMacchina, DateTime dtMin, DateTime dtMax)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var pDtMin = new SqlParameter("@DtMin", dtMin);
|
||||
var pDtMax = new SqlParameter("@DtMax", dtMax);
|
||||
@@ -85,7 +94,7 @@ namespace MP.Data.Repository.Dossier
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DossiersUpdateValoreAsync(DossierModel editRec)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
var currRec = await dbCtx
|
||||
.DbSetDossiers
|
||||
.Where(x => x.IdxDossier == editRec.IdxDossier)
|
||||
@@ -104,18 +113,18 @@ namespace MP.Data.Repository.Dossier
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<string>> ArticleWithDossierAsync()
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
return await dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Select(i => i.CodArticolo)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
}
|
||||
#endregion Public Methods
|
||||
|
||||
#endregion
|
||||
#region Protected Fields
|
||||
|
||||
protected readonly IDbContextFactory<MoonPro_FluxContext> _ctxFactoryFL;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user