gestione manutenzioni (presa in carico, rilascia e chiudi)
This commit is contained in:
parent
a5eee0b6cf
commit
65878e9cfb
@ -6564,119 +6564,12 @@ namespace ApiPolo.Controllers
|
|||||||
if (await checkManutenzionePresaInCarico(ten, model.pimpianto, model.picodint, model.pidatman) == 0)
|
if (await checkManutenzionePresaInCarico(ten, model.pimpianto, model.picodint, model.pidatman) == 0)
|
||||||
{
|
{
|
||||||
Prese r = fillPreseByInput(model, token);
|
Prese r = fillPreseByInput(model, token);
|
||||||
|
await _service.AddPreseToDbAsync(ten, r);
|
||||||
|
System.Threading.Thread.Sleep(1000);
|
||||||
|
|
||||||
|
|
||||||
//scrittura
|
|
||||||
/*
|
|
||||||
switch (ten)
|
|
||||||
{
|
|
||||||
case Clienti.Marrocco:
|
|
||||||
using (var transaction = _Marro_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Marro_prese.Prese.AddAsync(r);
|
|
||||||
await _Marro_prese.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Ferrari:
|
|
||||||
using (var transaction2 = _Ferra_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Ferra_prese.Prese.AddAsync(r);
|
|
||||||
await _Ferra_prese.SaveChangesAsync();
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sarom:
|
|
||||||
using (var transaction5 = _Sarom_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sarom_prese.Prese.AddAsync(r);
|
|
||||||
await _Sarom_prese.SaveChangesAsync();
|
|
||||||
transaction5.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sicilia:
|
|
||||||
using (var transaction3 = _Sicilia_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sicilia_prese.Prese.AddAsync(r);
|
|
||||||
await _Sicilia_prese.SaveChangesAsync();
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Discovery:
|
|
||||||
using (var transaction4 = _Disco_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Disco_prese.Prese.AddAsync(r);
|
|
||||||
await _Disco_prese.SaveChangesAsync();
|
|
||||||
transaction4.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Gitoga:
|
|
||||||
using (var transactionGit = _Gitoga_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Gitoga_prese.Prese.AddAsync(r);
|
|
||||||
await _Gitoga_prese.SaveChangesAsync();
|
|
||||||
transactionGit.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Lifta:
|
|
||||||
using (var transactionLif = _Lifta_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Lifta_prese.Prese.AddAsync(r);
|
|
||||||
await _Lifta_prese.SaveChangesAsync();
|
|
||||||
transactionLif.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Siet:
|
|
||||||
using (var transactionSiet = _Siet_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Siet_prese.Prese.AddAsync(r);
|
|
||||||
await _Siet_prese.SaveChangesAsync();
|
|
||||||
transactionSiet.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.PMS:
|
|
||||||
using (var transactionPMS = _PMS_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _PMS_prese.Prese.AddAsync(r);
|
|
||||||
await _PMS_prese.SaveChangesAsync();
|
|
||||||
transactionPMS.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.LW:
|
|
||||||
using (var transactionLW = _LW_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _LW_prese.Prese.AddAsync(r);
|
|
||||||
await _LW_prese.SaveChangesAsync();
|
|
||||||
transactionLW.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Tedesco:
|
|
||||||
using (var transactionTedes = _Tedes_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Tedes_prese.Prese.AddAsync(r);
|
|
||||||
await _Tedes_prese.SaveChangesAsync();
|
|
||||||
transactionTedes.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Syscom:
|
|
||||||
using (var transactionSys = _Sys_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sys_prese.Prese.AddAsync(r);
|
|
||||||
await _Sys_prese.SaveChangesAsync();
|
|
||||||
transactionSys.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//man = await getManutenzioneByChiave(model, token);
|
|
||||||
man = await getManutenzioneByChiave2(r, token);
|
man = await getManutenzioneByChiave2(r, token);
|
||||||
|
|
||||||
//output = fillManprogOut(man, ten);
|
|
||||||
output = fillManprogOut2(man, ten);
|
output = fillManprogOut2(man, ten);
|
||||||
|
|
||||||
output.err_status_code = StatiRisposta.Ok;
|
output.err_status_code = StatiRisposta.Ok;
|
||||||
return StatusCode(StatusCodes.Status200OK, output);
|
return StatusCode(StatusCodes.Status200OK, output);
|
||||||
}
|
}
|
||||||
@ -6720,338 +6613,10 @@ namespace ApiPolo.Controllers
|
|||||||
string newSerial = string.Empty;
|
string newSerial = string.Empty;
|
||||||
newSerial = await getSeriale(token);
|
newSerial = await getSeriale(token);
|
||||||
Rapp_New r = await fillRappNewChiudiManByInput(model, token, newSerial, _confLette);
|
Rapp_New r = await fillRappNewChiudiManByInput(model, token, newSerial, _confLette);
|
||||||
/*
|
await _service.AddRappNewToDbAsync(ten, r);
|
||||||
switch (ten)
|
System.Threading.Thread.Sleep(1000);
|
||||||
{
|
|
||||||
case Clienti.Marrocco:
|
|
||||||
using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Marro_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Marro_rapp.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
man = await getManutenzioneByChiaveOut(model, token,r);
|
||||||
break;
|
|
||||||
case Clienti.Ferrari:
|
|
||||||
using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Ferra_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Ferra_rapp.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sarom:
|
|
||||||
using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sarom_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Sarom_rapp.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sicilia:
|
|
||||||
using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Sicilia_rapp.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
int riga = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _Sicilia_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
riga = riga + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Sicilia_mag.Mag.AddAsync(mn);
|
|
||||||
await _Sicilia_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
using (var transaction3 = _Sicilia_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
riga = riga + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Sicilia_mag.Mag.AddAsync(mn);
|
|
||||||
await _Sicilia_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Discovery:
|
|
||||||
using (var transaction4 = _Disco_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Disco_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Disco_rapp.SaveChangesAsync();
|
|
||||||
transaction4.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Gitoga:
|
|
||||||
using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Gitoga_rapp.SaveChangesAsync();
|
|
||||||
transactionGit.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Lifta:
|
|
||||||
using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Lifta_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Lifta_rapp.SaveChangesAsync();
|
|
||||||
transactionLif.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Siet:
|
|
||||||
using (var transactionSiet = _Siet_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Siet_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Siet_rapp.SaveChangesAsync();
|
|
||||||
transactionSiet.Commit();
|
|
||||||
}
|
|
||||||
int rigaSiet = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _Siet_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
rigaSiet = rigaSiet + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, rigaSiet, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Siet_mag.Mag.AddAsync(mn);
|
|
||||||
await _Siet_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
using (var transaction3 = _Siet_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
rigaSiet = rigaSiet + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, rigaSiet, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Siet_mag.Mag.AddAsync(mn);
|
|
||||||
await _Siet_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Clienti.PMS:
|
|
||||||
using (var transactionPms = _Pms_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Pms_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Pms_rapp.SaveChangesAsync();
|
|
||||||
transactionPms.Commit();
|
|
||||||
}
|
|
||||||
int rigapms = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _PMS_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
rigapms = rigapms + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, rigapms, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _PMS_mag.Mag.AddAsync(mn);
|
|
||||||
await _PMS_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
using (var transaction3 = _PMS_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
rigapms = rigapms + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, rigapms, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _PMS_mag.Mag.AddAsync(mn);
|
|
||||||
await _PMS_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Clienti.LW:
|
|
||||||
using (var transactionLW = _LW_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _LW_rapp.Rapps.AddAsync(r);
|
|
||||||
await _LW_rapp.SaveChangesAsync();
|
|
||||||
transactionLW.Commit();
|
|
||||||
}
|
|
||||||
int rigalw = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _LW_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
rigalw = rigalw + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, rigalw, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _LW_mag.Mag.AddAsync(mn);
|
|
||||||
await _LW_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
using (var transaction3 = _LW_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
rigalw = rigalw + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, rigalw, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _LW_mag.Mag.AddAsync(mn);
|
|
||||||
await _LW_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Clienti.Tedesco:
|
|
||||||
using (var transactionTedes = _Tedes_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Tedes_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Tedes_rapp.SaveChangesAsync();
|
|
||||||
transactionTedes.Commit();
|
|
||||||
}
|
|
||||||
int rigatedes = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _Tedes_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
rigatedes = rigatedes + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, rigatedes, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Tedes_mag.Mag.AddAsync(mn);
|
|
||||||
await _Tedes_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
using (var transaction3 = _Tedes_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
rigatedes = rigatedes + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, rigatedes, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Tedes_mag.Mag.AddAsync(mn);
|
|
||||||
await _Tedes_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Clienti.Syscom:
|
|
||||||
using (var transactionSys = _Sys_rapp.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
await _Sys_rapp.Rapps.AddAsync(r);
|
|
||||||
await _Sys_rapp.SaveChangesAsync();
|
|
||||||
transactionSys.Commit();
|
|
||||||
}
|
|
||||||
int rigasys = 0;
|
|
||||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
using (var transaction2 = _Sys_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (Saldiart co in model.compo_add)
|
|
||||||
{
|
|
||||||
rigasys = rigasys + 1;
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
mn = saldiartToMag_New(co, rigasys, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Sys_mag.Mag.AddAsync(mn);
|
|
||||||
await _Sys_mag.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
||||||
{
|
|
||||||
using (var transaction3 = _Sys_mag.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
foreach (Compo_Impia co in model.compo_del)
|
|
||||||
{
|
|
||||||
Mag_New mn = new Mag_New();
|
|
||||||
rigasys = rigasys + 1;
|
|
||||||
mn = compo_ImpiaToMag_New(co, rigasys, newSerial, tecnico);
|
|
||||||
|
|
||||||
await _Sys_mag.Mag.AddAsync(mn);
|
|
||||||
await _Sys_mag.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
man = await getManutenzioneByChiaveOut(model, token,r);
|
|
||||||
output = fillManprogOut(man, ten);
|
output = fillManprogOut(man, ten);
|
||||||
output.err_status_code = StatiRisposta.Ok;
|
output.err_status_code = StatiRisposta.Ok;
|
||||||
return StatusCode(StatusCodes.Status200OK, output);
|
return StatusCode(StatusCodes.Status200OK, output);
|
||||||
@ -7092,115 +6657,13 @@ namespace ApiPolo.Controllers
|
|||||||
{
|
{
|
||||||
if ((pre=await checkManutenzioneDaRilasciare(ten, model.pimpianto, model.picodint, model.pidatman)) !=null)
|
if ((pre=await checkManutenzioneDaRilasciare(ten, model.pimpianto, model.picodint, model.pidatman)) !=null)
|
||||||
{
|
{
|
||||||
//scrittura
|
Prese p = new Prese();
|
||||||
/*
|
p = fillPreseByInput(model, token);
|
||||||
switch (ten)
|
await _service.RemovePreseToDbAsync(ten, p);
|
||||||
{
|
System.Threading.Thread.Sleep(1000);
|
||||||
case Clienti.Marrocco:
|
|
||||||
using (var transaction = _Marro_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Marro_prese.Prese.Remove(pre);
|
|
||||||
await _Marro_prese.SaveChangesAsync();
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Ferrari:
|
|
||||||
using (var transaction2 = _Ferra_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Ferra_prese.Prese.Remove(pre);
|
|
||||||
await _Ferra_prese.SaveChangesAsync();
|
|
||||||
transaction2.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sarom:
|
|
||||||
using (var transaction5 = _Sarom_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Sarom_prese.Prese.Remove(pre);
|
|
||||||
await _Sarom_prese.SaveChangesAsync();
|
|
||||||
transaction5.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Sicilia:
|
|
||||||
using (var transaction3 = _Sicilia_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Sicilia_prese.Prese.Remove(pre);
|
|
||||||
await _Sicilia_prese.SaveChangesAsync();
|
|
||||||
transaction3.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Discovery:
|
|
||||||
using (var transaction4 = _Disco_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Disco_prese.Prese.Remove(pre);
|
|
||||||
await _Disco_prese.SaveChangesAsync();
|
|
||||||
transaction4.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Gitoga:
|
|
||||||
using (var transactionGit = _Gitoga_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Gitoga_prese.Prese.Remove(pre);
|
|
||||||
await _Gitoga_prese.SaveChangesAsync();
|
|
||||||
transactionGit.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Lifta:
|
|
||||||
using (var transactionLif = _Lifta_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Lifta_prese.Prese.Remove(pre);
|
|
||||||
await _Lifta_prese.SaveChangesAsync();
|
|
||||||
transactionLif.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Siet:
|
|
||||||
using (var transactionSiet = _Siet_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Siet_prese.Prese.Remove(pre);
|
|
||||||
await _Siet_prese.SaveChangesAsync();
|
|
||||||
transactionSiet.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.PMS:
|
|
||||||
using (var transactionPms = _PMS_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_PMS_prese.Prese.Remove(pre);
|
|
||||||
await _PMS_prese.SaveChangesAsync();
|
|
||||||
transactionPms.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.LW:
|
|
||||||
using (var transactionLW = _LW_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_LW_prese.Prese.Remove(pre);
|
|
||||||
await _LW_prese.SaveChangesAsync();
|
|
||||||
transactionLW.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Tedesco:
|
|
||||||
using (var transactionTedes = _Tedes_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Tedes_prese.Prese.Remove(pre);
|
|
||||||
await _Tedes_prese.SaveChangesAsync();
|
|
||||||
transactionTedes.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Clienti.Syscom :
|
|
||||||
using (var transactionSys = _Sys_prese.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
_Sys_prese.Prese.Remove(pre);
|
|
||||||
await _Sys_prese.SaveChangesAsync();
|
|
||||||
transactionSys.Commit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
man = await getManutenzioneByChiave2(pre, token);
|
man = await getManutenzioneByChiave2(pre, token);
|
||||||
|
|
||||||
output = fillManprogOut(man, ten);
|
output = fillManprogOut(man, ten);
|
||||||
//output = fillManprogOut2(man, ten);
|
|
||||||
|
|
||||||
output.err_status_code = StatiRisposta.Ok;
|
output.err_status_code = StatiRisposta.Ok;
|
||||||
return StatusCode(StatusCodes.Status200OK, output);
|
return StatusCode(StatusCodes.Status200OK, output);
|
||||||
|
|||||||
@ -197,5 +197,53 @@ namespace ApiPolo
|
|||||||
throw new InvalidOperationException("Error in Service - AddRappNewToDbAsync: " + mex);
|
throw new InvalidOperationException("Error in Service - AddRappNewToDbAsync: " + mex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Scrive su PIPRESE: Manutenzione prendi in carico</summary>
|
||||||
|
public async Task AddPreseToDbAsync(string tenant, Prese model)
|
||||||
|
{
|
||||||
|
|
||||||
|
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||||
|
|
||||||
|
string mex = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var transaction = await dbContext.Database.BeginTransactionAsync())
|
||||||
|
{
|
||||||
|
await dbContext.Prese.AddAsync(model);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
await transaction.CommitAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
mex = ex.Message;
|
||||||
|
throw new InvalidOperationException("Error in Service - AddPreseToDbAsync: " + mex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Scrive su PIPRESE: Manutenzione rilascia</summary>
|
||||||
|
public async Task RemovePreseToDbAsync(string tenant, Prese model)
|
||||||
|
{
|
||||||
|
|
||||||
|
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var transaction = await dbContext.Database.BeginTransactionAsync())
|
||||||
|
{
|
||||||
|
dbContext.Prese.Remove(model);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
await transaction.CommitAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string mex = string.Empty;
|
||||||
|
mex = ex.Message;
|
||||||
|
throw new InvalidOperationException("Error in Service - RemovePreseToDbAsync: " + mex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user