refactor
This commit is contained in:
parent
ba97d8606e
commit
1d52b8f945
@ -2,14 +2,20 @@
|
||||
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;
|
||||
@ -131,6 +137,654 @@ namespace ApiPolo.Controllers
|
||||
}
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using ApiPolo.Interfaces;
|
||||
using ApiPolo.Models;
|
||||
using ApiPolo.Models.Security_dbcontext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ApiPolo.Data
|
||||
{
|
||||
/// <summary></summary>
|
||||
public class Maras_DbContext : DbContext,ITenantDbContext
|
||||
{
|
||||
#region PROPERTIES
|
||||
@ -55,11 +57,14 @@ namespace ApiPolo.Data
|
||||
public DbSet<Commessa>? Commesse { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary></summary>
|
||||
public Maras_DbContext(DbContextOptions<Maras_DbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary></summary>
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
void TryConfigureEntity(Action<ModelBuilder> configure, string entityName)
|
||||
{
|
||||
try
|
||||
|
||||
176
ApiPolo/Data/Marro_DbContext.cs
Normal file
176
ApiPolo/Data/Marro_DbContext.cs
Normal file
@ -0,0 +1,176 @@
|
||||
using ApiPolo.Interfaces;
|
||||
using ApiPolo.Models;
|
||||
using ApiPolo.Models.Security_dbcontext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ApiPolo.Data
|
||||
{
|
||||
/// <summary></summary>
|
||||
public class Marro_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; }
|
||||
#endregion
|
||||
|
||||
/// <summary></summary>
|
||||
public Marro_DbContext(DbContextOptions<Marro_DbContext> options) : base(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");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,29 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ApiPolo.Data;
|
||||
using ApiPolo.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static ApiPolo.Controllers.PoloController;
|
||||
using ApiPolo.Data;
|
||||
|
||||
namespace ApiPolo.Services
|
||||
public class TenantDbContextFactory : ITenantDbContextFactory
|
||||
{
|
||||
public class TenantDbContextFactory : ITenantDbContextFactory
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public TenantDbContextFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public TenantDbContextFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public ITenantDbContext GetDbContext(string tenant)
|
||||
public ITenantDbContext GetDbContext(string tenant)
|
||||
{
|
||||
// Create a scope to resolve DbContext
|
||||
using (var scope = _serviceProvider.CreateScope())
|
||||
{
|
||||
return tenant switch
|
||||
{
|
||||
Clienti.Maras => _serviceProvider.GetRequiredService<Maras_DbContext>(),
|
||||
Clienti.Maras => scope.ServiceProvider.GetRequiredService<Maras_DbContext>(),
|
||||
Clienti.Marrocco => scope.ServiceProvider.GetRequiredService<Marro_DbContext>(),
|
||||
// Add other tenants as needed
|
||||
// Clienti.AnotherTenant => _serviceProvider.GetRequiredService<AnotherTenant_DbContext>(),
|
||||
// Clienti.AnotherTenant => scope.ServiceProvider.GetRequiredService<AnotherTenant_DbContext>(),
|
||||
_ => throw new KeyNotFoundException($"No DbContext found for tenant: {tenant}")
|
||||
};
|
||||
}
|
||||
|
||||
@ -1015,12 +1015,19 @@ namespace ApiPolo
|
||||
));
|
||||
#endregion
|
||||
|
||||
|
||||
//TEST
|
||||
|
||||
services.AddDbContext<Maras_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARAS")
|
||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||
));
|
||||
services.AddDbContext<Marro_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARRO")
|
||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||
));
|
||||
|
||||
|
||||
// FACTORY MUTI-TENANT
|
||||
services.AddSingleton<ITenantDbContextFactory, TenantDbContextFactory>();
|
||||
services.AddScoped<ITenantDbContextFactory, TenantDbContextFactory>();
|
||||
|
||||
|
||||
services.AddSwaggerGen(gen =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user