Aggiunta ricerca "non taggati"

This commit is contained in:
Samuele Locatelli
2021-09-15 13:11:19 +02:00
parent 3aa8341c94
commit 2a42571375
5 changed files with 44 additions and 6 deletions
+4 -4
View File
@@ -161,14 +161,14 @@ namespace MP.FileData.Controllers
dbCtx.Dispose();
}
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, string FileName, string Tag)
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag)
{
int answ = 0;
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
{
answ = localDbCtx
.DbSetProgFile
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "0") && (x.Active == OnlyActive || !OnlyActive) && (!OnlyMod || x.DiskStatus != FileState.Ok) && (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName)) && (x.Tags.Where(t => t.TagId == Tag).Count() > 0 || string.IsNullOrEmpty(Tag)))
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "0") && (x.Active == OnlyActive || !OnlyActive) && (x.Tags.Count() == 0 || !OnlyNoTag) && (!OnlyMod || x.DiskStatus != FileState.Ok) && (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName)) && (x.Tags.Where(t => t.TagId == Tag).Count() > 0 || string.IsNullOrEmpty(Tag)))
.Count();
}
return answ;
@@ -254,7 +254,7 @@ namespace MP.FileData.Controllers
return dbResult;
}
public List<DatabaseModels.FileModel> FileGetFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, string FileName, string Tag, int NumStart, int NumRecords)
public List<DatabaseModels.FileModel> FileGetFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag, int NumStart, int NumRecords)
{
List<DatabaseModels.FileModel> dbResult = new List<DatabaseModels.FileModel>();
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
@@ -263,7 +263,7 @@ namespace MP.FileData.Controllers
.DbSetProgFile
.Include(m => m.Macchina)
.Include(t => t.Tags)
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "0") && (x.Active == OnlyActive || !OnlyActive) && (!OnlyMod || x.DiskStatus != FileState.Ok) && (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName)) && (x.Tags.Where(t => t.TagId == Tag).Count() > 0 || string.IsNullOrEmpty(Tag)))
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "0") && (x.Active == OnlyActive || !OnlyActive) && (x.Tags.Count() == 0 || !OnlyNoTag) && (!OnlyMod || x.DiskStatus != FileState.Ok) && (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName)) && (x.Tags.Where(t => t.TagId == Tag).Count() > 0 || string.IsNullOrEmpty(Tag)))
.OrderByDescending(x => x.LastMod)
.Skip(NumStart)
.Take(NumRecords)