completamento refactor chiamate
This commit is contained in:
parent
81c6a75fa7
commit
ad5122b1ca
@ -1327,21 +1327,12 @@ namespace ApiPolo.Controllers
|
||||
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
return dbContext.Prog; // Use Set<T>() to handle different DbContexts
|
||||
}
|
||||
//private DbSet<Prog> getChiamateProgressiviByTenant(string tenant)
|
||||
//{
|
||||
// var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
// return dbContext.Progressivi; // Use Set<T>() to handle different DbContexts
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// CONFLITTO CON Compo_Impia_Table
|
||||
/// </summary>
|
||||
/*
|
||||
private DbSet<Compo_Impia_Table> getComponentiByTenant(string tenant)
|
||||
{ // IN CONFLITTO CON Compo_Impia_Table
|
||||
|
||||
private DbSet<Compo_Impia> getComponentiByTenant(string tenant)
|
||||
{
|
||||
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
return dbContext.Componen; // Use Set<T>() to handle different DbContexts
|
||||
}*/
|
||||
return dbContext.Compo; // Use Set<T>() to handle different DbContexts
|
||||
}
|
||||
private DbSet<Compo_Impia_Table> getComponentiTableByTenant(string tenant)
|
||||
{
|
||||
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
@ -1393,11 +1384,7 @@ namespace ApiPolo.Controllers
|
||||
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
return dbContext.ChiamateTables; // Use Set<T>() to handle different DbContexts
|
||||
}
|
||||
//private DbSet<Compo_Impia> getComponentiByTenant(string tenant)
|
||||
//{
|
||||
// var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
// return dbContext.Compo; // Use Set<T>() to handle different DbContexts
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Utility
|
||||
@ -5682,6 +5669,26 @@ namespace ApiPolo.Controllers
|
||||
Rapp_New r = await fillRappNewChiudiByInput(model, token, newSerial, _confLette);
|
||||
_service.AddRappNewToDbAsync(ten, r);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
if (model.compo_add != null && model.compo_add.Count() > 0)
|
||||
{
|
||||
foreach (Saldiart co in model.compo_add)
|
||||
{
|
||||
riga = riga + 1;
|
||||
Mag_New mn = new Mag_New();
|
||||
mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
||||
_service.AddMagNewToDbAsync(ten, mn);
|
||||
}
|
||||
}
|
||||
if (model.compo_del != null && model.compo_del.Count() > 0)
|
||||
{
|
||||
foreach (Compo_Impia co in model.compo_del)
|
||||
{
|
||||
riga = riga + 1;
|
||||
Mag_New mn = new Mag_New();
|
||||
mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
||||
_service.AddMagNewToDbAsync(ten, mn);
|
||||
}
|
||||
}
|
||||
|
||||
calltec = await getChiamataBySerial(r.seriale_chiamata, token);
|
||||
calltec_out = fillChiamateOut(calltec, ten);
|
||||
@ -5704,8 +5711,6 @@ namespace ApiPolo.Controllers
|
||||
calltec_out.err_status_code = StatiRisposta.ErroreInterno;
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
||||
}
|
||||
|
||||
//return calltec_out;
|
||||
}
|
||||
|
||||
/// <summary>rilascia: elimina record su RAPP_NEW con i dati dell'intervento return:ActionResult</summary>
|
||||
@ -5762,86 +5767,6 @@ namespace ApiPolo.Controllers
|
||||
//return calltec_out;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("chiamate/test")]
|
||||
public async Task<ActionResult<Chiamate_out>> test([FromBody] Rapp_New model)
|
||||
{
|
||||
string mex = string.Empty;
|
||||
/*
|
||||
using (var dbContext = _dbContextFactory.CreateDbContext())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add the entity to the DbSet
|
||||
await dbContext.Set<T>().AddAsync(entity);
|
||||
|
||||
// Save the changes to the database
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions as necessary
|
||||
Console.WriteLine($"Error inserting entity: {ex.Message}");
|
||||
// Optionally rethrow or log the errorMaras
|
||||
throw;
|
||||
}
|
||||
}*/
|
||||
try
|
||||
{
|
||||
_service.AddRappNewToDbAsync("MARAS",model);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
mex = ex.Message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Maras_DbContext dbContext = (Maras_DbContext)_dbContextFactory.GetDbContext("MARAS");
|
||||
|
||||
try
|
||||
{
|
||||
using (var transaction = dbContext.Database.BeginTransaction())
|
||||
{
|
||||
await dbContext.Rapps.AddAsync(model);
|
||||
await dbContext.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mex = ex.Message;
|
||||
}
|
||||
*/
|
||||
|
||||
return StatusCode(StatusCodes.Status200OK, mex);
|
||||
}
|
||||
|
||||
//[HttpPost]
|
||||
//[Route("chiamate/test2")]
|
||||
//public async Task<ActionResult<Chiamate_out>> Test2([FromBody] Rapp_New model)
|
||||
//{
|
||||
// var dbContext = _dbContextFactory.GetDbContext("MARAS");
|
||||
|
||||
// string mex = string.Empty;
|
||||
// try
|
||||
// {
|
||||
// using (var transaction = await dbContext.Database.BeginTransactionAsync())
|
||||
// {
|
||||
// await dbContext.Rapps.AddAsync(model);
|
||||
// await dbContext.SaveChangesAsync();
|
||||
// await transaction.CommitAsync();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// mex = ex.Message;
|
||||
// }
|
||||
|
||||
// return StatusCode(StatusCodes.Status200OK, mex);
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@ -7568,22 +7493,27 @@ namespace ApiPolo.Controllers
|
||||
[HttpGet("componenti_impianto")]
|
||||
public async Task<ActionResult<IEnumerable<Compo_Impia>>> componenti_impianto(string token, string codimp)
|
||||
{
|
||||
Compo_Impia ci = new Compo_Impia();
|
||||
try
|
||||
{
|
||||
string ten = getClaimValueByToken(token, "tenant");
|
||||
List<Compo_Impia> lst = new List<Compo_Impia>();
|
||||
_compo = getComponentiByTenant(ten);
|
||||
|
||||
Compo_Impia ci = new Compo_Impia();
|
||||
ci.cocodimp = codimp;
|
||||
ci.cprownum = 1;
|
||||
ci.cocodart = "00001";
|
||||
ci.cocodazi = "AZI02";
|
||||
ci.ardesart = "Tubo in metallo";
|
||||
|
||||
|
||||
lst.Add(ci);
|
||||
|
||||
var l = await _compo.Where(t => t.cocodimp.Equals(codimp)).ToListAsync();
|
||||
|
||||
if(l!=null && l.Count()>0)
|
||||
{
|
||||
foreach(Compo_Impia c in l)
|
||||
{
|
||||
lst.Add(c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ci.ardesart = "Non ci sono componenti per questo impianto";
|
||||
lst.Add(ci);
|
||||
}
|
||||
return StatusCode(StatusCodes.Status200OK, lst);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -7822,25 +7752,7 @@ namespace ApiPolo.Controllers
|
||||
}
|
||||
if (!string.IsNullOrEmpty(matric))
|
||||
{
|
||||
//List<Saldiart> lista = new List<Saldiart>();
|
||||
//var codart = co.Where(m => m.amcodice != null && m.amcodice.ToUpper().Contains(matric.ToUpper())).ToList();
|
||||
//var query = co.Where(p => codart.Any(kw => p..StartsWith(kw)));
|
||||
//if (codart != null && codart.Count() > 0)
|
||||
//{
|
||||
// foreach(Saldiart sa in codart)
|
||||
// {
|
||||
// string artTrovato = sa.slcodice;
|
||||
// co= co.Where(t => t.slcodice != null && t.slcodice.ToUpper().Contains(artTrovato.ToUpper())
|
||||
// && t.amcodice.ToUpper().Contains(matric.ToUpper())).ToList();
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // devo svuotare l'elenco articoli
|
||||
// co = co.Take(0).ToList();
|
||||
//}
|
||||
co = co.Where(t => t.amcodice != null && t.amcodice.ToUpper().Contains(matric.ToUpper())).ToList();
|
||||
|
||||
}
|
||||
//2024-02-19: se l'articolo è gestito a matricole, la query restituisce tutte le righe splittate,
|
||||
//in questo caso forzo la quantità a 1
|
||||
@ -7852,7 +7764,6 @@ namespace ApiPolo.Controllers
|
||||
{
|
||||
s.slqtaper = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
co = co.Take(max_record).ToList();
|
||||
@ -10600,6 +10511,7 @@ namespace ApiPolo.Controllers
|
||||
[HttpGet("storico_interventi")]
|
||||
public async Task<ActionResult<IEnumerable<Sto_Rapp_out>>> storico_interventi(string token, string? codimp, bool rapp_tec=true)
|
||||
{
|
||||
Sto_Rapp_out e = new Sto_Rapp_out();
|
||||
try
|
||||
{
|
||||
string ten = getClaimValueByToken(token, "tenant");
|
||||
@ -10620,17 +10532,29 @@ namespace ApiPolo.Controllers
|
||||
}
|
||||
|
||||
List<Sto_Rapp_out> lis = new List<Sto_Rapp_out>();
|
||||
foreach(Sto_Rapp s in l)
|
||||
if(l!=null && l.Count()>0)
|
||||
{
|
||||
Sto_Rapp_out o = new Sto_Rapp_out();
|
||||
o = fillSto_Rapp_Out(s, ten);
|
||||
lis.Add(o);
|
||||
foreach (Sto_Rapp s in l)
|
||||
{
|
||||
Sto_Rapp_out o = new Sto_Rapp_out();
|
||||
o = fillSto_Rapp_Out(s, ten);
|
||||
lis.Add(o);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
//dic.Add("", "Nessuno storico interventi per questo impianto");
|
||||
//e.dettaglio = dic;
|
||||
e.note_esito = "Nessuno storico interventi per questo impianto";
|
||||
lis.Add(e);
|
||||
}
|
||||
|
||||
return StatusCode(StatusCodes.Status200OK, lis);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Sto_Rapp_out e = new Sto_Rapp_out();
|
||||
|
||||
e.err_title = "Errore in storico interventi";
|
||||
e.err_detail = ex.Message;
|
||||
e.err_status_code = StatiRisposta.ErroreInterno;
|
||||
@ -11216,32 +11140,42 @@ namespace ApiPolo.Controllers
|
||||
[HttpGet("storico_impianto")]
|
||||
public async Task<ActionResult<IEnumerable<Sto_Imp_out>>> storico_impianto(string token, string? codimp /*,bool rapp_tec = true*/)
|
||||
{
|
||||
Sto_Imp_out e = new Sto_Imp_out();
|
||||
try
|
||||
{
|
||||
|
||||
string ten = getClaimValueByToken(token, "tenant");
|
||||
string tecnico = getClaimValueByToken(token, "tccodice");
|
||||
_sto_imp = getStoricoImpiantoByTenant(ten);
|
||||
//var l = await _rapportini.Where(t => t.raaziimp != null && t.raaziimp.Equals(ten) && t.racodte1 != null && t.racodte1.Trim().Equals(tecnico.Trim())).ToListAsync();
|
||||
|
||||
var l = await _sto_imp.Where(t => t.azienda_impianto != null && t.azienda_impianto.Equals(ten)).ToListAsync();
|
||||
if (!string.IsNullOrEmpty(codimp))
|
||||
{
|
||||
l = l.Where(t => t.codimp != null && t.codimp.Equals(codimp)).ToList();
|
||||
}
|
||||
|
||||
|
||||
List<Sto_Imp_out> lis = new List<Sto_Imp_out>();
|
||||
foreach (Sto_Imp s in l)
|
||||
if(l!=null && l.Count()>0)
|
||||
{
|
||||
Sto_Imp_out o = new Sto_Imp_out();
|
||||
o = fillSto_Imp_Out(s, ten);
|
||||
lis.Add(o);
|
||||
foreach (Sto_Imp s in l)
|
||||
{
|
||||
Sto_Imp_out o = new Sto_Imp_out();
|
||||
o = fillSto_Imp_Out(s, ten);
|
||||
lis.Add(o);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.articolo = "Nessun dato storico per questo impianto";
|
||||
lis.Add(e);
|
||||
}
|
||||
|
||||
|
||||
return StatusCode(StatusCodes.Status200OK, lis);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Sto_Imp_out e = new Sto_Imp_out();
|
||||
|
||||
e.err_title = "Errore in Storico impianto";
|
||||
e.err_detail = ex.Message;
|
||||
e.err_status_code = StatiRisposta.ErroreInterno;
|
||||
@ -11404,14 +11338,11 @@ namespace ApiPolo.Controllers
|
||||
{
|
||||
ten = tenConf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Radio Commessa, tipo 1 , campi cli e comm
|
||||
//Radio Cliente, tipo 2, campi cli
|
||||
//Radio Impianto, tipo 3, campi codimp e indirizzoImp
|
||||
|
||||
|
||||
|
||||
var st = StatusCodes.Status200OK;
|
||||
List<Output_Ricerca> lis = new List<Output_Ricerca>();
|
||||
switch (tipo)
|
||||
@ -11525,12 +11456,11 @@ namespace ApiPolo.Controllers
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Impianto_out e = new Impianto_out();
|
||||
e.err_title = "Errore in ricerca impianti2.";
|
||||
e.err_detail = ex.Message;
|
||||
e.err_status_code = StatiRisposta.ErroreInterno;
|
||||
//return StatusCode(StatusCodes.Status428PreconditionRequired, e);
|
||||
{
|
||||
uscita.err_title = "Errore in ricerca impianti2.";
|
||||
uscita.err_detail = ex.Message;
|
||||
uscita.err_status_code = StatiRisposta.ErroreInterno;
|
||||
|
||||
st = StatusCodes.Status500InternalServerError;
|
||||
lis.Add(uscita);
|
||||
}
|
||||
@ -11585,68 +11515,17 @@ namespace ApiPolo.Controllers
|
||||
string esercizio = Convert.ToString(DateTime.Today.Year);
|
||||
|
||||
//lettura seriali e progressivi
|
||||
switch (ten)
|
||||
{
|
||||
case Clienti.PMS:
|
||||
cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "prog\\NUMCHI\\", esercizio);
|
||||
progChiamata = Convert.ToString(cpwarnNumChiamataDecimal.autonum);
|
||||
tablecodeProg = cpwarnNumChiamataDecimal.tablecode;
|
||||
warncodeProg = cpwarnNumChiamataDecimal.warncode;
|
||||
progressivoLetto = cpwarnNumChiamataDecimal.autonum;
|
||||
|
||||
cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "prog\\NUMCHI\\", esercizio);
|
||||
progChiamata = Convert.ToString(cpwarnNumChiamataDecimal.autonum);
|
||||
tablecodeProg = cpwarnNumChiamataDecimal.tablecode;
|
||||
warncodeProg = cpwarnNumChiamataDecimal.warncode;
|
||||
progressivoLetto = cpwarnNumChiamataDecimal.autonum;
|
||||
|
||||
cpwarnSerialeDecimal = await leggiCpwarnSerialeDecimal(ten, "prog\\SERCHI\\");
|
||||
serialeChiamata = Convert.ToString(cpwarnSerialeDecimal.autonum);
|
||||
tablecodeSer = cpwarnSerialeDecimal.tablecode;
|
||||
warncodeSer = cpwarnSerialeDecimal.warncode;
|
||||
serialeLetto = cpwarnSerialeDecimal.autonum;
|
||||
|
||||
break;
|
||||
case Clienti.LW:
|
||||
//passo il tablecode senza la prima parte
|
||||
cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "NUMCHI", esercizio);
|
||||
//cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "prog\\NUMCHI\\", esercizio);
|
||||
progChiamata = Convert.ToString(cpwarnNumChiamataDecimal.autonum);
|
||||
tablecodeProg = cpwarnNumChiamataDecimal.tablecode;
|
||||
warncodeProg = cpwarnNumChiamataDecimal.warncode;
|
||||
progressivoLetto = cpwarnNumChiamataDecimal.autonum;
|
||||
|
||||
cpwarnSerialeDecimal = await leggiCpwarnSerialeDecimal(ten, "SERCHI");
|
||||
serialeChiamata = Convert.ToString(cpwarnSerialeDecimal.autonum);
|
||||
tablecodeSer = cpwarnSerialeDecimal.tablecode;
|
||||
warncodeSer = cpwarnSerialeDecimal.warncode;
|
||||
serialeLetto = cpwarnSerialeDecimal.autonum;
|
||||
|
||||
break;
|
||||
case Clienti.Syscom:
|
||||
cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "prog\\NUMCHI\\", esercizio);
|
||||
progChiamata = Convert.ToString(cpwarnNumChiamataDecimal.autonum);
|
||||
tablecodeProg = cpwarnNumChiamataDecimal.tablecode;
|
||||
warncodeProg = cpwarnNumChiamataDecimal.warncode;
|
||||
progressivoLetto = cpwarnNumChiamataDecimal.autonum;
|
||||
|
||||
cpwarnSerialeDecimal = await leggiCpwarnSerialeDecimal(ten, "prog\\SERCHI\\");
|
||||
serialeChiamata = Convert.ToString(cpwarnSerialeDecimal.autonum);
|
||||
tablecodeSer = cpwarnSerialeDecimal.tablecode;
|
||||
warncodeSer = cpwarnSerialeDecimal.warncode;
|
||||
serialeLetto = cpwarnSerialeDecimal.autonum;
|
||||
|
||||
break;
|
||||
case Clienti.Maras:
|
||||
cpwarnNumChiamataDecimal = await leggiCpwarnProgDecimal(ten, "prog\\NUMCHI\\", esercizio);
|
||||
progChiamata = Convert.ToString(cpwarnNumChiamataDecimal.autonum);
|
||||
tablecodeProg = cpwarnNumChiamataDecimal.tablecode;
|
||||
warncodeProg = cpwarnNumChiamataDecimal.warncode;
|
||||
progressivoLetto = cpwarnNumChiamataDecimal.autonum;
|
||||
|
||||
cpwarnSerialeDecimal = await leggiCpwarnSerialeDecimal(ten, "prog\\SERCHI\\");
|
||||
serialeChiamata = Convert.ToString(cpwarnSerialeDecimal.autonum);
|
||||
tablecodeSer = cpwarnSerialeDecimal.tablecode;
|
||||
warncodeSer = cpwarnSerialeDecimal.warncode;
|
||||
serialeLetto = cpwarnSerialeDecimal.autonum;
|
||||
|
||||
break;
|
||||
}
|
||||
cpwarnSerialeDecimal = await leggiCpwarnSerialeDecimal(ten, "prog\\SERCHI\\");
|
||||
serialeChiamata = Convert.ToString(cpwarnSerialeDecimal.autonum);
|
||||
tablecodeSer = cpwarnSerialeDecimal.tablecode;
|
||||
warncodeSer = cpwarnSerialeDecimal.warncode;
|
||||
serialeLetto = cpwarnSerialeDecimal.autonum;
|
||||
|
||||
//inserisco
|
||||
//2024-04-23: codice_commessa posto a nullable (quando inserisco una chiamata selezionando solo l'impianto)
|
||||
@ -11657,7 +11536,6 @@ namespace ApiPolo.Controllers
|
||||
serial_comm = await leggiSerialeByCodCommessa(ten, codice_commessa);
|
||||
}
|
||||
|
||||
//tOut.uscita = await inserimentoChiamata2(ten, tecnico, codimp, serialeChiamata, progChiamata, serial_comm,ten);
|
||||
tOut.uscita = await inserimentoChiamata2(tenConf, tecnico, codimp, serialeChiamata, progChiamata, serial_comm, ten, tenConf);
|
||||
|
||||
//aggiornamento seriali e progressivi
|
||||
@ -11669,47 +11547,7 @@ namespace ApiPolo.Controllers
|
||||
|
||||
progressivoLetto = progressivoLetto + 1;
|
||||
tOut.prog_Out = await aggiornaprogressivoDecimal(ten, progressivoLetto, tablecodeProg, warncodeProg);
|
||||
|
||||
//switch (ten)
|
||||
//{
|
||||
|
||||
// case Clienti.PMS:
|
||||
|
||||
// serialeUpdate = tOut.uscita.chserial;
|
||||
// serialeLetto = serialeLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, serialeLetto, tablecodeSer, warncodeSer);
|
||||
|
||||
// progressivoLetto = progressivoLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, progressivoLetto, tablecodeProg, warncodeProg);
|
||||
// break;
|
||||
// case Clienti.LW:
|
||||
// serialeUpdate = tOut.uscita.chserial;
|
||||
// serialeLetto = serialeLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, serialeLetto, tablecodeSer, warncodeSer);
|
||||
|
||||
// progressivoLetto = progressivoLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, progressivoLetto, tablecodeProg, warncodeProg);
|
||||
// break;
|
||||
|
||||
|
||||
// case Clienti.Syscom:
|
||||
// serialeUpdate = tOut.uscita.chserial;
|
||||
// serialeLetto = serialeLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, serialeLetto, tablecodeSer, warncodeSer);
|
||||
|
||||
// progressivoLetto = progressivoLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, progressivoLetto, tablecodeProg, warncodeProg);
|
||||
// break;
|
||||
// case Clienti.Maras:
|
||||
// serialeUpdate = tOut.uscita.chserial;
|
||||
// serialeLetto = serialeLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, serialeLetto, tablecodeSer, warncodeSer);
|
||||
|
||||
// progressivoLetto = progressivoLetto + 1;
|
||||
// tOut.prog_Out = await aggiornaprogressivoDecimal(ten, progressivoLetto, tablecodeProg, warncodeProg);
|
||||
// break;
|
||||
//}
|
||||
|
||||
|
||||
i.codice_impianto = tOut.uscita.chcodimp;
|
||||
i.seriale_chiamata = tOut.uscita.chserial;
|
||||
i.ora_ini_rapportino = Convert.ToString(tOut.uscita.chora);
|
||||
@ -11786,51 +11624,7 @@ namespace ApiPolo.Controllers
|
||||
|
||||
return r;
|
||||
}
|
||||
private Output_Ricerca fillOutputRicercaVT(CommesseVT i)
|
||||
{
|
||||
Output_Ricerca r = new Output_Ricerca();
|
||||
|
||||
r.codice_commessa = i.lacodcom;
|
||||
r.desc_commessa = i.lacodcom;
|
||||
|
||||
r.tipo_cliente_comm = i.latipcli;
|
||||
r.cliente_comm = i.lacodcli;
|
||||
r.dt_fine_validita = i.ladatchi;
|
||||
r.codice_impianto = i.imcodimp;
|
||||
r.imindiri1 = i.imindiri1;
|
||||
r.imindiri2 = i.imindiri2;
|
||||
r.imindiri3 = i.imindiri3;
|
||||
r.imindiri4 = i.imindiri4;
|
||||
r.imindiri5 = i.imindiri5;
|
||||
r.desc_cliente_comm = i.andescri;
|
||||
r.cap_impianto = i.imcodcap;
|
||||
r.provincia_impianto = i.improvin;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
string commessa = !string.IsNullOrEmpty(i.lacodcom) ? i.lacodcom.Trim() : string.Empty;
|
||||
if (!string.IsNullOrEmpty(i.ladeslav))
|
||||
{
|
||||
commessa = commessa + " - " + i.ladeslav.Trim();
|
||||
}
|
||||
|
||||
sb.AppendLine("<b>Comm: <b>" + commessa);
|
||||
|
||||
if (!string.IsNullOrEmpty(i.imcodimp))
|
||||
{
|
||||
sb.AppendLine("<b>Imp: <b>" + i.imcodimp);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(i.andescri))
|
||||
{
|
||||
string appoCli = i.andescri;
|
||||
appoCli = appoCli.Substring(0, 25);
|
||||
sb.AppendLine("<b>Cli <b>" + appoCli);
|
||||
}
|
||||
r.itemList = sb.ToString();
|
||||
sb.Clear();
|
||||
|
||||
return r;
|
||||
}
|
||||
private Output_Ricerca fillOutputRicercaByImpianto(Impianto i)
|
||||
{
|
||||
Output_Ricerca r = new Output_Ricerca();
|
||||
@ -11864,15 +11658,13 @@ namespace ApiPolo.Controllers
|
||||
string sca = !string.IsNullOrEmpty(i.imindiri5) ? i.imindiri5.Trim() : string.Empty;
|
||||
|
||||
string appo = string.Empty;
|
||||
appo = via + indiri + num + num2 + sca;
|
||||
|
||||
if (!string.IsNullOrEmpty(via)) appo=appo+via;
|
||||
if (!string.IsNullOrEmpty(indiri)) appo = appo + " "+indiri;
|
||||
if (!string.IsNullOrEmpty(num)) appo = appo + " ," + num;
|
||||
if (!string.IsNullOrEmpty(num2)) appo = appo + " Int: " + num2;
|
||||
if (!string.IsNullOrEmpty(sca)) appo = appo + " Scala: " + sca;
|
||||
|
||||
|
||||
|
||||
sb.AppendLine(appo);
|
||||
if (!string.IsNullOrEmpty( i.imrefref))
|
||||
{
|
||||
@ -11966,104 +11758,7 @@ namespace ApiPolo.Controllers
|
||||
|
||||
return o;
|
||||
}
|
||||
private async Task<ChiamateTableTaskManager> fillChiamateTableTaskManagerInput(ChiamateTableTaskManager i, string codimp, string tecnico, string tenant, string serialeLetto, string progLetto, string seriale_commessa)
|
||||
{
|
||||
|
||||
DateTime adesso = DateTime.Now;
|
||||
ChiamateTableTaskManager o = new ChiamateTableTaskManager();
|
||||
string codiceEsercizio = string.Empty;
|
||||
codiceEsercizio = Convert.ToString(adesso.Year);
|
||||
string nuovoSeriale = string.Empty;
|
||||
nuovoSeriale = getNuovoSerialeChiamata(serialeLetto);
|
||||
|
||||
o.chcodazi = i.chcodazi;
|
||||
o.chserial = nuovoSeriale;
|
||||
//o.chtipo = i.chtipo; scrivo tipo A per distinguere le chiamate normali da quelle inserite da app
|
||||
o.chtipo = "X";
|
||||
o.chcodese = codiceEsercizio;
|
||||
o.chnumero = Convert.ToDecimal(progLetto) + 1;
|
||||
o.chdata = adesso.Date;
|
||||
o.chora = adesso.Hour;
|
||||
o.chmin = adesso.Minute;
|
||||
o.chopins = i.chopins;
|
||||
o.chopass = i.chopass;
|
||||
o.chopchi = i.chopchi;
|
||||
o.chcodimp = codimp;
|
||||
o.chaziimp = i.chaziimp;
|
||||
|
||||
o.chtchiam = tecnico;
|
||||
o.chtmanut = i.chtmanut;
|
||||
o.chstato = "C";
|
||||
o.chdtapp = adesso.Date;
|
||||
o.choraapi = adesso.Hour;
|
||||
o.chminapi = adesso.Minute;
|
||||
o.choraapf = adesso.Hour + 1;
|
||||
o.chminapf = adesso.Minute;
|
||||
|
||||
//TODO il seriale della commessa lo devo avere e lo memorizzo qui
|
||||
//per ora prendo quello che scrivo sul template; poi quello che mi viene passato dalla ricerca
|
||||
o.chrifer = seriale_commessa;
|
||||
o.chtelef = i.chtelef;
|
||||
|
||||
o.chcodseg = i.chcodseg;
|
||||
o.chstopi = i.chstopi;
|
||||
o.chnote = i.chnote;
|
||||
o.chdtass = adesso.Date;
|
||||
o.chorass = adesso.Hour;
|
||||
o.chminass = adesso.Minute;
|
||||
o.chdtchi = i.chdtchi;
|
||||
o.chorachi = i.chorachi;
|
||||
o.chminchi = i.chminchi;
|
||||
o.chdtlin = i.chdtlin;
|
||||
o.chorali = i.chorali;
|
||||
o.chminli = i.chminli;
|
||||
|
||||
o.chdtlfi = i.chdtlfi;
|
||||
o.choralf = i.choralf;
|
||||
o.chminlf = i.chminlf;
|
||||
o.chvalfat = i.chvalfat;
|
||||
o.cpccchk = getCpccchk(10);
|
||||
o.chnrap1 = i.chnrap1;
|
||||
o.chsrap1 = i.chsrap1;
|
||||
o.chnrap2 = i.chnrap2;
|
||||
o.chsrap2 = i.chsrap2;
|
||||
o.chmodrac = i.chmodrac;
|
||||
o.chprgann = i.chprgann;
|
||||
o.chserchi = i.chserchi;
|
||||
o.chdesfat = i.chdesfat;
|
||||
o.chdessup = i.chdessup;
|
||||
o.chimpofa = i.chimpofa;
|
||||
o.chserdoc = i.chserdoc;
|
||||
o.chimpmat = i.chimpmat;
|
||||
o.chimpman = i.chimpman;
|
||||
o.chperman = i.chperman;
|
||||
o.chfleste = i.chfleste;
|
||||
o.chflstim = i.chflstim;
|
||||
o.chserext = i.chserext;
|
||||
o.chrifiutata = i.chrifiutata;
|
||||
|
||||
//o.chincarico = i.chincarico;
|
||||
//o.chserweb = i.chserweb;
|
||||
//o.chinlinea = i.chinlinea;
|
||||
//o.chtelesan = i.chtelesan;
|
||||
string _cli = string.Empty;
|
||||
_cli = await getCodCliByImp(tenant, codimp);
|
||||
o.cliente = _cli;
|
||||
return o;
|
||||
}
|
||||
private async Task<string> getCodCliByImp(string tenant, string codiceImpianto)
|
||||
{
|
||||
string codiceCliente = string.Empty;
|
||||
_impianto = getImpiantiByTenant(tenant);
|
||||
|
||||
var i = await _impianto.Where(t => t.imcodimp!=null && t.imcodimp.Equals(codiceImpianto)).ToListAsync();
|
||||
if(i!=null)
|
||||
{
|
||||
codiceCliente = i.First().imultcli;
|
||||
}
|
||||
|
||||
return codiceCliente;
|
||||
}
|
||||
private string getNuovoSerialeChiamata(string lastSerial)
|
||||
{
|
||||
//lunghezza 10 fissa
|
||||
@ -12255,132 +11950,6 @@ namespace ApiPolo.Controllers
|
||||
}
|
||||
return calltec_out;
|
||||
}
|
||||
private async Task<ChiamataSeriale_out> aggiornaSeriale(string tenant, string nuovoSeriale)
|
||||
{
|
||||
ChiamataSeriale_out cso = new ChiamataSeriale_out();
|
||||
|
||||
string cpcccchk = getCpccchk(10);
|
||||
//scrittura
|
||||
/*
|
||||
switch (tenant)
|
||||
{
|
||||
case Clienti.Marrocco:
|
||||
using (var transaction = _Marro_chiaser.Database.BeginTransaction())
|
||||
{
|
||||
ChiamataSeriale entitasViewModel = _chiamateser.Where(p => p.piditta.Equals(tenant)).FirstOrDefault();
|
||||
entitasViewModel.pinumero = nuovoSeriale;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
_Marro_chiaser.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Marro_chiaser.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Gitoga:
|
||||
using (var transaction = _Gitoga_chiaser.Database.BeginTransaction())
|
||||
{
|
||||
ChiamataSeriale entitasViewModel = _chiamateser.Where(p => p.piditta.Equals(tenant)).FirstOrDefault();
|
||||
entitasViewModel.pinumero = nuovoSeriale;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
_Gitoga_chiaser.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Gitoga_chiaser.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Lifta:
|
||||
using (var transaction = _Lifta_chiaser.Database.BeginTransaction())
|
||||
{
|
||||
ChiamataSeriale entitasViewModel = _chiamateser.Where(p => p.piditta.Equals(tenant)).FirstOrDefault();
|
||||
entitasViewModel.pinumero = nuovoSeriale;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
_Lifta_chiaser.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Lifta_chiaser.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Siet:
|
||||
using (var transactionSiet = _Siet_chiaser.Database.BeginTransaction())
|
||||
{
|
||||
ChiamataSeriale entitasViewModel = _chiamateser.Where(p => p.piditta.Equals(tenant)).FirstOrDefault();
|
||||
entitasViewModel.pinumero = nuovoSeriale;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
_Siet_chiaser.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Siet_chiaser.SaveChangesAsync();
|
||||
transactionSiet.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Sicilia:
|
||||
using (var transactionSicilia = _Sicilia_chiaser.Database.BeginTransaction())
|
||||
{
|
||||
ChiamataSeriale entitasViewModel = _chiamateser.Where(p => p.piditta.Equals(tenant)).FirstOrDefault();
|
||||
entitasViewModel.pinumero = nuovoSeriale;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
_Sicilia_chiaser.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Sicilia_chiaser.SaveChangesAsync();
|
||||
transactionSicilia.Commit();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
return cso;
|
||||
}
|
||||
private async Task<Prog_out> aggiornaprogressivo(string tenant, float nuovoProg,string tablecode,string warncode)
|
||||
{
|
||||
Prog_out cso = new Prog_out();
|
||||
|
||||
string cpcccchk = getCpccchk(10);
|
||||
//scrittura
|
||||
/*
|
||||
switch (tenant)
|
||||
{
|
||||
case Clienti.Marrocco:
|
||||
case Clienti.Gitoga:
|
||||
case Clienti.Lifta:
|
||||
using (var transaction = _Marro_chiaprog.Database.BeginTransaction())
|
||||
{
|
||||
Prog entitasViewModel = _chiamateprogr.Where(p => p.tablecode.Equals(tablecode)&& p.warncode.Equals(warncode)).FirstOrDefault();
|
||||
entitasViewModel.autonum = nuovoProg;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
|
||||
_Marro_chiaprog.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Marro_chiaprog.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Siet:
|
||||
using (var transactionSiet = _Siet_chiaprog.Database.BeginTransaction())
|
||||
{
|
||||
Prog entitasViewModel = _chiamateprogr.Where(p => p.tablecode.Equals(tablecode) && p.warncode.Equals(warncode)).FirstOrDefault();
|
||||
entitasViewModel.autonum = nuovoProg;
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
|
||||
_Siet_chiaprog.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Siet_chiaprog.SaveChangesAsync();
|
||||
transactionSiet.Commit();
|
||||
}
|
||||
break;
|
||||
case Clienti.Sicilia:
|
||||
using (var transactionSicilia = _Sicilia_cpwarn.Database.BeginTransaction())
|
||||
{
|
||||
_cpwarns = getCpwarnByTenant(tenant);
|
||||
Prog2 entitasViewModel = _cpwarns.Where(p => p.tablecode.Equals(tablecode) && p.warncode.Equals(warncode)).FirstOrDefault();
|
||||
entitasViewModel.autonum = Convert.ToDecimal( nuovoProg);
|
||||
entitasViewModel.cpccchk = cpcccchk;
|
||||
|
||||
_Sicilia_cpwarn.Entry(entitasViewModel).State = EntityState.Modified;
|
||||
await _Sicilia_cpwarn.SaveChangesAsync();
|
||||
transactionSicilia.Commit();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
return cso;
|
||||
}
|
||||
private async Task<Prog_out> aggiornaprogressivoDecimal(string tenant, decimal? nuovoProg, string tablecode, string warncode)
|
||||
{
|
||||
Prog_out cso = new Prog_out();
|
||||
@ -12455,23 +12024,6 @@ namespace ApiPolo.Controllers
|
||||
*/
|
||||
return cso;
|
||||
}
|
||||
|
||||
private async Task<Prog> leggiCpwarnSeriale(string tenant, string tablecode)
|
||||
{
|
||||
//autorun float
|
||||
//_chiamateprogr = getChiamateProgressiviByTenant(tenant);
|
||||
//var cpwarn = await _chiamateprogr.Where(p => p.tablecode != null && p.tablecode.Contains(tablecode) && p.tablecode.Contains(tenant)).FirstAsync();
|
||||
Prog cpwarn = new Prog();
|
||||
return cpwarn;
|
||||
}
|
||||
private async Task<Prog> leggiCpwarnProg(string tenant, string tablecode, string codiceEsercizio)
|
||||
{
|
||||
//autorun float
|
||||
//_chiamateprogr = getChiamateProgressiviByTenant(tenant);
|
||||
//var cpwarn = await _chiamateprogr.Where(p => p.tablecode != null && p.tablecode.Contains(tablecode) && p.tablecode.Contains(codiceEsercizio) && p.tablecode.Contains(tenant)).FirstAsync();
|
||||
Prog cpwarn = new Prog();
|
||||
return cpwarn;
|
||||
}
|
||||
private async Task<Prog2> leggiCpwarnProgDecimal(string tenant, string tablecode, string codiceEsercizio)
|
||||
{
|
||||
string _ten = tenant;
|
||||
|
||||
@ -1,195 +0,0 @@
|
||||
using ApiPolo.Interfaces;
|
||||
using ApiPolo.Models;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ApiPolo.Data
|
||||
{
|
||||
/// <summary></summary>
|
||||
public class Maras_DbContext : DbContext,ITenantDbContext
|
||||
{
|
||||
#region PROPERTIES
|
||||
public DbSet<Caus_Rapp>? Causali { get; set; }
|
||||
|
||||
public DbSet<Chiusure>? Chiusure { get; set; }
|
||||
|
||||
public DbSet<AziendaRif>? Azi { get; set; }
|
||||
|
||||
public DbSet<CC_CI>? ccci { get; set; }
|
||||
|
||||
public DbSet<CC_CIWiev>? ccciWiev { get; set; }
|
||||
|
||||
public DbSet<Chiamate>? Chiamate { get; set; }
|
||||
|
||||
public DbSet<Anag>? Clienti { get; set; }
|
||||
|
||||
public DbSet<Compo_Impia_Table>? Componen { get; set; } // IN CONFLITTO CON Compo_Impia
|
||||
|
||||
//public DbSet<Compo_Impia>? Componen { get; set; } //CAMBIARE NOME!!!
|
||||
|
||||
public DbSet<Impianto>? Impia { get; set; }
|
||||
|
||||
public DbSet<Mag_New>? Mag { get; set; }
|
||||
|
||||
public DbSet<Magazzini>? Magaz { get; set; }
|
||||
|
||||
public DbSet<Manprog>? Manutenzioni { get; set; }
|
||||
|
||||
public DbSet<Pagam>? Pagamenti { get; set; }
|
||||
|
||||
public DbSet<Prese>? Prese { get; set; }
|
||||
|
||||
public DbSet<Rapp_New>? Rapps { get; set; }
|
||||
|
||||
public DbSet<Rappmast>? rapp { get; set; }
|
||||
|
||||
public DbSet<Sostituzione>? Sost { get; set; }
|
||||
|
||||
public DbSet<Saldiart>? Saldi { get; set; }
|
||||
|
||||
public DbSet<Sto_Rapp>? StoRapp { get; set; }
|
||||
|
||||
public DbSet<Tecnici>? Tecnici { get; set; }
|
||||
public DbSet<Sto_Imp>? StoImp { get; set; }
|
||||
|
||||
public DbSet<Timbratura>? Timbr { get; set; }
|
||||
|
||||
public DbSet<Commessa>? Commesse { get; set; }
|
||||
|
||||
public DbSet<Prog2>? Prog { get; set; }
|
||||
//public DbSet<Prog>? Progressivi { get; set; }
|
||||
//public DbSet<Compo_Impia>? Compo { get; set; }
|
||||
public DbSet<ChiamateTable>? ChiamateTables { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private readonly DbContextOptions<Maras_DbContext> _options;
|
||||
/// <summary></summary>
|
||||
public Maras_DbContext(DbContextOptions<Maras_DbContext> options) : base(options)
|
||||
{
|
||||
_options = options;
|
||||
}
|
||||
|
||||
/// <summary></summary>
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
void TryConfigureEntity(Action<ModelBuilder> configure, string entityName)
|
||||
{
|
||||
try
|
||||
{
|
||||
configure(modelBuilder);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Warning: Skipping entity '{entityName}' due to error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Caus_Rapp>().ToView("API_CAUS_RAPP"), "API_CAUS_RAPP");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Chiusure>().ToView("API_CHIUSURE"), "API_CHIUSURE");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<AziendaRif>().ToTable("PIAZIRIF");
|
||||
mb.Entity<AziendaRif>().HasKey(table => new
|
||||
{
|
||||
table.piazihoc,
|
||||
table.picodtec,
|
||||
table.pirifazi
|
||||
});
|
||||
}, "PIAZIRIF");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<CC_CI>().ToTable("PIASSCHIU");
|
||||
mb.Entity<CC_CI>().HasKey(table => new
|
||||
{
|
||||
table.picodazi,
|
||||
table.picodint,
|
||||
table.picodchi
|
||||
});
|
||||
}, "PIASSCHIU");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<CC_CIWiev>().ToView("API_ASSCHIU"), "API_ASSCHIU");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Chiamate>().ToView("API_CHIAMATE"), "API_CHIAMATE");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Anag>().ToView("API_CLIENTI"), "API_CLIENTI");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<Compo_Impia_Table>().ToTable("DISCOMICOMIMP");
|
||||
mb.Entity<Compo_Impia_Table>().HasKey(table => new
|
||||
{
|
||||
table.cocodimp,
|
||||
table.cprownum,
|
||||
table.cocodazi
|
||||
});
|
||||
}, "DISCOMICOMIMP");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Compo_Impia>().ToView("API_MICOMIMP"), "API_MICOMIMP");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Impianto>().ToView("API_IMPIANTI"), "API_IMPIANTI");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<Mag_New>().ToTable("DISCOMAG_NEW");
|
||||
mb.Entity<Mag_New>().HasKey(table => new
|
||||
{
|
||||
table.seriale_rapportino,
|
||||
table.riga
|
||||
});
|
||||
}, "DISCOMAG_NEW");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Magazzini>().ToTable("DISCOMAGAZZIN"), "DISCOMAGAZZIN");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Manprog>().ToView("API_MANPROG"), "API_MANPROG");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Pagam>().ToView("API_PAGAMENTI"), "API_PAGAMENTI");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<Prese>().ToTable("PIPRESA");
|
||||
mb.Entity<Prese>().HasKey(table => new
|
||||
{
|
||||
table.picodazi,
|
||||
table.pimpianto,
|
||||
table.picodint,
|
||||
table.pidatman
|
||||
});
|
||||
}, "PIPRESA");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Rapp_New>().ToTable("RAPP_NEW"), "RAPP_NEW");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Rappmast>().ToView("API_RAPPORTINI"), "API_RAPPORTINI");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Saldiart>().ToView("API_SALDIART_PREZZI"), "API_SALDIART_PREZZI");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Sostituzione>().ToView("API_SOSTITUZIONI"), "API_SOSTITUZIONI");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Sto_Rapp>().ToView("API_STO_RAPP"), "API_STO_RAPP");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Tecnici>().ToView("API_TECNICI"), "API_TECNICI");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Timbratura>().ToTable("TIMBRATURE"), "TIMBRATURE");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Commessa>().ToView("API_COMMESSE"), "API_COMMESSE");
|
||||
|
||||
TryConfigureEntity(mb => mb.Entity<Sto_Imp>().ToView("API_STO_IMP"), "API_STO_IMP");
|
||||
|
||||
TryConfigureEntity(mb =>
|
||||
{
|
||||
mb.Entity<Prog2>().ToTable("CPWARN");
|
||||
mb.Entity<Prog2>().HasKey(table => new
|
||||
{
|
||||
table.tablecode,
|
||||
table.warncode
|
||||
});
|
||||
}, "CPWARN");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace ApiPolo.Data
|
||||
|
||||
public DbSet<Prog2>? Prog { get; set; }
|
||||
//public DbSet<Prog>? Progressivi { get; set; }
|
||||
//public DbSet<Compo_Impia>? Compo { get; set; }
|
||||
public DbSet<Compo_Impia>? Compo { get; set; }
|
||||
|
||||
public DbSet<ChiamateTable>? ChiamateTables { get; set; }
|
||||
#endregion
|
||||
|
||||
@ -152,5 +152,28 @@ namespace ApiPolo
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Scrive su Mag_new: prendi in carico, rifiuta, chiudi</summary>
|
||||
public async Task AddMagNewToDbAsync(string tenant, Mag_New model)
|
||||
{
|
||||
|
||||
var dbContext = _dbContextFactory.GetDbContext(tenant);
|
||||
|
||||
string mex = string.Empty;
|
||||
try
|
||||
{
|
||||
using (var transaction = await dbContext.Database.BeginTransactionAsync())
|
||||
{
|
||||
await dbContext.Mag.AddAsync(model);
|
||||
await dbContext.SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mex = ex.Message;
|
||||
throw new InvalidOperationException("Error in Service - AddRappNewToDbAsync: " + mex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1005,9 +1005,7 @@ namespace ApiPolo
|
||||
*/
|
||||
|
||||
|
||||
services.AddDbContext<Maras_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARAS")
|
||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||
));
|
||||
|
||||
|
||||
|
||||
// FACTORY MUTI-TENANT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user