Continuo gestione vocabolari

This commit is contained in:
zaccaria.majid
2023-06-06 17:12:26 +02:00
parent ac115ac7ee
commit a56818a2c8
15 changed files with 1331 additions and 76 deletions
@@ -540,7 +540,7 @@ namespace WebDoorCreator.Data.Controllers
.OrderBy(x => x.DoorOpTypId)
.ToList();
}
else if(hwCode != "*" && parentId == -1)
else if (hwCode != "*" && parentId == -1)
{
dbResult = localDbCtx
.DbSetDoorOpType
@@ -548,7 +548,7 @@ namespace WebDoorCreator.Data.Controllers
.OrderBy(x => x.DoorOpTypId)
.ToList();
}
else if(hwCode == "*" && parentId >= 0)
else if (hwCode == "*" && parentId >= 0)
{
dbResult = localDbCtx
.DbSetDoorOpType
@@ -556,7 +556,7 @@ namespace WebDoorCreator.Data.Controllers
.OrderBy(x => x.DoorOpTypId)
.ToList();
}
else if(hwCode != "*" && parentId >= 0)
else if (hwCode != "*" && parentId >= 0)
{
dbResult = localDbCtx
.DbSetDoorOpType
@@ -744,7 +744,8 @@ namespace WebDoorCreator.Data.Controllers
.DbSetDoor
.Where(x => x.DoorId == addEditRec.DoorId)
.FirstOrDefault();
if (currRec != null) //if is not null edit the record found
//if is not null edit the record found
if (currRec != null)
{
currRec.Quantity = addEditRec.Quantity;
currRec.DoorExtCode = addEditRec.DoorExtCode;
@@ -752,7 +753,8 @@ namespace WebDoorCreator.Data.Controllers
currRec.ParentId = addEditRec.ParentId;
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
else //if is null add the record as new in the table
//if is null add the record as new in the table
else
{
localDbCtx
.DbSetDoor
@@ -1517,6 +1519,66 @@ namespace WebDoorCreator.Data.Controllers
}
return fatto;
}
public async Task<bool> VocLemmaSetConf(string lingua, string lemma, bool isConf)
{
await Task.Delay(1);
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
// import massivo dati in tab temp
var termSearch = localDbCtx
.DbSetVocabularyTemp
.Where(x => x.Lingua == lingua && x.Lemma == lemma)
.FirstOrDefault();
if (termSearch != null)
{
termSearch.IsConfSave = isConf;
localDbCtx.Entry(termSearch).State = EntityState.Modified;
await localDbCtx.SaveChangesAsync();
fatto = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante VocLemmaSetConf: {Environment.NewLine}{exc}");
}
}
return fatto;
}
public async Task<VocabularyTempModel> VocLemmaFindByKeys(string lingua, string lemma)
{
await Task.Delay(1);
VocabularyTempModel dbResult = new VocabularyTempModel();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
// import massivo dati in tab temp
var termSearch = localDbCtx
.DbSetVocabularyTemp
.Where(x => x.Lingua == lingua && x.Lemma == lemma)
.FirstOrDefault();
if (termSearch != null)
{
dbResult = termSearch;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante VocLemmaCheckConf: {Environment.NewLine}{exc}");
}
}
return dbResult;
}
public Dictionary<string, Dictionary<string, string>> VocLemmaTEMPGetAll()
{