diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
index 796127d1..f7861d52 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
@@ -209,11 +209,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
///
/// Elenco prod
///
- /// Num max record da recuperare
+ /// Num max record da recuperare
/// Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)
/// Se true: mostra anche archiviati (default li nasconde)
///
- public List GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
+ public List GetLastDesc(int NumRecord, bool OnlyActive, bool ShowArchived = false)
{
List result = new List();
//List dbResult = GetLastDbModelDesc(numRecord);
@@ -221,9 +221,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
- if (numRecord == 0)
+ if (NumRecord == 0)
{
- numRecord = localDbCtx.ProdList.Count();
+ NumRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
@@ -236,7 +236,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
}
@@ -248,13 +248,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
///
/// Elenco prod
///
- /// Inizio periodo estrazione
- /// Fine periodo estrazione
- /// Num max record da recuperare
+ /// Inizio periodo estrazione
+ /// Fine periodo estrazione
+ /// Num max record da recuperare
/// Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)
/// Se true: mostra anche archiviati (default li nasconde)
///
- public List GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
+ public List GetLastDesc(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
{
List result = new List();
//List dbResult = GetLastDbModelDesc(numRecord);
@@ -262,14 +262,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
- if (numRecord == 0)
+ if (NumRecord == 0)
{
- numRecord = localDbCtx.ProdList.Count();
+ NumRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
.ProdList
- .Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd && (!x.IsArchived || ShowArchived))
+ .Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
p => p.ProdDbId,
@@ -277,7 +277,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
}
@@ -289,11 +289,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
///
/// Elenco prod
///
- /// Num max record da recuperare
+ /// Num max record da recuperare
/// Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)
/// Se true: mostra anche archiviati (default li nasconde)
///
- public List GetLastDescFull(int numRecord, bool OnlyActive, bool ShowArchived = false)
+ public List GetLastDescFull(int NumRecord, bool OnlyActive, bool ShowArchived = false)
{
List result = new List();
// elenco prod completi
@@ -303,9 +303,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
- if (numRecord == 0)
+ if (NumRecord == 0)
{
- numRecord = localDbCtx.ProdList.Count();
+ NumRecord = localDbCtx.ProdList.Count();
}
// recupero PROD + proj relativi
dbResultProd = localDbCtx
@@ -320,7 +320,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Distinct()
.Include(j => j.ProjListNav)
.OrderByDescending(x => x.ProdId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
// recupero i proj "orfani"
@@ -328,7 +328,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null)
.OrderByDescending(x => x.ProjId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
}
@@ -339,33 +339,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
result.AddRange(resProj);
return result;
}
+
///
/// Elenco prod
///
- /// Inizio periodo estrazione
- /// Fine periodo estrazione
- /// Num max record da recuperare
+ /// Inizio periodo estrazione
+ /// Fine periodo estrazione
+ /// Num max record da recuperare
/// Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)
/// Se true: mostra anche archiviati (default li nasconde)
///
- public List GetLastDescFull(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
+ public List GetLastDescFull(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
{
List result = new List();
- //List dbResult = GetLastDbModelDesc(numRecord);
+ // elenco prod completi
List dbResultProd = new List();
// elenco proj "orfani"
List dbResultProj = new List();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
- if (numRecord == 0)
+ if (NumRecord == 0)
{
- numRecord = localDbCtx.ProdList.Count();
+ NumRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResultProd = localDbCtx
.ProdList
- .Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd && (!x.IsArchived || ShowArchived))
+ .Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
p => p.ProdDbId,
@@ -374,18 +375,86 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Distinct()
.Include(j => j.ProjListNav)
.OrderByDescending(x => x.ProdId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
// recupero i proj "orfani"
dbResultProj = localDbCtx
.ProjList
- .Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= dtStart && x.DtCreated <= dtEnd))
+ .Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd))
.OrderByDescending(x => x.ProjId)
- .Take(numRecord)
+ .Take(NumRecord)
.ToList();
}
+ // conversione
+ result = dbResultProd.Select(x => coreItemConv(x)).ToList();
+ var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
+ // sommo i risultati
+ result.AddRange(resProj);
+ return result;
+ }
+ ///
+ /// Elenco prod
+ ///
+ /// Inizio periodo estrazione
+ /// Fine periodo estrazione
+ /// Ture: usa data creazione / False: usa data export
+ /// Num max record da recuperare
+ /// Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)
+ /// Nome Macchina (default vuoto = non usato)
+ /// Nome file BTL (default vuoto = non usato)
+ /// Nome List (default vuoto = non usato)
+ /// Se true: mostra anche archiviati (default li nasconde)
+ ///
+ public List GetLastDescFull(DateTime DtStart, DateTime DtEnd, bool DtIsCreation, int NumRecord, bool OnlyActive, string Machine = "", string BtlFileName = "", string ListName = "", bool ShowArchived = false)
+ {
+ List result = new List();
+ List dbResultProd = new List();
+ // elenco proj "orfani"
+ List dbResultProj = new List();
+ using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
+ {
+ // se numRecord = 0 --> passo tutti
+ if (NumRecord == 0)
+ {
+ NumRecord = localDbCtx.ProdList.Count();
+ }
+ // retrieve
+ dbResultProd = localDbCtx
+ .ProdList
+ .Where(x => (!x.IsArchived || ShowArchived))
+ // condizione join sui PROJ
+ .Join(localDbCtx.ProjList.Where(x =>
+ (x.IsActive || !OnlyActive)
+ && (string.IsNullOrEmpty(Machine) || x.Machine == Machine)
+ && (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName == BtlFileName)
+ && (string.IsNullOrEmpty(ListName) || x.ListName == ListName)
+ && ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd)))
+ ),
+ p => p.ProdDbId,
+ e => e.ProdDbId,
+ (p, e) => p)
+ .Distinct()
+ .Include(j => j.ProjListNav)
+ .OrderByDescending(x => x.ProdId)
+ .Take(NumRecord)
+ .ToList();
+
+ // recupero i proj "orfani"
+ dbResultProj = localDbCtx
+ .ProjList
+ .Where(x =>
+ (x.IsActive || !OnlyActive)
+ && x.Prod == null
+ && (string.IsNullOrEmpty(Machine) || x.Machine == Machine)
+ && (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName == BtlFileName)
+ && (string.IsNullOrEmpty(ListName) || x.ListName == ListName)
+ && ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd))))
+ .OrderByDescending(x => x.ProjId)
+ .Take(NumRecord)
+ .ToList();
+ }
// conversione
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();