Completata search libera (senza debounce da sistemare)
This commit is contained in:
@@ -162,15 +162,21 @@ namespace MP.FileData.Controllers
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag)
|
||||
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag, string SearchVal)
|
||||
{
|
||||
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) && (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();
|
||||
.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))
|
||||
&& ((!string.IsNullOrEmpty(SearchVal) && (x.Path.Contains(SearchVal) || x.Tags.Where(t => t.TagId.Contains(SearchVal)).Count() > 0)) || string.IsNullOrEmpty(SearchVal))
|
||||
).Count();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -255,7 +261,7 @@ namespace MP.FileData.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<DatabaseModels.FileModel> FileGetFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, 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, string SearchVal, int NumStart, int NumRecords)
|
||||
{
|
||||
List<DatabaseModels.FileModel> dbResult = new List<DatabaseModels.FileModel>();
|
||||
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
|
||||
@@ -264,8 +270,14 @@ namespace MP.FileData.Controllers
|
||||
.DbSetProgFile
|
||||
.Include(m => m.Macchina)
|
||||
.Include(t => t.Tags)
|
||||
.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)
|
||||
.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))
|
||||
&& ((!string.IsNullOrEmpty(SearchVal) && (x.Path.Contains(SearchVal) || x.Tags.Where(t => t.TagId.Contains(SearchVal)).Count() > 0)) || string.IsNullOrEmpty(SearchVal))
|
||||
).OrderByDescending(x => x.LastMod)
|
||||
.Skip(NumStart)
|
||||
.Take(NumRecords)
|
||||
.ToList();
|
||||
|
||||
Reference in New Issue
Block a user