Aggiunta ricerca "non taggati"
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace MP.Prog.Data
|
||||
int numCount = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
numCount = dbController.FileCountFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.FileName, CurrFilter.Tag);
|
||||
numCount = dbController.FileCountFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.OnlyNoTag, CurrFilter.FileName, CurrFilter.Tag);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Info($"Effettuata lettura da DB + caching per FileCountFilt: {ts.TotalMilliseconds} ms");
|
||||
@@ -239,7 +239,7 @@ namespace MP.Prog.Data
|
||||
List<FileData.DatabaseModels.FileModel> dbResult = new List<FileData.DatabaseModels.FileModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.FileGetFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.FileName, CurrFilter.Tag, CurrFilter.NumSkip, CurrFilter.PageSize).ToList();
|
||||
dbResult = dbController.FileGetFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.OnlyNoTag, CurrFilter.FileName, CurrFilter.Tag, CurrFilter.NumSkip, CurrFilter.PageSize).ToList();
|
||||
//dbResult = dbController.FileGetFilt(CurrFilter.IdxMacchina, CurrFilter.OnlyActive, CurrFilter.OnlyMod, CurrFilter.FirstRecord, CurrFilter.PageSize * 10, CurrFilter.SearchVal).ToList();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace MP.Prog.Data
|
||||
|
||||
public bool OnlyActive { get; set; } = true;
|
||||
public bool OnlyMod { get; set; } = false;
|
||||
public bool OnlyNoTag { get; set; } = false;
|
||||
public int PageNum { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
public string SearchVal { get; set; } = "";
|
||||
@@ -83,12 +84,16 @@ namespace MP.Prog.Data
|
||||
return false;
|
||||
if (OnlyMod != item.OnlyMod)
|
||||
return false;
|
||||
if (OnlyNoTag != item.OnlyNoTag)
|
||||
return false;
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
if (FileName != item.FileName)
|
||||
return false;
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
if (Tag != item.Tag)
|
||||
return false;
|
||||
if (DateEnd != item.DateEnd)
|
||||
return false;
|
||||
if (DateStart != item.DateStart)
|
||||
|
||||
@@ -60,6 +60,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="togNoTag" title="Solo senza Tag / Mostra tutti" @bind-value="@OnlyNoTag" checked="@OnlyNoTag" />
|
||||
<label class="custom-control-label" for="togNoTag"><sub>No Tag</sub></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (!string.IsNullOrEmpty(SelFileName))
|
||||
{
|
||||
|
||||
@@ -111,6 +111,31 @@ namespace MP.Prog.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyNoTag
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyNoTag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyNoTag.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyNoTag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelFileName
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user