PROG
- fix missing file x IOB (errore in assegnazione modifica pre salvataggio in EFCore)
This commit is contained in:
@@ -869,21 +869,21 @@ namespace MP.FileData.Controllers
|
||||
DateTime adesso = DateTime.Now;
|
||||
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
|
||||
{
|
||||
// SOLO SE richiesto forzatura tags
|
||||
if (forceTag)
|
||||
// elenco Tags
|
||||
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
|
||||
FileModel currItem = null;
|
||||
foreach (var item in updFiles)
|
||||
{
|
||||
// elenco Tags
|
||||
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
|
||||
FileModel currItem = null;
|
||||
foreach (var item in updFiles)
|
||||
{
|
||||
// recupero record da DB...
|
||||
currItem = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.FileId == item.FileId)
|
||||
.Include(x => x.Tags)
|
||||
.FirstOrDefault();
|
||||
// recupero record da DB...
|
||||
currItem = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.FileId == item.FileId)
|
||||
.Include(x => x.Tags)
|
||||
.FirstOrDefault();
|
||||
|
||||
// SOLO SE richiesto forzatura tags
|
||||
if (forceTag)
|
||||
{
|
||||
List<string> Tags = new List<string>();
|
||||
List<TagModel> Tag4File = new List<TagModel>();
|
||||
// se necessario bonifico filename...
|
||||
@@ -933,30 +933,24 @@ namespace MP.FileData.Controllers
|
||||
// salvo i tags relativi ai files
|
||||
currItem.Tags.Clear();
|
||||
currItem.Tags = Tag4File;
|
||||
//localDbCtx.Entry(currItem).State = EntityState.Modified;
|
||||
}
|
||||
//localDbCtx.SaveChanges();
|
||||
}
|
||||
try
|
||||
{
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in salvataggio FileSetChecked{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
#if false
|
||||
// update comunque data-ora
|
||||
foreach (var item in updFiles)
|
||||
{
|
||||
// salvo update file
|
||||
item.LastCheck = adesso;
|
||||
localDbCtx.Entry(item).State = EntityState.Modified;
|
||||
}
|
||||
#endif
|
||||
// update comunque data-ora e stato missing
|
||||
currItem.DiskStatus = FileState.Ok;
|
||||
currItem.LastCheck = adesso;
|
||||
localDbCtx.Entry(currItem).State = EntityState.Modified;
|
||||
|
||||
}
|
||||
|
||||
// salvo
|
||||
try
|
||||
{
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in salvataggio FileSetChecked{Environment.NewLine}{exc}");
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
GC.Collect();
|
||||
@@ -977,21 +971,21 @@ namespace MP.FileData.Controllers
|
||||
DateTime adesso = DateTime.Now;
|
||||
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
|
||||
{
|
||||
// SOLO SE richiesto forzatura tags
|
||||
if (forceTag)
|
||||
// elenco Tags
|
||||
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
|
||||
FileModel currItem = null;
|
||||
foreach (var item in missFiles)
|
||||
{
|
||||
// elenco Tags
|
||||
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
|
||||
FileModel currItem = null;
|
||||
foreach (var item in missFiles)
|
||||
{
|
||||
// recupero record da DB...
|
||||
currItem = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.FileId == item.FileId)
|
||||
.Include(x => x.Tags)
|
||||
.FirstOrDefault();
|
||||
// recupero record da DB...
|
||||
currItem = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.FileId == item.FileId)
|
||||
.Include(x => x.Tags)
|
||||
.FirstOrDefault();
|
||||
|
||||
// SOLO SE richiesto forzatura tags
|
||||
if (forceTag)
|
||||
{
|
||||
List<string> Tags = new List<string>();
|
||||
List<TagModel> Tag4File = new List<TagModel>();
|
||||
// se necessario bonifico filename...
|
||||
@@ -1043,18 +1037,13 @@ namespace MP.FileData.Controllers
|
||||
currItem.Tags = Tag4File;
|
||||
//localDbCtx.Entry(currItem).State = EntityState.Modified;
|
||||
}
|
||||
//localDbCtx.SaveChanges();
|
||||
}
|
||||
// update comunque data-ora e stato missing
|
||||
currItem.DiskStatus = FileState.Missing;
|
||||
currItem.LastCheck = adesso;
|
||||
localDbCtx.Entry(currItem).State = EntityState.Modified;
|
||||
}
|
||||
|
||||
// update comunque data-ora e stato missing
|
||||
foreach (var item in missFiles)
|
||||
{
|
||||
// salvo update file
|
||||
item.DiskStatus = FileState.Missing;
|
||||
item.LastCheck = adesso;
|
||||
localDbCtx.Entry(item).State = EntityState.Modified;
|
||||
}
|
||||
try
|
||||
{
|
||||
// salvo
|
||||
|
||||
Reference in New Issue
Block a user