- Fix filtro file e username
This commit is contained in:
Samuele Locatelli
2024-10-22 19:25:48 +02:00
parent 417aaa9d28
commit 18c58522a2
10 changed files with 74 additions and 31 deletions
+4 -2
View File
@@ -247,7 +247,7 @@ namespace MP.FileData.Controllers
dbCtx.Dispose();
}
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag, string SearchVal)
public int FileCountFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string UserName, string Tag, string SearchVal)
{
int answ = 0;
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
@@ -259,6 +259,7 @@ namespace MP.FileData.Controllers
&& (x.Active == OnlyActive || !OnlyActive) && (x.Tags.Count() == 0 || !OnlyNoTag)
&& (!OnlyMod || x.DiskStatus != FileState.Ok)
&& (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName))
&& (x.UserAppr.Equals(UserName) || string.IsNullOrEmpty(UserName))
&& (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();
@@ -397,7 +398,7 @@ namespace MP.FileData.Controllers
return dbResult;
}
public List<DatabaseModels.FileModel> FileGetFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string Tag, string SearchVal, int NumStart, int NumRecords)
public List<DatabaseModels.FileModel> FileGetFilt(string IdxMacchina, bool OnlyActive, bool OnlyMod, bool OnlyNoTag, string FileName, string UserName, string Tag, string SearchVal, int NumStart, int NumRecords)
{
List<DatabaseModels.FileModel> dbResult = new List<DatabaseModels.FileModel>();
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
@@ -411,6 +412,7 @@ namespace MP.FileData.Controllers
&& (x.Active == OnlyActive || !OnlyActive) && (x.Tags.Count() == 0 || !OnlyNoTag)
&& (!OnlyMod || x.DiskStatus != FileState.Ok)
&& (x.Path.Equals(FileName) || string.IsNullOrEmpty(FileName))
&& (x.UserAppr.Equals(UserName) || string.IsNullOrEmpty(UserName))
&& (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)