ApiManutenzioni/ApiPolo/Controllers/TestController.cs
2025-03-24 14:00:32 +01:00

792 lines
51 KiB
C#

using ApiPolo.Interfaces;
using ApiPolo.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.IdentityModel.Tokens.Jwt;
using System.Text;
using static ApiPolo.Controllers.PoloController;
namespace ApiPolo.Controllers
{
/// <summary></summary>
public class TestController : Controller
{
//interfaccia con tutti i possibili dbset
private readonly ITenantDbContextFactory _dbContextFactory;
//DI con ITenantDbContextFactory
/// <summary></summary>
private DbSet<Chiamate>? _chiamate;
public TestController(ITenantDbContextFactory dbContextFactory)
{
_dbContextFactory = dbContextFactory;
}
//ATTENZIONE - CONFLITTO TRA Compo_Impia_Table e
#region GET_BY_TENANT
private DbSet<Tecnici> getTecniciByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Tecnici; // Use Set<T>() to handle different DbContexts
}
private DbSet<Rapp_New> getRappNewByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Rapps; // Use Set<T>() to handle different DbContexts
}
private DbSet<Chiamate> getChiamateByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Chiamate; // Use Set<T>() to handle different DbContexts
}
private DbSet<Chiusure>? getChiusureByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Chiusure;
}
private DbSet<Manprog> getManutenzioniByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Manutenzioni; // Use Set<T>() to handle different DbContexts
}
private DbSet<Prese> getPreseByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Prese; // Use Set<T>() to handle different DbContexts
}
private DbSet<Sto_Rapp> getSto_RappByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.StoRapp; // Use Set<T>() to handle different DbContexts
}
private DbSet<Anag> getClientiByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Clienti; // Use Set<T>() to handle different DbContexts
}
private DbSet<Caus_Rapp> getCausaliRappByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Causali; // Use Set<T>() to handle different DbContexts
}
private DbSet<Pagam> getPagamentiByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Pagamenti; // Use Set<T>() to handle different DbContexts
}
private DbSet<Saldiart> getSaldiartByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Saldi; // 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
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Componen; // Use Set<T>() to handle different DbContexts
}*/
private DbSet<Compo_Impia_Table> getComponentiTableByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Componen; // Use Set<T>() to handle different DbContexts
}
private DbSet<Magazzini> getMagazziniByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Magaz; // Use Set<T>() to handle different DbContexts
}
private DbSet<Mag_New> getMag_NewByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Mag; // Use Set<T>() to handle different DbContexts
}
private DbSet<Impianto> getImpiantiByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Impia; // Use Set<T>() to handle different DbContexts
}
private DbSet<Commessa> getCommesseByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Commesse; // Use Set<T>() to handle different DbContexts
}
private DbSet<Timbratura> getTimbratureByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Timbr; // Use Set<T>() to handle different DbContexts
}
private DbSet<Sto_Imp> getStoricoImpiantoByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.StoImp; // Use Set<T>() to handle different DbContexts
}
private DbSet<AziendaRif> getAziendeRifByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Azi; // Use Set<T>() to handle different DbContexts
}
private DbSet<Sostituzione> getSostituzioneByTenant(string tenant)
{
var dbContext = _dbContextFactory.GetDbContext(tenant);
return dbContext.Sost; // Use Set<T>() to handle different DbContexts
}
#endregion
#region utility
private string getClaimValueByToken(string token, string claimName)
{
string t = string.Empty;
var handler = new JwtSecurityTokenHandler();
var jwtSecurityToken = handler.ReadJwtToken(token);
if (jwtSecurityToken != null)
{
var id = jwtSecurityToken.Claims.First(claim => claim.Type == claimName).Value;
t = id;
}
return t;
}
private Chiamate_out fillChiamateOut(Chiamate i, string tenant)
{
Chiamate_out o = new Chiamate_out();
o.chcodazi = i.chcodazi;
o.chserial = i.chserial;
o.chstato = i.chstato;
o.chtchiam = i.chtchiam;
o.chdtapp = i.chdtapp;
o.choraaPI = i.choraaPI;
o.chminapi = i.chminapi;
o.chnote = i.chnote;
o.chcodimp = i.chcodimp;
o.csdescr = i.csdescr;
o.antelefo = i.antelefo;
o.andescri = i.andescri;
o.imindiri1 = i.imindiri1;
o.imindiri2 = i.imindiri2;
o.imindiri3 = i.imindiri3;
o.imindiri4 = i.imindiri4;
o.imindiri5 = i.imindiri5;
o.imlocali = i.imlocali;
o.imrefref = i.imrefref;
//costruisco il campo indirizzo
StringBuilder sb = new StringBuilder();
string chiamataIndStampa = string.Empty;
switch (tenant)
{
case Clienti.Marrocco:
#region marrocco
chiamataIndStampa = formattaIndirizzoStampaMarrocco(i);
#endregion
break;
case Clienti.Gitoga:
#region gitoga
chiamataIndStampa = formattaIndirizzoStampaMarrocco(i);
#endregion
break;
case Clienti.Lifta:
#region lifta
chiamataIndStampa = formattaIndirizzoStampaMarrocco(i);
#endregion
break;
case Clienti.Discovery:
#region Discovery
chiamataIndStampa = formattaIndirizzoStampaDiscovery(i);
#endregion
break;
case Clienti.Siet:
//ragione sociale cliente
sb.Append("<b>SPETT.LE :</b>");
sb.Append(!string.IsNullOrEmpty(i.andescri) ? i.andescri + " " : string.Empty);
sb.Append("<br>");
//indirizzo
sb.Append(!string.IsNullOrEmpty(i.imindiri1) ? i.imindiri1.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri2) ? i.imindiri2.Trim() + " " : string.Empty);
sb.Append(i.imindiri3 != null ? i.imindiri3.ToString() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri4) ? i.imindiri4.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri5) ? i.imindiri5.Trim() : string.Empty);
chiamataIndStampa = sb.ToString();
break;
default:
sb.Append("<b>SPETT.LE :</b>");
if (!string.IsNullOrEmpty(i.andescri))
{
sb.Append(!string.IsNullOrEmpty(i.andescri) ? i.andescri + " " : string.Empty);
sb.Append("<br>");
}
sb.Append(!string.IsNullOrEmpty(i.imindiri1) ? i.imindiri1.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri2) ? i.imindiri2.Trim() + " " : string.Empty);
sb.Append(i.imindiri3 != null ? i.imindiri3.ToString() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri4) ? i.imindiri4.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri5) ? i.imindiri5.Trim() : string.Empty);
chiamataIndStampa = sb.ToString();
break;
}
o.indirizzo_stampa = chiamataIndStampa;
sb.Clear();
string chiamataItemList = string.Empty;
switch (tenant)
{
case Clienti.Marrocco:
#region marrocco
chiamataItemList = formattaItemChiamateMarrocco(i);
#endregion
break;
case Clienti.Gitoga:
#region gitoga
chiamataItemList = formattaItemChiamateMarrocco(i);
#endregion
break;
case Clienti.Lifta:
#region lifta
chiamataItemList = formattaItemChiamateMarrocco(i);
#endregion
break;
case Clienti.Tedesco:
#region Tedesco
chiamataItemList = formattaItemChiamateTedesco(i);
#endregion
break;
case Clienti.VT:
chiamataItemList = formattaItemChiamateVT(i);
break;
default:
#region default
sb.Append(!string.IsNullOrEmpty(i.imindiri1) ? i.imindiri1.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri2) ? i.imindiri2.Trim() + " " : string.Empty);
sb.Append(i.imindiri3 != null ? i.imindiri3.ToString() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri4) ? i.imindiri4.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imindiri5) ? i.imindiri5.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imcodcap) ? " " + i.imcodcap.Trim() + " " : string.Empty);
sb.Append(!string.IsNullOrEmpty(i.imlocali) ? " " + i.imlocali.Trim() + " " : string.Empty);
if (!string.IsNullOrEmpty(i.chcodimp))
{
sb.Append("<br>");
sb.Append("<b>Impianto</b> : " + i.chcodimp.Trim());
}
chiamataItemList = sb.ToString();
break;
#endregion
}
o.impianto_list = chiamataItemList;
sb.Clear();
string rif_impianto = string.Empty;
switch (tenant)
{
case Clienti.Marrocco:
#region marrocco
rif_impianto = formattaRiferimentoImpiantoMarrocco(i);
#endregion
break;
case Clienti.Gitoga:
#region gitoga
rif_impianto = formattaRiferimentoImpiantoMarrocco(i);
#endregion
break;
case Clienti.Lifta:
#region lifta
rif_impianto = formattaRiferimentoImpiantoMarrocco(i);
#endregion
break;
case Clienti.Discovery:
#region discovery
rif_impianto = formattaRiferimentoImpiantoDiscovery(i);
#endregion
break;
case Clienti.Ferrari:
#region ferrari
rif_impianto = formattaRiferimentoImpiantoFerrari(i);
#endregion
break;
case Clienti.Siet:
#region SIET
sb.AppendLine("<b>N. Impianto: </b> " + i.chcodimp);
if (!string.IsNullOrEmpty(i.imubicaz))
{
sb.AppendLine("<b>Ubicazione: </b> " + i.imubicaz);
}
if (!string.IsNullOrEmpty(i.chrifer))
{
string comm = getCommessaSietBySerial(i.chrifer);
if (!string.IsNullOrEmpty(comm))
{
sb.AppendLine("<b>Commessa: </b> " + comm);
}
}
rif_impianto = sb.ToString();
#endregion
break;
default:
sb.AppendLine("<b>N. Impianto: </b> " + i.chcodimp);
if (!string.IsNullOrEmpty(i.imubicaz))
sb.AppendLine("<b>Ubicazione: </b> " + i.imubicaz);
rif_impianto = sb.ToString();
break;
}
o.riferimento_impianto = rif_impianto;
sb.Clear();
o.imcodcap = i.imcodcap;
o.imcomune = i.imcomune;
o.improvin = i.improvin;
o.imcodnaz = i.imcodnaz;
o.immatric = i.immatric;
o.imnumimp = i.imnumimp;
o.imubicaz = i.imubicaz;
o.tcdescri = i.tcdescri;
o.tccodice = i.tccodice;
o.ser_rapp_ic = i.ser_rapp_ic;
o.tipo_rapp_ic = i.tipo_rapp_ic;
o.ic = i.ic;
o.ser_rapp_rif = i.ser_rapp_rif;
o.tipo_rapp_rif = i.tipo_rapp_rif;
o.rif = i.rif;
o.ser_rapp_chiu = i.ser_rapp_chiu;
o.tipo_rapp_chiu = i.tipo_rapp_chiu;
o.ser_buono_chiu = i.ser_buono_chiu;
o.err_title = i.err_title;
o.err_detail = i.err_detail;
o.err_status_code = i.err_status_code;
o.ancodice = i.ancodice;
o.chiamata = i.chiamata;
o.spe_viaggio = i.spe_viaggio;
o.chnumero = i.chnumero;
Dictionary<string, string> dic = new Dictionary<string, string>();
switch (tenant)
{
case Clienti.Marrocco:
#region marrocco
dic.Add("Esercizio ", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("REF ", !string.IsNullOrEmpty(i.imrefref) ? i.imrefref : String.Empty);
dic.Add("Riferimento:", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Telefono rif.:", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
#endregion
break;
case Clienti.Gitoga:
#region gitoga
dic.Add("Esercizio ", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("REF ", !string.IsNullOrEmpty(i.imrefref) ? i.imrefref : String.Empty);
dic.Add("Riferimento:", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Telefono rif.:", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
#endregion
break;
case Clienti.Lifta:
#region lifta
dic.Add("Esercizio ", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("REF ", !string.IsNullOrEmpty(i.imrefref) ? i.imrefref : String.Empty);
dic.Add("Riferimento:", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Telefono rif.:", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
#endregion
break;
case Clienti.Ferrari:
#region ferrari
dic.Add("Esercizio", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("Tipo", !string.IsNullOrEmpty(i.chtipo) ? i.chtipo : String.Empty);
dic.Add("Numero chiamata", !string.IsNullOrEmpty(i.chnumero.ToString()) ? i.chnumero.ToString() : String.Empty);
dic.Add("Data chiamata", !string.IsNullOrEmpty(i.chdata.ToString()) ? i.chdata.ToString() : String.Empty);
dic.Add("Ora inserimento chiamata", !string.IsNullOrEmpty(i.chora.ToString()) ? i.chora.ToString() : String.Empty);
dic.Add("Min inserimento chiamata", !string.IsNullOrEmpty(i.chmin.ToString()) ? i.chmin.ToString() : String.Empty);
dic.Add("Operatore assegnazione", !string.IsNullOrEmpty(i.chopass.ToString()) ? i.chopass.ToString() : String.Empty);
dic.Add("Operatore chiusura", !string.IsNullOrEmpty(i.chopchi.ToString()) ? i.chopchi.ToString() : String.Empty);
dic.Add("Azienda impianto", !string.IsNullOrEmpty(i.chaziimp) ? i.chaziimp : String.Empty);
dic.Add("Ora appuntamento fine", !string.IsNullOrEmpty(i.choraapf.ToString()) ? i.choraapf.ToString() : String.Empty);
dic.Add("Min appuntamento fine", !string.IsNullOrEmpty(i.chminapf.ToString()) ? i.chminapf.ToString() : String.Empty);
dic.Add("Riferimento chiamata", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Riferimento telefono", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
dic.Add("Codice segnalazione", !string.IsNullOrEmpty(i.chcodseg) ? i.chcodseg : String.Empty);
dic.Add("Fermo impianto", !string.IsNullOrEmpty(i.chstopi) ? i.chstopi : String.Empty);
dic.Add("Data assegnazione chiamata", !string.IsNullOrEmpty(i.chdtass.ToString()) ? i.chdtass.ToString() : String.Empty);
dic.Add("Ora assegnazione chiamata", !string.IsNullOrEmpty(i.chorass.ToString()) ? i.chorass.ToString() : String.Empty);
dic.Add("Min assegnazione chiamata", !string.IsNullOrEmpty(i.chminass.ToString()) ? i.chminass.ToString() : String.Empty);
dic.Add("Data chiusura chiamata", !string.IsNullOrEmpty(i.chdtchi.ToString()) ? i.chdtchi.ToString() : String.Empty);
dic.Add("Ora chiusura chiamata", !string.IsNullOrEmpty(i.chorachi.ToString()) ? i.chorachi.ToString() : String.Empty);
dic.Add("Min chiusura chiamata", !string.IsNullOrEmpty(i.chminchi.ToString()) ? i.chminchi.ToString() : String.Empty);
dic.Add("Data inizio intervento", !string.IsNullOrEmpty(i.chdtlin.ToString()) ? i.chdtlin.ToString() : String.Empty);
dic.Add("Ora inizio intervento", !string.IsNullOrEmpty(i.chorali.ToString()) ? i.chorali.ToString() : String.Empty);
dic.Add("Min inizio intervento", !string.IsNullOrEmpty(i.chminli.ToString()) ? i.chminli.ToString() : String.Empty);
dic.Add("Data fine intervento", !string.IsNullOrEmpty(i.chdtlfi.ToString()) ? i.chdtlfi.ToString() : String.Empty);
dic.Add("Ora fine intervento", !string.IsNullOrEmpty(i.choralf.ToString()) ? i.choralf.ToString() : String.Empty);
dic.Add("Min fine intervento", !string.IsNullOrEmpty(i.chminlf.ToString()) ? i.chminlf.ToString() : String.Empty);
dic.Add("Numero 1 rapportino futuro", !string.IsNullOrEmpty(i.chnrap1.ToString()) ? i.chnrap1.ToString() : String.Empty);
dic.Add("Serie 1 rapportino futuro", !string.IsNullOrEmpty(i.chsrap1) ? i.chsrap1 : String.Empty);
dic.Add("Numero 2 rapportino futuro", !string.IsNullOrEmpty(i.chnrap2.ToString()) ? i.chnrap2.ToString() : String.Empty);
dic.Add("Modalità raccolta chiamata", !string.IsNullOrEmpty(i.chmodrac) ? i.chmodrac : String.Empty);
dic.Add("Numero chiamata per impianto per anno", !string.IsNullOrEmpty(i.chprgann.ToString()) ? i.chprgann.ToString() : String.Empty);
dic.Add("Importo manodopera", !string.IsNullOrEmpty(i.chimpman.ToString()) ? i.chimpman.ToString() : String.Empty);
dic.Add("Percentuale manodopera", !string.IsNullOrEmpty(i.chperman.ToString()) ? i.chperman.ToString() : String.Empty);
dic.Add("Stampa manodopera", !string.IsNullOrEmpty(i.chflstim) ? i.chflstim : String.Empty);
dic.Add("Chiusura da remoto", !string.IsNullOrEmpty(i.chfleste) ? i.chfleste : String.Empty);
dic.Add("Riferimento seriale importazione", !string.IsNullOrEmpty(i.chserext) ? i.chserext : String.Empty);
dic.Add("Descrizione impianto", !string.IsNullOrEmpty(i.imdescri) ? i.imdescri : String.Empty);
dic.Add("Tipo impianto", !string.IsNullOrEmpty(i.imtipoim) ? i.imtipoim : String.Empty);
dic.Add("Matricola impianto ", !string.IsNullOrEmpty(i.immatric) ? i.immatric : String.Empty);
dic.Add("Numero impianto ", !string.IsNullOrEmpty(i.imnumimp) ? i.imnumimp : String.Empty);
dic.Add("Ultimo amministratore ", !string.IsNullOrEmpty(i.imultamm) ? i.imultamm : String.Empty);
dic.Add("Desc Ultimo amministratore ", !string.IsNullOrEmpty(i.imultdam) ? i.imultdam : String.Empty);
dic.Add("Telefono Ult. Amministratore", !string.IsNullOrEmpty(i.imulttam) ? i.imulttam : String.Empty);
dic.Add("Ubicazione impianto", !string.IsNullOrEmpty(i.imubicaz) ? i.imubicaz : String.Empty);
dic.Add("Zona manutenzione", !string.IsNullOrEmpty(i.imzonman) ? i.imzonman : String.Empty);
dic.Add("Pubblico/privato", !string.IsNullOrEmpty(i.imflpupr) ? i.imflpupr : String.Empty);
dic.Add("Zona chiamate", !string.IsNullOrEmpty(i.imzonchi) ? i.imzonchi : String.Empty);
dic.Add("Zona supervisione", !string.IsNullOrEmpty(i.imzonsup) ? i.imzonsup : String.Empty);
dic.Add("Data inizio manutenzione", i.imdainma != null ? i.imdainma.ToString() : String.Empty);
dic.Add("Data fine manutenzione", !string.IsNullOrEmpty(i.imdafima.ToString()) ? i.imdafima.ToString() : String.Empty);
dic.Add("Data costruzione", !string.IsNullOrEmpty(i.imdatcos.ToString()) ? i.imdatcos.ToString() : String.Empty);
dic.Add("Numero telesoccorso ", !string.IsNullOrEmpty(i.imteleso) ? i.imteleso : String.Empty);
dic.Add("Email cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Ultimo cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Codice cliente", !string.IsNullOrEmpty(i.ancodice) ? i.ancodice : String.Empty);
dic.Add("Tipo anagrafica", !string.IsNullOrEmpty(i.antipcon) ? i.antipcon : String.Empty);
#endregion
break;
case Clienti.Sicilia:
#region sicilia
dic.Add("Esercizio", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("Tipo", !string.IsNullOrEmpty(i.chtipo) ? i.chtipo : String.Empty);
dic.Add("Numero chiamata", !string.IsNullOrEmpty(i.chnumero.ToString()) ? i.chnumero.ToString() : String.Empty);
dic.Add("Data chiamata", !string.IsNullOrEmpty(i.chdata.ToString()) ? i.chdata.ToString() : String.Empty);
dic.Add("Ora inserimento chiamata", !string.IsNullOrEmpty(i.chora.ToString()) ? i.chora.ToString() : String.Empty);
dic.Add("Min inserimento chiamata", !string.IsNullOrEmpty(i.chmin.ToString()) ? i.chmin.ToString() : String.Empty);
dic.Add("Operatore assegnazione", !string.IsNullOrEmpty(i.chopass.ToString()) ? i.chopass.ToString() : String.Empty);
dic.Add("Operatore chiusura", !string.IsNullOrEmpty(i.chopchi.ToString()) ? i.chopchi.ToString() : String.Empty);
dic.Add("Azienda impianto", !string.IsNullOrEmpty(i.chaziimp) ? i.chaziimp : String.Empty);
dic.Add("Ora appuntamento fine", !string.IsNullOrEmpty(i.choraapf.ToString()) ? i.choraapf.ToString() : String.Empty);
dic.Add("Min appuntamento fine", !string.IsNullOrEmpty(i.chminapf.ToString()) ? i.chminapf.ToString() : String.Empty);
dic.Add("Riferimento chiamata", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Riferimento telefono", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
dic.Add("Codice segnalazione", !string.IsNullOrEmpty(i.chcodseg) ? i.chcodseg : String.Empty);
dic.Add("Fermo impianto", !string.IsNullOrEmpty(i.chstopi) ? i.chstopi : String.Empty);
dic.Add("Data assegnazione chiamata", !string.IsNullOrEmpty(i.chdtass.ToString()) ? i.chdtass.ToString() : String.Empty);
dic.Add("Ora assegnazione chiamata", !string.IsNullOrEmpty(i.chorass.ToString()) ? i.chorass.ToString() : String.Empty);
dic.Add("Min assegnazione chiamata", !string.IsNullOrEmpty(i.chminass.ToString()) ? i.chminass.ToString() : String.Empty);
dic.Add("Data chiusura chiamata", !string.IsNullOrEmpty(i.chdtchi.ToString()) ? i.chdtchi.ToString() : String.Empty);
dic.Add("Ora chiusura chiamata", !string.IsNullOrEmpty(i.chorachi.ToString()) ? i.chorachi.ToString() : String.Empty);
dic.Add("Min chiusura chiamata", !string.IsNullOrEmpty(i.chminchi.ToString()) ? i.chminchi.ToString() : String.Empty);
dic.Add("Data inizio intervento", !string.IsNullOrEmpty(i.chdtlin.ToString()) ? i.chdtlin.ToString() : String.Empty);
dic.Add("Ora inizio intervento", !string.IsNullOrEmpty(i.chorali.ToString()) ? i.chorali.ToString() : String.Empty);
dic.Add("Min inizio intervento", !string.IsNullOrEmpty(i.chminli.ToString()) ? i.chminli.ToString() : String.Empty);
dic.Add("Data fine intervento", !string.IsNullOrEmpty(i.chdtlfi.ToString()) ? i.chdtlfi.ToString() : String.Empty);
dic.Add("Ora fine intervento", !string.IsNullOrEmpty(i.choralf.ToString()) ? i.choralf.ToString() : String.Empty);
dic.Add("Min fine intervento", !string.IsNullOrEmpty(i.chminlf.ToString()) ? i.chminlf.ToString() : String.Empty);
dic.Add("Numero 1 rapportino futuro", !string.IsNullOrEmpty(i.chnrap1.ToString()) ? i.chnrap1.ToString() : String.Empty);
dic.Add("Serie 1 rapportino futuro", !string.IsNullOrEmpty(i.chsrap1) ? i.chsrap1 : String.Empty);
dic.Add("Numero 2 rapportino futuro", !string.IsNullOrEmpty(i.chnrap2.ToString()) ? i.chnrap2.ToString() : String.Empty);
dic.Add("Modalità raccolta chiamata", !string.IsNullOrEmpty(i.chmodrac) ? i.chmodrac : String.Empty);
dic.Add("Numero chiamata per impianto per anno", !string.IsNullOrEmpty(i.chprgann.ToString()) ? i.chprgann.ToString() : String.Empty);
dic.Add("Importo manodopera", !string.IsNullOrEmpty(i.chimpman.ToString()) ? i.chimpman.ToString() : String.Empty);
dic.Add("Percentuale manodopera", !string.IsNullOrEmpty(i.chperman.ToString()) ? i.chperman.ToString() : String.Empty);
dic.Add("Stampa manodopera", !string.IsNullOrEmpty(i.chflstim) ? i.chflstim : String.Empty);
dic.Add("Chiusura da remoto", !string.IsNullOrEmpty(i.chfleste) ? i.chfleste : String.Empty);
dic.Add("Riferimento seriale importazione", !string.IsNullOrEmpty(i.chserext) ? i.chserext : String.Empty);
dic.Add("Descrizione impianto", !string.IsNullOrEmpty(i.imdescri) ? i.imdescri : String.Empty);
dic.Add("Tipo impianto", !string.IsNullOrEmpty(i.imtipoim) ? i.imtipoim : String.Empty);
dic.Add("Matricola impianto ", !string.IsNullOrEmpty(i.immatric) ? i.immatric : String.Empty);
dic.Add("Numero impianto ", !string.IsNullOrEmpty(i.imnumimp) ? i.imnumimp : String.Empty);
dic.Add("Ultimo amministratore ", !string.IsNullOrEmpty(i.imultamm) ? i.imultamm : String.Empty);
dic.Add("Desc Ultimo amministratore ", !string.IsNullOrEmpty(i.imultdam) ? i.imultdam : String.Empty);
dic.Add("Telefono Ult. Amministratore", !string.IsNullOrEmpty(i.imulttam) ? i.imulttam : String.Empty);
dic.Add("Ubicazione impianto", !string.IsNullOrEmpty(i.imubicaz) ? i.imubicaz : String.Empty);
dic.Add("Zona manutenzione", !string.IsNullOrEmpty(i.imzonman) ? i.imzonman : String.Empty);
dic.Add("Pubblico/privato", !string.IsNullOrEmpty(i.imflpupr) ? i.imflpupr : String.Empty);
dic.Add("Zona chiamate", !string.IsNullOrEmpty(i.imzonchi) ? i.imzonchi : String.Empty);
dic.Add("Zona supervisione", !string.IsNullOrEmpty(i.imzonsup) ? i.imzonsup : String.Empty);
dic.Add("Data inizio manutenzione", i.imdainma != null ? i.imdainma.ToString() : String.Empty);
dic.Add("Data fine manutenzione", !string.IsNullOrEmpty(i.imdafima.ToString()) ? i.imdafima.ToString() : String.Empty);
dic.Add("Data costruzione", !string.IsNullOrEmpty(i.imdatcos.ToString()) ? i.imdatcos.ToString() : String.Empty);
dic.Add("Numero telesoccorso ", !string.IsNullOrEmpty(i.imteleso) ? i.imteleso : String.Empty);
dic.Add("Email cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Ultimo cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Codice cliente", !string.IsNullOrEmpty(i.ancodice) ? i.ancodice : String.Empty);
dic.Add("Tipo anagrafica", !string.IsNullOrEmpty(i.antipcon) ? i.antipcon : String.Empty);
#endregion
break;
case Clienti.Discovery:
#region discovery
dic.Add("Esercizio", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("Tipo", !string.IsNullOrEmpty(i.chtipo) ? i.chtipo : String.Empty);
dic.Add("Numero chiamata", !string.IsNullOrEmpty(i.chnumero.ToString()) ? i.chnumero.ToString() : String.Empty);
dic.Add("Data chiamata", !string.IsNullOrEmpty(i.chdata.ToString()) ? i.chdata.ToString() : String.Empty);
dic.Add("Ora inserimento chiamata", !string.IsNullOrEmpty(i.chora.ToString()) ? i.chora.ToString() : String.Empty);
dic.Add("Min inserimento chiamata", !string.IsNullOrEmpty(i.chmin.ToString()) ? i.chmin.ToString() : String.Empty);
dic.Add("Operatore assegnazione", !string.IsNullOrEmpty(i.chopass.ToString()) ? i.chopass.ToString() : String.Empty);
dic.Add("Operatore chiusura", !string.IsNullOrEmpty(i.chopchi.ToString()) ? i.chopchi.ToString() : String.Empty);
dic.Add("Azienda impianto", !string.IsNullOrEmpty(i.chaziimp) ? i.chaziimp : String.Empty);
dic.Add("Ora appuntamento fine", !string.IsNullOrEmpty(i.choraapf.ToString()) ? i.choraapf.ToString() : String.Empty);
dic.Add("Min appuntamento fine", !string.IsNullOrEmpty(i.chminapf.ToString()) ? i.chminapf.ToString() : String.Empty);
dic.Add("Riferimento chiamata", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Riferimento telefono", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
dic.Add("Codice segnalazione", !string.IsNullOrEmpty(i.chcodseg) ? i.chcodseg : String.Empty);
dic.Add("Fermo impianto", !string.IsNullOrEmpty(i.chstopi) ? i.chstopi : String.Empty);
dic.Add("Data assegnazione chiamata", !string.IsNullOrEmpty(i.chdtass.ToString()) ? i.chdtass.ToString() : String.Empty);
dic.Add("Ora assegnazione chiamata", !string.IsNullOrEmpty(i.chorass.ToString()) ? i.chorass.ToString() : String.Empty);
dic.Add("Min assegnazione chiamata", !string.IsNullOrEmpty(i.chminass.ToString()) ? i.chminass.ToString() : String.Empty);
dic.Add("Data chiusura chiamata", !string.IsNullOrEmpty(i.chdtchi.ToString()) ? i.chdtchi.ToString() : String.Empty);
dic.Add("Ora chiusura chiamata", !string.IsNullOrEmpty(i.chorachi.ToString()) ? i.chorachi.ToString() : String.Empty);
dic.Add("Min chiusura chiamata", !string.IsNullOrEmpty(i.chminchi.ToString()) ? i.chminchi.ToString() : String.Empty);
dic.Add("Data inizio intervento", !string.IsNullOrEmpty(i.chdtlin.ToString()) ? i.chdtlin.ToString() : String.Empty);
dic.Add("Ora inizio intervento", !string.IsNullOrEmpty(i.chorali.ToString()) ? i.chorali.ToString() : String.Empty);
dic.Add("Min inizio intervento", !string.IsNullOrEmpty(i.chminli.ToString()) ? i.chminli.ToString() : String.Empty);
dic.Add("Data fine intervento", !string.IsNullOrEmpty(i.chdtlfi.ToString()) ? i.chdtlfi.ToString() : String.Empty);
dic.Add("Ora fine intervento", !string.IsNullOrEmpty(i.choralf.ToString()) ? i.choralf.ToString() : String.Empty);
dic.Add("Min fine intervento", !string.IsNullOrEmpty(i.chminlf.ToString()) ? i.chminlf.ToString() : String.Empty);
dic.Add("Numero 1 rapportino futuro", !string.IsNullOrEmpty(i.chnrap1.ToString()) ? i.chnrap1.ToString() : String.Empty);
dic.Add("Serie 1 rapportino futuro", !string.IsNullOrEmpty(i.chsrap1) ? i.chsrap1 : String.Empty);
dic.Add("Numero 2 rapportino futuro", !string.IsNullOrEmpty(i.chnrap2.ToString()) ? i.chnrap2.ToString() : String.Empty);
dic.Add("Modalità raccolta chiamata", !string.IsNullOrEmpty(i.chmodrac) ? i.chmodrac : String.Empty);
dic.Add("Numero chiamata per impianto per anno", !string.IsNullOrEmpty(i.chprgann.ToString()) ? i.chprgann.ToString() : String.Empty);
dic.Add("Importo manodopera", !string.IsNullOrEmpty(i.chimpman.ToString()) ? i.chimpman.ToString() : String.Empty);
dic.Add("Percentuale manodopera", !string.IsNullOrEmpty(i.chperman.ToString()) ? i.chperman.ToString() : String.Empty);
dic.Add("Stampa manodopera", !string.IsNullOrEmpty(i.chflstim) ? i.chflstim : String.Empty);
dic.Add("Chiusura da remoto", !string.IsNullOrEmpty(i.chfleste) ? i.chfleste : String.Empty);
dic.Add("Riferimento seriale importazione", !string.IsNullOrEmpty(i.chserext) ? i.chserext : String.Empty);
dic.Add("Descrizione impianto", !string.IsNullOrEmpty(i.imdescri) ? i.imdescri : String.Empty);
dic.Add("Tipo impianto", !string.IsNullOrEmpty(i.imtipoim) ? i.imtipoim : String.Empty);
dic.Add("Matricola impianto ", !string.IsNullOrEmpty(i.immatric) ? i.immatric : String.Empty);
dic.Add("Numero impianto ", !string.IsNullOrEmpty(i.imnumimp) ? i.imnumimp : String.Empty);
dic.Add("Ultimo amministratore ", !string.IsNullOrEmpty(i.imultamm) ? i.imultamm : String.Empty);
dic.Add("Desc Ultimo amministratore ", !string.IsNullOrEmpty(i.imultdam) ? i.imultdam : String.Empty);
dic.Add("Telefono Ult. Amministratore", !string.IsNullOrEmpty(i.imulttam) ? i.imulttam : String.Empty);
dic.Add("Ubicazione impianto", !string.IsNullOrEmpty(i.imubicaz) ? i.imubicaz : String.Empty);
dic.Add("Zona manutenzione", !string.IsNullOrEmpty(i.imzonman) ? i.imzonman : String.Empty);
dic.Add("Pubblico/privato", !string.IsNullOrEmpty(i.imflpupr) ? i.imflpupr : String.Empty);
dic.Add("Zona chiamate", !string.IsNullOrEmpty(i.imzonchi) ? i.imzonchi : String.Empty);
dic.Add("Zona supervisione", !string.IsNullOrEmpty(i.imzonsup) ? i.imzonsup : String.Empty);
dic.Add("Data inizio manutenzione", i.imdainma != null ? i.imdainma.ToString() : String.Empty);
dic.Add("Data fine manutenzione", !string.IsNullOrEmpty(i.imdafima.ToString()) ? i.imdafima.ToString() : String.Empty);
dic.Add("Data costruzione", !string.IsNullOrEmpty(i.imdatcos.ToString()) ? i.imdatcos.ToString() : String.Empty);
dic.Add("Numero telesoccorso ", !string.IsNullOrEmpty(i.imteleso) ? i.imteleso : String.Empty);
dic.Add("Email cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Ultimo cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Codice cliente", !string.IsNullOrEmpty(i.ancodice) ? i.ancodice : String.Empty);
dic.Add("Tipo anagrafica", !string.IsNullOrEmpty(i.antipcon) ? i.antipcon : String.Empty);
#endregion
break;
case Clienti.Sarom:
#region Sarom
dic.Add("Esercizio", !string.IsNullOrEmpty(i.chcodese) ? i.chcodese : String.Empty);
dic.Add("Tipo", !string.IsNullOrEmpty(i.chtipo) ? i.chtipo : String.Empty);
dic.Add("Numero chiamata", !string.IsNullOrEmpty(i.chnumero.ToString()) ? i.chnumero.ToString() : String.Empty);
dic.Add("Data chiamata", !string.IsNullOrEmpty(i.chdata.ToString()) ? i.chdata.ToString() : String.Empty);
dic.Add("Ora inserimento chiamata", !string.IsNullOrEmpty(i.chora.ToString()) ? i.chora.ToString() : String.Empty);
dic.Add("Min inserimento chiamata", !string.IsNullOrEmpty(i.chmin.ToString()) ? i.chmin.ToString() : String.Empty);
dic.Add("Operatore assegnazione", !string.IsNullOrEmpty(i.chopass.ToString()) ? i.chopass.ToString() : String.Empty);
dic.Add("Operatore chiusura", !string.IsNullOrEmpty(i.chopchi.ToString()) ? i.chopchi.ToString() : String.Empty);
dic.Add("Azienda impianto", !string.IsNullOrEmpty(i.chaziimp) ? i.chaziimp : String.Empty);
dic.Add("Ora appuntamento fine", !string.IsNullOrEmpty(i.choraapf.ToString()) ? i.choraapf.ToString() : String.Empty);
dic.Add("Min appuntamento fine", !string.IsNullOrEmpty(i.chminapf.ToString()) ? i.chminapf.ToString() : String.Empty);
dic.Add("Riferimento chiamata", !string.IsNullOrEmpty(i.chrifer) ? i.chrifer : String.Empty);
dic.Add("Riferimento telefono", !string.IsNullOrEmpty(i.chtelef) ? i.chtelef : String.Empty);
dic.Add("Codice segnalazione", !string.IsNullOrEmpty(i.chcodseg) ? i.chcodseg : String.Empty);
dic.Add("Fermo impianto", !string.IsNullOrEmpty(i.chstopi) ? i.chstopi : String.Empty);
dic.Add("Data assegnazione chiamata", !string.IsNullOrEmpty(i.chdtass.ToString()) ? i.chdtass.ToString() : String.Empty);
dic.Add("Ora assegnazione chiamata", !string.IsNullOrEmpty(i.chorass.ToString()) ? i.chorass.ToString() : String.Empty);
dic.Add("Min assegnazione chiamata", !string.IsNullOrEmpty(i.chminass.ToString()) ? i.chminass.ToString() : String.Empty);
dic.Add("Data chiusura chiamata", !string.IsNullOrEmpty(i.chdtchi.ToString()) ? i.chdtchi.ToString() : String.Empty);
dic.Add("Ora chiusura chiamata", !string.IsNullOrEmpty(i.chorachi.ToString()) ? i.chorachi.ToString() : String.Empty);
dic.Add("Min chiusura chiamata", !string.IsNullOrEmpty(i.chminchi.ToString()) ? i.chminchi.ToString() : String.Empty);
dic.Add("Data inizio intervento", !string.IsNullOrEmpty(i.chdtlin.ToString()) ? i.chdtlin.ToString() : String.Empty);
dic.Add("Ora inizio intervento", !string.IsNullOrEmpty(i.chorali.ToString()) ? i.chorali.ToString() : String.Empty);
dic.Add("Min inizio intervento", !string.IsNullOrEmpty(i.chminli.ToString()) ? i.chminli.ToString() : String.Empty);
dic.Add("Data fine intervento", !string.IsNullOrEmpty(i.chdtlfi.ToString()) ? i.chdtlfi.ToString() : String.Empty);
dic.Add("Ora fine intervento", !string.IsNullOrEmpty(i.choralf.ToString()) ? i.choralf.ToString() : String.Empty);
dic.Add("Min fine intervento", !string.IsNullOrEmpty(i.chminlf.ToString()) ? i.chminlf.ToString() : String.Empty);
dic.Add("Numero 1 rapportino futuro", !string.IsNullOrEmpty(i.chnrap1.ToString()) ? i.chnrap1.ToString() : String.Empty);
dic.Add("Serie 1 rapportino futuro", !string.IsNullOrEmpty(i.chsrap1) ? i.chsrap1 : String.Empty);
dic.Add("Numero 2 rapportino futuro", !string.IsNullOrEmpty(i.chnrap2.ToString()) ? i.chnrap2.ToString() : String.Empty);
dic.Add("Modalità raccolta chiamata", !string.IsNullOrEmpty(i.chmodrac) ? i.chmodrac : String.Empty);
dic.Add("Numero chiamata per impianto per anno", !string.IsNullOrEmpty(i.chprgann.ToString()) ? i.chprgann.ToString() : String.Empty);
dic.Add("Importo manodopera", !string.IsNullOrEmpty(i.chimpman.ToString()) ? i.chimpman.ToString() : String.Empty);
dic.Add("Percentuale manodopera", !string.IsNullOrEmpty(i.chperman.ToString()) ? i.chperman.ToString() : String.Empty);
dic.Add("Stampa manodopera", !string.IsNullOrEmpty(i.chflstim) ? i.chflstim : String.Empty);
dic.Add("Chiusura da remoto", !string.IsNullOrEmpty(i.chfleste) ? i.chfleste : String.Empty);
dic.Add("Riferimento seriale importazione", !string.IsNullOrEmpty(i.chserext) ? i.chserext : String.Empty);
dic.Add("Descrizione impianto", !string.IsNullOrEmpty(i.imdescri) ? i.imdescri : String.Empty);
dic.Add("Tipo impianto", !string.IsNullOrEmpty(i.imtipoim) ? i.imtipoim : String.Empty);
dic.Add("Matricola impianto ", !string.IsNullOrEmpty(i.immatric) ? i.immatric : String.Empty);
dic.Add("Numero impianto ", !string.IsNullOrEmpty(i.imnumimp) ? i.imnumimp : String.Empty);
dic.Add("Ultimo amministratore ", !string.IsNullOrEmpty(i.imultamm) ? i.imultamm : String.Empty);
dic.Add("Desc Ultimo amministratore ", !string.IsNullOrEmpty(i.imultdam) ? i.imultdam : String.Empty);
dic.Add("Telefono Ult. Amministratore", !string.IsNullOrEmpty(i.imulttam) ? i.imulttam : String.Empty);
dic.Add("Ubicazione impianto", !string.IsNullOrEmpty(i.imubicaz) ? i.imubicaz : String.Empty);
dic.Add("Zona manutenzione", !string.IsNullOrEmpty(i.imzonman) ? i.imzonman : String.Empty);
dic.Add("Pubblico/privato", !string.IsNullOrEmpty(i.imflpupr) ? i.imflpupr : String.Empty);
dic.Add("Zona chiamate", !string.IsNullOrEmpty(i.imzonchi) ? i.imzonchi : String.Empty);
dic.Add("Zona supervisione", !string.IsNullOrEmpty(i.imzonsup) ? i.imzonsup : String.Empty);
dic.Add("Data inizio manutenzione", i.imdainma != null ? i.imdainma.ToString() : String.Empty);
dic.Add("Data fine manutenzione", !string.IsNullOrEmpty(i.imdafima.ToString()) ? i.imdafima.ToString() : String.Empty);
dic.Add("Data costruzione", !string.IsNullOrEmpty(i.imdatcos.ToString()) ? i.imdatcos.ToString() : String.Empty);
dic.Add("Numero telesoccorso ", !string.IsNullOrEmpty(i.imteleso) ? i.imteleso : String.Empty);
dic.Add("Email cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Ultimo cliente", !string.IsNullOrEmpty(i.an_email) ? i.an_email : String.Empty);
dic.Add("Codice cliente", !string.IsNullOrEmpty(i.ancodice) ? i.ancodice : String.Empty);
dic.Add("Tipo anagrafica", !string.IsNullOrEmpty(i.antipcon) ? i.antipcon : String.Empty);
#endregion
break;
default:
break;
}
o.altri = dic;
o.imazirif = i.imazirif;
o.imrefref = i.imrefref;
return o;
}
private string getCommessaSietBySerial(string seriale)
{
string commessa = string.Empty;
try
{
//_commDescSiet = _Siet_commDesc.Commdesc;
//var c = _commDescSiet.Where(c => c.laserial.Equals(seriale)).First();
//if (c != null && !string.IsNullOrEmpty(c.lacodcom))
//{
// commessa = c.lacodcom.Trim();
// if (!string.IsNullOrEmpty(c.lacodcen))
// {
// commessa = commessa + " - " + c.lacodcen.Trim();
// }
//}
}
catch
{
Console.WriteLine(string.Format("*********** {1} Errore Chiamata al metodo getCommessaSietBySerial: seriale:{0} ", seriale, DateTime.Now.ToString()));
}
return commessa;
}
#endregion
/// <summary>chiamatetest</summary>
[HttpGet("chiamatetest")]
public async Task<ActionResult<IEnumerable<Chiamate_out>>> chiamate(string token)
{
try
{
List<Chiamate_out> ilist = new List<Chiamate_out>();
string ten = getClaimValueByToken(token, "tenant");
string ten2 = getClaimValueByToken(token, "tenant2");
string tenOut = getClaimValueByToken(token, "tenant");
string tecnico = getClaimValueByToken(token, "tccodice");
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
if (string.IsNullOrEmpty(ten))
{
ten = tenConf;
}
_chiamate = getChiamateByTenant(ten);
var calltec = await _chiamate.Where(
t => t.tccodice == tecnico
&& t.chcodazi == ten
).OrderByDescending(t => t.chdtapp).ToListAsync();
foreach (Chiamate ch in calltec)
{
Chiamate_out o = new Chiamate_out();
o = fillChiamateOut(ch, ten);
ilist.Add(o);
}
// cerco le chiamate che devo fare per sostituzioni SE funzione abilitata
//bool cerca_sostituzioni = false;
//cerca_sostituzioni = checkSostituzioneAbilitata(ten);
//if (cerca_sostituzioni)
//{
// //step 1 : trovo tutte le MIE sostituzioni
// _sostituzione = getSostituzioneByTenant(ten);
// var s = _sostituzione.Where(t => t.tscodazi.Equals(ten) && t.tscodsos.Trim().Equals(tecnico));
// foreach (Sostituzione ss in s)
// {
// string tecnico_sostituito = string.Empty;
// tecnico_sostituito = ss.tscodtec != null ? ss.tscodtec : string.Empty;
// //2023-03-13: cancellato il filtro sulla zona perchè il tecnico che sostituisce spesso è di un'altra zona
// //string zona = string.Empty;
// //zona = ss.tscodzon != null ? ss.tscodzon : "zonavuota";
// //step 2 : trovo tutte le chiamate del tecnico che sto sostitutendo e le aggiungo alla mie
// var calltecSost = await _chiamate.Where(
// t => t.tccodice == tecnico_sostituito
// && t.chcodazi == ten
// //&& t.imzonchi.Equals(zona)
// ).OrderByDescending(t => t.chdtapp).ToListAsync();
// foreach (Chiamate ch in calltecSost)
// {
// Chiamate_out o = new Chiamate_out();
// if (tenOut.Equals(Clienti.VT))
// {
// o = fillChiamateOutVT(ch, ten);
// }
// else
// {
// o = fillChiamateOut(ch, ten);
// }
// ilist.Add(o);
// }
// }
//}
IEnumerable<Chiamate_out> enumerable = ilist as IEnumerable<Chiamate_out>;
//return StatusCode(StatusCodes.Status200OK, enumerable.Take(100));
return StatusCode(StatusCodes.Status200OK, enumerable);
}
catch (Exception ex)
{
string err = "Errore: " + ex.Message;
return StatusCode(StatusCodes.Status500InternalServerError, err);
}
}
}
}