14850 lines
707 KiB
C#
14850 lines
707 KiB
C#
using ApiPolo.Models;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
using Renci.SshNet;
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
using System.Net;
|
|
using System.Security.Claims;
|
|
using System.Text;
|
|
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using FirebaseAdmin;
|
|
using FirebaseAdmin.Messaging;
|
|
using Google.Apis.Auth.OAuth2;
|
|
using Newtonsoft.Json;
|
|
using static ApiPolo.Controllers.PoloController;
|
|
using System.Net.Http.Headers;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Linq.Expressions;
|
|
using FirebaseAdmin.Auth.Multitenancy;
|
|
using System.Globalization;
|
|
using ApiPolo.Models.VT_dbcontext;
|
|
using System.Diagnostics.Contracts;
|
|
using Microsoft.EntityFrameworkCore.Storage;
|
|
using System.Diagnostics.Metrics;
|
|
using System.Transactions;
|
|
using System.Web.Razor.Parser;
|
|
using System;
|
|
using System.Collections;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
using System.IO;
|
|
using Microsoft.AspNetCore.Http;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Microsoft.Extensions.Primitives;
|
|
using System.Text.RegularExpressions;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Diagnostics;
|
|
|
|
namespace ApiPolo.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Controller unico
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class PoloController : Controller
|
|
{
|
|
private string _token = string.Empty;
|
|
private readonly ConfigurazioniDbContext? _config;
|
|
private readonly IConfiguration? _configuration;
|
|
|
|
private readonly TokenDbContext? _tokens;
|
|
|
|
#region TECNICI
|
|
|
|
private readonly VT_TECNICI_DbContext _VT_tecnici;
|
|
|
|
#endregion
|
|
|
|
#region VT - Chiusure
|
|
private readonly VT_CHIUSURE_TABLE_DbContext _VT_chiutable;
|
|
private readonly VT_CHIUSURE_DbContext _VT_chiu;
|
|
#endregion
|
|
|
|
#region VT - Tecnici
|
|
private readonly VT_TECNICI_TABLE_DbContext _VT_tectable;
|
|
private readonly VT_TECNICI_DbContext _VT_tec;
|
|
#endregion
|
|
|
|
#region VT - anagrafiche
|
|
private readonly VT_CONTI_TABLE_DbContext _VT_anagtable;
|
|
private readonly VT_CONTI_DbContext _VT_anag;
|
|
#endregion
|
|
|
|
#region VT - Impianti
|
|
private readonly VT_IMPIANTI_TABLE_DbContext _VT_impiatable;
|
|
private readonly VT_IMPIANTI_DbContext _VT_impia;
|
|
private readonly VT_IMPIANTI_MANAGER_DbContext _VT_impiaMngr;
|
|
#endregion
|
|
|
|
#region VT-RAPP NEW
|
|
private readonly VT_RAPP_NEW_TABLE_DbContext _VT_rapptable;
|
|
private readonly VT_RAPP_NEW_DbContext _VT_rapp;
|
|
#endregion
|
|
|
|
#region VT-CHIAMATE
|
|
private readonly VT_CHIAMATE_TABLE_DbContext _VT_chiatable;
|
|
private readonly VT_CHIAMATE_DbContext _VT_chia;
|
|
private readonly VT_CHIAMATE_MANAGER_DbContext _VT_chiaMngr;
|
|
#endregion
|
|
|
|
#region VT-Progressivi
|
|
private readonly VT_PROGRESSIVI_DbContext _VT_progtable;
|
|
#endregion
|
|
|
|
#region VT-aziende
|
|
private readonly VT_AZIENDA_RIF_DbContext _VT_azi;
|
|
#endregion
|
|
|
|
#region VT-registrazioni
|
|
private readonly VT_REGISTRAZIONE_DbContext _VT_reg;
|
|
#endregion
|
|
|
|
#region VT-aziendePresenti
|
|
private readonly VT_AZIENDE_PRESENTI_DbContext _VT_AziPres;
|
|
#endregion
|
|
|
|
#region VT-commesse
|
|
private readonly VT_COMMESSE_DbContext _VT_Comm;
|
|
private readonly VT_COMMESSE_TABLE_DbContext _VT_CommTable;
|
|
private readonly VT_COMMESSE_APP_DbContext _VT_CommApp;
|
|
#endregion
|
|
|
|
#region VT-rapportini excel
|
|
private readonly VT_RAPPORTINI_DbContext _VT_Rapportini;
|
|
|
|
#endregion
|
|
|
|
#region VT-Buoni
|
|
private readonly VT_Buoni_DbContext _VT_Buoni;
|
|
#endregion
|
|
|
|
#region VT - Dati azienda
|
|
private readonly VT_DATI_AZIENDA_DbContext _VT_DatiAzienda;
|
|
#endregion
|
|
|
|
#region VT-Storico Rapp
|
|
private readonly VT_STO_RAPP_DbContext _VT_StoRapp;
|
|
#endregion
|
|
|
|
#region VT-TIMBRATURE
|
|
private readonly VT_TIMBRATURE_DbContext _VT_timbr;
|
|
#endregion
|
|
|
|
#region VT-ARTICOLI
|
|
private readonly VT_ARTICOLI_TABLE_DbContext _VT_articoliTable;
|
|
#endregion
|
|
|
|
#region VT-MAG_NEW
|
|
private readonly VT_MAG_NEW_DbContext _VT_MagNew;
|
|
#endregion
|
|
|
|
#region VT-MAGAZZINI
|
|
private readonly VT_MAGAZZINI_DbContext _VT_Magazzini;
|
|
#endregion
|
|
|
|
#region VT-CODICI SEGNALAZIONI
|
|
private readonly VT_CODICE_SEGNALAZIONE_DbContext _VT_CodSegn;
|
|
#endregion
|
|
|
|
|
|
private DbSet<Tecnici>? _tecnici;
|
|
private DbSet<Rapp_New>? _rapp_new;
|
|
private DbSet<Chiamate>? _chiamate;
|
|
private DbSet<Chiusure>? _chiusure;
|
|
private DbSet<Manprog>? _manutprog;
|
|
private DbSet<Prese>? _prese;
|
|
private DbSet<Compo_Impia>? _compo;
|
|
private DbSet<Compo_Impia_Table>? _compoTable;
|
|
private DbSet<Saldiart>? _saldi;
|
|
private DbSet<Mag_New>? _mag;
|
|
private DbSet<Magazzini>? _magazzini;
|
|
private DbSet<Sto_Rapp>? _sto_rapp;
|
|
private DbSet<Anag>? _clienti;
|
|
private DbSet<Caus_Rapp>? _cau_rapp;
|
|
private DbSet<Pagam>? _pagam;
|
|
private DbSet<Commessa>? _comm;
|
|
private DbSet<Timbratura>? _timbr;
|
|
private DbSet<Sto_Imp>? _sto_imp;
|
|
private DbSet<AziendaRif>? _azi_coll;
|
|
private DbSet<Impianto>? _impianto;
|
|
private DbSet<Sostituzione>? _sostituzione;
|
|
private DbSet<ChiamateTable>? _chiatable;
|
|
private DbSet<ChiamateTableTaskManager>? _chiatableTaskManager;
|
|
private DbSet<ChiamataSeriale>? _chiamateser;
|
|
private DbSet<Prog>? _chiamateprogr;
|
|
private DbSet<Prog2>? _cpwarns;
|
|
|
|
private DbSet<ChiusureTable>? _chiuTable;
|
|
private DbSet<TecniciTable>? _tecTable;
|
|
private DbSet<AnagTable>? _anagTable;
|
|
private DbSet<ImpiantoTable>? _impiaTable;
|
|
private DbSet<AnagVT>? _clientiVT;
|
|
private DbSet<Progressivo>? _VT_prog;
|
|
private DbSet<Registrazione>? _VT_regi;
|
|
private DbSet<AziendaPres>? _VT_AziPresenti;
|
|
private DbSet<CommesseVT>? _VT_Commesse;
|
|
private DbSet<CommesseVT_Table>? _VT_CommesseTable;
|
|
private DbSet<DatiAzienda>? _VT_DatiAzi;
|
|
private DbSet<Rapportino>? _VT_rapport;
|
|
private DbSet<Buoni>? _VT_buo;
|
|
private DbSet<Rapp_New_View>? _rapp_new_view;
|
|
private DbSet<Articoli>? _articoliTable;
|
|
private DbSet<Vt_Mag_New>? _magNewVT;
|
|
private DbSet<MagazziniVT>? _magazziniVT;
|
|
private DbSet<CodiceSegnalazione>? _codSegnVT;
|
|
|
|
private DbSet<CommessaDesc>? _commDesc;
|
|
|
|
private DbSet<CC_CI>? _ccci;
|
|
private DbSet<CC_CIWiev>? _ccciView;
|
|
|
|
private Configurazioni? _confLette;
|
|
|
|
/// <summary>polocontroller</summary>
|
|
public PoloController(IConfiguration configuration,ConfigurazioniDbContext config
|
|
,TokenDbContext tokens,VT_TECNICI_DbContext VT_tecnici,
|
|
#region Virtual task
|
|
VT_TECNICI_TABLE_DbContext VT_tectable,
|
|
VT_TECNICI_DbContext VT_tec,
|
|
VT_CHIUSURE_TABLE_DbContext VT_chiutable,
|
|
VT_CHIUSURE_DbContext VT_chiu,
|
|
VT_CONTI_TABLE_DbContext VT_anagtable,
|
|
VT_CONTI_DbContext VT_anag,
|
|
VT_RAPP_NEW_TABLE_DbContext VT_rapptable,
|
|
VT_RAPP_NEW_DbContext VT_rapp,
|
|
VT_IMPIANTI_TABLE_DbContext VT_impiatable,
|
|
VT_IMPIANTI_DbContext VT_impia,
|
|
VT_IMPIANTI_MANAGER_DbContext VT_impiaMngr,
|
|
VT_CHIAMATE_TABLE_DbContext VT_chiatable,
|
|
VT_CHIAMATE_DbContext VT_chia,
|
|
VT_PROGRESSIVI_DbContext VT_progtable,
|
|
VT_CHIAMATE_MANAGER_DbContext VT_chiaMngr,
|
|
VT_AZIENDA_RIF_DbContext VT_azi,
|
|
VT_REGISTRAZIONE_DbContext VT_reg,
|
|
VT_AZIENDE_PRESENTI_DbContext VT_AziPres,
|
|
VT_COMMESSE_DbContext VT_Comm,
|
|
VT_COMMESSE_TABLE_DbContext VT_CommTable,
|
|
VT_COMMESSE_APP_DbContext VT_CommApp,
|
|
VT_DATI_AZIENDA_DbContext VT_DatiAzienda,
|
|
VT_RAPPORTINI_DbContext VT_Rapportini,
|
|
VT_Buoni_DbContext VT_Buoni,
|
|
VT_STO_RAPP_DbContext VT_StoRapp,
|
|
VT_TIMBRATURE_DbContext VT_timbr,
|
|
VT_ARTICOLI_TABLE_DbContext VT_artTable,
|
|
VT_MAG_NEW_DbContext VT_MagNew,
|
|
VT_MAGAZZINI_DbContext VT_Magazzini,
|
|
VT_CODICE_SEGNALAZIONE_DbContext VT_CodSegn
|
|
#endregion
|
|
)
|
|
{
|
|
_configuration = configuration;
|
|
_config = config;
|
|
_tokens = tokens;
|
|
|
|
#region TECNICI
|
|
_VT_tecnici = VT_tecnici;
|
|
#endregion
|
|
|
|
#region VIRTUAL TASK
|
|
_VT_tectable = VT_tectable;
|
|
_VT_tec = VT_tec;
|
|
_VT_chiutable = VT_chiutable;
|
|
_VT_chiu = VT_chiu;
|
|
_VT_anagtable = VT_anagtable;
|
|
_VT_anag = VT_anag;
|
|
_VT_rapptable = VT_rapptable;
|
|
_VT_rapp = VT_rapp;
|
|
_VT_impiatable = VT_impiatable;
|
|
_VT_impia = VT_impia;
|
|
_VT_impiaMngr = VT_impiaMngr;
|
|
_VT_chiatable = VT_chiatable;
|
|
_VT_chia = VT_chia;
|
|
_VT_progtable = VT_progtable;
|
|
_VT_chiaMngr = VT_chiaMngr;
|
|
_VT_azi = VT_azi;
|
|
_VT_reg = VT_reg;
|
|
_VT_AziPres = VT_AziPres;
|
|
_VT_Comm = VT_Comm;
|
|
_VT_CommTable = VT_CommTable;
|
|
_VT_CommApp = VT_CommApp;
|
|
_VT_DatiAzienda = VT_DatiAzienda;
|
|
_VT_Rapportini = VT_Rapportini;
|
|
_VT_Buoni = VT_Buoni;
|
|
_VT_StoRapp = VT_StoRapp;
|
|
_VT_timbr = VT_timbr;
|
|
_VT_articoliTable = VT_artTable;
|
|
_VT_MagNew = VT_MagNew;
|
|
_VT_Magazzini = VT_Magazzini;
|
|
_VT_CodSegn = VT_CodSegn;
|
|
#endregion
|
|
|
|
}
|
|
|
|
#region Utility
|
|
private async Task<Configurazioni> readConf(string ten)
|
|
{
|
|
Configurazioni c=new Configurazioni();
|
|
List<Configurazioni> co =new List<Configurazioni>();
|
|
if(_config is not null && _config.conf is not null)
|
|
//co = await _config.conf.Where(t => t.azienda_adhoc == ten).ToListAsync();
|
|
co = await _config.conf.Where(t => t.azienda == ten).ToListAsync();
|
|
|
|
foreach (var a in co)
|
|
{
|
|
c.azienda = a.azienda != null ? a.azienda.Trim() : string.Empty; ;
|
|
c.prefisso_buoni_chia = a.prefisso_buoni_chia!=null ?a.prefisso_buoni_chia.Trim():string.Empty;
|
|
c.prefisso_buoni_man = a.prefisso_buoni_man !=null ? a.prefisso_buoni_man.Trim():string.Empty;
|
|
c.path_buoni = a.path_buoni != null ? a.path_buoni.Trim() : string.Empty;
|
|
c.ftp_url = a.ftp_url != null ? a.ftp_url.Trim() : string.Empty;
|
|
c.ftp_usr = a.ftp_usr != null ? a.ftp_usr.Trim() : string.Empty;
|
|
c.ftp_pwd = a.ftp_pwd != null ? a.ftp_pwd.Trim() : string.Empty;
|
|
c.listino=a.listino!=null? a.listino.Trim() : string.Empty;
|
|
|
|
|
|
c.abilita_naviga = a.abilita_naviga != null ? a.abilita_naviga : true;
|
|
c.abilita_telefona = a.abilita_telefona != null ? a.abilita_telefona : true;
|
|
c.abilita_chiamate = a.abilita_chiamate != null ? a.abilita_chiamate : true;
|
|
c.abilita_manutenzioni = a.abilita_manutenzioni != null ? a.abilita_manutenzioni : true;
|
|
c.abilita_barcode = a.abilita_barcode != null ? a.abilita_barcode : true;
|
|
c.chiamate_accetta = a.chiamate_accetta != null ? a.chiamate_accetta : true;
|
|
c.chiamate_accetta_barcode = a.chiamate_accetta_barcode != null ? a.chiamate_accetta_barcode : true;
|
|
c.chiamate_accetta_offline = a.chiamate_accetta_offline != null ? a.chiamate_accetta_offline : true;
|
|
c.chiamate_rifiuta = a.chiamate_rifiuta != null ? a.chiamate_rifiuta : true;
|
|
c.chiamate_rifiuta_barcode = a.chiamate_rifiuta_barcode != null ? a.chiamate_rifiuta_barcode : true;
|
|
c.chiamate_rifiuta_offline = a.chiamate_rifiuta_offline != null ? a.chiamate_rifiuta_offline : true;
|
|
c.chiamate_chiudi_barcode = a.chiamate_chiudi_barcode != null ? a.chiamate_chiudi_barcode : true;
|
|
c.chiamate_firma_barcode = a.chiamate_firma_barcode != null ? a.chiamate_firma_barcode : true;
|
|
c.chiamate_chiudi_salva_barcode = a.chiamate_chiudi_salva_barcode != null ? a.chiamate_chiudi_salva_barcode : true;
|
|
c.chiamate_chiudi_salva_offline = a.chiamate_chiudi_salva_offline != null ? a.chiamate_chiudi_salva_offline : true;
|
|
|
|
c.manutenzioni_accetta = a.manutenzioni_accetta != null ? a.manutenzioni_accetta : true;
|
|
c.manutenzioni_rifiuta = a.manutenzioni_rifiuta != null ? a.manutenzioni_rifiuta : true;
|
|
c.manutenzioni_accetta_barcode = a.manutenzioni_accetta_barcode != null ? a.manutenzioni_accetta_barcode : true;
|
|
c.manutenzioni_accetta_offline = a.manutenzioni_accetta_offline != null ? a.manutenzioni_accetta_offline : true;
|
|
c.manutenzioni_chiudi_barcode = a.manutenzioni_chiudi_barcode != null ? a.manutenzioni_chiudi_barcode : true;
|
|
c.manutenzioni_firma_barcode = a.manutenzioni_firma_barcode != null ? a.manutenzioni_firma_barcode : true;
|
|
c.manutenzioni_chiudi_salva_barcode = a.manutenzioni_chiudi_salva_barcode != null ? a.manutenzioni_chiudi_salva_barcode : true;
|
|
c.manutenzioni_chiudi_salva_offline = a.manutenzioni_chiudi_salva_offline != null ? a.manutenzioni_chiudi_salva_offline : true;
|
|
c.manutenzioni_rifiuta_barcode = a.manutenzioni_rifiuta_barcode != null ? a.manutenzioni_rifiuta_barcode : true;
|
|
|
|
c.dpi_checkbox = a.dpi_checkbox != null ? a.dpi_checkbox : true;
|
|
|
|
c.anagrafica = a.anagrafica != null ? a.anagrafica : true;
|
|
c.stato_finale = a.stato_finale != null ? a.stato_finale : true;
|
|
c.descrizione_intervento = a.descrizione_intervento != null ? a.descrizione_intervento : true;
|
|
c.composizione_impianto = a.composizione_impianto != null ? a.composizione_impianto : true;
|
|
c.note_intervento = a.note_intervento != null ? a.note_intervento : true;
|
|
c.esito_intervento = a.esito_intervento != null ? a.esito_intervento : true;
|
|
c.ora_inizio_fine = a.ora_inizio_fine != null ? a.ora_inizio_fine : true;
|
|
c.materiali = a.materiali != null ? a.materiali : true;
|
|
c.diritto_chiamata = a.diritto_chiamata != null ? a.diritto_chiamata : true;
|
|
c.manodopera = a.manodopera != null ? a.manodopera : true;
|
|
c.spese_viaggio = a.spese_viaggio != null ? a.spese_viaggio : true;
|
|
c.tipo_pagamento = a.tipo_pagamento != null ? a.tipo_pagamento : true;
|
|
c.note_pagamento = a.note_pagamento != null ? a.note_pagamento : true;
|
|
c.causale = a.causale != null ? a.causale : true;
|
|
|
|
c.time_sheet=a.time_sheet!= null ? a.time_sheet : true;
|
|
c.time_sheet_offline = a.time_sheet_offline != null ? a.time_sheet_offline : true;
|
|
c.costo_orario = a.costo_orario != null ? a.costo_orario : 0;
|
|
c.ftp_port = a.ftp_port != null ? a.ftp_port : 0;
|
|
|
|
c.storico=a.storico != null ? a.storico : true;
|
|
c.storico_tecnico = a.storico_tecnico != null ? a.storico_tecnico : true;
|
|
|
|
c.storico_interventi = a.storico_interventi != null ? a.storico_interventi : true;
|
|
c.storico_impianto = a.storico_impianto != null ? a.storico_impianto : true;
|
|
c.ricerca_impianti = a.ricerca_impianti != null ? a.ricerca_impianti : true;
|
|
c.ora_inizio_fine_automatica = a.ora_inizio_fine_automatica != null ? a.ora_inizio_fine_automatica : true;
|
|
c.stampa_orario = a.stampa_orario != null ? a.stampa_orario : true;
|
|
c.intestazione_stampa = a.intestazione_stampa != null ? a.intestazione_stampa.Trim() : string.Empty;
|
|
c.abilita_inserimento_chiamate = a.abilita_inserimento_chiamate != null ? a.abilita_inserimento_chiamate : 0;
|
|
c.seriale_template_chi = a.seriale_template_chi != null ? a.seriale_template_chi : string.Empty;
|
|
c.abilita_data_rapp_edit = a.abilita_data_rapp_edit != null ? a.abilita_data_rapp_edit : false;
|
|
c.numeri_decimali = a.numeri_decimali != null ? a.numeri_decimali : 0;
|
|
c.max_record = a.max_record != null ? a.max_record : 100;
|
|
c.prezzi_visibili = a.prezzi_visibili != null ? a.prezzi_visibili : true;
|
|
c.desc_supp_prodotti_visibile=a.desc_supp_prodotti_visibile!=null?a.desc_supp_prodotti_visibile:false;
|
|
c.azienda_adhoc = a.azienda_adhoc != null ? a.azienda_adhoc : string.Empty;
|
|
|
|
c.azienda_adhoc = a.azienda_adhoc != null ? a.azienda_adhoc : string.Empty;
|
|
c.desc_interv_stampa = a.desc_interv_stampa != null ? a.desc_interv_stampa : false;
|
|
c.note_interv_stampa = a.note_interv_stampa != null ? a.note_interv_stampa :false;
|
|
|
|
}
|
|
return c;
|
|
}
|
|
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 DbSet<Tecnici> getTecniciByTenant(string tenant)
|
|
{
|
|
DbSet<Tecnici>? _tecs;
|
|
string appo = string.Empty;
|
|
_tecs = _VT_tec.Tecnici;
|
|
|
|
return _tecs;
|
|
}
|
|
|
|
|
|
private DbSet<Chiamate> getChiamateByTenant(string tenant)
|
|
{
|
|
DbSet<Chiamate>? _calls;
|
|
|
|
_calls = _VT_chia.Chiamate;
|
|
|
|
return _calls;
|
|
}
|
|
private DbSet<Chiusure> getChiusureByTenant(string tenant)
|
|
{
|
|
DbSet<Chiusure>? _chiu;
|
|
_chiu = _VT_chiu.Chiu;
|
|
return _chiu;
|
|
}
|
|
|
|
//private DbSet<Manprog> getManutenzioniByTenant(string tenant)
|
|
//{
|
|
// DbSet<Manprog>? _mans;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Ferrari:
|
|
// _mans = _Ferra_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _mans = _Marro_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// _mans = _Sicilia_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _mans = _Disco_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _mans = _Sarom_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _mans = _Gitoga_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _mans = _Lifta_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _mans = _Siet_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _mans = _PMS_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _mans = _LW_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _mans = _Tedes_mp.Manutenzioni;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _mans = _Sys_mp.Manutenzioni;
|
|
// break;
|
|
// default:
|
|
// _mans = null;
|
|
// break;
|
|
// }
|
|
// return _mans;
|
|
//}
|
|
|
|
//private DbSet<Prese> getPreseByTenant(string tenant)
|
|
//{
|
|
// DbSet<Prese>? _pre;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Ferrari:
|
|
// _pre = _Ferra_prese.Prese;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _pre = _Marro_prese.Prese;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// _pre = _Sicilia_prese.Prese;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _pre = _Disco_prese.Prese;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _pre = _Sarom_prese.Prese;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _pre = _Gitoga_prese.Prese;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _pre = _Lifta_prese.Prese;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _pre = _Siet_prese.Prese;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _pre = _PMS_prese.Prese;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _pre = _LW_prese.Prese;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _pre = _Tedes_prese.Prese;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _pre = _Sys_prese.Prese;
|
|
// break;
|
|
// default:
|
|
// _pre = null;
|
|
// break;
|
|
// }
|
|
// return _pre;
|
|
//}
|
|
|
|
//private DbSet<Sto_Rapp> getSto_RappByTenant(string tenant)
|
|
//{
|
|
// DbSet<Sto_Rapp>? _sto;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _sto = _Sicilia_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _sto = _Disco_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _sto = _Marro_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _sto = _Ferra_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _sto = _Sarom_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _sto = _Gitoga_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _sto = _Lifta_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _sto = _Siet_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _sto = _PMS_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _sto = _LW_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _sto = _Tedes_sto_rapp.StoRapp;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _sto = _Sys_sto_rapp.StoRapp;
|
|
// break;
|
|
// default:
|
|
// _sto = null;
|
|
// break;
|
|
// }
|
|
// return _sto;
|
|
//}
|
|
|
|
//private DbSet<Anag> getClientiByTenant(string tenant)
|
|
//{
|
|
// DbSet<Anag>? _cli;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _cli = _Sicilia_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _cli = _Disco_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _cli = _Ferra_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _cli = _Marro_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _cli = _Sarom_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _cli = _Gitoga_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _cli = _Lifta_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _cli = _Siet_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _cli = _PMS_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _cli = _LW_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _cli = _Tedes_clienti.Clienti;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _cli = _Sys_clienti.Clienti;
|
|
// break;
|
|
// default:
|
|
// _cli = null;
|
|
// break;
|
|
// }
|
|
// return _cli;
|
|
//}
|
|
|
|
//private DbSet<Caus_Rapp> getCausaliRappByTenant(string tenant)
|
|
//{
|
|
// DbSet<Caus_Rapp>? _cau;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _cau = _Sicilia_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _cau = _Disco_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _cau = _Ferra_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _cau = _Marro_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _cau = _Sarom_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _cau = _Gitoga_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _cau = _Lifta_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _cau = _Siet_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _cau = _PMS_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _cau = _LW_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _cau = _Tedes_caus_rapp.Causali;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _cau = _Sys_caus_rapp.Causali;
|
|
// break;
|
|
// default:
|
|
// _cau = null;
|
|
// break;
|
|
// }
|
|
// return _cau;
|
|
//}
|
|
|
|
private DbSet<CodiceSegnalazione> getVTCodiciSegnalaz(string tenant)
|
|
{
|
|
DbSet<CodiceSegnalazione>? _codSeg;
|
|
|
|
if (tenant.Equals(Clienti.VT))
|
|
{
|
|
_codSeg = _VT_CodSegn.CodSegn;
|
|
|
|
return _codSeg;
|
|
}
|
|
return _codSeg = null;
|
|
}
|
|
|
|
//private DbSet<Pagam> getPagamentiByTenant(string tenant)
|
|
//{
|
|
// DbSet<Pagam>? _pag;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _pag = _Sicilia_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _pag = _Disco_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _pag = _Ferra_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _pag = _Marro_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _pag = _Sarom_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _pag = _Gitoga_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _pag = _Lifta_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _pag = _Siet_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _pag = _PMS_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _pag = _LW_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _pag = _Tedes_pagam.Pagamenti;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _pag = _Sys_pagam.Pagamenti;
|
|
// break;
|
|
// default:
|
|
// _pag = null;
|
|
// break;
|
|
// }
|
|
// return _pag;
|
|
//}
|
|
|
|
//private DbSet<Saldiart> getSaldiartByTenant(string tenant)
|
|
//{
|
|
// DbSet<Saldiart>? _sa;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _sa = _Sicilia_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _sa = _Disco_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.Siet :
|
|
// _sa = _Siet_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _sa = _PMS_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _sa = _LW_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _sa = _Tedes_saldi.Saldi;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _sa = _Sys_saldi.Saldi;
|
|
// break;
|
|
// default:
|
|
// _sa = null;
|
|
// break;
|
|
// }
|
|
// return _sa;
|
|
//}
|
|
|
|
//private DbSet<Compo_Impia> getComponentiByTenant(string tenant)
|
|
//{
|
|
// DbSet<Compo_Impia>? _compon;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _compon = _Sicilia_comp.Componen;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _compon = _Disco_comp.Componen;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _compon = _Siet_comp.Componen;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _compon = _PMS_comp.Componen;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _compon = _LW_comp.Componen;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _compon = _Tedes_comp.Componen;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _compon = _Sys_comp.Componen;
|
|
// break;
|
|
// default:
|
|
// _compon = null;
|
|
// break;
|
|
// }
|
|
// return _compon;
|
|
//}
|
|
|
|
//private DbSet<Compo_Impia_Table> getComponentiTableByTenant(string tenant)
|
|
//{
|
|
// DbSet<Compo_Impia_Table>? _compon;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _compon = _Sicilia_compTable.Componen;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _compon = _Disco_compTable.Componen;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _compon = _Siet_compTable.Componen;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _compon = _PMS_compTable.Componen;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _compon = _LW_compTable.Componen;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _compon = _Tedes_compTable.Componen;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _compon = _Sys_compTable.Componen;
|
|
// break;
|
|
// default:
|
|
// _compon = null;
|
|
// break;
|
|
// }
|
|
// return _compon;
|
|
//}
|
|
|
|
//private DbSet<Magazzini> getMagazziniByTenant(string tenant)
|
|
//{
|
|
// DbSet<Magazzini>? _maga;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _maga = _Sicilia_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _maga = _Disco_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _maga = _Siet_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _maga = _PMS_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _maga = _LW_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _maga = _Tedes_magazzini.Magaz;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _maga = _Sys_magazzini.Magaz;
|
|
// break;
|
|
// default:
|
|
// _maga = null;
|
|
// break;
|
|
// }
|
|
// return _maga;
|
|
//}
|
|
|
|
//private DbSet<Mag_New> getMag_NewByTenant(string tenant)
|
|
//{
|
|
// DbSet<Mag_New>? _ma;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _ma = _Sicilia_mag.Mag;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _ma = _Disco_mag.Mag;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _ma = _Siet_mag.Mag;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _ma = _PMS_mag.Mag;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _ma = _LW_mag.Mag;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _ma = _Tedes_mag.Mag;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _ma = _Sys_mag.Mag;
|
|
// break;
|
|
// default:
|
|
// _ma = null;
|
|
// break;
|
|
// }
|
|
// return _ma;
|
|
//}
|
|
//private DbSet<Impianto> getImpiantiByTenant(string tenant)
|
|
//{
|
|
// DbSet<Impianto>? _imp;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _imp = _Sicilia_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _imp = _Disco_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _imp = _Marro_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _imp = null;
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// _imp = null;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _imp = _Gitoga_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _imp = _Lifta_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _imp = _Siet_impianti.Impia;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _imp = _PMS_impianti.Impia;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _imp = _LW_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _imp = _Tedes_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _imp = _Sys_impianti.Impia;
|
|
// break;
|
|
// default:
|
|
// _imp = null;
|
|
// break;
|
|
// }
|
|
// return _imp;
|
|
//}
|
|
|
|
//private DbSet<Commessa> getCommesseByTenant(string tenant)
|
|
//{
|
|
// DbSet<Commessa>? _commesse;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _commesse = _Sicilia_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _commesse = null;
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// _commesse = _Ferra_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Sinergo:
|
|
// _commesse = _Sinergo_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// _commesse = _Marro_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _commesse = _Gitoga_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _commesse = _Lifta_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _commesse = _Siet_comm.Commesse;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _commesse = _PMS_comm.Commesse;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _commesse = _LW_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _commesse = _Tedes_comm.Commesse;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _commesse = _Sys_comm.Commesse;
|
|
// break;
|
|
// default:
|
|
// _commesse = null;
|
|
// break;
|
|
// }
|
|
// return _commesse;
|
|
//}
|
|
private DbSet<Timbratura> getTimbratureByTenant(string tenant)
|
|
{
|
|
DbSet<Timbratura>? _timbrature;
|
|
_timbrature = _VT_timbr.Timbr;
|
|
|
|
return _timbrature;
|
|
}
|
|
|
|
//private DbSet<Sto_Imp> getStoricoImpiantoByTenant(string tenant)
|
|
//{
|
|
// DbSet<Sto_Imp>? _sto;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Sicilia:
|
|
// _sto = _Sicilia_sto_imp.StoImp;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _sto = _Siet_sto_imp.StoImp;
|
|
// break;
|
|
// case Clienti.PMS :
|
|
// _sto = _PMS_sto_imp.StoImp;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _sto = _LW_sto_imp.StoImp;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _sto = _Tedes_sto_imp.StoImp;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _sto = _Sys_sto_imp.StoImp;
|
|
// break;
|
|
// default:
|
|
// _sto = null;
|
|
// break;
|
|
// }
|
|
// return _sto;
|
|
//}
|
|
|
|
//private DbSet<AziendaRif> getAziendeRifByTenant(string tenant)
|
|
//{
|
|
// DbSet<AziendaRif>? _azi;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Discovery:
|
|
// _azi = _Disco_azi_coll.Azi;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _azi = _Siet_azi_coll.Azi;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _azi = _PMS_azi_coll.Azi;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _azi = _LW_azi_coll.Azi;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _azi = _Tedes_azi_coll.Azi;
|
|
// break;
|
|
// default:
|
|
// _azi = null;
|
|
// break;
|
|
// }
|
|
// return _azi;
|
|
//}
|
|
|
|
//private DbSet<Sostituzione> getSostituzioneByTenant(string tenant)
|
|
//{
|
|
// DbSet<Sostituzione>? _sost;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// _sost = _Marro_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _sost = _Gitoga_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _sost = _Lifta_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// _sost = _Disco_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _sost = _Siet_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// _sost = _Sicilia_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _sost = _PMS_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _sost = _LW_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _sost = _Tedes_sostituzioni.Sost;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _sost = _Sys_sostituzioni.Sost;
|
|
// break;
|
|
// default:
|
|
// _sost = null;
|
|
// break;
|
|
// }
|
|
// return _sost;
|
|
//}
|
|
private DbSet<ChiamateTable> getChiamateTableByTenant(string tenant)
|
|
{
|
|
DbSet<ChiamateTable>? _chia;
|
|
_chia = _VT_chiatable.Chi;
|
|
return _chia;
|
|
}
|
|
//private DbSet<ChiamateTableTaskManager> getChiamateTableTaskManagerByTenant(string tenant)
|
|
//{
|
|
// DbSet<ChiamateTableTaskManager>? _chia;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.LW:
|
|
// _chia = _LW_chiatable.Chi;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _chia = _Sys_chiatable.Chi;
|
|
// break;
|
|
// default:
|
|
// _chia = null;
|
|
// break;
|
|
// }
|
|
// return _chia;
|
|
//}
|
|
|
|
//private DbSet<ChiamataSeriale> getChiamateSerialeByTenant(string tenant)
|
|
//{
|
|
// DbSet<ChiamataSeriale>? _chiaser;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// _chiaser = _Marro_chiaser.Seriali;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// _chiaser = _Gitoga_chiaser.Seriali;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// _chiaser = _Lifta_chiaser.Seriali;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _chiaser = _Siet_chiaser.Seriali;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// _chiaser = _Sicilia_chiaser.Seriali;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _chiaser = _PMS_chiaser.Seriali;
|
|
// break;
|
|
|
|
// default:
|
|
// _chiaser = null;
|
|
// break;
|
|
// }
|
|
// return _chiaser;
|
|
//}
|
|
|
|
//private DbSet<Prog> getChiamateProgressiviByTenant(string tenant)
|
|
//{
|
|
// //gestione per cvpwarn con campo float
|
|
// DbSet<Prog>? _chiaprog;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// case Clienti.Gitoga:
|
|
// case Clienti.Lifta:
|
|
// _chiaprog = _Marro_chiaprog.Progressivi;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// _chiaprog = _Sicilia_chiaprog.Progressivi;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _chiaprog = _Siet_chiaprog.Progressivi;
|
|
// break;
|
|
// default:
|
|
// _chiaprog = null;
|
|
// break;
|
|
// }
|
|
// return _chiaprog;
|
|
//}
|
|
|
|
//private DbSet<Prog2> getCpwarnByTenant(string tenant)
|
|
//{
|
|
// //gestione per cvpwarn con campo float
|
|
// DbSet<Prog2>? _cpwarn;
|
|
|
|
// switch (tenant)
|
|
// {
|
|
|
|
// case Clienti.Sicilia:
|
|
// _cpwarn = _Sicilia_cpwarn.Progressivi;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// _cpwarn = _Siet_cpwarn.Progressivi;
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// _cpwarn = _PMS_cpwarn.Progressivi;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// _cpwarn = _LW_cpwarn.Progressivi;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// _cpwarn = _Tedes_cpwarn.Progressivi;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _cpwarn = _Sys_cpwarn.Progressivi;
|
|
// break;
|
|
// default:
|
|
// _cpwarn = null;
|
|
// break;
|
|
// }
|
|
// return _cpwarn;
|
|
//}
|
|
|
|
//private bool checkSostituzioneAbilitata(string tenant)
|
|
//{
|
|
// bool abilitata;
|
|
// switch (tenant)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// abilitata =true;
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.LW:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// abilitata = true;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// abilitata = true;
|
|
// break;
|
|
// default:
|
|
// abilitata = false;
|
|
// break;
|
|
// }
|
|
// return abilitata;
|
|
//}
|
|
|
|
private async Task<string> getSeriale(string token)
|
|
{
|
|
string seriale = string.Empty;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// //ten = ten2;
|
|
// break;
|
|
// default:
|
|
// _rapp_new = getRappNewByTenant(ten);
|
|
// break;
|
|
//}
|
|
|
|
string suff_rapp = string.Empty;
|
|
string primo_seriale = string.Empty;
|
|
//D000000004
|
|
|
|
var rapp = await Task.WhenAll(_rapp_new.Where(t => t.seriale_rapportino != null
|
|
&& t.seriale_rapportino.Contains(suff_rapp)).OrderByDescending(t => t.seriale_rapportino).Take(1).ToListAsync());
|
|
|
|
string? ser=string.Empty;
|
|
if (rapp.Any())
|
|
{
|
|
foreach(var i in rapp)
|
|
{
|
|
if(i.Count()>0)
|
|
{
|
|
ser = i.First().seriale_rapportino;
|
|
seriale = getNewSerialeRapportino(ser, ten);
|
|
}
|
|
else
|
|
{
|
|
seriale = primo_seriale;
|
|
}
|
|
}
|
|
}
|
|
return seriale;
|
|
}
|
|
|
|
private async Task<int> getNewId(string token)
|
|
{
|
|
int newId =1;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
_timbr = getTimbratureByTenant(ten);
|
|
var t = await Task.WhenAll(_timbr.OrderByDescending(t => t.id).Take(1).ToListAsync());
|
|
|
|
if (t.Any() && t.First().Count()>0)
|
|
{
|
|
foreach (var i in t)
|
|
{
|
|
newId = i.First().id;
|
|
}
|
|
newId++;
|
|
}
|
|
return newId;
|
|
}
|
|
private string getNewSerialeRapportino(string? lastSerial, string tenant)
|
|
{
|
|
string new_serial = string.Empty;
|
|
|
|
//lastSerial = lastSerial.Substring(1, lastSerial.Length-1);
|
|
lastSerial = lastSerial!=null? lastSerial.Substring(1, lastSerial.Length - 1):String.Empty;
|
|
|
|
int ser = int.Parse(lastSerial);
|
|
ser++;
|
|
new_serial = ser.ToString();
|
|
new_serial = new_serial.PadLeft(9, '0');
|
|
new_serial = suffClienti.VT + new_serial;
|
|
|
|
return new_serial;
|
|
}
|
|
|
|
private string getNewSerialeBuono(string lastSerial, string suff)
|
|
{
|
|
//CAM00118 CA=chiamata M=Marrocco 00118=seriale
|
|
//MAM00254 MA=manutenzione M=Marrocco 00254=seriale
|
|
//lunghezza 8 fissa
|
|
string new_serial = string.Empty;
|
|
|
|
string parteNum = lastSerial.Substring(3, 5);
|
|
int ser = int.Parse(parteNum);
|
|
ser++;
|
|
new_serial = ser.ToString();
|
|
new_serial = new_serial.PadLeft(5, '0');
|
|
new_serial = suff + new_serial;
|
|
|
|
return new_serial;
|
|
}
|
|
|
|
private string getNewSerialeBuonoMan(string lastSerial, string suff)
|
|
{
|
|
//CAM00118 CA=chiamata M=Marrocco 00118=seriale
|
|
//MAM00254 MA=manutenzione M=Marrocco 00254=seriale
|
|
//lunghezza 8 fissa
|
|
string new_serial = string.Empty;
|
|
|
|
string parteNum = lastSerial.Substring(3, 5);
|
|
int ser = int.Parse(parteNum);
|
|
ser++;
|
|
new_serial = ser.ToString();
|
|
new_serial = new_serial.PadLeft(5, '0');
|
|
new_serial = suff + new_serial;
|
|
|
|
return new_serial;
|
|
}
|
|
|
|
private async Task<Chiamate> getChiamataBySerial(string ser_chiamata, string token)
|
|
{
|
|
string new_serial = string.Empty;
|
|
string ten = string.Empty;
|
|
ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
_chiamate= _VT_chia.Chiamate;
|
|
}
|
|
else
|
|
{
|
|
_chiamate = getChiamateByTenant(ten);
|
|
}
|
|
|
|
var calltec = await _chiamate.Where(
|
|
t => t.chserial == ser_chiamata
|
|
&& t.chcodazi == ten
|
|
).OrderBy(t => t.chdtapp).ToListAsync();
|
|
|
|
return calltec.First();
|
|
}
|
|
|
|
private async Task<Manprog> getManutenzioneByChiave(Input i, string token )
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico= getClaimValueByToken(token, "tccodice");
|
|
|
|
//_manutprog =getManutenzioniByTenant(ten);
|
|
var manutenz = await _manutprog.Where(
|
|
t => t.ctcodazi.Equals(ten)
|
|
&& t.ctcodimp.Trim().Equals(i.pimpianto.Trim())
|
|
&& t.ctcodint.Trim().Equals(i.picodint.Trim())
|
|
&& t.ctdatpro==i.pidatman
|
|
//&& t.tccodice.Trim().Equals(tecnico.Trim()
|
|
//la devo ripescare solo per la chiave della tabella delle manutenzioni
|
|
).ToListAsync();
|
|
|
|
Manprog risultato = manutenz.First();
|
|
return risultato;
|
|
}
|
|
private async Task<Manprog> getManutenzioneByChiave2(Prese i, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
//_manutprog = getManutenzioniByTenant(ten);
|
|
var manutenz = await _manutprog.Where(
|
|
t => t.ctcodazi.Equals(ten)
|
|
&& t.ctcodimp.Trim().Equals(i.pimpianto.Trim())
|
|
&& t.ctcodint.Trim().Equals(i.picodint.Trim())
|
|
&& t.ctdatpro == i.pidatman
|
|
//&& t.tccodice.Trim().Equals(tecnico.Trim()
|
|
//la devo ripescare solo per la chiave della tabella delle manutenzioni
|
|
).ToListAsync();
|
|
|
|
Manprog risultato = manutenz.First();
|
|
return risultato;
|
|
}
|
|
|
|
private async Task<Manprog> getManutenzioneByChiaveOut(Input i, string token, Rapp_New ingresso)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
//_manutprog = getManutenzioniByTenant(ten);
|
|
var manutenz = await _manutprog.Where(
|
|
t => t.ctcodazi.Equals(ten)
|
|
&& t.ctcodimp.Trim().Equals(i.pimpianto.Trim())
|
|
&& t.ctcodint.Trim().Equals(i.picodint.Trim())
|
|
&& t.ctdatpro == i.pidatman
|
|
//&& t.tccodice.Trim().Equals(tecnico.Trim()
|
|
//la devo ripescare solo per la chiave della tabella delle manutenzioni
|
|
).ToListAsync();
|
|
|
|
Manprog risultato = manutenz.First();
|
|
risultato.ser_buono = ingresso.ser_buono;
|
|
risultato.seriale_rapportino = ingresso.seriale_rapportino;
|
|
|
|
return risultato;
|
|
}
|
|
|
|
/// <summary> vuoto=chiamata presa in carico 3=chiamata chiusa 2=manutenzione chiusa</summary>
|
|
public static class TipoRapportino
|
|
{
|
|
/// <summary></summary>
|
|
public const string PresaInCarico = "";
|
|
|
|
/// <summary></summary>
|
|
public const string ManutenzioneChiusa = "2";
|
|
|
|
/// <summary></summary>
|
|
public const string ChiamataChiusa = "3";
|
|
|
|
/// <summary></summary>
|
|
public const string ChiamataDaCommessa = "4";
|
|
|
|
/// <summary></summary>
|
|
public const string ChiamataCapoTecnico = "5";
|
|
}
|
|
private async Task<int> checkChiamataPresa(string ten, string serChiamata,string tipo, string ten2)
|
|
{
|
|
//tipo rapportino =""
|
|
int trovati = 0;
|
|
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
ten = ten2;
|
|
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten
|
|
&& t.seriale_chiamata !=null && t.seriale_chiamata.Equals(serChiamata)
|
|
&& t.tipo_rapportino !=null && t.tipo_rapportino.Equals(tipo)
|
|
&& t.incarico!=null && t.incarico.Equals("S")).ToListAsync();
|
|
if(rapp.Any())
|
|
{
|
|
trovati = rapp.Count();
|
|
}
|
|
|
|
return trovati;
|
|
}
|
|
private async Task<Rapp_New> checkChiamataDaRilasciare(string ten, string serRapportino, string tipo,string ten2)
|
|
{
|
|
//tipo rapportino =""
|
|
Rapp_New trovati = null;
|
|
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
ten = ten2;
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// break;
|
|
// default:
|
|
// _rapp_new = getRappNewByTenant(ten);
|
|
// break;
|
|
//}
|
|
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten
|
|
&& t.seriale_rapportino != null && t.seriale_rapportino.Equals(serRapportino)
|
|
&& t.tipo_rapportino != null && t.tipo_rapportino.Equals(tipo)
|
|
&& t.incarico != null && t.incarico.Equals("S")).ToListAsync();
|
|
if (rapp.Any())
|
|
{
|
|
trovati = rapp.First();
|
|
}
|
|
|
|
return trovati;
|
|
}
|
|
private async Task<int> checkChiamataRifiutata(string ten, string serChiamata, string tipo,string ten2)
|
|
{
|
|
//tipo rapportino =""
|
|
int trovati = 0;
|
|
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
ten = ten2;
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
|
|
// break;
|
|
// default:
|
|
// _rapp_new = getRappNewByTenant(ten);
|
|
// break;
|
|
//}
|
|
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten
|
|
&& t.seriale_chiamata != null && t.seriale_chiamata.Equals(serChiamata)
|
|
&& t.tipo_rapportino != null && t.tipo_rapportino.Equals(tipo)
|
|
&& t.incarico != null && t.rifiutata.Equals("S")).ToListAsync();
|
|
if (rapp.Any())
|
|
{
|
|
trovati = rapp.Count();
|
|
}
|
|
|
|
return trovati;
|
|
}
|
|
private async Task<int> checkChiamataChiusa(string ten, string serChiamata, string tipo)
|
|
{
|
|
//tipo rapportino =3 o tipo rapportino=4
|
|
int trovati = 0;
|
|
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
|
|
//if (ten.Equals(Clienti.VT))
|
|
//{
|
|
//}
|
|
//else
|
|
//{
|
|
// _rapp_new = getRappNewByTenant(ten);
|
|
//}
|
|
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten
|
|
&& t.seriale_chiamata != null && t.seriale_chiamata.Equals(serChiamata)
|
|
&& t.tipo_rapportino != null && (t.tipo_rapportino.Equals(TipoRapportino.ChiamataChiusa) || t.tipo_rapportino.Equals(TipoRapportino.ChiamataDaCommessa))).ToListAsync();
|
|
|
|
if (rapp.Any())
|
|
{
|
|
trovati = rapp.Count();
|
|
}
|
|
|
|
return trovati;
|
|
}
|
|
private async Task<int> checkTimbraturaPresente(string ten, Timbratura model)
|
|
{
|
|
int trovati = 0;
|
|
_timbr = getTimbratureByTenant(ten);
|
|
var ti = await _timbr.Where(t => t.azienda == ten && t.ora_ini== model.ora_ini && t.min_ini== model.min_ini && t.ora_fin==model.ora_fin && t.min_fin==model.min_fin
|
|
&& t.commessa.Equals(model.commessa) && t.data_timbratura==model.data_timbratura && t.ore_viaggio==model.ore_viaggio
|
|
).ToListAsync();
|
|
if (ti.Any())
|
|
{
|
|
trovati = ti.Count();
|
|
}
|
|
|
|
return trovati;
|
|
}
|
|
/// <summary> 200=Ok 500=ErroreInterno 400=OperazioneNonAmmessa</summary>
|
|
public static class StatiRisposta
|
|
{
|
|
/// <summary></summary>
|
|
public const string Ok = "200";
|
|
|
|
/// <summary></summary>
|
|
public const string ErroreInterno = "500";
|
|
|
|
/// <summary></summary>
|
|
public const string OperazioneNonAmmessa = "400";
|
|
}
|
|
private async Task<int> checkManutenzionePresaInCarico(string ten, string impianto,string codint,DateTime? dataMan)
|
|
{
|
|
int trovati = 0;
|
|
//_prese=getPreseByTenant(ten);
|
|
var pre =await _prese.Where(t => t.picodazi.Equals(ten) && t.pimpianto.Equals(impianto) && t.picodint.Equals(codint) && t.pidatman== dataMan).ToListAsync();
|
|
if (pre.Any())
|
|
{
|
|
trovati = pre.Count();
|
|
}
|
|
return trovati;
|
|
}
|
|
private async Task<Prese> checkManutenzioneDaRilasciare(string ten, string impianto, string codint, DateTime? dataMan)
|
|
{
|
|
Prese p = null;
|
|
//_prese = getPreseByTenant(ten);
|
|
var pre = await _prese.Where(t => t.picodazi.Equals(ten) && t.pimpianto.Equals(impianto) && t.picodint.Equals(codint) && t.pidatman == dataMan).ToListAsync();
|
|
if (pre.Any())
|
|
{
|
|
p = pre.First();
|
|
}
|
|
return p;
|
|
}
|
|
private async Task<int> checkManutenzioneChiusa(string ten,string tipo,string codImp, DateTime? dataMan, string codInt)
|
|
{
|
|
int trovati = 0;
|
|
//_rapp_new = getRappNewByTenant(ten);
|
|
var rapp = await _rapp_new.Where(
|
|
t => t.azienda_impianto == ten
|
|
&& t.tipo_rapportino != null && t.tipo_rapportino.Equals(tipo)
|
|
&& t.seriale_chiamata !=null && string.IsNullOrEmpty(t.seriale_chiamata.Trim())
|
|
&& t.codice_impianto !=null && t.codice_impianto.Equals(codImp)
|
|
&& t.data_validita== dataMan
|
|
&& t.codice_intervento !=null && t.codice_intervento.Equals(codInt)
|
|
).ToListAsync();
|
|
|
|
if (rapp.Any())
|
|
{
|
|
trovati = rapp.Count();
|
|
}
|
|
return trovati;
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public static class Clienti
|
|
{
|
|
/// <summary>VT app</summary>
|
|
public const string VT = "VIRTU";
|
|
}
|
|
/// <summary></summary>
|
|
public static class suffClienti
|
|
{
|
|
/// <summary>Virtual task</summary>
|
|
public const string VT = "V";
|
|
}
|
|
|
|
/// <summary>trasforma un Saldiart in un Mag_New</summary>
|
|
private Mag_New saldiartToMag_New(Saldiart co, int riga,string newSerial, string tecnico)
|
|
{
|
|
Mag_New mn = new Mag_New();
|
|
mn.seriale_rapportino = newSerial;
|
|
mn.riga = riga;
|
|
mn.magazzino = co.slcodmag;
|
|
mn.articolo = co.slcodice;
|
|
mn.tipo_movimento = "A";
|
|
mn.quantita = co.slqtaper;
|
|
mn.prezzo = co.liprezzo;
|
|
mn.codice_tecnico = tecnico;
|
|
mn.codlotto = co.locodice;
|
|
mn.matricola = co.amcodice;
|
|
mn.desc_art = co.ardesart;
|
|
mn.cpccchk = getCpccchk(10);
|
|
mn.desc_sup = co.desc_sup;
|
|
return mn;
|
|
}
|
|
|
|
/// <summary>trasforma un Saldiart in un Vt_Mag_New</summary>
|
|
private Vt_Mag_New SaldiArtToVtMag_New(Saldiart co, int riga, string newSerial, string tecnico, string azienda)
|
|
{
|
|
Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
vtmn.Azienda = azienda;
|
|
vtmn.Seriale_Rapportino = newSerial;
|
|
vtmn.Riga = riga;
|
|
vtmn.Magazzino = co.slcodmag;
|
|
vtmn.Articolo = co.slcodice;
|
|
vtmn.Tipo_Movimento = "A";
|
|
vtmn.Quantita = co.slqtaper;
|
|
vtmn.Prezzo = co.liprezzo;
|
|
vtmn.Codice_Tecnico = tecnico;
|
|
vtmn.CodLotto = co.locodice;
|
|
vtmn.Matricola = co.amcodice;
|
|
vtmn.Desc_Art = co.ardesart;
|
|
vtmn.Cpccchk = getCpccchk(10);
|
|
vtmn.Desc_Sup = co.desc_sup;
|
|
return vtmn;
|
|
|
|
}
|
|
|
|
/// <summary>trasforma un Compi_Impia in un Mag_New</summary>
|
|
private Mag_New compo_ImpiaToMag_New(Compo_Impia co, int riga, string newSerial, string tecnico)
|
|
{
|
|
|
|
Mag_New mn = new Mag_New();
|
|
mn.seriale_rapportino = newSerial;
|
|
mn.riga = riga;
|
|
mn.magazzino = "001";
|
|
mn.articolo = co.cocodart;
|
|
mn.tipo_movimento = "E";
|
|
mn.quantita = co.coqtaart;
|
|
mn.prezzo = 0;
|
|
mn.codice_tecnico = tecnico;
|
|
mn.codlotto = co.lotto;
|
|
mn.matricola = co.matricola;
|
|
mn.cprownum = co.cprownum;
|
|
mn.codimp = co.cocodimp;
|
|
mn.desc_art = co.ardesart;
|
|
mn.cpccchk = getCpccchk(10);
|
|
mn.desc_sup = co.desc_sup;
|
|
|
|
|
|
string appoNote = string.Empty;
|
|
appoNote = (co.co__note != null && co.co__note.Length>254) ? co.co__note.Substring(0, 254) : co.co__note;
|
|
mn.note = appoNote;
|
|
return mn;
|
|
}
|
|
|
|
/// <summary>trasforma un Compi_Impia in un Vt_Mag_New</summary>
|
|
private Vt_Mag_New compo_ImpiaToVt_Mag_New(Compo_Impia co, int riga, string newSerial, string tecnico, string azienda)
|
|
{
|
|
|
|
Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
vtmn.Azienda = azienda;
|
|
vtmn.Seriale_Rapportino = newSerial;
|
|
vtmn.Riga = riga;
|
|
vtmn.Matricola = "001";
|
|
vtmn.Articolo = co.cocodart;
|
|
vtmn.Tipo_Movimento = "E";
|
|
vtmn.Quantita = co.coqtaart;
|
|
vtmn.Prezzo = 0;
|
|
vtmn.Codice_Tecnico = tecnico;
|
|
vtmn.CodLotto = co.lotto;
|
|
vtmn.Matricola = co.matricola;
|
|
vtmn.Cprownum = co.cprownum;
|
|
vtmn.CodImp = co.cocodimp;
|
|
vtmn.Desc_Art = co.ardesart;
|
|
vtmn.Cpccchk = getCpccchk(10);
|
|
vtmn.Desc_Sup = co.desc_sup;
|
|
|
|
|
|
string appoNote = string.Empty;
|
|
appoNote = (co.co__note != null && co.co__note.Length>254) ? co.co__note.Substring(0, 254) : co.co__note;
|
|
vtmn.Note = appoNote;
|
|
return vtmn;
|
|
}
|
|
|
|
private static Random random = new Random();
|
|
/// <summary>crea un cpccchk</summary>
|
|
public static string getCpccchk(int length)
|
|
{
|
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo della lista chiamate</summary>
|
|
public static string formattaItemChiamateMarrocco(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
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());
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(i.imrefref))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ref.</b> : " + i.imrefref.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo stampa chiamate</summary>
|
|
public static string formattaIndirizzoStampaMarrocco(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>SPETT. AMM. COND. :</b> ");
|
|
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);
|
|
if (!string.IsNullOrEmpty(i.imrefref))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Numero Ref.</b> : " + i.imrefref.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo stampa chiamateper Discovery</summary>
|
|
public static string formattaIndirizzoStampaDiscovery(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>SPETT. AMM. COND. :</b> ");
|
|
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.imlocali) ? i.imlocali.Trim() + " " : string.Empty);
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo della lista chiamate TEDESCO</summary>
|
|
public static string formattaItemChiamateTedesco(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!string.IsNullOrEmpty(i.imdescri))
|
|
{
|
|
sb.Append("<b>N.pratica</b> : " + i.imdescri.Trim());
|
|
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);
|
|
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());
|
|
}
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo della lista chiamate Virtual task</summary>
|
|
public static string formattaItemChiamateVT(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!string.IsNullOrEmpty(i.andescri))
|
|
{
|
|
sb.Append("<b>Cliente</b> : " + i.andescri.Trim());
|
|
sb.Append("<br>");
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chcodimp))
|
|
{
|
|
sb.Append("<b>Impianto</b> : " + i.chcodimp.Trim());
|
|
sb.Append("<br>");
|
|
}
|
|
if(!string.IsNullOrEmpty(i.imindiri2))
|
|
{
|
|
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);
|
|
sb.Append(!string.IsNullOrEmpty(i.improvin) ? " " + i.improvin.Trim() + " " : string.Empty);
|
|
sb.Append("<br>");
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chrifer))
|
|
{
|
|
sb.Append("<b>Rif.</b> : " + i.chrifer.Trim());
|
|
sb.Append("<br>");
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chtelef))
|
|
{
|
|
sb.Append("<b>Tel.</b> : " + i.chtelef.Trim());
|
|
sb.Append("<br>");
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chcodseg))
|
|
{
|
|
sb.Append("<b>Cod.Segn.</b> : " + i.chcodseg.Trim());
|
|
sb.Append("<br>");
|
|
}
|
|
|
|
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
|
|
/// <summary>formatta il riferimento impainto (html)</summary>
|
|
public static string formattaRiferimentoImpiantoMarrocco(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>N. Impianto</b> : " + i.chcodimp.Trim());
|
|
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ubicazione</b> : " + i.imubicaz.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chcodimp))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Matricola impianto :</b> ");
|
|
sb.Append(!string.IsNullOrEmpty(i.immatric) ? i.immatric.Trim() + " " : string.Empty);
|
|
}
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta il riferimento impianto Disco (html)</summary>
|
|
public static string formattaRiferimentoImpiantoDiscovery(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>N. Impianto</b> : " + i.chcodimp.Trim());
|
|
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ubicazione</b> : " + i.imubicaz.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chcodimp))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Matricola impianto :</b> ");
|
|
sb.Append(!string.IsNullOrEmpty(i.immatric) ? i.immatric.Trim() + " " : string.Empty);
|
|
}
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
|
|
/// <summary>formatta il riferimento impianto Ferrari (html)</summary>
|
|
public static string formattaRiferimentoImpiantoFerrari(Chiamate i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>N. Impianto</b> : " + i.chcodimp.Trim());
|
|
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ubicazione</b> : " + i.imubicaz.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.chcodimp))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Matricola impianto :</b> ");
|
|
sb.Append(!string.IsNullOrEmpty(i.immatric) ? i.immatric.Trim() + " " : string.Empty);
|
|
}
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
|
|
/// <summary>formatta l'indirizzo stampa manutenzioni</summary>
|
|
public static string formattaIndirizzoStampaManutMarrocco(Manprog i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>SPETT. AMM. COND. :</b>");
|
|
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.imlocali) ? i.imlocali.Trim() + " " : string.Empty);
|
|
|
|
if (!string.IsNullOrEmpty(i.imrefref))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Numero Ref.</b> : " + i.imrefref.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta il riferimento impainto (html)</summary>
|
|
public static string formattaIndirizzoStampaManutDiscovery(Manprog i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("<b>SPETT. AMM. COND. :</b>");
|
|
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.imlocali) ? i.imlocali.Trim() + " " : string.Empty);
|
|
|
|
if (!string.IsNullOrEmpty(i.imrefref))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Numero Ref.</b> : " + i.imrefref.Trim());
|
|
}
|
|
|
|
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta l'indirizzo della lista manutenzioni</summary>
|
|
public static string formattaItemManutenzioniMarrocco(Manprog i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
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.ctcodimp))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Impianto</b> : " + i.ctcodimp.Trim());
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(i.imrefref))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ref.</b> : " + i.imrefref.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta riferimwnto impianto su buono (html)</summary>
|
|
public static string formattaRifImpMarrocco(Manprog i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
if (!string.IsNullOrEmpty(i.ctcodimp))
|
|
{
|
|
sb.Append("<b>Matricola impianto</b> : " + i.ctcodimp.Trim());
|
|
if(!string.IsNullOrEmpty(i.immatric))
|
|
{
|
|
sb.Append( " - " + i.immatric.Trim());
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ubicazione</b> : " + i.imubicaz.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
/// <summary>formatta riferimwnto impianto su buono (html) Disco</summary>
|
|
public static string formattaRifImpDiscovery(Manprog i)
|
|
{
|
|
string formatst = string.Empty;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!string.IsNullOrEmpty(i.ctcodimp))
|
|
{
|
|
sb.Append("<b>N. Impianto</b> : " + i.ctcodimp.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.Append("<b>Ubicazione</b> : " + i.imubicaz.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.immatric))
|
|
{
|
|
sb.Append("<br>");
|
|
sb.AppendLine("<b>Matricola</b> : " + i.immatric.Trim());
|
|
}
|
|
formatst = sb.ToString();
|
|
|
|
return formatst;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Configurazioni
|
|
private Configurazione_out fillConfigurazione(Configurazioni co)
|
|
{
|
|
Configurazione_out output = new Configurazione_out();
|
|
|
|
output.azienda = co.azienda;
|
|
output.path_buoni = co.path_buoni;
|
|
output.prefisso_buoni_chia = co.prefisso_buoni_chia;
|
|
output.prefisso_buoni_man = co.prefisso_buoni_man;
|
|
output.ftp_url = co.ftp_url;
|
|
output.ftp_usr = co.ftp_usr;
|
|
output.ftp_pwd = co.ftp_pwd;
|
|
output.ftp_port = co.ftp_port;
|
|
output.listino = co.listino;
|
|
|
|
output.abilita_barcode = co.abilita_barcode;
|
|
output.abilita_naviga = co.abilita_naviga;
|
|
output.abilita_telefona = co.abilita_telefona;
|
|
output.abilita_chiamate = co.abilita_chiamate;
|
|
|
|
output.abilita_manutenzioni = co.abilita_manutenzioni;
|
|
output.chiamate_accetta = co.chiamate_accetta;
|
|
output.chiamate_accetta_barcode = co.chiamate_accetta_barcode;
|
|
output.chiamate_accetta_offline = co.chiamate_accetta_offline;
|
|
output.chiamate_rifiuta = co.chiamate_rifiuta;
|
|
output.chiamate_rifiuta_barcode = co.chiamate_rifiuta_barcode;
|
|
output.chiamate_rifiuta_offline = co.chiamate_rifiuta_offline;
|
|
output.chiamate_chiudi_barcode = co.chiamate_chiudi_barcode;
|
|
output.chiamate_firma_barcode = co.chiamate_firma_barcode;
|
|
output.chiamate_chiudi_salva_barcode = co.chiamate_chiudi_salva_barcode;
|
|
output.chiamate_chiudi_salva_offline = co.chiamate_chiudi_salva_offline;
|
|
|
|
output.manutenzioni_accetta = co.manutenzioni_accetta;
|
|
output.manutenzioni_rifiuta = co.manutenzioni_rifiuta;
|
|
output.manutenzioni_accetta_barcode = co.manutenzioni_accetta_barcode;
|
|
output.manutenzioni_accetta_offline = co.manutenzioni_accetta_offline;
|
|
output.manutenzioni_chiudi_barcode = co.manutenzioni_chiudi_barcode;
|
|
output.manutenzioni_firma_barcode = co.manutenzioni_firma_barcode;
|
|
output.manutenzioni_chiudi_salva_barcode = co.manutenzioni_chiudi_salva_barcode;
|
|
output.manutenzioni_chiudi_salva_offline = co.manutenzioni_chiudi_salva_offline;
|
|
|
|
output.dpi_checkbox = co.dpi_checkbox;
|
|
|
|
output.anagrafica = co.anagrafica;
|
|
output.stato_finale = co.stato_finale;
|
|
output.descrizione_intervento = co.descrizione_intervento;
|
|
output.composizione_impianto = co.composizione_impianto;
|
|
output.note_intervento = co.note_intervento;
|
|
output.esito_intervento = co.esito_intervento;
|
|
output.ora_inizio_fine = co.ora_inizio_fine;
|
|
output.materiali = co.materiali;
|
|
output.diritto_chiamata = co.diritto_chiamata;
|
|
output.manodopera = co.manodopera;
|
|
output.spese_viaggio = co.spese_viaggio;
|
|
output.tipo_pagamento = co.tipo_pagamento;
|
|
output.note_pagamento = co.note_pagamento;
|
|
output.causale = co.causale;
|
|
|
|
output.time_sheet = co.time_sheet;
|
|
output.time_sheet_offline = co.time_sheet_offline;
|
|
output.costo_orario = co.costo_orario;
|
|
|
|
output.manutenzioni_rifiuta_barcode = co.manutenzioni_rifiuta_barcode;
|
|
|
|
//OBSOLETI
|
|
//output.storico = co.storico;
|
|
//output.storico_tecnico = co.storico_tecnico;
|
|
//FINE OBSOLETI
|
|
|
|
output.storico_interventi = co.storico_interventi;
|
|
output.storico_impianto = co.storico_impianto;
|
|
output.ricerca_impianti = co.ricerca_impianti;
|
|
output.abilita_data_rapp_edit = co.abilita_data_rapp_edit;
|
|
|
|
return output;
|
|
}
|
|
|
|
/// <summary>Configurazioni per azienda return:ActionResult</summary>
|
|
[HttpGet("configurazioni")]
|
|
public async Task<ActionResult<Configurazione_out>> configurazioni(string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
Configurazione_out output = new Configurazione_out();
|
|
try
|
|
{
|
|
var c = await _config.conf.Where(t => t.azienda == ten).ToListAsync();
|
|
var cc = c.First();
|
|
|
|
if (cc == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
output = fillConfigurazione(cc);
|
|
|
|
//cerco le aziende collegate
|
|
bool bCercaAzcoll = false;
|
|
List<AziendaRif> l = new List<AziendaRif>();
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Discovery:
|
|
// bCercaAzcoll = true;
|
|
// break;
|
|
//}
|
|
if(bCercaAzcoll)
|
|
{
|
|
//_azi_coll = getAziendeRifByTenant(ten);
|
|
var a = await _azi_coll.Where(t => t.piazihoc != null && t.piazihoc.Equals(ten)).ToListAsync();
|
|
if (a.Any())
|
|
{
|
|
foreach (AziendaRif appo in a)
|
|
{
|
|
l.Add(appo);
|
|
}
|
|
}
|
|
}
|
|
output.aziende_coll = l;
|
|
|
|
|
|
return StatusCode(StatusCodes.Status200OK, output);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
output.err_detail = err;
|
|
output.err_title = err;
|
|
output.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("configurazioni/add")]
|
|
public async Task<ActionResult<Configurazione_out>> addConfigurazione([FromBody] Configurazioni model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
try
|
|
{
|
|
using (var transaction = _config.Database.BeginTransaction())
|
|
{
|
|
await _config.conf.AddAsync(model);
|
|
await _config.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Token
|
|
|
|
/// <summary>token riewmpimento</summary>
|
|
private Token fillTokenByInput(string tokenDevice, string tokenLogin)
|
|
{
|
|
Token r = new Token();
|
|
|
|
string ten = getClaimValueByToken(tokenLogin, "tenant");
|
|
string tecnico = getClaimValueByToken(tokenLogin, "tccodice");
|
|
|
|
r.tenant = ten;
|
|
r.usr = tecnico;
|
|
r.token = tokenDevice;
|
|
r.ts = DateTime.Now;
|
|
return r;
|
|
}
|
|
|
|
/// <summary>elimina Token</summary>
|
|
private async void deleteToken(Token t)
|
|
{
|
|
using (var transaction = _tokens.Database.BeginTransaction())
|
|
{
|
|
_tokens.tok.Remove(t);
|
|
await _tokens.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
}
|
|
|
|
/// <summary>inserisce Token</summary>
|
|
private async void insertToken(Token t)
|
|
{
|
|
using (var transaction = _tokens.Database.BeginTransaction())
|
|
{
|
|
await _tokens.tok.AddAsync(t);
|
|
await _tokens.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
}
|
|
|
|
/// <summary>token salvataggio</summary>
|
|
[HttpPost]
|
|
[Route("token/add")]
|
|
public async Task<ActionResult<Token_out>> addToken(string tokenDevice, string token)
|
|
{
|
|
Token_out t = new Token_out();
|
|
bool da_inserire = false;
|
|
|
|
try
|
|
{
|
|
List<Token> co = new List<Token>();
|
|
if (_tokens is not null && _tokens.tok is not null)
|
|
{
|
|
co = await _tokens.tok.Where(c => c.token.Equals(tokenDevice)).ToListAsync();
|
|
}
|
|
Token inp = fillTokenByInput(tokenDevice, token);
|
|
|
|
if (co.Count== 0)
|
|
{
|
|
da_inserire = true;
|
|
}
|
|
else
|
|
{
|
|
//il token c'è. controllo che sia associato all'utente corretto
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
bool token_corretto_presente = false;
|
|
foreach(Token tt in co)
|
|
{
|
|
if (tt.usr is not null && tt.usr.Equals(tecnico) && tt.tenant is not null && tt.tenant.Equals(ten))
|
|
{
|
|
token_corretto_presente = true;
|
|
}
|
|
else
|
|
{
|
|
using (var transaction = _tokens.Database.BeginTransaction())
|
|
{
|
|
Token entitasViewModel = _tokens.tok.Where(p => p.Id == tt.Id).FirstOrDefault();
|
|
_tokens.Entry(entitasViewModel).State = EntityState.Deleted;
|
|
await _tokens.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
}
|
|
}
|
|
if (!token_corretto_presente)
|
|
da_inserire = true;
|
|
}
|
|
if(da_inserire)
|
|
{
|
|
using (var transaction = _tokens.Database.BeginTransaction())
|
|
{
|
|
await _tokens.tok.AddAsync(inp);
|
|
await _tokens.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
t.err_status_code = StatiRisposta.Ok;
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, t);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
t.err_title = ex.Message;
|
|
t.err_detail = errmsg;
|
|
t.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, t);
|
|
}
|
|
|
|
}
|
|
/// <summary>token salvataggio</summary>
|
|
[HttpPost]
|
|
[Route("token/sendMessage")]
|
|
public async Task<ActionResult<Token_out>> sendMessage(string tokenDevice,string _title, string _body)
|
|
{
|
|
Token_out t = new Token_out();
|
|
//Token inp = fillTokenByInput(tokenDevice, tokenLogin);
|
|
|
|
try
|
|
{
|
|
if (FirebaseApp.DefaultInstance == null)
|
|
{
|
|
FirebaseApp.Create(new AppOptions()
|
|
{
|
|
Credential = GoogleCredential.FromFile("private_key.json")
|
|
});
|
|
}
|
|
//var registrationToken = "dDxUDIC3QcWytp6UeVMDyT:APA91bH9y0N7Iff39Ncv0m_EjJ-hv7YTWYaL_5P37-2dob2PRuArvpfl6kmrk10GO2eJiAQ2tVT3tZX9khUD-NPyfljGbpBn1iUyjbTpL6tDF-0IgJN960v95I4_2SWM_crtSH-ZrXAK";
|
|
var registrationToken = tokenDevice;
|
|
var message = new Message()
|
|
{
|
|
Data = new Dictionary<string, string>()
|
|
{
|
|
{ "myData", "123457777" },
|
|
},
|
|
Token = registrationToken,
|
|
//Notification = new Notification()
|
|
//{
|
|
// Title = _title+" "+getCpccchk(4),
|
|
// Body = _body + " "+ DateTime.Now.ToString("yyyyMMddHHmmss")
|
|
//}
|
|
};
|
|
string response = FirebaseMessaging.DefaultInstance.SendAsync(message).Result;
|
|
t.response = response;
|
|
|
|
//t.response= await SendNotificationAsync(tokenDevice,"titolo","corpo del messaggio");
|
|
return StatusCode(StatusCodes.Status200OK, t);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
t.err_title = ex.Message;
|
|
t.err_detail = errmsg;
|
|
t.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, t);
|
|
}
|
|
}
|
|
|
|
//<summary>SendNotificationAsync</summary>
|
|
private async Task<string> SendNotificationAsync(string token, string title, string body)
|
|
{
|
|
using (var client = new HttpClient())
|
|
{
|
|
//var firebaseOptionsServerId = _firebaseOptions.ServerApiKey;
|
|
//var firebaseOptionsSenderId = _firebaseOptions.SenderId;
|
|
var firebaseOptionsServerId = "AAAAGBwLmNY:APA91bG5GmgYcaxsU8HrOqvZbb9r82tH9RAEifgKhwoj_zwBe7qei8u3BSxMzFl9Dwykd0TWRuM7ffNe6ehhDDRUqaRPj_vKM9KreJnNrqB6f2hxjPAxzk5De2Ys437-dnSAuS_8SVJV";
|
|
var firebaseOptionsSenderId = "103549737174";
|
|
|
|
|
|
|
|
client.BaseAddress = new Uri("https://fcm.googleapis.com");
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization",
|
|
$"key={firebaseOptionsServerId}");
|
|
client.DefaultRequestHeaders.TryAddWithoutValidation("Sender", $"id={firebaseOptionsSenderId}");
|
|
|
|
|
|
var data = new
|
|
{
|
|
to = token,
|
|
|
|
body = body,
|
|
title = title,
|
|
|
|
priority = "high"
|
|
};
|
|
|
|
var json = JsonConvert.SerializeObject(data);
|
|
var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
var result = await client.PostAsync("/fcm/send", httpContent);
|
|
return result.ToString();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region LOGIN
|
|
/// <summary>Magazzini per login return:ActionResult</summary>
|
|
[HttpGet("magazzini")]
|
|
public async Task<ActionResult<IEnumerable<Magazzini>>> magazzini(string token)
|
|
{
|
|
List<Magazzini> lst= new List<Magazzini>();
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenAdhoc = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
|
|
if(string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenAdhoc;
|
|
}
|
|
_magazziniVT = _VT_Magazzini.Magazzini;
|
|
|
|
List<MagazziniVT> magaVTList = new List<MagazziniVT>();
|
|
magaVTList = await _magazziniVT.Where(x => x.Azienda.Equals(ten2)).ToListAsync();
|
|
|
|
foreach (var magVT in magaVTList)
|
|
{
|
|
Magazzini maga = new Magazzini();
|
|
maga.mgcodmag = magVT.Mgcodmag.TrimEnd();
|
|
maga.mgdesmag = magVT.Mgdesmag.TrimEnd();
|
|
|
|
lst.Add(maga);
|
|
}
|
|
|
|
return lst;
|
|
|
|
//if (ten.Equals(Clienti.VT))
|
|
//{
|
|
// _magazziniVT = _VT_Magazzini.Magazzini;
|
|
|
|
// List<MagazziniVT> magaVTList = new List<MagazziniVT>();
|
|
// magaVTList = await _magazziniVT.Where(x => x.Azienda.Equals(ten2)).ToListAsync();
|
|
|
|
// foreach (var magVT in magaVTList)
|
|
// {
|
|
// Magazzini maga = new Magazzini();
|
|
// maga.mgcodmag = magVT.Mgcodmag.TrimEnd();
|
|
// maga.mgdesmag = magVT.Mgdesmag.TrimEnd();
|
|
|
|
// lst.Add(maga);
|
|
// }
|
|
// return lst;
|
|
//}
|
|
//else
|
|
//{
|
|
// _magazzini = getMagazziniByTenant(ten);
|
|
// return await _magazzini.ToListAsync();
|
|
//}
|
|
|
|
}
|
|
|
|
/// <summary>Login iniziale return:ActionResult</summary>
|
|
[HttpPost("loginTechnical")]
|
|
public async Task< ActionResult<LoginOut>> loginTechnical([FromBody] LoginModel model)
|
|
{
|
|
LoginOut o = new LoginOut();
|
|
string tenAdHoc = string.Empty;
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(model.Username) || string.IsNullOrEmpty(model.Password))
|
|
{
|
|
o.err_detail = "Username e Password non possono essere vuoti.";
|
|
o.err_title = "Username e Password non possono essere vuoti.";
|
|
o.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status200OK, o);
|
|
}
|
|
else
|
|
{
|
|
var tecnico=new List<Tecnici>();
|
|
switch (model.Tenant)
|
|
{
|
|
case Clienti.VT:
|
|
_tecnici= _VT_tec.Tecnici;
|
|
tecnico = await _tecnici.Where(t => t.tcuser == model.Username && t.tcpwd == model.Password ).Take(1).ToListAsync();
|
|
string ten2 = tecnico.First().tccodazi;
|
|
tenAdHoc = model.Tenant;
|
|
_confLette = await readConf(ten2);
|
|
break;
|
|
default:
|
|
//2024-11-26: leggo le configurazioni prima perchè come tenant non devo più leggere AZIENDA ma AZIENDA_ADHOC
|
|
_confLette = await readConf(model.Tenant);
|
|
|
|
tenAdHoc = (_confLette != null && _confLette.azienda_adhoc!=null)? _confLette.azienda_adhoc:string.Empty;
|
|
_tecnici = getTecniciByTenant(tenAdHoc);
|
|
//model.Tenant = tenAdHoc;// lo valoriozzo con quello iniziale per non cambiare il passaggio nel token
|
|
|
|
tecnico = await _tecnici.Where(t => t.tcuser == model.Username && t.tcpwd == model.Password && t.tccodazi == tenAdHoc).Take(1).ToListAsync();
|
|
break;
|
|
}
|
|
|
|
if (tecnico == null || (tecnico != null && tecnico.Count == 0))
|
|
{
|
|
o.err_detail = "Username o Password non trovati.";
|
|
o.err_title = "Username o Password non trovati.";
|
|
o.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status404NotFound, o);
|
|
}
|
|
else
|
|
{
|
|
var authClaims = new List<Claim>
|
|
{
|
|
//new Claim(ClaimTypes.Name, model.Username),
|
|
new Claim(ClaimTypes.Name,tecnico.First().tcuser),
|
|
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
|
new Claim("tenant", tenAdHoc),//questa è la vera azienda in AdHoc. Quella del model è quella che individua l'azienda nelle configurazioni (A0001 è sempre la stessa per tutte le installazioni di ADHOC WEB)
|
|
new Claim("tenantConfigurazioni", model.Tenant),//questa è l'azienda nelle configurazioni
|
|
new Claim("tenant2", tecnico.First().tccodazi),
|
|
new Claim("tccodice", tecnico.First().tccodice),
|
|
};
|
|
var authSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["JWT:Secret"]));
|
|
var token = new JwtSecurityToken(
|
|
issuer: _configuration["JWT:ValidIssuer"],
|
|
audience: _configuration["JWT:ValidAudience"],
|
|
expires: DateTime.Now.AddMonths(3),
|
|
claims: authClaims,
|
|
signingCredentials: new SigningCredentials(authSigningKey, SecurityAlgorithms.HmacSha256)
|
|
);
|
|
string tok = new JwtSecurityTokenHandler().WriteToken(token);
|
|
_token = tok;
|
|
|
|
|
|
o.Tok = tok;
|
|
o.Tcdescri = tecnico.First().Tcdescri;
|
|
o.Tccodice = tecnico.First().tccodice;
|
|
Conf cc = new Conf();
|
|
|
|
//le configurazioni per VT vanno lette con il tenant generico VIRTU
|
|
//2024-05-16: tornati alla impostazione iniziale per poter gestite i pulsanti per ogni cliente di VT
|
|
//_confLette = await readConf(model.Tenant);
|
|
|
|
cc.abilita_naviga = _confLette.abilita_naviga;
|
|
cc.abilita_telefona = _confLette.abilita_telefona;
|
|
cc.abilita_chiamate = _confLette.abilita_chiamate;
|
|
cc.abilita_barcode = _confLette.abilita_barcode;
|
|
|
|
cc.abilita_manutenzioni = _confLette.abilita_manutenzioni;
|
|
cc.chiamate_accetta = _confLette.chiamate_accetta;
|
|
cc.chiamate_accetta_barcode = _confLette.chiamate_accetta_barcode;
|
|
cc.chiamate_accetta_offline = _confLette.chiamate_accetta_offline;
|
|
cc.chiamate_rifiuta = _confLette.chiamate_rifiuta;
|
|
cc.chiamate_rifiuta_barcode = _confLette.chiamate_rifiuta_barcode;
|
|
cc.chiamate_rifiuta_offline = _confLette.chiamate_rifiuta_offline;
|
|
cc.chiamate_chiudi_barcode = _confLette.chiamate_chiudi_barcode;
|
|
cc.chiamate_firma_barcode = _confLette.chiamate_firma_barcode;
|
|
cc.chiamate_chiudi_salva_barcode = _confLette.chiamate_chiudi_salva_barcode;
|
|
cc.chiamate_chiudi_salva_offline = _confLette.chiamate_chiudi_salva_offline;
|
|
|
|
cc.manutenzioni_accetta = _confLette.manutenzioni_accetta;
|
|
cc.manutenzioni_rifiuta = _confLette.manutenzioni_rifiuta;
|
|
cc.manutenzioni_accetta_barcode = _confLette.manutenzioni_accetta_barcode;
|
|
cc.manutenzioni_accetta_offline = _confLette.manutenzioni_accetta_offline;
|
|
cc.manutenzioni_chiudi_barcode = _confLette.manutenzioni_chiudi_barcode;
|
|
cc.manutenzioni_firma_barcode = _confLette.manutenzioni_firma_barcode;
|
|
cc.manutenzioni_chiudi_salva_barcode = _confLette.manutenzioni_chiudi_salva_barcode;
|
|
cc.manutenzioni_chiudi_salva_offline = _confLette.manutenzioni_chiudi_salva_offline;
|
|
|
|
cc.dpi_checkbox = _confLette.dpi_checkbox;
|
|
|
|
cc.anagrafica = _confLette.anagrafica;
|
|
cc.stato_finale = _confLette.stato_finale;
|
|
cc.descrizione_intervento = _confLette.descrizione_intervento;
|
|
cc.composizione_impianto = _confLette.composizione_impianto;
|
|
cc.note_intervento = _confLette.note_intervento;
|
|
cc.esito_intervento = _confLette.esito_intervento;
|
|
cc.ora_inizio_fine = _confLette.ora_inizio_fine;
|
|
cc.materiali = _confLette.materiali;
|
|
cc.diritto_chiamata = _confLette.diritto_chiamata;
|
|
cc.manodopera = _confLette.manodopera;
|
|
cc.spese_viaggio = _confLette.spese_viaggio;
|
|
cc.tipo_pagamento = _confLette.tipo_pagamento;
|
|
cc.note_pagamento = _confLette.note_pagamento;
|
|
cc.causale = _confLette.causale;
|
|
|
|
cc.time_sheet = _confLette.time_sheet;
|
|
cc.time_sheet_offline = _confLette.time_sheet_offline;
|
|
|
|
//per VT il costo lo devo leggere dal profilo del tecnico
|
|
if (model.Tenant.Equals(Clienti.VT))
|
|
{
|
|
string ten2 = tecnico.First().tccodazi;
|
|
string codTec = tecnico.First().tccodice;
|
|
_tecTable = _VT_tectable.Tectable;
|
|
var costo = _tecTable.Where(t => t.tccodazi.Equals(ten2) && t.tccodice.Equals(codTec)).First();
|
|
cc.costo_orario = costo.tccoor;
|
|
}
|
|
else
|
|
{
|
|
cc.costo_orario = _confLette.costo_orario;
|
|
}
|
|
|
|
|
|
cc.ftp_port= _confLette.ftp_port;
|
|
cc.manutenzioni_rifiuta_barcode = _confLette.manutenzioni_rifiuta_barcode;
|
|
cc.storico = _confLette.storico;
|
|
cc.storico_tecnico = _confLette.storico_tecnico;
|
|
cc.storico_interventi = _confLette.storico_interventi;
|
|
cc.storico_impianto = _confLette.storico_impianto;
|
|
cc.ricerca_impianti = _confLette.ricerca_impianti;
|
|
|
|
cc.ora_inizio_fine_automatica = _confLette.ora_inizio_fine_automatica;
|
|
cc.stampa_orario = _confLette.stampa_orario;
|
|
cc.intestazione_stampa = _confLette.intestazione_stampa;
|
|
cc.seriale_template_chi = _confLette.seriale_template_chi;
|
|
cc.abilita_inserimento_chiamate = _confLette.abilita_inserimento_chiamate;
|
|
cc.abilita_data_rapp_edit = _confLette.abilita_data_rapp_edit;
|
|
cc.numeri_decimali = _confLette.numeri_decimali;
|
|
cc.max_record = _confLette.max_record;
|
|
cc.prezzi_visibili = _confLette.prezzi_visibili;
|
|
cc.desc_supp_prodotti_visibile = _confLette.desc_supp_prodotti_visibile;
|
|
cc.azienda_adhoc = _confLette.azienda_adhoc;
|
|
cc.note_interv_stampa = _confLette.note_interv_stampa;
|
|
cc.desc_interv_stampa = _confLette.desc_interv_stampa;
|
|
|
|
|
|
o.Config = cc;
|
|
|
|
//cerco le aziende collegate
|
|
List<AziendaRif> l = new List<AziendaRif>();
|
|
string ten = model.Tenant;
|
|
bool bCercaAzcoll = false;
|
|
bool bCercaAziVT = false;
|
|
|
|
bCercaAziVT = true;
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Discovery:
|
|
// bCercaAzcoll = true;
|
|
// break;
|
|
// case Clienti.VT:
|
|
// bCercaAziVT = true;
|
|
// break;
|
|
|
|
//}
|
|
if (bCercaAzcoll)
|
|
{
|
|
//_azi_coll = getAziendeRifByTenant(ten);
|
|
var a = await _azi_coll.Where(t => t.piazihoc != null && t.piazihoc.Equals(ten) && t.picodtec!=null && t.picodtec.Trim().Equals(o.Tccodice.Trim())).ToListAsync();
|
|
if (a.Any())
|
|
{
|
|
|
|
foreach (AziendaRif appo in a)
|
|
{
|
|
string logo = !string.IsNullOrEmpty(appo.pilogurl) ? appo.pilogurl.Trim() : string.Empty;
|
|
//var uriBuilder = new UriBuilder(Request.Scheme, Request.Host.Host, Request.Host.Port ?? -1);
|
|
//logo = uriBuilder + logo;
|
|
appo.pilogurl = logo;
|
|
l.Add(appo);
|
|
}
|
|
}
|
|
}
|
|
if(bCercaAziVT)
|
|
{
|
|
|
|
ten = model.Tenant;
|
|
string ten2 = tecnico.First().tccodazi;
|
|
string tecn= tecnico.First().tccodice;
|
|
_VT_DatiAzi = _VT_DatiAzienda.Dati;
|
|
var t = await _VT_DatiAzi.Where(t => t.azienda.Equals(ten2) && t.tecnico.Equals(tecn)).ToListAsync();
|
|
if (t.Any())
|
|
{
|
|
foreach (DatiAzienda appo in t)
|
|
{
|
|
AziendaRif ar = new AziendaRif();
|
|
|
|
//https://localhost:7068/VIRTU/AZI01/AZI01_LOGO.jpg
|
|
string logo = !string.IsNullOrEmpty(appo.url_logo) ? appo.url_logo.Trim() : string.Empty;
|
|
//var uriBuilder = new UriBuilder(Request.Scheme, Request.Host.Host, Request.Host.Port ?? -1);
|
|
//logo = uriBuilder + logo;
|
|
ar.pilogurl = logo;
|
|
ar.picodtec = appo.tecnico;
|
|
ar.pinomede = appo.ragsoc;
|
|
ar.pitextin = appo.testo_buono;
|
|
ar.pirifazi = appo.azienda;
|
|
ar.piazihoc = model.Tenant;
|
|
|
|
l.Add(ar);
|
|
}
|
|
}
|
|
/*
|
|
_azi_coll = _VT_azi.Azi;
|
|
var a= await _azi_coll.Where(t => t.piazihoc != null && t.piazihoc.Equals(ten)
|
|
&& t.picodtec != null && t.picodtec.Trim().Equals(o.Tccodice.Trim())
|
|
&& t.pirifazi!=null && t.pirifazi.Equals(ten2)
|
|
).ToListAsync();
|
|
|
|
if(a.Any())
|
|
{
|
|
foreach (AziendaRif appo in a)
|
|
{
|
|
|
|
//https://localhost:7068/VIRTU/AZI01/AZI01_LOGO.jpg
|
|
string logo = !string.IsNullOrEmpty(appo.pilogurl) ? appo.pilogurl.Trim() : string.Empty;
|
|
//var uriBuilder = new UriBuilder(Request.Scheme, Request.Host.Host, Request.Host.Port ?? -1);
|
|
//logo = uriBuilder + logo;
|
|
appo.pilogurl = logo;
|
|
l.Add(appo);
|
|
}
|
|
}
|
|
*/
|
|
|
|
}
|
|
o.aziende_coll = l;
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, o);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
o.err_detail = err;
|
|
o.err_title = err;
|
|
o.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, o);
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region CHIAMATE
|
|
private async Task<string> getSerBuonoChiamata(string ten,string pref, string ten2)
|
|
{
|
|
//inizializzo il buono nel caso non lo trovi in tabella (per Sicilia è stato così)
|
|
string seriale = pref+"00000";
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// ten = ten2;
|
|
|
|
// break;
|
|
// default:
|
|
// _rapp_new = getRappNewByTenant(ten);
|
|
// break;
|
|
//}
|
|
|
|
//var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten && t.ser_buono!=null && t.tipo_rapportino== TipoRapportino.ChiamataChiusa).OrderByDescending(t => t.ser_buono).Take(1).ToListAsync();
|
|
//var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten && t.ser_buono != null && t.ser_buono.Trim().Contains(pref) && t.tipo_rapportino == TipoRapportino.ChiamataChiusa).OrderByDescending(t => t.ser_buono).Take(1).ToListAsync();
|
|
//tolto filtro su tipo rapportino per gestire anche il tipo 4 =commessa
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten && t.ser_buono != null && t.ser_buono.Trim().Contains(pref)).OrderByDescending(t => t.ser_buono).Take(1).ToListAsync();
|
|
|
|
if (rapp != null && rapp.Count() > 0)
|
|
{
|
|
seriale = getNewSerialeBuono(rapp.First().ser_buono, pref);
|
|
}
|
|
else
|
|
{
|
|
seriale = getNewSerialeBuono(seriale, pref);
|
|
}
|
|
|
|
return seriale;
|
|
}
|
|
private async Task<Rapp_New> fillRappNewByInput(Input i, string token, string newSerial,Configurazioni co)
|
|
{
|
|
Rapp_New r = new Rapp_New();
|
|
DateTime dateIni = new DateTime(1900, 1, 1);
|
|
DateTime adesso = DateTime.Now;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
switch (ten)
|
|
{
|
|
case Clienti.VT:
|
|
_chiamate = _VT_chia.Chiamate;
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
break;
|
|
default:
|
|
_chiamate = getChiamateByTenant(ten);
|
|
break;
|
|
}
|
|
//i = fakeInput(i,ten);
|
|
|
|
var chia = await _chiamate.Where(t => t.chserial.Trim().Equals(i.seriale_chiamata.Trim())).OrderBy(t => t.chdtapp).ToListAsync();
|
|
|
|
r.seriale_rapportino = newSerial;
|
|
r.tipo_rapportino = string.Empty;
|
|
r.azienda_impianto = ten;
|
|
r.codice_impianto = chia.First().chcodimp;
|
|
r.azienda_chiamata = ten;
|
|
r.seriale_chiamata = i.seriale_chiamata;
|
|
r.seriale_commessa = string.Empty;
|
|
r.data_rapportino = adesso;
|
|
//r.ora_ini_rapportino = adesso.Hour.ToString();
|
|
r.ora_ini_rapportino = i.ora_ini_rapportino;
|
|
r.ora_fin_rapportino = "01";
|
|
r.min_ini_rapportino = i.min_ini_rapportino;
|
|
r.min_fin_rapportino = "00";
|
|
r.codice_chiusura_1 = string.Empty;
|
|
r.codice_chiusura_2 = string.Empty;
|
|
r.codice_chiusura_3 = string.Empty;
|
|
r.codice_chiusura_4 = string.Empty;
|
|
r.codice_chiusura_5 = string.Empty;
|
|
r.codice_chiusura_6 = string.Empty;
|
|
r.codice_chiusura_7 = string.Empty;
|
|
r.codice_chiusura_8 = string.Empty;
|
|
r.codice_chiusura_9 = string.Empty;
|
|
r.codice_chiusura_10 = string.Empty;
|
|
r.descrizione_intervento = "ACCETTAZIONE chiamata " + i.seriale_chiamata;
|
|
r.stato_finale = string.Empty;
|
|
r.azienda_tecnico = ten;
|
|
r.codice_tecnico = tecnico;
|
|
r.rifiutata = "N";
|
|
r.firma = string.Empty;
|
|
r.incarico = "S";
|
|
r.data_validita = dateIni;
|
|
r.immagine = i.immagine;
|
|
r.ser_buono = string.Empty;
|
|
|
|
|
|
return r;
|
|
}
|
|
private async Task<Rapp_New> fillRappNewRifiutoByInput(Input i, string token, string newSerial, Configurazioni co)
|
|
{
|
|
Rapp_New r = new Rapp_New();
|
|
DateTime dateIni = new DateTime(1900, 1, 1);
|
|
DateTime adesso = DateTime.Now;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
switch (ten)
|
|
{
|
|
case Clienti.VT:
|
|
_chiamate = _VT_chia.Chiamate;
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
break;
|
|
default:
|
|
_chiamate = getChiamateByTenant(ten);
|
|
break;
|
|
}
|
|
|
|
var chia = await _chiamate.Where(t => t.chserial == i.seriale_chiamata).OrderBy(t => t.chdtapp).ToListAsync();
|
|
|
|
r.seriale_rapportino = newSerial;
|
|
r.tipo_rapportino = string.Empty;
|
|
r.azienda_impianto = ten;
|
|
r.codice_impianto = chia.First().chcodimp;
|
|
r.azienda_chiamata = ten;
|
|
r.seriale_chiamata = i.seriale_chiamata;
|
|
r.seriale_commessa = string.Empty;
|
|
r.data_rapportino = adesso;
|
|
r.ora_ini_rapportino = adesso.Hour.ToString();
|
|
r.ora_fin_rapportino = "01";
|
|
r.min_ini_rapportino = adesso.Minute.ToString();
|
|
r.min_fin_rapportino = "00";
|
|
r.codice_chiusura_1 = string.Empty;
|
|
r.codice_chiusura_2 = string.Empty;
|
|
r.codice_chiusura_3 = string.Empty;
|
|
r.codice_chiusura_4 = string.Empty;
|
|
r.codice_chiusura_5 = string.Empty;
|
|
r.codice_chiusura_6 = string.Empty;
|
|
r.codice_chiusura_7 = string.Empty;
|
|
r.codice_chiusura_8 = string.Empty;
|
|
r.codice_chiusura_9 = string.Empty;
|
|
r.codice_chiusura_10 = string.Empty;
|
|
r.descrizione_intervento = "RIFIUTO chiamata " + i.seriale_chiamata;
|
|
r.stato_finale = string.Empty;
|
|
r.azienda_tecnico = ten;
|
|
r.codice_tecnico = tecnico;
|
|
r.rifiutata = "S";
|
|
r.firma = string.Empty;
|
|
r.incarico = "N";
|
|
r.data_validita = dateIni;
|
|
r.immagine = i.immagine;
|
|
r.ser_buono = string.Empty;
|
|
|
|
return r;
|
|
}
|
|
private async Task<Rapp_New> fillRappNewChiudiByInput(Input i, string token, string newSerial, Configurazioni co)
|
|
{
|
|
Rapp_New r = new Rapp_New();
|
|
DateTime dateIni = new DateTime(1900, 1, 1);
|
|
DateTime adesso = DateTime.Now;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
var sBuono = await getSerBuonoChiamata(ten, co.prefisso_buoni_chia,ten2);
|
|
|
|
|
|
switch (ten)
|
|
{
|
|
case Clienti.VT:
|
|
_chiamate = _VT_chia.Chiamate;
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
break;
|
|
default:
|
|
_chiamate = getChiamateByTenant(ten);
|
|
break;
|
|
}
|
|
|
|
|
|
var chiam = await _chiamate.Where(
|
|
t => t.chserial.Equals(i.seriale_chiamata)
|
|
&& t.chcodazi == ten && t.chtipo.Equals("X")
|
|
).OrderByDescending(t => t.chdtapp).ToListAsync();
|
|
if(chiam!=null && chiam.Count()>0)
|
|
{
|
|
r.tipo_rapportino = TipoRapportino.ChiamataDaCommessa;
|
|
r.seriale_commessa = chiam.FirstOrDefault().chrifer;
|
|
}
|
|
else
|
|
{
|
|
r.tipo_rapportino = TipoRapportino.ChiamataChiusa;
|
|
r.seriale_commessa = string.Empty;
|
|
}
|
|
|
|
// MARROCCO se la chiamata è fatta da un capo tecnico che deve rendicontare l'attività delle squadra
|
|
// sulla chiamata nel campo CHMODRAC viene scritto COMME
|
|
var chiam2 = await _chiamate.Where(
|
|
t => t.chserial.Equals(i.seriale_chiamata)
|
|
&& t.chcodazi == ten && t.chtipo.Equals("A")
|
|
).OrderByDescending(t => t.chdtapp).ToListAsync();
|
|
//if (chiam2 != null && chiam2.Count() > 0)
|
|
//{
|
|
// if (ten.Equals(Clienti.Marrocco) && chiam2 != null && chiam2.FirstOrDefault().chmodrac != null && chiam2.FirstOrDefault().chmodrac.Equals("COMME"))
|
|
// {
|
|
// r.tipo_rapportino = TipoRapportino.ChiamataCapoTecnico;
|
|
// }
|
|
// if (ten.Equals(Clienti.Gitoga) && chiam2 != null && chiam2.FirstOrDefault().chmodrac != null && chiam2.FirstOrDefault().chmodrac.Equals("COMME"))
|
|
// {
|
|
// r.tipo_rapportino = TipoRapportino.ChiamataCapoTecnico;
|
|
// }
|
|
// if (ten.Equals(Clienti.Lifta) && chiam2 != null && chiam2.FirstOrDefault().chmodrac != null && chiam2.FirstOrDefault().chmodrac.Equals("COMME"))
|
|
// {
|
|
// r.tipo_rapportino = TipoRapportino.ChiamataCapoTecnico;
|
|
// }
|
|
//}
|
|
|
|
r.seriale_rapportino = newSerial;
|
|
|
|
r.azienda_impianto = ten;
|
|
r.codice_impianto = i.codice_impianto;
|
|
r.azienda_chiamata = ten;
|
|
r.seriale_chiamata = i.seriale_chiamata;
|
|
|
|
|
|
//2023-11-23: gestione data retrodatata. Se l'input è valorizzato vuol dire che l'ho editato dal campo, altrimenti passo la data di sistema
|
|
if(i.data_rapportino!=null)
|
|
r.data_rapportino = i.data_rapportino;
|
|
else
|
|
r.data_rapportino = adesso;
|
|
|
|
//r.ora_ini_rapportino = adesso.Hour.ToString();
|
|
r.ora_ini_rapportino = i.ora_ini_rapportino;
|
|
r.ora_fin_rapportino = i.ora_fin_rapportino;
|
|
//r.min_ini_rapportino = adesso.Minute.ToString();
|
|
r.min_ini_rapportino = i.min_ini_rapportino;
|
|
r.min_fin_rapportino = i.min_fin_rapportino;
|
|
r.codice_chiusura_1 = i.codice_chiusura_1;
|
|
r.codice_chiusura_2 = i.codice_chiusura_2;
|
|
r.codice_chiusura_3 = i.codice_chiusura_3;
|
|
r.codice_chiusura_4 = i.codice_chiusura_4;
|
|
r.codice_chiusura_5 = i.codice_chiusura_5;
|
|
r.codice_chiusura_6 = i.codice_chiusura_6;
|
|
r.codice_chiusura_7 = i.codice_chiusura_7;
|
|
r.codice_chiusura_8 = i.codice_chiusura_8;
|
|
r.codice_chiusura_9 = i.codice_chiusura_9;
|
|
r.codice_chiusura_10 = i.codice_chiusura_10;
|
|
r.descrizione_intervento = i.descrizione_intervento;
|
|
r.stato_finale = string.Empty;
|
|
r.azienda_tecnico = ten;
|
|
r.codice_tecnico = tecnico.Trim();
|
|
r.rifiutata = string.Empty;
|
|
r.firma = i.firma;
|
|
r.incarico = string.Empty;
|
|
r.data_validita = adesso;
|
|
//r.immagine = co.path_buoni + sBuono.ToString();
|
|
|
|
r.esito_intervento = i.esito_intervento;
|
|
r.note_intervento = i.note_intervento;
|
|
r.note_esito = i.note_esito;
|
|
r.difetti_riscontrati = i.difetti_riscontrati;
|
|
r.lavoro_eseguito = i.lavoro_eseguito;
|
|
r.nuovo_contratto = i.nuovo_contratto;
|
|
r.ore_lavoro = i.ore_lavoro;
|
|
r.causale = i.causale;
|
|
r.materiale = i.materiale;
|
|
r.diritto_chiamata = i.diritto_chiamata;
|
|
r.manodopera = i.manodopera;
|
|
r.spese_viaggio = i.spese_viaggio;
|
|
r.pagamento = i.pagamento;
|
|
r.anticipo = i.anticipo;
|
|
r.totale = i.totale;
|
|
r.note_pagamento = i.note_pagamento;
|
|
r.tipo_intervento = i.tipo_intervento;
|
|
r.rafoto1 = i.rafoto1;
|
|
r.rafoto2 = i.rafoto2;
|
|
r.rafoto3 = i.rafoto3;
|
|
r.rafoto4 = i.rafoto4;
|
|
r.rafoto5 = i.rafoto5;
|
|
r.rafoto6 = i.rafoto6;
|
|
r.rafoto7 = i.rafoto7;
|
|
r.rafoto8 = i.rafoto8;
|
|
r.rafoto9 = i.rafoto9;
|
|
r.rafoto10 = i.rafoto10;
|
|
r.codice_intervento = i.codice_intervento;
|
|
r.data_effettiva = i.data_effettiva;
|
|
//manca codice giro ?
|
|
|
|
//r.immagine = i.immagine;
|
|
r.immagine = string.Format(@"{0}\{1}.jpg", co.path_buoni, sBuono.ToString());
|
|
r.ser_buono = sBuono.ToString();
|
|
Console.WriteLine(string.Format("*********** {2} metodo chiudi: tenant:{0} tenant2: {1} tenantConf: {5} buono: {3} tecnico:{4} ", ten, ten2, DateTime.Now.ToString(), r.ser_buono, r.codice_tecnico,tenConf));
|
|
|
|
return r;
|
|
}
|
|
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;
|
|
chiamataItemList = formattaItemChiamateVT(i);
|
|
|
|
//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 Chiamate_out fillChiamateOutVT(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;
|
|
sb.Append("<b>SPETT.LE :</b>");
|
|
if (!string.IsNullOrEmpty(i.andescri))
|
|
{
|
|
sb.Append(!string.IsNullOrEmpty(i.andescri) ? i.andescri.Trim() + " " : 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();
|
|
|
|
//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
|
|
//}
|
|
chiamataItemList = formattaItemChiamateVT(i);
|
|
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;
|
|
//}
|
|
|
|
|
|
//sb.AppendLine("<b>N. Impianto: </b> " + i.chcodimp);
|
|
if (!string.IsNullOrEmpty(i.imubicaz))
|
|
sb.AppendLine("<b>Ubicazione: </b> " + i.imubicaz);
|
|
|
|
rif_impianto = sb.ToString();
|
|
|
|
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;
|
|
//}
|
|
|
|
private Chiamate_out inputToChiamateOut(Input i)
|
|
{
|
|
Chiamate_out c = new Chiamate_out();
|
|
c.chserial = i.seriale_chiamata;
|
|
c.chcodazi = i.azienda_chiamata;
|
|
c.chaziimp = i.codice_impianto;
|
|
c.tccodice = i.codice_tecnico;
|
|
c.chdata = i.data_rapportino;
|
|
return c;
|
|
}
|
|
|
|
/// <summary>Codici di chiusura per scheda intevento return:ActionResult</summary>
|
|
[HttpGet("codici_chiusura")]
|
|
public async Task<ActionResult<IEnumerable<Chiusure>>> codiciChiusura(string token)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
_chiusure = _VT_chiu.Chiu;
|
|
|
|
switch (ten)
|
|
{
|
|
case Clienti.VT:
|
|
_chiusure = _VT_chiu.Chiu;
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
break;
|
|
}
|
|
|
|
var l = await _chiusure.Where(c => c.cccodazi.Equals(ten)).ToListAsync();
|
|
//per DISCOVERY devo riempire anche gli abbinamenti con il tipo manutenzione
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Discovery:
|
|
|
|
// //_ccci = _Disco_ccci.ccci;
|
|
// _ccciView= _Disco_ccciView.ccciWiev;
|
|
// foreach (Chiusure t in l)
|
|
// {
|
|
// t.tipologieMan = new List<string>();
|
|
|
|
|
|
// string cod = t.cccodice;
|
|
// //logica per cercare nella tabella degli abbinamenti
|
|
|
|
|
|
// var appo= await _ccciView.Where(c => c.picodazi!=null && c.picodazi.Equals(ten) && c.picodchi != null && c.picodchi.Equals(cod)).ToListAsync();
|
|
// if (appo != null && appo.Count() > 0)
|
|
// {
|
|
// //sono nel caso dei codici gestiti: nella lista metto solo quelli permessi
|
|
// foreach (CC_CIWiev c in appo)
|
|
// {
|
|
// t.tipologieMan.Add(c.picodint);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// //t.tipologieMan.Add("SEMESTRALE");
|
|
// //t.tipologieMan.Add("ANN ");
|
|
// //t.tipologieMan.Add("BIMESTRALE");
|
|
// //t.tipologieMan.Add("MENSILE ");
|
|
// //t.tipologieMan.Add("QUADRIMEST");
|
|
// //t.tipologieMan.Add("TR ");
|
|
// //t.tipologieMan.Add("VERSEM ");
|
|
|
|
// //Aggiungo tutti
|
|
// var result = _ccciView.GroupBy(test => test.cicodice)
|
|
// .Select(grp => grp.First())
|
|
// .ToList();
|
|
// foreach (CC_CIWiev c in result)
|
|
// {
|
|
// string codint = !string.IsNullOrEmpty(c.cicodice) ? c.cicodice : string.Empty;
|
|
// t.tipologieMan.Add(codint);
|
|
// }
|
|
|
|
// //trovo tutti gli altri NON gestiti e li elimino dal totale
|
|
// var result2 = _ccciView.Where(p=>p.picodint!=null).GroupBy(test => test.cicodice)
|
|
// .Select(grp => grp.First())
|
|
// .ToList();
|
|
// foreach (CC_CIWiev c in result2)
|
|
// {
|
|
// string codint = !string.IsNullOrEmpty(c.cicodice)? c.cicodice:string.Empty;
|
|
// t.tipologieMan.Remove(codint);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
// default:
|
|
|
|
// break;
|
|
//}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, l);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>Chiamate per tecnico e azienda (tenant) in stato C=Assegnate return:ActionResult</summary>
|
|
[HttpGet("chiamate")]
|
|
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 = _VT_chia.Chiamate;
|
|
ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// _chiamate = _VT_chia.Chiamate;
|
|
// ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
// break;
|
|
// default:
|
|
// _chiamate = getChiamateByTenant(ten);
|
|
// break;
|
|
//}
|
|
|
|
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();
|
|
if (tenOut.Equals(Clienti.VT))
|
|
{
|
|
o = fillChiamateOutVT(ch, ten);
|
|
}
|
|
else
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>presaInCarico: 1) crea un nuovo seriale per RAPP_NEW 2)inserisce il primo record di una presa in carico su RAPP_NEW return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamate/prendi_in_carico")]
|
|
public async Task<ActionResult<Chiamate_out>> prendiInCarico([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
Chiamate calltec=new Chiamate();
|
|
Chiamate_out calltec_out = new Chiamate_out();
|
|
string tec = string.Empty;
|
|
try {
|
|
tec = getClaimValueByToken(token, "tccodice");
|
|
}
|
|
catch { }
|
|
Console.WriteLine(string.Format("*********** {2} metodo prendiInCarico1: tenant:{0} tenant2: {1} token: {3} tecnico:{4} ", ten, ten2, DateTime.Now.ToString(), token, tec));
|
|
|
|
try
|
|
{
|
|
if (await checkChiamataPresa(ten, model.seriale_chiamata,TipoRapportino.PresaInCarico,ten2) ==0)
|
|
{
|
|
|
|
_confLette = await readConf(tenConf);
|
|
string newSerial = string.Empty;
|
|
newSerial = await getSeriale(token);
|
|
Rapp_New r = await fillRappNewByInput(model, token, newSerial, _confLette);
|
|
using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
await _VT_rapptable.Rapps.AddAsync(r);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transactionVT.Commit();
|
|
}
|
|
//switch (ten)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_rapp.Rapps.AddAsync(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Ferra_rapp.Rapps.AddAsync(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Disco_rapp.Rapps.AddAsync(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sarom_rapp.Rapps.AddAsync(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Lifta_rapp.Rapps.AddAsync(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_rapp.Rapps.AddAsync(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_rapp.Rapps.AddAsync(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_rapptable.Rapps.AddAsync(r);
|
|
// await _VT_rapptable.SaveChangesAsync();
|
|
// transactionVT.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionLW = _LW_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_rapp.Rapps.AddAsync(r);
|
|
// await _LW_rapp.SaveChangesAsync();
|
|
// transactionLW.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_rapp.Rapps.AddAsync(r);
|
|
// await _Tedes_rapp.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionSys = _Sys_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_rapp.Rapps.AddAsync(r);
|
|
// await _Sys_rapp.SaveChangesAsync();
|
|
// transactionSys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
//restituisco la chiamata
|
|
Console.WriteLine(string.Format("*********** {2} metodo prendiInCarico2: tenant:{0} tenant2: {1} token: {3} tecnico:{4} ", ten, ten2, DateTime.Now.ToString(), token, tec));
|
|
calltec = await getChiamataBySerial(model.seriale_chiamata, token);
|
|
calltec_out = fillChiamateOut(calltec, ten);
|
|
calltec_out.err_status_code = StatiRisposta.Ok;
|
|
|
|
//2024-08-01: metto la lettura della chiamata in un try/catch per evitare l'errore casuale "sequence contains no element"
|
|
//nel catch faccio uscire un oggetto riempito con i valori dell'Input di ingresso
|
|
//try
|
|
//{
|
|
// calltec = await getChiamataBySerial(model.seriale_chiamata, token);
|
|
// calltec_out = fillChiamateOut(calltec, ten);
|
|
// calltec_out.err_status_code = StatiRisposta.Ok;
|
|
//}
|
|
//catch(Exception ee)
|
|
//{
|
|
// calltec_out = inputToChiamateOut(model);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
calltec_out.err_title = "Impossibile prendere in carico la chiamata";
|
|
calltec_out.err_detail = "Chiamata precendentemente presa in carico: " + model.seriale_chiamata;
|
|
calltec_out.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, calltec_out);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
calltec_out.err_title = ex.Message;
|
|
calltec_out.err_detail = errmsg;
|
|
calltec_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary> rifiuta: 1) crea un nuovo seriale per RAPP_NEW 2)inserisce record su RAPP_NEW con INCARICO=N e RIFIUTATA=S return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamate/rifiuta")]
|
|
public async Task<ActionResult<Chiamate_out>> rifiuta([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
Chiamate calltec = new Chiamate();
|
|
Chiamate_out calltec_out = new Chiamate_out();
|
|
|
|
try
|
|
{
|
|
if (await checkChiamataRifiutata(ten, model.seriale_chiamata, TipoRapportino.PresaInCarico,ten2) == 0)
|
|
{
|
|
_confLette = await readConf(tenConf);
|
|
string newSerial = string.Empty;
|
|
newSerial = await getSeriale(token);
|
|
Rapp_New r = await fillRappNewRifiutoByInput(model, token, newSerial, _confLette);
|
|
|
|
using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
await _VT_rapptable.Rapps.AddAsync(r);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transactionVT.Commit();
|
|
}
|
|
//switch (ten)
|
|
// {
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_rapp.Rapps.AddAsync(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Ferra_rapp.Rapps.AddAsync(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Disco_rapp.Rapps.AddAsync(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sarom_rapp.Rapps.AddAsync(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Lifta_rapp.Rapps.AddAsync(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_rapp.Rapps.AddAsync(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_rapp.Rapps.AddAsync(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_rapptable.Rapps.AddAsync(r);
|
|
// await _VT_rapptable.SaveChangesAsync();
|
|
// transactionVT.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionLW = _LW_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_rapp.Rapps.AddAsync(r);
|
|
// await _LW_rapp.SaveChangesAsync();
|
|
// transactionLW.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_rapp.Rapps.AddAsync(r);
|
|
// await _Tedes_rapp.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionSys = _Sys_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_rapp.Rapps.AddAsync(r);
|
|
// await _Sys_rapp.SaveChangesAsync();
|
|
// transactionSys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
calltec = await getChiamataBySerial(model.seriale_chiamata, token);
|
|
calltec_out = fillChiamateOut(calltec, ten);
|
|
calltec_out.err_status_code = StatiRisposta.Ok;
|
|
|
|
}
|
|
else
|
|
{
|
|
calltec_out.err_title = "Impossibile rifiutare la chiamata";
|
|
calltec_out.err_detail = "Chiamata precendentemente rifiutata: " + model.seriale_chiamata;
|
|
calltec_out.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, calltec_out);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
calltec_out.err_title = ex.Message;
|
|
calltec_out.err_detail = errmsg;
|
|
calltec_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
|
}
|
|
|
|
//return calltec_out;
|
|
|
|
}
|
|
|
|
/// <summary>chiudi: 1) crea un nuovo seriale per RAPP_NEW 2)inserisce record su RAPP_NEW con i dati dell'intervento return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamate/chiudi")]
|
|
public async Task<ActionResult<Chiamate_out>> chiudi([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf= getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
Chiamate calltec = new Chiamate();
|
|
Chiamate_out calltec_out = new Chiamate_out();
|
|
try
|
|
{
|
|
if (await checkChiamataChiusa(ten, model.seriale_chiamata, TipoRapportino.ChiamataChiusa) == 0)
|
|
{
|
|
int riga = 0;
|
|
if(ten.Equals(Clienti.VT))
|
|
{
|
|
_confLette = await readConf(ten2);
|
|
}
|
|
else
|
|
{
|
|
|
|
_confLette = await readConf(tenConf);
|
|
}
|
|
|
|
string newSerial = string.Empty;
|
|
newSerial = await getSeriale(token);
|
|
|
|
Rapp_New r = await fillRappNewChiudiByInput(model, token, newSerial, _confLette);
|
|
|
|
using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
await _VT_rapptable.Rapps.AddAsync(r);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transactionVT.Commit();
|
|
}
|
|
// 27/02/2025 agggiunta gestione Vt_MagNew
|
|
riga = 0;
|
|
if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
{
|
|
using (var transactionVT2 = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
foreach (Saldiart co in model.compo_add)
|
|
{
|
|
Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
riga = riga + 1;
|
|
vtmn = SaldiArtToVtMag_New(co, riga, newSerial, tecnico, ten2);
|
|
|
|
await _VT_MagNew.MagNewVt.AddAsync(vtmn);
|
|
await _VT_MagNew.SaveChangesAsync();
|
|
}
|
|
transactionVT2.Commit();
|
|
}
|
|
}
|
|
if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
{
|
|
using (var transactionVt3 = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
foreach (Compo_Impia co in model.compo_del)
|
|
{
|
|
Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
riga = riga + 1;
|
|
vtmn = compo_ImpiaToVt_Mag_New(co, riga, newSerial, tecnico, ten2);
|
|
|
|
await _VT_MagNew.MagNewVt.AddAsync(vtmn);
|
|
await _VT_MagNew.SaveChangesAsync();
|
|
}
|
|
transactionVt3.Commit();
|
|
}
|
|
}
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_rapp.Rapps.AddAsync(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Ferra_rapp.Rapps.AddAsync(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sarom_rapp.Rapps.AddAsync(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Lifta_rapp.Rapps.AddAsync(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add!=null && model.compo_add.Count()>0)
|
|
// {
|
|
// using (var transaction2 = _Sicilia_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sicilia_mag.Mag.AddAsync(mn);
|
|
// await _Sicilia_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Sicilia_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sicilia_mag.Mag.AddAsync(mn);
|
|
// await _Sicilia_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
|
|
// using (var transaction = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Disco_rapp.Rapps.AddAsync(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _Disco_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Disco_mag.Mag.AddAsync(mn);
|
|
// await _Disco_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Disco_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Disco_mag.Mag.AddAsync(mn);
|
|
// await _Disco_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
|
|
// using (var transaction = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_rapp.Rapps.AddAsync(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _Siet_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Siet_mag.Mag.AddAsync(mn);
|
|
// await _Siet_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Siet_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Siet_mag.Mag.AddAsync(mn);
|
|
// await _Siet_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
|
|
// using (var transaction = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_rapp.Rapps.AddAsync(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _PMS_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _PMS_mag.Mag.AddAsync(mn);
|
|
// await _PMS_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _PMS_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _PMS_mag.Mag.AddAsync(mn);
|
|
// await _PMS_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_rapptable.Rapps.AddAsync(r);
|
|
// await _VT_rapptable.SaveChangesAsync();
|
|
// transactionVT.Commit();
|
|
// }
|
|
// // 27/02/2025 agggiunta gestione Vt_MagNew
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transactionVT2 = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
// riga = riga + 1;
|
|
// vtmn = SaldiArtToVtMag_New(co, riga, newSerial, tecnico, ten2);
|
|
|
|
// await _VT_MagNew.MagNewVt.AddAsync(vtmn);
|
|
// await _VT_MagNew.SaveChangesAsync();
|
|
// }
|
|
// transactionVT2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transactionVt3 = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Vt_Mag_New vtmn = new Vt_Mag_New();
|
|
// riga = riga + 1;
|
|
// vtmn = compo_ImpiaToVt_Mag_New(co, riga, newSerial, tecnico, ten2);
|
|
|
|
// await _VT_MagNew.MagNewVt.AddAsync(vtmn);
|
|
// await _VT_MagNew.SaveChangesAsync();
|
|
// }
|
|
// transactionVt3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
|
|
// using (var transaction = _LW_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_rapp.Rapps.AddAsync(r);
|
|
// await _LW_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _LW_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _LW_mag.Mag.AddAsync(mn);
|
|
// await _LW_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _LW_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _LW_mag.Mag.AddAsync(mn);
|
|
// await _LW_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
|
|
// using (var transaction = _Tedes_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_rapp.Rapps.AddAsync(r);
|
|
// await _Tedes_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _Tedes_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Tedes_mag.Mag.AddAsync(mn);
|
|
// await _Tedes_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Tedes_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Tedes_mag.Mag.AddAsync(mn);
|
|
// await _Tedes_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
|
|
// case Clienti.Syscom:
|
|
|
|
// using (var transaction = _Sys_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_rapp.Rapps.AddAsync(r);
|
|
// await _Sys_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
// using (var transaction2 = _Sys_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sys_mag.Mag.AddAsync(mn);
|
|
// await _Sys_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Sys_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sys_mag.Mag.AddAsync(mn);
|
|
// await _Sys_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
calltec = await getChiamataBySerial(r.seriale_chiamata, token);
|
|
calltec_out = fillChiamateOut(calltec, ten);
|
|
calltec_out.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, calltec_out);
|
|
|
|
}
|
|
else
|
|
{
|
|
calltec_out.err_title = "Impossibile chiudere la chiamata";
|
|
calltec_out.err_detail = "Chiamata precendentemente chiusa: " + model.seriale_chiamata;
|
|
calltec_out.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
calltec_out.err_title = ex.Message;
|
|
calltec_out.err_detail = errmsg;
|
|
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>
|
|
[HttpPost]
|
|
[Route("chiamate/rilascia")]
|
|
public async Task<ActionResult<Chiamate_out>> rilascia([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
Chiamate calltec = new Chiamate();
|
|
Chiamate_out calltec_out = new Chiamate_out();
|
|
Rapp_New r = null;
|
|
|
|
try
|
|
{
|
|
if ((r=await checkChiamataDaRilasciare (ten, model.seriale_rapportino, TipoRapportino.PresaInCarico, ten2))!=null)
|
|
{
|
|
using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
_VT_rapptable.Rapps.Remove(r);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transactionVT.Commit();
|
|
}
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Marro_rapp.Rapps.Remove(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Ferra_rapp.Rapps.Remove(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Sarom_rapp.Rapps.Remove(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Gitoga_rapp.Rapps.Remove(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Lifta_rapp.Rapps.Remove(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Sicilia_rapp.Rapps.Remove(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Disco_rapp.Rapps.Remove(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
|
|
// using (var transaction = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Siet_rapp.Rapps.Remove(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
|
|
// using (var transaction = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Pms_rapp.Rapps.Remove(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionVT = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// _VT_rapptable.Rapps.Remove(r);
|
|
// await _VT_rapptable.SaveChangesAsync();
|
|
// transactionVT.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
|
|
// using (var transaction = _LW_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _LW_rapp.Rapps.Remove(r);
|
|
// await _LW_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco :
|
|
|
|
// using (var transaction = _Tedes_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Tedes_rapp.Rapps.Remove(r);
|
|
// await _Tedes_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
|
|
// using (var transaction = _Sys_rapp.Database.BeginTransaction())
|
|
// {
|
|
// _Sys_rapp.Rapps.Remove(r);
|
|
// await _Sys_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
calltec = await getChiamataBySerial(r.seriale_chiamata, token);
|
|
calltec_out = fillChiamateOut(calltec, ten);
|
|
calltec_out.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, calltec_out);
|
|
|
|
}
|
|
else
|
|
{
|
|
calltec_out.err_title = "Impossibile rilasciare la chiamata.Chiamata non trovata";
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("seriale Chiamata : " + model.seriale_chiamata);
|
|
sb.AppendLine("seriale Rapportino : " + model.seriale_rapportino);
|
|
calltec_out.err_detail = sb.ToString();
|
|
sb.Clear();
|
|
calltec_out.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
calltec_out.err_title = ex.Message;
|
|
calltec_out.err_detail = errmsg;
|
|
calltec_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, calltec_out);
|
|
}
|
|
|
|
//return calltec_out;
|
|
}
|
|
#endregion
|
|
|
|
#region MANUTENZIONI
|
|
private Prese fillPreseByInput(Input i, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
Prese p = new Prese();
|
|
p.picodazi = ten;
|
|
p.pimpianto = i.pimpianto;
|
|
p.picodint = i.picodint;
|
|
p.picodtec = tecnico;
|
|
p.pidatman = i.pidatman;
|
|
p.cpccchk = getCpccchk(10);
|
|
return p;
|
|
}
|
|
private async Task<Rapp_New> fillRappNewChiudiManByInput(Input model, string token, string newSerial,Configurazioni co)
|
|
{
|
|
Rapp_New r = new Rapp_New();
|
|
//DateTime dateIni = new DateTime(1900, 1, 1);
|
|
DateTime adesso = DateTime.Now;
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
var sBuono = await getSerBuonoManutenzione(ten, co.prefisso_buoni_man);
|
|
|
|
//model = fakeInputMan(model);
|
|
r.seriale_rapportino = newSerial;
|
|
|
|
r.tipo_rapportino = TipoRapportino.ManutenzioneChiusa;
|
|
r.azienda_impianto = ten;
|
|
//r.codice_impianto = model.codice_impianto;
|
|
r.codice_impianto = model.pimpianto;//da tabella PIPRESA
|
|
r.azienda_chiamata = ten;
|
|
r.seriale_chiamata = String.Empty;
|
|
r.seriale_commessa = string.Empty;
|
|
|
|
|
|
//var time = "03/07/2023 00:00:00";
|
|
//adesso = DateTime.ParseExact(time, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
|
|
r.data_rapportino = adesso;
|
|
|
|
|
|
//r.ora_ini_rapportino = adesso.Hour.ToString();
|
|
r.ora_ini_rapportino = model.ora_ini_rapportino;
|
|
r.ora_fin_rapportino = model.ora_fin_rapportino;
|
|
//r.min_ini_rapportino = adesso.Minute.ToString();
|
|
r.min_ini_rapportino = model.min_ini_rapportino;
|
|
r.min_fin_rapportino = model.min_fin_rapportino;
|
|
r.codice_chiusura_1 = model.codice_chiusura_1;
|
|
r.codice_chiusura_2 = model.codice_chiusura_2;
|
|
r.codice_chiusura_3 = model.codice_chiusura_3;
|
|
r.codice_chiusura_4 = model.codice_chiusura_4;
|
|
r.codice_chiusura_5 = model.codice_chiusura_5;
|
|
r.codice_chiusura_6 = model.codice_chiusura_6;
|
|
r.codice_chiusura_7 = model.codice_chiusura_7;
|
|
r.codice_chiusura_8 = model.codice_chiusura_8;
|
|
r.codice_chiusura_9 = model.codice_chiusura_9;
|
|
r.codice_chiusura_10 = model.codice_chiusura_10;
|
|
r.descrizione_intervento = model.descrizione_intervento;
|
|
r.stato_finale = model.stato_finale;
|
|
r.azienda_tecnico = ten;
|
|
r.codice_tecnico = tecnico;
|
|
r.rifiutata = string.Empty;
|
|
r.firma = model.firma;
|
|
r.incarico = string.Empty;
|
|
r.data_validita = model.pidatman;
|
|
|
|
//r.immagine = co.path_buoni + sBuono.ToString();
|
|
|
|
r.esito_intervento = model.esito_intervento;
|
|
r.note_intervento = model.note_intervento;
|
|
r.note_esito = model.note_esito;
|
|
r.difetti_riscontrati = model.difetti_riscontrati;
|
|
r.lavoro_eseguito = model.lavoro_eseguito;
|
|
r.nuovo_contratto = model.nuovo_contratto;
|
|
r.ore_lavoro = model.ore_lavoro;
|
|
r.causale = model.causale;
|
|
r.materiale = model.materiale;
|
|
r.diritto_chiamata = model.diritto_chiamata;
|
|
r.manodopera = model.manodopera;
|
|
r.spese_viaggio = model.spese_viaggio;
|
|
r.pagamento = model.pagamento;
|
|
r.anticipo = model.anticipo;
|
|
r.totale = model.totale;
|
|
r.note_pagamento = model.note_pagamento;
|
|
r.tipo_intervento = model.tipo_intervento;
|
|
r.rafoto1 = model.rafoto1;
|
|
r.rafoto2 = model.rafoto2;
|
|
r.rafoto3 = model.rafoto3;
|
|
r.rafoto4 = model.rafoto4;
|
|
r.rafoto5 = model.rafoto5;
|
|
r.rafoto6 = model.rafoto6;
|
|
r.rafoto7 = model.rafoto7;
|
|
r.rafoto8 = model.rafoto8;
|
|
r.rafoto9 = model.rafoto9;
|
|
r.rafoto10 = model.rafoto10;
|
|
//r.codice_intervento = model.codice_intervento;
|
|
r.codice_intervento = model.picodint;// da tabella PIPRESA
|
|
//r.data_effettiva = model.data_effettiva;
|
|
r.data_effettiva = model.pidatman;// da tabella PIPRESA
|
|
|
|
|
|
//r.immagine = model.immagine;
|
|
r.immagine = string.Format(@"{0}\{1}.jpg",co.path_buoni,sBuono.ToString());
|
|
//string ts = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
//r.immagine = string.Format(@"{0}\{1}_{2}.jpg", co.path_buoni, sBuono.ToString(),ts);
|
|
r.ser_buono = sBuono.ToString();
|
|
Console.WriteLine(string.Format("*********** {2} metodo chiudi MAN: tenant:{0} tenant2: {1} tenantConf: {5} buono: {3} tecnico:{4} ", ten, ten2, DateTime.Now.ToString(), r.ser_buono, r.codice_tecnico, tenConf));
|
|
|
|
return r;
|
|
}
|
|
private async Task<string> getSerBuonoManutenzione(string ten,string suff)
|
|
{
|
|
//inizializzo il buono nel caso non lo trovi in tabella (per Sicilia è stato così)
|
|
//TODO da togliere
|
|
//suff = "MAK";
|
|
string seriale = suff+"00000";
|
|
|
|
//_rapp_new = getRappNewByTenant(ten);
|
|
//var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten && t.ser_buono != null && t.tipo_rapportino == TipoRapportino.ManutenzioneChiusa).OrderByDescending(t => t.seriale_rapportino).Take(1).ToListAsync();
|
|
var rapp = await _rapp_new.Where(t => t.azienda_impianto == ten && t.ser_buono != null && t.ser_buono.Trim().Contains(suff) && t.tipo_rapportino == TipoRapportino.ManutenzioneChiusa).OrderByDescending(t => t.seriale_rapportino).Take(1).ToListAsync();
|
|
|
|
if (rapp != null && rapp.Count() > 0)
|
|
{
|
|
seriale = getNewSerialeBuonoMan(rapp.First().ser_buono, suff);
|
|
}
|
|
else
|
|
{
|
|
seriale = getNewSerialeBuonoMan(seriale, suff);
|
|
}
|
|
return seriale;
|
|
}
|
|
private Manprog_out fillManprogOut(Manprog m, string tenant)
|
|
{
|
|
Manprog_out o = new Manprog_out();
|
|
o.ctcodint=m.ctcodint;
|
|
o.ctdatpro = m.ctdatpro;
|
|
o.ctdesint = m.ctdesint;
|
|
o.imindiri1 = m.imindiri1;
|
|
o.imindiri2 = m.imindiri2;
|
|
|
|
o.imindiri3 = m.imindiri3;
|
|
o.imindiri4 = m.imindiri4;
|
|
o.imindiri5 = m.imindiri5;
|
|
o.imlocali = m.imlocali;
|
|
o.imcodcap = m.imcodcap;
|
|
|
|
o.imcomune = m.imcomune;
|
|
o.improvin = m.improvin;
|
|
o.improvin = m.improvin;
|
|
|
|
o.immatric = m.immatric;
|
|
o.imnumimp = m.imnumimp;
|
|
o.imubicaz = m.imubicaz;
|
|
|
|
o.tccodice = m.tccodice;
|
|
o.seriale_rapportino = m.seriale_rapportino;
|
|
o.ser_buono = m.ser_buono;
|
|
o.generato = m.generato;
|
|
|
|
|
|
o.pimpianto = m.pimpianto;
|
|
o.picodint = m.picodint;
|
|
o.pidatman = m.pidatman;
|
|
o.err_title = m.err_title;
|
|
o.err_detail = m.err_detail;
|
|
o.err_status_code = m.err_status_code;
|
|
|
|
o.telefono1 = m.telefono1;
|
|
o.telefono2 = m.telefono2;
|
|
o.cliente = m.cliente;
|
|
o.chiamata = m.chiamata;
|
|
o.spe_viaggio = m.spe_viaggio;
|
|
|
|
//campi chiave
|
|
o.ctcodazi = tenant;
|
|
o.ctcodimp = m.ctcodimp;
|
|
o.ctdatpro = Convert.ToDateTime(m.ctdatpro);
|
|
o.ctcodint = m.ctcodint;
|
|
//FINE campi chiave
|
|
StringBuilder sb = new StringBuilder();
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
string indStampa = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
|
|
// dic.Add("Num. Impianto", !string.IsNullOrEmpty(m.imnumimp) ? m.imnumimp : String.Empty);
|
|
// dic.Add("Ubicazione", !string.IsNullOrEmpty(m.imubicaz) ? m.imubicaz : String.Empty);
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
|
|
// dic.Add("Num. Impianto", !string.IsNullOrEmpty(m.imnumimp) ? m.imnumimp : String.Empty);
|
|
// dic.Add("Ubicazione", !string.IsNullOrEmpty(m.imubicaz) ? m.imubicaz : String.Empty);
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
|
|
// dic.Add("Num. Impianto", !string.IsNullOrEmpty(m.imnumimp) ? m.imnumimp : String.Empty);
|
|
// dic.Add("Ubicazione", !string.IsNullOrEmpty(m.imubicaz) ? m.imubicaz : String.Empty);
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// #region sicila dictionary
|
|
// dic.Add("Gennaio", !string.IsNullOrEmpty(m.mpmesgen) ? m.mpmesgen : String.Empty);
|
|
// dic.Add("Febbraio", !string.IsNullOrEmpty(m.mpmesfeb) ? m.mpmesfeb : String.Empty);
|
|
// dic.Add("Marzo", !string.IsNullOrEmpty(m.mpmesmar) ? m.mpmesmar : String.Empty);
|
|
// dic.Add("Aprile", !string.IsNullOrEmpty(m.mpmesapr) ? m.mpmesapr : String.Empty);
|
|
// dic.Add("Maggio", !string.IsNullOrEmpty(m.mpmesmag) ? m.mpmesmag : String.Empty);
|
|
// dic.Add("Giugno", !string.IsNullOrEmpty(m.mpmesgiu) ? m.mpmesgiu : String.Empty);
|
|
|
|
// dic.Add("Luglio", !string.IsNullOrEmpty(m.mpmeslug) ? m.mpmeslug : String.Empty);
|
|
// dic.Add("Agosto", !string.IsNullOrEmpty(m.mpmesago) ? m.mpmesago : String.Empty);
|
|
// dic.Add("Settembre", !string.IsNullOrEmpty(m.mpmesset) ? m.mpmesset : String.Empty);
|
|
// dic.Add("Ottobre", !string.IsNullOrEmpty(m.mpmesott) ? m.mpmesott : String.Empty);
|
|
// dic.Add("Novembre", !string.IsNullOrEmpty(m.mpmesnov) ? m.mpmesnov : String.Empty);
|
|
// dic.Add("Dicembre", !string.IsNullOrEmpty(m.mpmesdic) ? m.mpmesdic : String.Empty);
|
|
// #endregion
|
|
|
|
// #region sicilia indirizzo
|
|
// sb.Append("<b>SPETT.LE :</b>");
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// indStampa = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// #region discovery
|
|
// indStampa = formattaIndirizzoStampaManutDiscovery(m);
|
|
|
|
// dic.Add("Num. Impianto", !string.IsNullOrEmpty(m.imnumimp) ? m.imnumimp : String.Empty);
|
|
// dic.Add("Ubicazione", !string.IsNullOrEmpty(m.imubicaz) ? m.imubicaz : String.Empty);
|
|
// #endregion
|
|
// break;
|
|
// default:
|
|
// sb.Append("<b>SPETT.LE :</b>");
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// indStampa = sb.ToString();
|
|
// break;
|
|
//}
|
|
o.altri = dic;
|
|
o.indirizzo_stampa = indStampa;
|
|
sb.Clear();
|
|
|
|
string itemList = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia lista man
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imcodcap) ? " " + m.imcodcap.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imlocali) ? " " + m.imlocali.Trim() : string.Empty);
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// itemList = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Tedesco:
|
|
// #region Tedesco lista man
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// //var sBuono = await getSerBuonoManutenzione(ten, co.prefisso_buoni_man);
|
|
// var a = getDescrImpTedesco(m.ctcodimp, tenant);
|
|
// string appo = a.Result;
|
|
// sb.Append("<b>N.pratica</b> : " + appo);
|
|
// sb.Append("<br>");
|
|
// }
|
|
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imcodcap) ? " " + m.imcodcap.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imlocali) ? " " + m.imlocali.Trim() : string.Empty);
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(m.imubicaz))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Ubicazione</b> : " + m.imubicaz.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(m.immatric))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Matricola</b> : " + m.immatric.Trim());
|
|
// }
|
|
|
|
// itemList = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// default:
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imcodcap) ? " " + m.imcodcap.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imlocali) ? " " + m.imlocali.Trim() : string.Empty);
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(m.imubicaz))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Ubicazione</b> : " + m.imubicaz.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(m.immatric))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Matricola</b> : " + m.immatric.Trim());
|
|
// }
|
|
|
|
// itemList = sb.ToString();
|
|
|
|
// break;
|
|
//}
|
|
o.impianto_list = itemList;
|
|
sb.Clear();
|
|
|
|
string rif_impianto = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Discovery:
|
|
// #region dicovery
|
|
// rif_impianto = formattaRifImpDiscovery(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia lista man
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
|
|
// sb.AppendLine("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// rif_impianto = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// default:
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<b>N. Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// rif_impianto = sb.ToString();
|
|
// break;
|
|
//}
|
|
o.riferimento_impianto = rif_impianto;
|
|
sb.Clear();
|
|
|
|
o.imazirif = m.imazirif;
|
|
o.imzonman = m.imzonman;
|
|
o.imrefref = m.imrefref;
|
|
|
|
return o;
|
|
}
|
|
private Manprog_out fillManprogOut2(Manprog m, string tenant)
|
|
{
|
|
Manprog_out o = new Manprog_out();
|
|
o.ctcodint = m.ctcodint;
|
|
o.ctdatpro = m.ctdatpro;
|
|
o.ctdesint = m.ctdesint;
|
|
o.imindiri1 = m.imindiri1;
|
|
o.imindiri2 = m.imindiri2;
|
|
|
|
o.imindiri3 = m.imindiri3;
|
|
o.imindiri4 = m.imindiri4;
|
|
o.imindiri5 = m.imindiri5;
|
|
o.imlocali = m.imlocali;
|
|
o.imcodcap = m.imcodcap;
|
|
|
|
o.imcomune = m.imcomune;
|
|
o.improvin = m.improvin;
|
|
|
|
o.improvin = m.improvin;
|
|
o.improvin = m.improvin;
|
|
o.improvin = m.improvin;
|
|
|
|
o.immatric = m.immatric;
|
|
o.imnumimp = m.imnumimp;
|
|
o.imubicaz = m.imubicaz;
|
|
|
|
o.tccodice = m.tccodice;
|
|
o.seriale_rapportino = m.seriale_rapportino;
|
|
o.ser_buono = m.ser_buono;
|
|
o.generato = m.generato;
|
|
|
|
|
|
//o.pimpianto = m.pimpianto;
|
|
//questo è il campo che l'app deve avere per accorgersi del cambiamento di stato
|
|
//quindi gli passo, se lo trovo vuoto, quello riletto dalla manutenzione
|
|
string impianto = string.Empty;
|
|
if (!string.IsNullOrEmpty(m.pimpianto))
|
|
impianto = m.pimpianto;
|
|
else
|
|
impianto = m.ctcodimp;
|
|
o.pimpianto = impianto;
|
|
|
|
//o.picodint = m.picodint;
|
|
string codice_intervento = string.Empty;
|
|
if (!string.IsNullOrEmpty(m.picodint))
|
|
codice_intervento = m.picodint;
|
|
else
|
|
codice_intervento = m.ctcodint;
|
|
o.picodint = codice_intervento;
|
|
|
|
//o.pidatman = m.pidatman;
|
|
DateTime? data_manutenzione = null;
|
|
if (m.pidatman != null)
|
|
data_manutenzione = m.pidatman;
|
|
else
|
|
data_manutenzione = m.ctdatpro;
|
|
o.pidatman = data_manutenzione;
|
|
|
|
|
|
o.err_title = m.err_title;
|
|
o.err_detail = m.err_detail;
|
|
o.err_status_code = m.err_status_code;
|
|
|
|
o.telefono1 = m.telefono1;
|
|
o.telefono2 = m.telefono2;
|
|
o.cliente = m.cliente;
|
|
o.chiamata = m.chiamata;
|
|
o.spe_viaggio = m.spe_viaggio;
|
|
|
|
//campi chiave
|
|
o.ctcodazi = tenant;
|
|
o.ctcodimp = m.ctcodimp;
|
|
o.ctdatpro = Convert.ToDateTime(m.ctdatpro);
|
|
o.ctcodint = m.ctcodint;
|
|
//FINE campi chiave
|
|
StringBuilder sb = new StringBuilder();
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
//posizione 1-questa stampa è quella che va sotto il numero del buono e
|
|
//ha l'indirizzo dell'impianto che comincia con spettabile
|
|
string indStampa = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Discovery:
|
|
// #region discovery
|
|
// indStampa = formattaIndirizzoStampaManutDiscovery(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// indStampa = formattaIndirizzoStampaManutMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// #region sicila dictionary
|
|
// dic.Add("Gennaio", !string.IsNullOrEmpty(m.mpmesgen) ? m.mpmesgen : String.Empty);
|
|
// dic.Add("Febbraio", !string.IsNullOrEmpty(m.mpmesfeb) ? m.mpmesfeb : String.Empty);
|
|
// dic.Add("Marzo", !string.IsNullOrEmpty(m.mpmesmar) ? m.mpmesmar : String.Empty);
|
|
// dic.Add("Aprile", !string.IsNullOrEmpty(m.mpmesapr) ? m.mpmesapr : String.Empty);
|
|
// dic.Add("Maggio", !string.IsNullOrEmpty(m.mpmesmag) ? m.mpmesmag : String.Empty);
|
|
// dic.Add("Giugno", !string.IsNullOrEmpty(m.mpmesgiu) ? m.mpmesgiu : String.Empty);
|
|
|
|
// dic.Add("Luglio", !string.IsNullOrEmpty(m.mpmeslug) ? m.mpmeslug : String.Empty);
|
|
// dic.Add("Agosto", !string.IsNullOrEmpty(m.mpmesago) ? m.mpmesago : String.Empty);
|
|
// dic.Add("Settembre", !string.IsNullOrEmpty(m.mpmesset) ? m.mpmesset : String.Empty);
|
|
// dic.Add("Ottobre", !string.IsNullOrEmpty(m.mpmesott) ? m.mpmesott : String.Empty);
|
|
// dic.Add("Novembre", !string.IsNullOrEmpty(m.mpmesnov) ? m.mpmesnov : String.Empty);
|
|
// dic.Add("Dicembre", !string.IsNullOrEmpty(m.mpmesdic) ? m.mpmesdic : String.Empty);
|
|
// #endregion
|
|
|
|
// #region sicilia indirizzo
|
|
// sb.Append("<b>SPETT.LE :</b>");
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// indStampa = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// default:
|
|
// sb.Append("<b>SPETT.LE :</b>");
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// indStampa = sb.ToString();
|
|
// break;
|
|
//}
|
|
o.indirizzo_stampa = indStampa;
|
|
o.altri = dic;
|
|
sb.Clear();
|
|
|
|
//posizione 2
|
|
string itemList = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// itemList = formattaItemManutenzioniMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia lista man
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imcodcap) ? "," + m.imcodcap.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imlocali) ? "," + m.imlocali.Trim() : string.Empty);
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// itemList = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// default:
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri1) ? m.imindiri1.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri2) ? m.imindiri2.Trim() + " " : string.Empty);
|
|
// sb.Append(m.imindiri3 != null ? m.imindiri3.ToString() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri4) ? m.imindiri4.Trim() + " " : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imindiri5) ? m.imindiri5.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imcodcap) ? "," + m.imcodcap.Trim() : string.Empty);
|
|
// sb.Append(!string.IsNullOrEmpty(m.imlocali) ? "," + m.imlocali.Trim() : string.Empty);
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<br>");
|
|
// sb.Append("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// itemList = sb.ToString();
|
|
// break;
|
|
//}
|
|
o.impianto_list = itemList;
|
|
sb.Clear();
|
|
|
|
//posizione 3-questa stampa è quella che va a destra della posizione 1
|
|
//contiene i dati (matricola, ubicazione, num impianto)
|
|
string rif_impianto = string.Empty;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Discovery:
|
|
// #region discovery
|
|
// rif_impianto = formattaRifImpDiscovery(m);
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// rif_impianto = formattaRifImpMarrocco(m);
|
|
// #endregion
|
|
// break;
|
|
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia lista man
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
|
|
// sb.AppendLine("<b>Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// rif_impianto = sb.ToString();
|
|
// #endregion
|
|
// break;
|
|
|
|
// default:
|
|
// if (!string.IsNullOrEmpty(m.ctcodimp))
|
|
// {
|
|
// sb.Append("<b>N. Impianto</b> : " + m.ctcodimp.Trim());
|
|
// }
|
|
// rif_impianto = sb.ToString();
|
|
// break;
|
|
//}
|
|
o.riferimento_impianto = rif_impianto;
|
|
sb.Clear();
|
|
|
|
o.imazirif = m.imazirif;
|
|
o.imzonman = m.imzonman;
|
|
o.imrefref = m.imrefref;
|
|
|
|
return o;
|
|
}
|
|
|
|
private async Task<string> getDescrImpTedesco(string codimp, string ten)
|
|
{
|
|
string descImp = string.Empty;
|
|
//_impianto = _Tedes_impianti.Impia;
|
|
var l = await _impianto.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten) && t.imcodimp != null && t.imcodimp.Equals(codimp)).ToListAsync();
|
|
if (l != null && l.Count()>0 )
|
|
{
|
|
foreach(Impianto i in l)
|
|
{
|
|
descImp = i.imdescri;
|
|
}
|
|
}
|
|
return descImp;
|
|
}
|
|
|
|
/// <summary>Manutenzioni per tecnico e azienda (tenant). Intervallo: 1 mese prima e 1 mese dopo rispetto a GETDATE() con GENERATO diverso da S return:ActionResult</summary>
|
|
[HttpGet("manutenzioni")]
|
|
public async Task<ActionResult<IEnumerable<Manprog_out>>> manutenzioni(string token)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
//_manutprog = getManutenzioniByTenant(ten);
|
|
|
|
//var manut = await _manutprog.Where(t => t.tccodice == tecnico && t.ctcodazi == ten && t.ctdatpro >= da && t.ctdatpro <= a).OrderBy(t => t.ctcodint).ToListAsync();
|
|
var manut = await _manutprog.Where(t => t.tccodice == tecnico && t.ctcodazi == ten).OrderBy(t => t.ctcodint).ToListAsync();
|
|
|
|
List<Manprog_out> ilist = new List<Manprog_out>();
|
|
foreach (Manprog ch in manut)
|
|
{
|
|
Manprog_out o = new Manprog_out();
|
|
o = fillManprogOut(ch, ten);
|
|
ilist.Add(o);
|
|
}
|
|
|
|
|
|
// cerco le manutenzioni che devo fare per sostituzioni SE abilitate
|
|
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;
|
|
//string zona = string.Empty;
|
|
//zona = ss.tscodzon != null ? ss.tscodzon : "zonavuota";
|
|
|
|
//step 2 : trovo tutte le manutenzioni del tecnico che sto sostitutendo e le aggiungo alla mie
|
|
var manutSost = await _manutprog.Where(t => t.tccodice == tecnico_sostituito
|
|
&& t.ctcodazi == ten
|
|
//&& t.imzonman == zona
|
|
).OrderBy(t => t.ctcodint).ToListAsync();
|
|
|
|
foreach (Manprog ch in manutSost)
|
|
{
|
|
Manprog_out o = new Manprog_out();
|
|
o = fillManprogOut(ch, ten);
|
|
ilist.Add(o);
|
|
}
|
|
}
|
|
}
|
|
|
|
IEnumerable<Manprog_out> enumerable = ilist as IEnumerable<Manprog_out>;
|
|
//return enumerable;
|
|
return StatusCode(StatusCodes.Status200OK, enumerable);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary> prendi_in_carico: inserisce record su Prese con i dati dell'intervento return:ActionResult</summary> TEDES_MAGAZZINIDbContext
|
|
[HttpPost]
|
|
[Route("manutenzioni/prendi_in_carico")]
|
|
public async Task<ActionResult<Manprog_out>> prendiInCaricoMan([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
Manprog man=new Manprog();
|
|
Manprog_out output = new Manprog_out();
|
|
|
|
try
|
|
{
|
|
if (await checkManutenzionePresaInCarico(ten, model.pimpianto, model.picodint, model.pidatman) == 0)
|
|
{
|
|
Prese r = fillPreseByInput(model, token);
|
|
|
|
//man = await getManutenzioneByChiave(model, token);
|
|
man = await getManutenzioneByChiave2(r, token);
|
|
|
|
//output = fillManprogOut(man, ten);
|
|
output = fillManprogOut2(man, ten);
|
|
output.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, output);
|
|
}
|
|
else
|
|
{
|
|
output.err_title = "Impossibile prendere in carico";
|
|
output.err_detail = "Manutenzione precedentemente presa in carico";
|
|
output.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
output.err_title = ex.Message;
|
|
output.err_detail = errmsg;
|
|
output.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
|
|
//return output;
|
|
}
|
|
|
|
/// <summary>chiudi: 1) crea un nuovo seriale per RAPP_NEW 2)inserisce record su RAPP_NEW con i dati dell'intervento return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("manutenzioni/chiudi")]
|
|
public async Task<ActionResult<Manprog_out>> chiudiMan([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
|
|
Manprog man = new Manprog();
|
|
Manprog_out output = new Manprog_out();
|
|
try
|
|
{
|
|
if (await checkManutenzioneChiusa(ten,TipoRapportino.ManutenzioneChiusa,model.pimpianto,model.pidatman,model.picodint)==0)
|
|
{
|
|
_confLette = await readConf(tenConf);
|
|
string newSerial = string.Empty;
|
|
newSerial = await getSeriale(token);
|
|
Rapp_New r = await fillRappNewChiudiManByInput(model, token, newSerial, _confLette);
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_rapp.Rapps.AddAsync(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
|
|
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Ferra_rapp.Rapps.AddAsync(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sarom_rapp.Rapps.AddAsync(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// int riga = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _Sicilia_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// riga = riga + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sicilia_mag.Mag.AddAsync(mn);
|
|
// await _Sicilia_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
|
|
|
|
// using (var transaction3 = _Sicilia_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// riga = riga + 1;
|
|
// mn = compo_ImpiaToMag_New(co, riga, newSerial, tecnico);
|
|
|
|
// await _Sicilia_mag.Mag.AddAsync(mn);
|
|
// await _Sicilia_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction4 = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Disco_rapp.Rapps.AddAsync(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction4.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Lifta_rapp.Rapps.AddAsync(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
// break;
|
|
//case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_rapp.Rapps.AddAsync(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// int rigaSiet = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _Siet_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// rigaSiet = rigaSiet + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, rigaSiet, newSerial, tecnico);
|
|
|
|
// await _Siet_mag.Mag.AddAsync(mn);
|
|
// await _Siet_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Siet_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// rigaSiet = rigaSiet + 1;
|
|
// mn = compo_ImpiaToMag_New(co, rigaSiet, newSerial, tecnico);
|
|
|
|
// await _Siet_mag.Mag.AddAsync(mn);
|
|
// await _Siet_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
//case Clienti.PMS:
|
|
// using (var transactionPms = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_rapp.Rapps.AddAsync(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transactionPms.Commit();
|
|
// }
|
|
// int rigapms = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _PMS_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// rigapms = rigapms + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, rigapms, newSerial, tecnico);
|
|
|
|
// await _PMS_mag.Mag.AddAsync(mn);
|
|
// await _PMS_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _PMS_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// rigapms = rigapms + 1;
|
|
// mn = compo_ImpiaToMag_New(co, rigapms, newSerial, tecnico);
|
|
|
|
// await _PMS_mag.Mag.AddAsync(mn);
|
|
// await _PMS_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
|
|
//case Clienti.LW:
|
|
// using (var transactionLW = _LW_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_rapp.Rapps.AddAsync(r);
|
|
// await _LW_rapp.SaveChangesAsync();
|
|
// transactionLW.Commit();
|
|
// }
|
|
// int rigalw = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _LW_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// rigalw = rigalw + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, rigalw, newSerial, tecnico);
|
|
|
|
// await _LW_mag.Mag.AddAsync(mn);
|
|
// await _LW_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _LW_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// rigalw = rigalw + 1;
|
|
// mn = compo_ImpiaToMag_New(co, rigalw, newSerial, tecnico);
|
|
|
|
// await _LW_mag.Mag.AddAsync(mn);
|
|
// await _LW_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
|
|
//case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_rapp.Rapps.AddAsync(r);
|
|
// await _Tedes_rapp.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// int rigatedes = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _Tedes_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// rigatedes = rigatedes + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, rigatedes, newSerial, tecnico);
|
|
|
|
// await _Tedes_mag.Mag.AddAsync(mn);
|
|
// await _Tedes_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Tedes_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// rigatedes = rigatedes + 1;
|
|
// mn = compo_ImpiaToMag_New(co, rigatedes, newSerial, tecnico);
|
|
|
|
// await _Tedes_mag.Mag.AddAsync(mn);
|
|
// await _Tedes_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
|
|
//case Clienti.Syscom:
|
|
// using (var transactionSys = _Sys_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_rapp.Rapps.AddAsync(r);
|
|
// await _Sys_rapp.SaveChangesAsync();
|
|
// transactionSys.Commit();
|
|
// }
|
|
// int rigasys = 0;
|
|
// if (model.compo_add != null && model.compo_add.Count() > 0)
|
|
// {
|
|
|
|
// using (var transaction2 = _Sys_mag.Database.BeginTransaction())
|
|
// {
|
|
|
|
// foreach (Saldiart co in model.compo_add)
|
|
// {
|
|
// rigasys = rigasys + 1;
|
|
// Mag_New mn = new Mag_New();
|
|
// mn = saldiartToMag_New(co, rigasys, newSerial, tecnico);
|
|
|
|
// await _Sys_mag.Mag.AddAsync(mn);
|
|
// await _Sys_mag.SaveChangesAsync();
|
|
|
|
// }
|
|
// transaction2.Commit();
|
|
// }
|
|
// }
|
|
// if (model.compo_del != null && model.compo_del.Count() > 0)
|
|
// {
|
|
// using (var transaction3 = _Sys_mag.Database.BeginTransaction())
|
|
// {
|
|
// foreach (Compo_Impia co in model.compo_del)
|
|
// {
|
|
// Mag_New mn = new Mag_New();
|
|
// rigasys = rigasys + 1;
|
|
// mn = compo_ImpiaToMag_New(co, rigasys, newSerial, tecnico);
|
|
|
|
// await _Sys_mag.Mag.AddAsync(mn);
|
|
// await _Sys_mag.SaveChangesAsync();
|
|
// }
|
|
// transaction3.Commit();
|
|
// }
|
|
// }
|
|
|
|
// break;
|
|
//default:
|
|
// break;
|
|
//}
|
|
man = await getManutenzioneByChiaveOut(model, token,r);
|
|
output = fillManprogOut(man, ten);
|
|
output.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, output);
|
|
}
|
|
else
|
|
{
|
|
output.err_title = "Impossibile chiudere la manutenzione";
|
|
output.err_detail = "Manutenzione precedentemente chiusa";
|
|
output.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
output.err_title = ex.Message;
|
|
output.err_detail = errmsg;
|
|
output.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
|
|
//return output;
|
|
}
|
|
|
|
/// <summary> rilascia: elimina record su Prese con i dati dell'intervento return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("manutenzioni/rilascia")]
|
|
public async Task<ActionResult<Manprog_out>> rilasciaMan([FromBody] Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
Manprog man = new Manprog();
|
|
Manprog_out output = new Manprog_out();
|
|
Prese pre = null;
|
|
try
|
|
{
|
|
if ((pre=await checkManutenzioneDaRilasciare(ten, model.pimpianto, model.picodint, model.pidatman)) !=null)
|
|
{
|
|
//_prese = getPreseByTenant(ten);
|
|
//var pre = _prese.SingleOrDefault(t => t.picodazi.Equals(ten) && t.pimpianto.Equals(model.pimpianto) && t.picodint.Equals(model.picodint) && t.pidatman == model.pidatman);
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Marro_prese.Prese.Remove(pre);
|
|
// await _Marro_prese.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction2 = _Ferra_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Ferra_prese.Prese.Remove(pre);
|
|
// await _Ferra_prese.SaveChangesAsync();
|
|
// transaction2.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction5 = _Sarom_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Sarom_prese.Prese.Remove(pre);
|
|
// await _Sarom_prese.SaveChangesAsync();
|
|
// transaction5.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction3 = _Sicilia_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Sicilia_prese.Prese.Remove(pre);
|
|
// await _Sicilia_prese.SaveChangesAsync();
|
|
// transaction3.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction4 = _Disco_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Disco_prese.Prese.Remove(pre);
|
|
// await _Disco_prese.SaveChangesAsync();
|
|
// transaction4.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Gitoga_prese.Prese.Remove(pre);
|
|
// await _Gitoga_prese.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Lifta_prese.Prese.Remove(pre);
|
|
// await _Lifta_prese.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Siet_prese.Prese.Remove(pre);
|
|
// await _Siet_prese.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPms = _PMS_prese.Database.BeginTransaction())
|
|
// {
|
|
// _PMS_prese.Prese.Remove(pre);
|
|
// await _PMS_prese.SaveChangesAsync();
|
|
// transactionPms.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionLW = _LW_prese.Database.BeginTransaction())
|
|
// {
|
|
// _LW_prese.Prese.Remove(pre);
|
|
// await _LW_prese.SaveChangesAsync();
|
|
// transactionLW.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Tedes_prese.Prese.Remove(pre);
|
|
// await _Tedes_prese.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom :
|
|
// using (var transactionSys = _Sys_prese.Database.BeginTransaction())
|
|
// {
|
|
// _Sys_prese.Prese.Remove(pre);
|
|
// await _Sys_prese.SaveChangesAsync();
|
|
// transactionSys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
//man = await getManutenzioneByChiave(model, token);
|
|
man = await getManutenzioneByChiave2(pre, token);
|
|
|
|
output = fillManprogOut(man, ten);
|
|
//output = fillManprogOut2(man, ten);
|
|
|
|
output.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, output);
|
|
}
|
|
else
|
|
{
|
|
output.err_title = "Impossibile rilasciare la manutenzione. Manutenzione non trovata";
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("pimpianto: "+model.pimpianto);
|
|
sb.AppendLine("picodint: " + model.picodint);
|
|
sb.AppendLine("pidatman: " + model.pidatman);
|
|
sb.AppendLine("tenant: " + ten);
|
|
output.err_detail = sb.ToString();
|
|
sb.Clear();
|
|
output.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
output.err_title = ex.Message;
|
|
output.err_detail = errmsg;
|
|
output.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, output);
|
|
}
|
|
|
|
//return output;
|
|
}
|
|
#endregion
|
|
|
|
#region UPLOAD FILE
|
|
private static void FtpSend(string url, string ftp_usr, string ftp_pwd, IFormFile files)
|
|
{
|
|
//string url = "ftp://10.0.0.10/LABSE/" + fileName;
|
|
//url = "ftp://poloinformatico41.clienti.init-s.it:6363/test.bmp";
|
|
|
|
//esempio Discovery
|
|
//url = "ftp://discoverylift.dyndns.org:21/test.jpg";
|
|
|
|
|
|
//esempio SICILIA PROD
|
|
//url = "ftp://studioliuzzo.selfip.net:21/adhoc/bmp_24.bmp";
|
|
|
|
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(url);
|
|
request.Credentials = new NetworkCredential(ftp_usr, ftp_pwd);
|
|
//request.Credentials = new NetworkCredential("anonymous", "janeDoe@contoso.com");
|
|
request.Method = WebRequestMethods.Ftp.UploadFile;
|
|
using (Stream ftpStream = request.GetRequestStream())
|
|
{
|
|
files.CopyTo(ftpStream);
|
|
}
|
|
}
|
|
private static string CheckFtp(string url, string ftp_usr, string ftp_pwd)
|
|
{
|
|
string _esito = "OK";
|
|
//url = "ftp://10.0.0.10/PMS/cccetcwqsss.jpg";
|
|
|
|
var request = (FtpWebRequest)WebRequest.Create(url);
|
|
request.Credentials = new NetworkCredential(ftp_usr, ftp_pwd);
|
|
request.Method = WebRequestMethods.Ftp.GetFileSize;
|
|
|
|
try
|
|
{
|
|
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
|
|
}
|
|
catch (WebException ex)
|
|
{
|
|
FtpWebResponse response = (FtpWebResponse)ex.Response;
|
|
if (response.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable)
|
|
{
|
|
_esito = "KO";
|
|
}
|
|
}
|
|
return _esito;
|
|
}
|
|
private static void SFtpSend(string url, string ftp_usr, string ftp_pwd, IFormFile files)
|
|
{
|
|
var connectionInfo = new Renci.SshNet.ConnectionInfo(url, "sftp", new PasswordAuthenticationMethod(ftp_usr, ftp_pwd));
|
|
|
|
// Upload File
|
|
using (var sftp = new SftpClient(connectionInfo))
|
|
{
|
|
sftp.Connect();
|
|
//sftp.ChangeDirectory("/MyFolder");
|
|
using (var uplfileStream = System.IO.File.OpenRead(files.FileName))
|
|
{
|
|
sftp.UploadFile(uplfileStream, files.FileName, true);
|
|
}
|
|
sftp.Disconnect();
|
|
}
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public static void FileUploadSFTP(IFormFile files,string ip,string usr,string pwd, int? sftp_port, string filename)
|
|
{
|
|
//var host = "37.159.179.14";
|
|
//var port = 27000;
|
|
//var username = "apppolo";
|
|
//var password = "utx3BizRykw1hdY";
|
|
|
|
var host = ip;
|
|
var port = sftp_port.Value;
|
|
var username = usr;
|
|
var password = pwd;
|
|
|
|
// path for file you want to upload
|
|
//var uploadFile = @"C:\Zucchetti\b.bmp";
|
|
var uploadFile = files.OpenReadStream();
|
|
|
|
using (var client = new SftpClient(host, port, username, password))
|
|
{
|
|
client.Connect();
|
|
using (var uplfileStream = files.OpenReadStream())
|
|
{
|
|
client.UploadFile(uplfileStream, filename);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>Upload return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("file/upload")]
|
|
public async Task<IActionResult> OnPostUpload2Async(IFormFile files, string token, string nomefile)
|
|
{
|
|
|
|
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
string fileName = string.Empty;
|
|
|
|
//Console.WriteLine(string.Format("*********** {2} metodo chiudi: tenant:{0} tenant2: {1} tenantConf: {5} buono: {3} tecnico:{4} ", ten, ten2, DateTime.Now.ToString(), r.ser_buono, r.codice_tecnico,tenConf));
|
|
Console.WriteLine(string.Format("*********** {2} INIZIO Chiamata al metodo upload: tenant:{0} tenant2: {3} tenantConf: {4} file: {1} tecnico:{5}", ten, nomefile, DateTime.Now.ToString(),ten2,tenConf, tecnico));
|
|
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
//ten2= getClaimValueByToken(token, "tenant2");
|
|
_confLette = await readConf(ten2);
|
|
}
|
|
else
|
|
{
|
|
_confLette = await readConf(tenConf);
|
|
}
|
|
|
|
try
|
|
{
|
|
long size = files.Length;
|
|
if(string.IsNullOrEmpty(nomefile))
|
|
{
|
|
fileName = Path.GetFileName(files.FileName);
|
|
}
|
|
else
|
|
{
|
|
fileName = nomefile;
|
|
}
|
|
|
|
string url = string.Empty;
|
|
string usr = string.Empty;
|
|
string pwd = string.Empty;
|
|
string ip = string.Empty;
|
|
int? port = 0;
|
|
|
|
// per VT faccio solo il salvataggio in tabella
|
|
//2024-04-08: CONTRORDINE: devo salvare il file perchè il file deve essere depositato nella directory
|
|
//dove risiedono le API per poter essere esposto con un url pubblico in modo da poter essere utilizzato dall'app
|
|
//(questo per le Immagini azienda che vanno nel logo del buono)
|
|
|
|
#region inserimento tabella
|
|
Buoni model = new Buoni();
|
|
model.azienda = ten2;
|
|
if (nomefile.Length > 8)
|
|
nomefile = nomefile.Substring(0, 8);
|
|
model.ser_buono = nomefile;
|
|
model.dt_ins = DateTime.Now;
|
|
using (MemoryStream ms = new MemoryStream())
|
|
{
|
|
files.CopyTo(ms);
|
|
byte[] array = ms.GetBuffer();
|
|
model.immagine = array;
|
|
}
|
|
using (var transaction = _VT_Buoni.Database.BeginTransaction())
|
|
{
|
|
await _VT_Buoni.buoni.AddAsync(model);
|
|
await _VT_Buoni.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
#endregion
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
|
|
// break;
|
|
|
|
// case Clienti.Ferrari:
|
|
// ip = _confLette.ftp_url!=null ? _confLette.ftp_url : string.Empty;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// port = _confLette.ftp_port != null ? _confLette.ftp_port : 0;
|
|
|
|
// FileUploadSFTP(files,ip,usr,pwd, port,fileName);
|
|
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// ip = _confLette.ftp_url != null ? _confLette.ftp_url : string.Empty;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// port = _confLette.ftp_port != null ? _confLette.ftp_port : 0;
|
|
|
|
// FileUploadSFTP(files, ip, usr, pwd, port, fileName);
|
|
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
|
|
// //ip = _confLette.ftp_url != null ? _confLette.ftp_url : string.Empty;
|
|
// //usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// //pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// //port = _confLette.ftp_port != null ? _confLette.ftp_port : 0;
|
|
// //FileUploadSFTP(files, ip, usr, pwd, port, fileName);
|
|
|
|
|
|
// //url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// port = _confLette.ftp_port != null ? _confLette.ftp_port : 0;
|
|
|
|
// //ftp://discoverylift.dyndns.org:21/test.jpg;
|
|
// url = string.Format("{0}:{1}/{2}", _confLette.ftp_url, port, fileName);
|
|
// FtpSend(url, usr, pwd, files);
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// //url = _confLette.ftp_url + fileName;
|
|
// //usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// //pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// //port = _confLette.ftp_port != null ? _confLette.ftp_port : 0;
|
|
// //ip = _confLette.ftp_url != null ? _confLette.ftp_url : string.Empty;
|
|
// //FileUploadSFTP(files, ip, usr, pwd, port, fileName);
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
|
|
// FtpSend(url, usr, pwd, files);
|
|
// string _esito = CheckFtp(url, usr, pwd);
|
|
// if(_esito.Equals("KO"))
|
|
// {
|
|
// throw new Exception("Buono non depositato !!"+url);
|
|
// }
|
|
|
|
// break;
|
|
// case Clienti.VT:
|
|
|
|
// // per VT faccio solo il salvataggio in tabella
|
|
// //2024-04-08: CONTRORDINE: devo salvare il file perchè il file deve essere depositato nella directory
|
|
// //dove risiedono le API per poter essere esposto con un url pubblico in modo da poter essere utilizzato dall'app
|
|
// //(questo per le Immagini azienda che vanno nel logo del buono)
|
|
|
|
|
|
// #region inserimento tabella
|
|
// Buoni model = new Buoni();
|
|
// model.azienda = ten2;
|
|
// if (nomefile.Length > 8)
|
|
// nomefile = nomefile.Substring(0, 8);
|
|
// model.ser_buono = nomefile;
|
|
// model.dt_ins = DateTime.Now;
|
|
// using (MemoryStream ms = new MemoryStream())
|
|
// {
|
|
// files.CopyTo(ms);
|
|
// byte[] array = ms.GetBuffer();
|
|
// model.immagine = array;
|
|
// }
|
|
// using (var transaction = _VT_Buoni.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_Buoni.buoni.AddAsync(model);
|
|
// await _VT_Buoni.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// #endregion
|
|
|
|
|
|
|
|
// break;
|
|
// case Clienti.LW:
|
|
|
|
// #region inserimento tabella
|
|
// BuoniLW model2 = new BuoniLW();
|
|
// model2.azienda = ten;
|
|
// if (nomefile.Length > 8)
|
|
// nomefile = nomefile.Substring(0, 8);
|
|
// model2.ser_buono = nomefile;
|
|
// model2.dt_ins = DateTime.Now;
|
|
// using (MemoryStream ms = new MemoryStream())
|
|
// {
|
|
// files.CopyTo(ms);
|
|
// byte[] byteArray = ms.GetBuffer();
|
|
// string base64String = Convert.ToBase64String(byteArray);
|
|
// model2.immagine = base64String;
|
|
// }
|
|
// //var result = new StringBuilder();
|
|
// //using (var reader = new StreamReader(files.OpenReadStream()))
|
|
// //{
|
|
// // while (reader.Peek() >= 0)
|
|
// // {
|
|
// // result.AppendLine(reader.ReadLine());
|
|
// // }
|
|
// //}
|
|
// //model2.immagine = result.ToString();
|
|
// using (var transaction = _LW_Buoni.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_Buoni.buoni.AddAsync(model2);
|
|
// await _LW_Buoni.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
|
|
// url = _confLette.ftp_url + fileName;
|
|
// usr = _confLette.ftp_usr != null ? _confLette.ftp_usr : string.Empty;
|
|
// pwd = _confLette.ftp_pwd != null ? _confLette.ftp_pwd : string.Empty;
|
|
// FtpSend(url, usr, pwd, files);
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
|
|
// #region inserimento tabella
|
|
// BuoniLW modelsys = new BuoniLW();
|
|
// modelsys.azienda = ten;
|
|
// if (nomefile.Length > 8)
|
|
// nomefile = nomefile.Substring(0, 8);
|
|
// modelsys.ser_buono = nomefile;
|
|
// modelsys.dt_ins = DateTime.Now;
|
|
// using (MemoryStream ms = new MemoryStream())
|
|
// {
|
|
// files.CopyTo(ms);
|
|
// byte[] byteArray = ms.GetBuffer();
|
|
// string base64String = Convert.ToBase64String(byteArray);
|
|
// modelsys.immagine = base64String;
|
|
// }
|
|
|
|
// using (var transaction = _Sys_Buoni.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_Buoni.buoni.AddAsync(modelsys);
|
|
// await _Sys_Buoni.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
Console.WriteLine(string.Format("*********** {2} FINE Chiamata al metodo upload: tenant:{0} tenant2: {3} tenantConf: {4} file: {1} tecnico:{5}", ten, nomefile, DateTime.Now.ToString(), ten2, tenConf, tecnico));
|
|
return Ok(new { count = 1, size });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
string errMsg = string.Empty;
|
|
if(ex.Message!=null)
|
|
{
|
|
sb.AppendLine(ex.Message);
|
|
}
|
|
if(ex.InnerException!=null)
|
|
{
|
|
sb.AppendLine(ex.InnerException.Message);
|
|
}
|
|
errMsg = sb.ToString();
|
|
//Console.WriteLine(string.Format("*********** {2} ERRORE metodo upload: tenant:{0} file: {1} ==> {3}", ten, nomefile, DateTime.Now.ToString(),errMsg));
|
|
Console.WriteLine(string.Format("*********** {2} ERRORE metodo upload: tenant:{0} tenant2: {3} tenantConf: {4} file: {1} tecnico:{5} ==> {6}", ten, nomefile, DateTime.Now.ToString(), ten2, tenConf, tecnico, errMsg));
|
|
return StatusCode(StatusCodes.Status500InternalServerError, "Error: "+errMsg);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IMPIANTI COMPONENTI
|
|
private async Task<Compo_Impia_Table> fillCompoImpiaByInput(Compo_Impia i, string token)
|
|
{
|
|
Compo_Impia_Table r = new Compo_Impia_Table();
|
|
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
//i = fakeInput(i, ten);
|
|
//_compoTable = getComponentiTableByTenant(ten);
|
|
var co = await _compoTable.Where(t => t.cocodimp == i.cocodimp).OrderByDescending(t => t.cprownum).ToListAsync();
|
|
|
|
int? row = 0;
|
|
if(co!=null && co.Count()>0)
|
|
{
|
|
row = co.First().cprownum;
|
|
}
|
|
row++;
|
|
|
|
r.cocodimp = co.First().cocodimp;
|
|
r.cprownum = row;
|
|
r.cocodart = i.cocodart;
|
|
r.coqtaart = i.coqtaart;
|
|
r.co__note = i.co__note;
|
|
r.pilotto = i.lotto;
|
|
r.pimatric = i.matricola;
|
|
r.cocodazi = ten;
|
|
|
|
return r;
|
|
}
|
|
private Compo_Impia_out fillCompoImpiaOUTByInput(Compo_Impia_Table i)
|
|
{
|
|
Compo_Impia_out r = new Compo_Impia_out();
|
|
|
|
r.cocodimp = i.cocodimp;
|
|
r.cprownum = i.cprownum;
|
|
r.cocodart = i.cocodart;
|
|
r.coqtaart = i.coqtaart;
|
|
r.co__note = i.co__note;
|
|
r.lotto = i.pilotto;
|
|
r.matricola = i.pimatric;
|
|
r.cocodazi = i.cocodazi;
|
|
|
|
return r;
|
|
}
|
|
|
|
/// <summary>Componenti impianto return:ActionResult</summary>
|
|
[HttpGet("componenti_impianto")]
|
|
public async Task<ActionResult<IEnumerable<Compo_Impia>>> componenti_impianto(string token, string codimp)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
List<Compo_Impia> lst = new List<Compo_Impia>();
|
|
|
|
if(!ten.Equals(Clienti.VT))
|
|
{
|
|
//_compo = getComponentiByTenant(ten);
|
|
|
|
var co = await _compo.Where(
|
|
t => t.cocodimp == codimp
|
|
).ToListAsync();
|
|
lst = co;
|
|
}
|
|
else
|
|
{
|
|
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);
|
|
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, lst);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>aggiunge un componente all'impianto. Inserisce in LABSEMICOMIMP return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("componenti_impianto/add")]
|
|
public async Task<ActionResult<Compo_Impia_out>> addcomponente([FromBody] Compo_Impia model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
Compo_Impia_Table co = new Compo_Impia_Table();
|
|
Compo_Impia_out co_out = new Compo_Impia_out();
|
|
co = await fillCompoImpiaByInput(model, token);
|
|
co_out = fillCompoImpiaOUTByInput(co);
|
|
|
|
try
|
|
{
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_compTable.Componen.AddAsync(co);
|
|
// await _Sicilia_compTable.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_compTable.Componen.AddAsync(co);
|
|
// await _Siet_compTable.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPms = _PMS_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _PMS_compTable.Componen.AddAsync(co);
|
|
// await _PMS_compTable.SaveChangesAsync();
|
|
// transactionPms.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionlw = _LW_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_compTable.Componen.AddAsync(co);
|
|
// await _LW_compTable.SaveChangesAsync();
|
|
// transactionlw.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_compTable.Componen.AddAsync(co);
|
|
// await _Tedes_compTable.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionsys = _Sys_compTable.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_compTable.Componen.AddAsync(co);
|
|
// await _Sys_compTable.SaveChangesAsync();
|
|
// transactionsys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
co_out.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, co_out);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
co_out.err_title = ex.Message;
|
|
co_out.err_detail = errmsg;
|
|
co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, co_out);
|
|
}
|
|
//return co_out;
|
|
}
|
|
|
|
/// <summary>toglie un componente all'impianto. Cancella in LABSEMICOMIMP return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("componenti_impianto/del")]
|
|
public async Task<ActionResult<Compo_Impia_out>> delcomponente([FromBody] Compo_Impia model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
//_compoTable = getComponentiTableByTenant(ten);
|
|
var comp = await _compoTable.Where(t => t.cocodimp == model.cocodimp && t.cprownum == model.cprownum && t.cocodazi == ten).ToListAsync();
|
|
Compo_Impia_out co_out = new Compo_Impia_out();
|
|
|
|
if (comp != null)
|
|
{
|
|
Compo_Impia_Table t = new Compo_Impia_Table();
|
|
t = (Compo_Impia_Table)comp.First();
|
|
co_out = fillCompoImpiaOUTByInput(t);
|
|
try
|
|
{
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _Sicilia_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _Sicilia_compTable.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _Siet_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _Siet_compTable.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _PMS_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _PMS_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _PMS_compTable.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionlw = _LW_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _LW_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _LW_compTable.SaveChangesAsync();
|
|
// transactionlw.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _Tedes_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _Tedes_compTable.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionsys = _Sys_compTable.Database.BeginTransaction())
|
|
// {
|
|
// _Sys_compTable.Entry(t).State = EntityState.Deleted;
|
|
// await _Sys_compTable.SaveChangesAsync();
|
|
// transactionsys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
co_out.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, co_out);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
co_out.err_title = ex.Message;
|
|
co_out.err_detail = errmsg;
|
|
co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, co_out);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
co_out.err_title = "Cancellazione fallita";
|
|
co_out.err_detail = "record non trovato";
|
|
co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, co_out);
|
|
}
|
|
//return co_out;
|
|
}
|
|
#endregion
|
|
|
|
#region Saldi articoli
|
|
/// <summary>Ricerca articoli per impianto return:ActionResult</summary>
|
|
[HttpGet("saldi_articolo")]
|
|
public async Task<ActionResult<IEnumerable<Saldiart>>> saldi_articolo(string token, string? art, string? desart, string? matric, string? maga,string? codcli, string? codimp )
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
|
|
//27/02/2025 aggiunta gestione Articoli
|
|
if (tenConf.Equals(Clienti.VT))
|
|
{
|
|
_articoliTable = _VT_articoliTable.Articoli;
|
|
|
|
var listaFiltro = new List<Articoli>();
|
|
|
|
listaFiltro = await _articoliTable.Where(x => x.Azienda.Equals(ten2)).ToListAsync();
|
|
|
|
if (!string.IsNullOrEmpty(art))
|
|
{
|
|
listaFiltro = await _articoliTable.Where(x => x.SlCodice.Contains(art)).ToListAsync();
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(desart))
|
|
{
|
|
listaFiltro = await _articoliTable.Where(x => x.ArDesArt.Contains(desart)).ToListAsync();
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(maga))
|
|
{
|
|
listaFiltro = await _articoliTable.Where(x => x.SlCodMag.Contains(maga)).ToListAsync();
|
|
}
|
|
|
|
List<Saldiart> listaSaldiArt = new List<Saldiart>();
|
|
|
|
foreach (Articoli a in listaFiltro)
|
|
{
|
|
Saldiart saldo = new Saldiart();
|
|
|
|
saldo.slcodice = a.SlCodice.TrimEnd();
|
|
saldo.ardesart = a.ArDesArt.TrimEnd();
|
|
saldo.slcodmag = a.SlCodMag.TrimEnd();
|
|
saldo.slqtaper = a.SlQtAper;
|
|
saldo.amcodice = !string.IsNullOrEmpty(a.AmCodice) ? a.AmCodice.TrimEnd():string.Empty;
|
|
saldo.locodice = !string.IsNullOrEmpty(a.LoCodice) ? a.LoCodice.TrimEnd() : string.Empty;
|
|
saldo.licodlis = !string.IsNullOrEmpty(a.LiCodLis) ? a.LiCodLis.TrimEnd() : string.Empty;
|
|
saldo.licodart = !string.IsNullOrEmpty(a.LiCodArt) ? a.LiCodArt.TrimEnd() : string.Empty;
|
|
saldo.lidatatt = a.LiDatAtt;
|
|
saldo.liquanti = a.LiQuanti;
|
|
saldo.liprezzo = a.LiPrezzo;
|
|
saldo.liscont1 = a.LiScont1;
|
|
saldo.liscont2 = a.LiScont2;
|
|
saldo.liscont3 = a.LiScont3;
|
|
saldo.liscont4 = a.LiScont4;
|
|
saldo.gest_matr = a.Gest_Matr.TrimEnd();
|
|
saldo.gest_lotti = a.Gest_Lotti.TrimEnd();
|
|
saldo.desc_sup = a.Desc_sup.TrimEnd();
|
|
|
|
listaSaldiArt.Add(saldo);
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, listaSaldiArt);
|
|
}
|
|
else
|
|
{
|
|
//_saldi = getSaldiartByTenant(ten);
|
|
Configurazioni conf = await readConf(tenConf);
|
|
int max_record = 0;
|
|
max_record = conf.max_record != null ? conf.max_record.Value : 0;
|
|
string codlis = string.Empty;
|
|
//_clienti = getClientiByTenant(ten);
|
|
var a = await _clienti.Where(t => t.ancodice == codcli).ToListAsync();
|
|
if (a != null && a.Count() == 0)
|
|
{
|
|
codlis = conf.listino;
|
|
}
|
|
else
|
|
{
|
|
codlis = string.IsNullOrEmpty(a.First().annumlis) ? conf.listino : a.First().annumlis;
|
|
}
|
|
var co = await _saldi.Where(t => t.slcodmag != null && t.slcodmag.Equals(maga) && t.licodlis != null && t.licodlis.Equals(codlis)).ToListAsync();
|
|
|
|
if (!string.IsNullOrEmpty(art))
|
|
{
|
|
co = co.Where(t => t.slcodice != null && t.slcodice.ToUpper().Contains(art.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(desart))
|
|
{
|
|
co = co.Where(t => t.ardesart != null && t.ardesart.ToUpper().Contains(desart.ToUpper())).ToList();
|
|
}
|
|
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
|
|
if (co != null && co.Count() > 0)
|
|
{
|
|
foreach (Saldiart s in co)
|
|
{
|
|
if (s.gest_matr != null && s.gest_matr.Equals("S"))
|
|
{
|
|
s.slqtaper = 1;
|
|
}
|
|
|
|
}
|
|
}
|
|
co = co.Take(max_record).ToList();
|
|
return StatusCode(StatusCodes.Status200OK, co);
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Magazzino
|
|
private async Task<Mag_New> fillMag_NewByInput(Mag_New i, string token)
|
|
{
|
|
Mag_New r = new Mag_New();
|
|
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
//i = fakeInput(i, ten);
|
|
//_mag = getMag_NewByTenant(ten);
|
|
var co = await _mag.Where(t => t.seriale_rapportino == i.seriale_rapportino).OrderByDescending(t => t.riga).ToListAsync();
|
|
|
|
int? row = 0;
|
|
if (co != null && co.Count() > 0)
|
|
{
|
|
row = co.First().riga;
|
|
row++;
|
|
}
|
|
else
|
|
{
|
|
row++;
|
|
}
|
|
|
|
|
|
r.seriale_rapportino = i.seriale_rapportino;
|
|
r.riga = row;
|
|
r.magazzino = i.magazzino;
|
|
r.articolo = i.articolo;
|
|
r.tipo_movimento = i.tipo_movimento;
|
|
r.quantita = i.quantita;
|
|
r.prezzo = i.prezzo;
|
|
r.codice_tecnico = i.codice_tecnico;
|
|
r.generato = i.generato;
|
|
r.codlotto = i.codlotto;
|
|
r.matricola = i.matricola;
|
|
r.cprownum = row;
|
|
|
|
return r;
|
|
}
|
|
private Mag_New_out fillMag_NewOUTByInput(Mag_New i)
|
|
{
|
|
Mag_New_out r = new Mag_New_out();
|
|
|
|
r.seriale_rapportino = i.seriale_rapportino;
|
|
r.riga = i.riga;
|
|
r.magazzino = i.magazzino;
|
|
r.articolo = i.articolo;
|
|
r.tipo_movimento = i.tipo_movimento;
|
|
r.quantita = i.quantita;
|
|
r.prezzo = i.prezzo;
|
|
r.codice_tecnico = i.codice_tecnico;
|
|
r.generato = i.generato;
|
|
r.codlotto = i.codlotto;
|
|
r.matricola = i.matricola;
|
|
return r;
|
|
}
|
|
|
|
/// <summary>rapportino per pezzi magazzino. Inserisce in LABSEMAG_NEW return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("rapportini/add")]
|
|
public async Task<ActionResult<Mag_New_out>> addrapportino([FromBody] Mag_New model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
Mag_New co = new Mag_New();
|
|
Mag_New_out co_out = new Mag_New_out();
|
|
co = await fillMag_NewByInput(model, token);
|
|
co_out = fillMag_NewOUTByInput(co);
|
|
|
|
try
|
|
{
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_mag.Mag.AddAsync(co);
|
|
// await _Sicilia_mag.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_mag.Mag.AddAsync(co);
|
|
// await _Siet_mag.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _PMS_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _PMS_mag.Mag.AddAsync(co);
|
|
// await _PMS_mag.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionlw = _LW_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_mag.Mag.AddAsync(co);
|
|
// await _LW_mag.SaveChangesAsync();
|
|
// transactionlw.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_mag.Mag.AddAsync(co);
|
|
// await _Tedes_mag.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionsys = _Sys_mag.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_mag.Mag.AddAsync(co);
|
|
// await _Sys_mag.SaveChangesAsync();
|
|
// transactionsys.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
co_out.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, co_out);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
co_out.err_title = ex.Message;
|
|
co_out.err_detail = errmsg;
|
|
co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, co_out);
|
|
}
|
|
//return co_out;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Storico rapportini
|
|
|
|
private Sto_Rapp_out fillSto_Rapp_Out(Sto_Rapp i, string tenant)
|
|
{
|
|
Sto_Rapp_out o = new Sto_Rapp_out();
|
|
|
|
o.tccodice = !string.IsNullOrEmpty(i.tccodice) ? i.tccodice.Trim() : string.Empty; ;
|
|
o.tcdescri = !string.IsNullOrEmpty(i.tcdescri) ? i.tcdescri.Trim() : string.Empty; ;
|
|
o.note_esito = !string.IsNullOrEmpty(i.note_esito) ? i.note_esito.Trim():string.Empty ;
|
|
o.data_rapportino = i.data_rapportino;
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
string appo = string.Empty;
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc1) ? " - " + i.cc1 : string.Empty;
|
|
dic.Add("Cod. Chiusura 1", i.codice_chiusura_1.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc2) ? " - " + i.cc2 : string.Empty;
|
|
dic.Add("Cod. Chiusura 2", i.codice_chiusura_2.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc3) ? " - " + i.cc3 : string.Empty;
|
|
dic.Add("Cod. Chiusura 3", i.codice_chiusura_3.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc4) ? " - " + i.cc4 : string.Empty;
|
|
dic.Add("Cod. Chiusura 4", i.codice_chiusura_4.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc5) ? " - " + i.cc5 : string.Empty;
|
|
dic.Add("Cod. Chiusura 5", i.codice_chiusura_5.Trim() + appo);
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc6) ? " - " + i.cc6 : string.Empty;
|
|
dic.Add("Cod. Chiusura 6", i.codice_chiusura_6.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc7) ? " - " + i.cc7 : string.Empty;
|
|
dic.Add("Cod. Chiusura 7", i.codice_chiusura_7.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc8) ? " - " + i.cc8 : string.Empty;
|
|
dic.Add("Cod. Chiusura 8", i.codice_chiusura_8.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc9) ? " - " + i.cc9 : string.Empty;
|
|
dic.Add("Cod. Chiusura 9", i.codice_chiusura_9.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
{
|
|
appo = string.Empty;
|
|
appo = !string.IsNullOrEmpty(i.cc10) ? " - " + i.cc10 : string.Empty;
|
|
dic.Add("Cod. Chiusura 10", i.codice_chiusura_10.Trim() + appo);
|
|
}
|
|
if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
{
|
|
dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
{
|
|
dic.Add("Note intervento", i.note_intervento.Trim());
|
|
}
|
|
if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
{
|
|
dic.Add("Esito intervento", i.esito_intervento.Trim());
|
|
}
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// #region marrocco
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// #region gitoga
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// #region lifta
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// #region ferrari
|
|
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if(!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - "+i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if(i.data_manutenzione!=null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if(!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - "+i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if(i.indirizzo_num!=null && i.indirizzo_num.Value>0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" "+indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ,"+num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio!=null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value>0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// #region discovery
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// #region sarom
|
|
// //chiamata
|
|
// if (!string.IsNullOrEmpty(i.codice_segnalazione) && !i.codice_segnalazione.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice segnalazione", i.codice_segnalazione.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_chiamata) && !i.seriale_chiamata.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° Chiamata", i.seriale_chiamata.Trim());
|
|
// }
|
|
// //manutenzione
|
|
// if (!string.IsNullOrEmpty(i.codice_intervento) && !i.codice_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_intervento.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cidescri) && !i.cidescri.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidescri.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.cidessup) && !i.cidessup.Trim().Equals(string.Empty))
|
|
// {
|
|
// sb.Append(" - " + i.cidessup.Trim());
|
|
// }
|
|
// dic.Add("Manutenzione", sb.ToString());
|
|
// }
|
|
// if (i.data_manutenzione != null)
|
|
// {
|
|
// dic.Add("Data manutenzione", i.data_manutenzione.Value.ToString());
|
|
// }
|
|
|
|
// //dati intervento
|
|
// if (!string.IsNullOrEmpty(i.stato_finale) && !i.stato_finale.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.stato_finale)
|
|
// {
|
|
// case "1":
|
|
// st = "In Funzione";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// case "0":
|
|
// st = "Fermo";
|
|
// dic.Add("Stato finale", st);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.esito_intervento)
|
|
// {
|
|
// case "1":
|
|
// st = "Positivo";
|
|
// break;
|
|
// case "P":
|
|
// st = "Positivo";
|
|
// break;
|
|
// default:
|
|
// st = "Negativo";
|
|
// break;
|
|
// }
|
|
// dic.Add("Esito intervento", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.difetti_riscontrati) && !i.difetti_riscontrati.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Difetti riscontrati", i.difetti_riscontrati.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.lavoro_eseguito) && !i.lavoro_eseguito.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Lavoro eseguito", i.lavoro_eseguito.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.tipo_intervento) && !i.tipo_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Tipo intervento", i.tipo_intervento.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_1.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc1))
|
|
// {
|
|
// sb.Append(" - " + i.cc1.Trim());
|
|
// }
|
|
// sb.Append(i.ccds1);
|
|
// if (!string.IsNullOrEmpty(i.ccds1))
|
|
// {
|
|
// sb.Append(" - " + i.ccds1.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 1", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_2.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc2))
|
|
// {
|
|
// sb.Append(" - " + i.cc2.Trim());
|
|
// }
|
|
// sb.Append(i.ccds2);
|
|
// if (!string.IsNullOrEmpty(i.ccds2))
|
|
// {
|
|
// sb.Append(" - " + i.ccds2.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 2", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_3.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc3))
|
|
// {
|
|
// sb.Append(" - " + i.cc3.Trim());
|
|
// }
|
|
// sb.Append(i.ccds3);
|
|
// if (!string.IsNullOrEmpty(i.ccds3))
|
|
// {
|
|
// sb.Append(" - " + i.ccds3.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 3", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_4.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc4))
|
|
// {
|
|
// sb.Append(" - " + i.cc4.Trim());
|
|
// }
|
|
// sb.Append(i.ccds4);
|
|
// if (!string.IsNullOrEmpty(i.ccds4))
|
|
// {
|
|
// sb.Append(" - " + i.ccds4.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 4", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_5.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc5))
|
|
// {
|
|
// sb.Append(" - " + i.cc5.Trim());
|
|
// }
|
|
// sb.Append(i.ccds5);
|
|
// if (!string.IsNullOrEmpty(i.ccds5))
|
|
// {
|
|
// sb.Append(" - " + i.ccds5.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 5", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_6.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc6))
|
|
// {
|
|
// sb.Append(" - " + i.cc6.Trim());
|
|
// }
|
|
// sb.Append(i.ccds6);
|
|
// if (!string.IsNullOrEmpty(i.ccds6))
|
|
// {
|
|
// sb.Append(" - " + i.ccds6.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 6", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_7.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc7))
|
|
// {
|
|
// sb.Append(" - " + i.cc7.Trim());
|
|
// }
|
|
// sb.Append(i.ccds7);
|
|
// if (!string.IsNullOrEmpty(i.ccds7))
|
|
// {
|
|
// sb.Append(" - " + i.ccds7.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 7", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_8.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc8))
|
|
// {
|
|
// sb.Append(" - " + i.cc8.Trim());
|
|
// }
|
|
// sb.Append(i.ccds8);
|
|
// if (!string.IsNullOrEmpty(i.ccds8))
|
|
// {
|
|
// sb.Append(" - " + i.ccds8.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 8", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_9.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc9))
|
|
// {
|
|
// sb.Append(" - " + i.cc9.Trim());
|
|
// }
|
|
// sb.Append(i.ccds9);
|
|
// if (!string.IsNullOrEmpty(i.ccds9))
|
|
// {
|
|
// sb.Append(" - " + i.ccds9.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 9", sb.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// string c = string.Empty;
|
|
// StringBuilder sb = new StringBuilder();
|
|
// sb.Append(i.codice_chiusura_10.Trim());
|
|
// if (!string.IsNullOrEmpty(i.cc10))
|
|
// {
|
|
// sb.Append(" - " + i.cc10.Trim());
|
|
// }
|
|
// sb.Append(i.ccds10);
|
|
// if (!string.IsNullOrEmpty(i.ccds10))
|
|
// {
|
|
// sb.Append(" - " + i.ccds10.Trim());
|
|
// }
|
|
// dic.Add("Codice Chiusura 10", sb.ToString());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.firma) && !i.firma.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Firma", i.firma.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.ser_buono) && !i.ser_buono.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("N° buono", i.ser_buono.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.pagamento) && !i.pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Pagamento", i.pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_pagamento) && !i.note_pagamento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note pagamento", i.note_pagamento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_impianto) && !i.codice_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Cod. impianto", i.codice_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_tecnico) && !i.azienda_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_tecnico);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.generato) && !i.generato.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.generato)
|
|
// {
|
|
// case "S":
|
|
// st = "SI";
|
|
// break;
|
|
// default:
|
|
// st = "NO";
|
|
// break;
|
|
// }
|
|
// dic.Add("Rapportino importato", st);
|
|
// }
|
|
|
|
// if (i.ore_lavoro != null && i.ore_lavoro.Value > 0)
|
|
// {
|
|
// dic.Add("Ore lavoro", i.ore_lavoro.Value.ToString());
|
|
// }
|
|
// if (i.spese_viaggio != null && i.spese_viaggio.Value > 0)
|
|
// {
|
|
// dic.Add("Spese viaggio", i.spese_viaggio.Value.ToString());
|
|
// }
|
|
// if (i.materiale != null && i.materiale.Value > 0)
|
|
// {
|
|
// dic.Add("Materiale", i.materiale.Value.ToString());
|
|
// }
|
|
// if (i.anticipo != null && i.anticipo.Value > 0)
|
|
// {
|
|
// dic.Add("Anticipo", i.anticipo.Value.ToString());
|
|
// }
|
|
// if (i.manodopera != null && i.manodopera.Value > 0)
|
|
// {
|
|
// dic.Add("Manodopera", i.manodopera.Value.ToString());
|
|
// }
|
|
// if (i.diritto_chiamata != null && i.diritto_chiamata.Value > 0)
|
|
// {
|
|
// dic.Add("Diritto chiamata", i.diritto_chiamata.Value.ToString());
|
|
// }
|
|
// if (i.totale != null && i.totale.Value > 0)
|
|
// {
|
|
// dic.Add("Totale", i.totale.Value.ToString());
|
|
// }
|
|
// #endregion
|
|
// break;
|
|
// default:
|
|
// string appo = string.Empty;
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_1) && !i.codice_chiusura_1.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc1) ? " - " + i.cc1 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 1", i.codice_chiusura_1.Trim()+appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_2) && !i.codice_chiusura_2.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc2) ? " - " + i.cc2 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 2", i.codice_chiusura_2.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_3) && !i.codice_chiusura_3.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc3) ? " - " + i.cc3 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 3", i.codice_chiusura_3.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_4) && !i.codice_chiusura_4.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc4) ? " - " + i.cc4 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 4", i.codice_chiusura_4.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_5) && !i.codice_chiusura_5.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc5) ? " - " + i.cc5 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 5", i.codice_chiusura_5.Trim() + appo);
|
|
// }
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_6) && !i.codice_chiusura_6.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc6) ? " - " + i.cc6 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 6", i.codice_chiusura_6.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_7) && !i.codice_chiusura_7.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc7) ? " - " + i.cc7 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 7", i.codice_chiusura_7.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_8) && !i.codice_chiusura_8.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc8) ? " - " + i.cc8 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 8", i.codice_chiusura_8.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_9) && !i.codice_chiusura_9.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc9) ? " - " + i.cc9 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 9", i.codice_chiusura_9.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_chiusura_10) && !i.codice_chiusura_10.Trim().Equals(string.Empty))
|
|
// {
|
|
// appo = string.Empty;
|
|
// appo = !string.IsNullOrEmpty(i.cc10) ? " - " + i.cc10 : string.Empty;
|
|
// dic.Add("Cod. Chiusura 10", i.codice_chiusura_10.Trim() + appo);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.descrizione_intervento) && !i.descrizione_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione intervento", i.descrizione_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note_intervento) && !i.note_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note_intervento.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.esito_intervento) && !i.esito_intervento.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Esito intervento", i.esito_intervento.Trim());
|
|
// }
|
|
|
|
// break;
|
|
//}
|
|
o.dettaglio = dic;
|
|
return o;
|
|
}
|
|
private Impianto_out fillImpianto_out(Impianto i)
|
|
{
|
|
Impianto_out u = new Impianto_out();
|
|
u.codimp = i.imcodimp;
|
|
u.descimp = i.imdescri;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
string via = !string.IsNullOrEmpty(i.imindiri1) ? i.imindiri1.Trim() : string.Empty;
|
|
string indiri = !string.IsNullOrEmpty(i.imindiri2) ? i.imindiri2.Trim() : string.Empty;
|
|
string num = string.Empty;
|
|
if (i.imindiri3 != null && i.imindiri3.Value > 0)
|
|
{
|
|
num = i.imindiri3.ToString().Trim();
|
|
}
|
|
string num2 = !string.IsNullOrEmpty(i.imindiri4) ? i.imindiri4.Trim() : string.Empty;
|
|
string sca = !string.IsNullOrEmpty(i.imindiri5) ? i.imindiri5.Trim() : string.Empty;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
u.indiri = sb.ToString();
|
|
u.localita = i.imlocali;
|
|
u.cap = i.imcodcap;
|
|
u.comune = i.imcomune;
|
|
u.provin = i.improvin;
|
|
|
|
return u;
|
|
}
|
|
|
|
/// <summary>Ricerca Impianti return:ActionResult</summary>
|
|
[HttpGet("ricerca_impianti")]
|
|
public async Task<ActionResult<IEnumerable<Impianto_out>>> ricerca_impianti(string token, string? codimp, string? indirizzo_imp)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(codimp) && string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
Impianto_out e = new Impianto_out();
|
|
e.err_title = "Errore in ricerca impianti.";
|
|
e.err_detail = "Immettere almeno un parametro di ricerca.";
|
|
e.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status400BadRequest, e);
|
|
}
|
|
else
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
ten = ten2;
|
|
_impianto = _VT_impia.Impia;
|
|
|
|
//if (ten.Equals(Clienti.VT))
|
|
//{
|
|
// ten = ten2;
|
|
// _impianto = _VT_impia.Impia;
|
|
//}
|
|
//else
|
|
//{
|
|
// _impianto = getImpiantiByTenant(ten);
|
|
//}
|
|
|
|
var l = await _impianto.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.Contains(codimp)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
List<Impianto_out> lis = new List<Impianto_out>();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Impianto_out o = new Impianto_out();
|
|
o = fillImpianto_out(i);
|
|
lis.Add(o);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, lis);
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
Impianto_out e = new Impianto_out();
|
|
e.err_title = "Errore in ricerca impianti.";
|
|
e.err_detail = ex.Message;
|
|
e.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status428PreconditionRequired, e);
|
|
}
|
|
}
|
|
|
|
/// <summary>Storico interventi return:ActionResult</summary>
|
|
[HttpGet("storico_interventi")]
|
|
public async Task<ActionResult<IEnumerable<Sto_Rapp_out>>> storico_interventi(string token, string? codimp, bool rapp_tec=true)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
_sto_rapp = _VT_StoRapp.StoRapp;
|
|
ten = ten2;
|
|
|
|
//if (ten.Equals(Clienti.VT))
|
|
//{
|
|
// _sto_rapp = _VT_StoRapp.StoRapp;
|
|
// ten = ten2;
|
|
//}
|
|
//else
|
|
//{
|
|
// _sto_rapp = getSto_RappByTenant(ten);
|
|
//}
|
|
var l = await _sto_rapp.Where(t => t.azienda_impianto != null && t.azienda_impianto.Equals(ten)).ToListAsync();
|
|
//var l = await _sto_rapp.Where(t => t.azienda_impianto != null && t.azienda_impianto.Equals(ten) && t.codice_impianto != null && t.codice_impianto.Equals(codimp)).ToListAsync();
|
|
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.codice_impianto != null && t.codice_impianto.Trim().Equals(codimp.Trim())).ToList();
|
|
}
|
|
if(rapp_tec)
|
|
{
|
|
l = l.Where(t => t.tccodice != null && t.tccodice.Equals(tecnico)).ToList();
|
|
}
|
|
|
|
List<Sto_Rapp_out> lis = new List<Sto_Rapp_out>();
|
|
foreach(Sto_Rapp s in l)
|
|
{
|
|
Sto_Rapp_out o = new Sto_Rapp_out();
|
|
o = fillSto_Rapp_Out(s, ten);
|
|
lis.Add(o);
|
|
}
|
|
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;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Anagrafica clienti
|
|
/// <summary>Anagrafica return:ActionResult</summary>
|
|
[HttpGet("anagrafica")]
|
|
public async Task<ActionResult<Anag>> anagrafica(string token, string codcli)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
Anag aa = new Anag();
|
|
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
_clientiVT = _VT_anag.Anag;
|
|
|
|
var t = await _clientiVT.Where(
|
|
t => t.antipcon.Equals("C")
|
|
&& t.andtobso == null
|
|
&& t.ancodazi.Equals(ten2)
|
|
&& t.ancodice.Equals(codcli)
|
|
).ToListAsync();
|
|
AnagVT a = t.First();
|
|
aa.antipcon = a.antipcon;
|
|
aa.ancodice = a.ancodice;
|
|
aa.ancodfis = a.ancodfis;
|
|
aa.anpariva = a.anpariva;
|
|
aa.annumlis = a.annumlis;
|
|
aa.an_email = a.an_email;
|
|
aa.an_empec = a.an_empec;
|
|
aa.andescri = a.andescri;
|
|
aa.anindiri = a.anindiri;
|
|
aa.annumcel = a.annumcel;
|
|
aa.antelefo = a.antelefo;
|
|
aa.annumlis = a.annumlis;
|
|
|
|
//switch (ten)
|
|
//{
|
|
|
|
// case Clienti.VT:
|
|
// //string ten2 = getClaimValueByToken(token, "tenant2");
|
|
// //_clientiVT = _VT_anag.Anag;
|
|
|
|
// //var t = await _clientiVT.Where(
|
|
// // t => t.antipcon.Equals("C")
|
|
// // && t.andtobso == null
|
|
// // && t.ancodazi.Equals(ten2)
|
|
// // && t.ancodice.Equals(codcli)
|
|
// // ).ToListAsync();
|
|
// //AnagVT a = t.First();
|
|
// //aa.antipcon = a.antipcon;
|
|
// //aa.ancodice = a.ancodice;
|
|
// //aa.ancodfis = a.ancodfis;
|
|
// //aa.anpariva = a.anpariva;
|
|
// //aa.annumlis = a.annumlis;
|
|
// //aa.an_email = a.an_email;
|
|
// //aa.an_empec = a.an_empec;
|
|
// //aa.andescri = a.andescri;
|
|
// //aa.anindiri = a.anindiri;
|
|
// //aa.annumcel = a.annumcel;
|
|
// //aa.antelefo = a.antelefo;
|
|
// //aa.annumlis = a.annumlis;
|
|
// break;
|
|
// default:
|
|
// _clienti = getClientiByTenant(ten);
|
|
// var an = await _clienti.Where(t => t.ancodice == codcli).ToListAsync();
|
|
// aa = an.First();
|
|
// break;
|
|
//}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, aa);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region tabelle di dominio
|
|
/// <summary>Tabelle di dominio: causali pagamenti, causali rapportino, tipi esito, tipi intervento return:ActionResult</summary>
|
|
[HttpGet("tabelle_dominio")]
|
|
public async Task<ActionResult<TabelleDominio>> tabelle_dominio(string token)
|
|
{
|
|
try
|
|
{
|
|
TabelleDominio td = new TabelleDominio();
|
|
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
|
|
//if(!ten.Equals(Clienti.VT))
|
|
//{
|
|
// _pagam = getPagamentiByTenant(ten);
|
|
// var a = await _pagam.ToListAsync();
|
|
// td.cau_pag = a;
|
|
|
|
// _cau_rapp = getCausaliRappByTenant(ten);
|
|
// var b = await _cau_rapp.ToListAsync();
|
|
// td.cau_rapp = b;
|
|
//}
|
|
|
|
_codSegnVT = getVTCodiciSegnalaz(ten);
|
|
var c = await _codSegnVT.Where(x => x.DataObso == null).ToListAsync();
|
|
//td.statoImpianto = c;
|
|
|
|
List<ComboItem> si = new List<ComboItem>();
|
|
|
|
foreach (var item in c)
|
|
{
|
|
ComboItem s1 = new ComboItem();
|
|
|
|
s1.chiave = item.cscodice.Trim();
|
|
s1.valore = item.csdescr.Trim();
|
|
si.Add(s1);
|
|
}
|
|
|
|
td.statoImpianto = si;
|
|
|
|
List<ComboItem> e = new List<ComboItem>();
|
|
ComboItem c1 = new ComboItem();
|
|
c1.chiave = "P";
|
|
c1.valore = "Positivo";
|
|
e.Add(c1);
|
|
|
|
ComboItem c2 = new ComboItem();
|
|
c2.chiave = "N";
|
|
c2.valore = "Negativo";
|
|
e.Add(c2);
|
|
|
|
td.esito = e;
|
|
|
|
|
|
//List<ComboItem> si = new List<ComboItem>();
|
|
//ComboItem s1 = new ComboItem();
|
|
//s1.chiave = "1";
|
|
//s1.valore = "In Funzione";
|
|
//si.Add(s1);
|
|
|
|
//ComboItem s2 = new ComboItem();
|
|
//s2.chiave = "0";
|
|
//s2.valore = "Fermo";
|
|
//si.Add(s2);
|
|
|
|
//td.statoImpianto = si;
|
|
|
|
return StatusCode(StatusCodes.Status200OK, td);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region timbrature
|
|
/// <summary></summary>
|
|
private async Task<Timbratura> fillTimbratura(Timbratura i, string token)
|
|
{
|
|
Timbratura r = new Timbratura();
|
|
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
if(ten.Equals(Clienti.VT))
|
|
{
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
ten = ten2;
|
|
}
|
|
|
|
int id=await getNewId(token);
|
|
|
|
r.azienda = ten;
|
|
r.id = id;
|
|
r.ora_ini = i.ora_ini;
|
|
r.min_ini = i.min_ini;
|
|
r.ora_fin = i.ora_fin;
|
|
r.min_fin = i.min_fin;
|
|
r.ore_viaggio = i.ore_viaggio;
|
|
r.data_timbratura = i.data_timbratura;
|
|
|
|
//if (ten.Equals(Clienti.Marrocco) && !string.IsNullOrEmpty(i.commessa))
|
|
//{
|
|
// i.commessa = i.commessa.Substring(0, 15);
|
|
//}
|
|
r.commessa = i.commessa;
|
|
r.tecnico = tecnico;
|
|
|
|
TimeSpan ts = new TimeSpan(i.ora_ini, i.min_ini, 0);
|
|
DateTime da = Convert.ToDateTime( r.data_timbratura) + ts;
|
|
ts = new TimeSpan(i.ora_fin, i.min_fin, 0);
|
|
DateTime a = Convert.ToDateTime(r.data_timbratura) + ts;
|
|
ts = (a - da);
|
|
|
|
if(ts.Minutes>0)
|
|
{
|
|
decimal decimali = Decimal.Divide(ts.Minutes, 100);
|
|
decimal totale = Convert.ToDecimal(ts.Hours) + decimali;
|
|
r.tot_ore = totale;
|
|
}
|
|
else
|
|
{
|
|
r.tot_ore = ts.Hours;
|
|
}
|
|
|
|
|
|
r.giorno =(int) Convert.ToDateTime(i.data_timbratura).DayOfWeek;
|
|
r.cpccchk = getCpccchk(10);
|
|
r.note = i.note;
|
|
|
|
return r;
|
|
}
|
|
private Timbratura_out fillTimbraturaOut(Timbratura i, string token, int id)
|
|
{
|
|
Timbratura_out r = new Timbratura_out();
|
|
|
|
r.azienda = i.azienda;
|
|
r.id = id;
|
|
r.ora_ini = i.ora_ini;
|
|
r.min_ini = i.min_ini;
|
|
r.ora_fin = i.ora_fin;
|
|
r.min_fin = i.min_fin;
|
|
r.ore_viaggio = i.ore_viaggio;
|
|
r.data_timbratura = i.data_timbratura;
|
|
r.commessa = i.commessa;
|
|
r.tecnico = i.tecnico;
|
|
r.note = i.note;
|
|
return r;
|
|
}
|
|
private CommesseAdHoc_out formattaCommessa(Commessa commessa)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
string _item = string.Empty;
|
|
CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
|
|
if (!string.IsNullOrEmpty(commessa.imcodimp))
|
|
{
|
|
sb.AppendLine("<b>Imp: </b> " + commessa.imcodimp);
|
|
|
|
|
|
string via = !string.IsNullOrEmpty(commessa.imindiri1) ? commessa.imindiri1.Trim() : string.Empty;
|
|
string indiri = !string.IsNullOrEmpty(commessa.imindiri2) ? commessa.imindiri2.Trim() : string.Empty;
|
|
string num = string.Empty;
|
|
if (commessa.imindiri3 != null && commessa.imindiri3.Value > 0)
|
|
{
|
|
num = commessa.imindiri3.ToString().Trim();
|
|
}
|
|
string num2 = !string.IsNullOrEmpty(commessa.imindiri4) ? commessa.imindiri4.Trim() : string.Empty;
|
|
string sca = !string.IsNullOrEmpty(commessa.imindiri5) ? commessa.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);
|
|
|
|
co.itemList = sb.ToString();
|
|
}
|
|
sb = null;
|
|
|
|
//copio anche gli altri campi della commessa
|
|
co.andescri = commessa.andescri;
|
|
co.imindiri1 = commessa.imindiri1;
|
|
co.imindiri2 = commessa.imindiri2;
|
|
co.imindiri3 = commessa.imindiri3;
|
|
co.imindiri4 = commessa.imindiri4;
|
|
co.imindiri5 = commessa.imindiri5;
|
|
co.imcodcap = commessa.imcodcap;
|
|
co.imcodimp = commessa.imcodimp;
|
|
co.imlocali = commessa.imlocali;
|
|
co.improvin = commessa.improvin;
|
|
co.lacodcli = commessa.lacodcli;
|
|
co.lacodcom = commessa.lacodcom;
|
|
co.ladatchi = commessa.ladatchi;
|
|
co.ladeslav = commessa.ladeslav;
|
|
co.laserial = commessa.laserial;
|
|
co.latipcli = commessa.latipcli;
|
|
|
|
return co;
|
|
}
|
|
private CommesseAdHoc_out formattaCommessaMarrocco(Commessa commessa)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
string _item = string.Empty;
|
|
CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
|
|
if (!string.IsNullOrEmpty(commessa.imcodimp))
|
|
{
|
|
sb.AppendLine("<b>Comm: </b> " + commessa.lacodcom);
|
|
|
|
|
|
string via = !string.IsNullOrEmpty(commessa.imindiri1) ? commessa.imindiri1.Trim() : string.Empty;
|
|
string indiri = !string.IsNullOrEmpty(commessa.imindiri2) ? commessa.imindiri2.Trim() : string.Empty;
|
|
string num = string.Empty;
|
|
if (commessa.imindiri3 != null && commessa.imindiri3.Value > 0)
|
|
{
|
|
num = commessa.imindiri3.ToString().Trim();
|
|
}
|
|
string num2 = !string.IsNullOrEmpty(commessa.imindiri4) ? commessa.imindiri4.Trim() : string.Empty;
|
|
string sca = !string.IsNullOrEmpty(commessa.imindiri5) ? commessa.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);
|
|
|
|
co.itemList = sb.ToString();
|
|
}
|
|
sb = null;
|
|
|
|
//copio anche gli altri campi della commessa
|
|
co.andescri = commessa.andescri;
|
|
co.imindiri1 = commessa.imindiri1;
|
|
co.imindiri2 = commessa.imindiri2;
|
|
co.imindiri3 = commessa.imindiri3;
|
|
co.imindiri4 = commessa.imindiri4;
|
|
co.imindiri5 = commessa.imindiri5;
|
|
co.imcodcap = commessa.imcodcap;
|
|
co.imcodimp = commessa.imcodimp;
|
|
co.imlocali = commessa.imlocali;
|
|
co.improvin = commessa.improvin;
|
|
co.lacodcli = commessa.lacodcli;
|
|
co.lacodcom = commessa.lacodcom;
|
|
co.ladatchi = commessa.ladatchi;
|
|
co.ladeslav = commessa.ladeslav;
|
|
co.laserial = commessa.laserial;
|
|
co.latipcli = commessa.latipcli;
|
|
|
|
return co;
|
|
}
|
|
private CommesseAdHoc_out formattaCommessaVT(CommesseVT commessa)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
string _item = string.Empty;
|
|
CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
|
|
if (!string.IsNullOrEmpty(commessa.imcodimp))
|
|
{
|
|
sb.AppendLine("<b>Imp: <b> " + commessa.imcodimp);
|
|
|
|
|
|
string via = !string.IsNullOrEmpty(commessa.imindiri1) ? commessa.imindiri1.Trim() : string.Empty;
|
|
string indiri = !string.IsNullOrEmpty(commessa.imindiri2) ? commessa.imindiri2.Trim() : string.Empty;
|
|
string num = string.Empty;
|
|
if (commessa.imindiri3 != null && commessa.imindiri3.Value > 0)
|
|
{
|
|
num = commessa.imindiri3.ToString().Trim();
|
|
}
|
|
string num2 = !string.IsNullOrEmpty(commessa.imindiri4) ? commessa.imindiri4.Trim() : string.Empty;
|
|
string sca = !string.IsNullOrEmpty(commessa.imindiri5) ? commessa.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);
|
|
|
|
co.itemList = sb.ToString();
|
|
}
|
|
sb = null;
|
|
|
|
//copio anche gli altri campi della commessa
|
|
co.andescri = commessa.andescri;
|
|
co.imindiri1 = commessa.imindiri1;
|
|
co.imindiri2 = commessa.imindiri2;
|
|
co.imindiri3 = commessa.imindiri3;
|
|
co.imindiri4 = commessa.imindiri4;
|
|
co.imindiri5 = commessa.imindiri5;
|
|
co.imcodcap = commessa.imcodcap;
|
|
co.imcodimp = commessa.imcodimp;
|
|
co.imlocali = commessa.imlocali;
|
|
co.improvin = commessa.improvin;
|
|
co.lacodcli = commessa.lacodcli;
|
|
co.lacodcom = commessa.lacodcom;
|
|
co.ladatchi = commessa.ladatchi;
|
|
co.ladeslav = commessa.ladeslav;
|
|
co.laserial = commessa.laserial;
|
|
co.latipcli = commessa.latipcli;
|
|
|
|
return co;
|
|
}
|
|
|
|
/// <summary>Commesse return:ActionResult IEnumerable Commessa</summary>
|
|
[HttpGet("timbrature/commesse")]
|
|
public async Task<ActionResult<IEnumerable<CommesseAdHoc_out>>> commesse(string token)
|
|
{
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
List<CommesseAdHoc_out> ll = new List<CommesseAdHoc_out>();
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
DbSet<CommesseVT>? _VT_CommesseAppo;
|
|
_VT_CommesseAppo = _VT_Comm.Comm;
|
|
var lst = _VT_CommesseAppo.Where(t => t.lacodazi != null && t.lacodazi.Equals(ten2)).ToList();
|
|
|
|
foreach (CommesseVT a in lst)
|
|
{
|
|
CommesseAdHoc_out c = new CommesseAdHoc_out();
|
|
c = formattaCommessaVT(a);
|
|
ll.Add(c);
|
|
}
|
|
}
|
|
//else if(ten.Equals(Clienti.Marrocco))
|
|
//{
|
|
// _comm = getCommesseByTenant(ten);
|
|
// var l = await _comm.OrderByDescending(t => t.ladatchi).ToListAsync();
|
|
// List<Commessa> commesse_filtrate = new List<Commessa>();
|
|
// _commDesc = _Marro_commDesc.Commdesc;
|
|
// var commesse_tecnico = _commDesc.Where((t => t.latecsup!=null && t.latecsup.Equals(tecnico))).ToList();
|
|
// foreach(CommessaDesc c in commesse_tecnico)
|
|
// {
|
|
// var co = _comm.Where(t => t.laserial.Equals(c.laserial)).ToList();
|
|
// if(co!=null && co.Count > 0)
|
|
// {
|
|
// commesse_filtrate.Add(co.First());
|
|
// }
|
|
// }
|
|
// foreach(Commessa c in commesse_filtrate)
|
|
// {
|
|
// CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
// co= formattaCommessa(c);
|
|
// ll.Add(co);
|
|
// }
|
|
//}
|
|
//else if (ten.Equals(Clienti.Gitoga))
|
|
//{
|
|
// _comm = getCommesseByTenant(ten);
|
|
// var l = await _comm.OrderByDescending(t => t.ladatchi).ToListAsync();
|
|
// List<Commessa> commesse_filtrate = new List<Commessa>();
|
|
// _commDesc = _Gitoga_commDesc.Commdesc;
|
|
// var commesse_tecnico = _commDesc.Where((t => t.latecsup != null && t.latecsup.Equals(tecnico))).ToList();
|
|
// foreach (CommessaDesc c in commesse_tecnico)
|
|
// {
|
|
// var co = _comm.Where(t => t.laserial.Equals(c.laserial)).ToList();
|
|
// if (co != null && co.Count > 0)
|
|
// {
|
|
// commesse_filtrate.Add(co.First());
|
|
// }
|
|
// }
|
|
// foreach (Commessa c in commesse_filtrate)
|
|
// {
|
|
// CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
// co = formattaCommessaMarrocco(c);
|
|
// ll.Add(co);
|
|
// }
|
|
//}
|
|
//else if ( ten.Equals(Clienti.Lifta))
|
|
//{
|
|
// _comm = getCommesseByTenant(ten);
|
|
// var l = await _comm.OrderByDescending(t => t.ladatchi).ToListAsync();
|
|
// foreach (Commessa c in l)
|
|
// {
|
|
// CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
// co = formattaCommessaMarrocco(c);
|
|
// ll.Add(co);
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// _comm = getCommesseByTenant(ten);
|
|
// var l = await _comm.OrderByDescending(t => t.ladatchi).ToListAsync();
|
|
|
|
// foreach (Commessa c in l)
|
|
// {
|
|
// CommesseAdHoc_out co = new CommesseAdHoc_out();
|
|
// co = formattaCommessaMarrocco(c);
|
|
// ll.Add(co);
|
|
// }
|
|
//}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, ll);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommesseAdHoc_out err = new CommesseAdHoc_out();
|
|
err.err_title = "Errore in timbrature/commesse";
|
|
err.err_detail = ex.Message;
|
|
err.err_status_code = "500";
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>Salva la timbratuta in tabella Timbrature return:ActionResult Timbratura_out</summary>
|
|
[HttpPost]
|
|
[Route("timbrature/salva")]
|
|
public async Task<ActionResult<Timbratura_out>> timbrature_salva([FromBody] Timbratura model, string token)
|
|
{
|
|
Timbratura_out tOut = new Timbratura_out();
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
if (await checkTimbraturaPresente(ten, model) == 0)
|
|
{
|
|
Timbratura t = await fillTimbratura(model, token);
|
|
|
|
using (var transactionVT = _VT_timbr.Database.BeginTransaction())
|
|
{
|
|
await _VT_timbr.Timbr.AddAsync(t);
|
|
await _VT_timbr.SaveChangesAsync();
|
|
transactionVT.Commit();
|
|
}
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_timbr.Timbr.AddAsync(t);
|
|
// await _Sicilia_timbr.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sinergo:
|
|
// using (var transaction2 = _Sinergo_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Sinergo_timbr.Timbr.AddAsync(t);
|
|
// await _Sinergo_timbr.SaveChangesAsync();
|
|
// transaction2.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_timbr.Timbr.AddAsync(t);
|
|
// await _Siet_timbr.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _PMS_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _PMS_timbr.Timbr.AddAsync(t);
|
|
// await _PMS_timbr.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionlw = _LW_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_timbr.Timbr.AddAsync(t);
|
|
// await _LW_timbr.SaveChangesAsync();
|
|
// transactionlw.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// using (var transactionTedes = _Tedes_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_timbr.Timbr.AddAsync(t);
|
|
// await _Tedes_timbr.SaveChangesAsync();
|
|
// transactionTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionVT = _VT_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_timbr.Timbr.AddAsync(t);
|
|
// await _VT_timbr.SaveChangesAsync();
|
|
// transactionVT.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom :
|
|
// using (var transactionsys = _Sys_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_timbr.Timbr.AddAsync(t);
|
|
// await _Sys_timbr.SaveChangesAsync();
|
|
// transactionsys.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Marrocco:
|
|
// using (var transactionMarro = _Marro_timbr.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_timbr.Timbr.AddAsync(t);
|
|
// await _Marro_timbr.SaveChangesAsync();
|
|
// transactionMarro.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
tOut = fillTimbraturaOut(model, ten, t.id);
|
|
tOut.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, tOut);
|
|
}
|
|
else
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, "timbratura presente.");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
tOut.err_title = ex.Message;
|
|
tOut.err_detail = errmsg;
|
|
tOut.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, tOut);
|
|
}
|
|
//return tOut;
|
|
}
|
|
#endregion
|
|
|
|
#region storico impianto
|
|
|
|
private Sto_Imp_out fillSto_Imp_Out(Sto_Imp i, string tenant)
|
|
{
|
|
Sto_Imp_out o = new Sto_Imp_out();
|
|
|
|
|
|
o.tipo_movimento = !string.IsNullOrEmpty(i.tipo_movimento) ? i.tipo_movimento.Trim() : string.Empty; ;
|
|
o.articolo = !string.IsNullOrEmpty(i.articolo) ? i.articolo.Trim() : string.Empty;
|
|
o.data_rapportino = i.data_rapportino;
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// #region sicilia
|
|
// if (!string.IsNullOrEmpty(i.codimp) && !i.codimp.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice Impianto", i.codimp.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.desc_impianto) && !i.desc_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione impianto", i.desc_impianto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.indirizzo) && !i.indirizzo.Trim().Equals(string.Empty))
|
|
// {
|
|
// StringBuilder sb = new StringBuilder();
|
|
// string ind = string.Empty;
|
|
// string via = !string.IsNullOrEmpty(i.indirizzo_tipo) ? i.indirizzo_tipo.Trim() : string.Empty;
|
|
// string indiri = !string.IsNullOrEmpty(i.indirizzo) ? i.indirizzo.Trim() : string.Empty;
|
|
// string num = string.Empty;
|
|
// if (i.indirizzo_num != null && i.indirizzo_num.Value > 0)
|
|
// {
|
|
// num = i.indirizzo_num.ToString().Trim();
|
|
// }
|
|
// string num2 = !string.IsNullOrEmpty(i.indirizzo_num2) ? i.indirizzo_num2.Trim() : string.Empty;
|
|
// string sca = !string.IsNullOrEmpty(i.indirizzo_scala) ? i.indirizzo_scala.Trim() : string.Empty;
|
|
|
|
// //ind = string.Concat("{0} {1} num {2} interno {3} scala {4}",via,indiri,num,num2,sca);
|
|
// if (!string.IsNullOrEmpty(via)) sb.Append(via);
|
|
// if (!string.IsNullOrEmpty(indiri)) sb.Append(" " + indiri);
|
|
// if (!string.IsNullOrEmpty(num)) sb.Append(" ," + num);
|
|
// if (!string.IsNullOrEmpty(num2)) sb.Append(" Int: " + num2);
|
|
// if (!string.IsNullOrEmpty(sca)) sb.Append(" Scala: " + sca);
|
|
// dic.Add("Indirizzo imp", sb.ToString());
|
|
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codice_tecnico) && !i.codice_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice tecnico", i.codice_tecnico.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.desc_tecnico) && !i.desc_tecnico.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione tecnico", i.desc_tecnico.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.seriale_rapportino) && !i.seriale_rapportino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Seriale rapportino", i.seriale_rapportino.Trim());
|
|
// }
|
|
// if (i.data_rapportino != null)
|
|
// {
|
|
// dic.Add("Data rapportino", i.data_rapportino.Value.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.magazzino) && !i.magazzino.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice magazzino", i.magazzino.Trim());
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(i.tipo_movimento) && !i.tipo_movimento.Trim().Equals(string.Empty))
|
|
// {
|
|
// string st = string.Empty;
|
|
// switch (i.tipo_movimento)
|
|
// {
|
|
// case "E":
|
|
// st = "Eliminato da impianto";
|
|
|
|
// break;
|
|
// case "A":
|
|
// st = "Aggiunto a impianto";
|
|
|
|
// break;
|
|
// case "S":
|
|
// st = "Sostituito a impianto";
|
|
|
|
// break;
|
|
// }
|
|
// dic.Add("Operazione", st);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.articolo) && !i.articolo.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice articolo", i.articolo.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.desc_art) && !i.desc_art.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Descrizione articolo", i.desc_art.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.codlotto) && !i.codlotto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Codice lotto", i.codlotto.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.matricola) && !i.matricola.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Matricola", i.matricola.Trim());
|
|
// }
|
|
|
|
// if (i.quantita != null && i.quantita.Value > 0)
|
|
// {
|
|
// dic.Add("Qta", i.quantita.Value.ToString());
|
|
// }
|
|
// if (i.prezzo != null && i.prezzo.Value > 0)
|
|
// {
|
|
// dic.Add("Prezzo", i.prezzo.Value.ToString());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.note) && !i.note.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Note intervento", i.note.Trim());
|
|
// }
|
|
// if (!string.IsNullOrEmpty(i.azienda_impianto) && !i.azienda_impianto.Trim().Equals(string.Empty))
|
|
// {
|
|
// dic.Add("Azienda", i.azienda_impianto.Trim());
|
|
// }
|
|
|
|
|
|
// #endregion
|
|
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
|
|
// break;
|
|
// default:
|
|
|
|
// break;
|
|
//}
|
|
o.dettaglio = dic;
|
|
return o;
|
|
}
|
|
|
|
/// <summary>Storico rapportini tecnico return:ActionResult di Sto_Imp_out</summary>
|
|
[HttpGet("storico_impianto")]
|
|
public async Task<ActionResult<IEnumerable<Sto_Imp_out>>> storico_impianto(string token, string? codimp /*,bool rapp_tec = true*/)
|
|
{
|
|
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)
|
|
{
|
|
Sto_Imp_out o = new Sto_Imp_out();
|
|
o = fillSto_Imp_Out(s, ten);
|
|
lis.Add(o);
|
|
}
|
|
|
|
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;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Rapportini da commessa
|
|
|
|
public string _tablecode;
|
|
public string _warncode;
|
|
|
|
/// <summary>Ricerca Commessa return:ActionResult</summary>
|
|
[HttpGet("ricerca_commessa_impianto")]
|
|
public async Task<ActionResult<IEnumerable<Output_Ricerca>>> ricerca_commessa_impianto(int tipo,string token, string? codimp, string? indirizzo_imp, string? cli, string? comm)
|
|
{
|
|
Output_Ricerca uscita = new Output_Ricerca();
|
|
//tipo 1: ricerca commessa - tipo2: ricerca impianto
|
|
|
|
var st = StatusCodes.Status200OK;
|
|
List<Output_Ricerca> lis = new List<Output_Ricerca>();
|
|
switch (tipo)
|
|
{
|
|
case 1:
|
|
#region ricerca commessa
|
|
try
|
|
{
|
|
//if (string.IsNullOrEmpty(codimp) && string.IsNullOrEmpty(indirizzo_imp) && string.IsNullOrEmpty(cli) && string.IsNullOrEmpty(comm))
|
|
//{
|
|
|
|
// uscita.err_title = "Errore in ricerca Commesse/Impianto.";
|
|
// uscita.err_detail = "Immettere almeno un parametro di ricerca.";
|
|
// uscita.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
// //return StatusCode(StatusCodes.Status400BadRequest, uscita);
|
|
// st = StatusCodes.Status400BadRequest;
|
|
// lis.Add(uscita);
|
|
//}
|
|
//else
|
|
//{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
|
|
string ten2= getClaimValueByToken(token, "tenant2");
|
|
_VT_Commesse = _VT_Comm.Comm;
|
|
var l = await _VT_Commesse.Where(t=>t.lacodazi.Equals(ten2)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.Contains(codimp)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.andescri != null && t.andescri.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(comm))
|
|
{
|
|
l = l.Where(t => t.lacodcom != null && t.lacodcom.ToUpper().Contains(comm.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
|
|
foreach (CommesseVT i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaVT(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
|
|
}
|
|
else
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
//_comm = getCommesseByTenant(ten);
|
|
var l = await _comm.ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.Contains(codimp)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.andescri != null && t.andescri.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(comm))
|
|
{
|
|
l = l.Where(t => t.lacodcom != null && t.lacodcom.ToUpper().Contains(comm.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
|
|
foreach (Commessa i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicerca(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
//}
|
|
|
|
|
|
//return StatusCode(StatusCodes.Status200OK, lis);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
uscita.err_title = "Errore in ricerca_impianti_chiamata.";
|
|
uscita.err_detail = ex.Message;
|
|
uscita.err_status_code = StatiRisposta.ErroreInterno;
|
|
//return StatusCode(StatusCodes.Status500InternalServerError, uscita);
|
|
st = StatusCodes.Status500InternalServerError;
|
|
lis.Add(uscita);
|
|
|
|
}
|
|
#endregion
|
|
break;
|
|
case 2:
|
|
#region ricerca Impianto
|
|
try
|
|
{
|
|
//if (string.IsNullOrEmpty(codimp) && string.IsNullOrEmpty(indirizzo_imp))
|
|
//{
|
|
|
|
// uscita.err_title = "Errore in ricerca_commessa_impianto.";
|
|
// uscita.err_detail = "Immettere almeno un parametro di ricerca.";
|
|
// uscita.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
// //return StatusCode(StatusCodes.Status400BadRequest, uscita);
|
|
// st = StatusCodes.Status400BadRequest;
|
|
// lis.Add(uscita);
|
|
//}
|
|
//else
|
|
//{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
var l = await _VT_impia.Impia.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten2)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.Contains(codimp)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
else
|
|
{
|
|
//_impianto = getImpiantiByTenant(ten);
|
|
var l = await _impianto.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.Contains(codimp)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Impianto_out e = new Impianto_out();
|
|
e.err_title = "Errore in ricerca impianti.";
|
|
e.err_detail = ex.Message;
|
|
e.err_status_code = StatiRisposta.ErroreInterno;
|
|
//return StatusCode(StatusCodes.Status428PreconditionRequired, e);
|
|
st = StatusCodes.Status500InternalServerError;
|
|
lis.Add(uscita);
|
|
}
|
|
#endregion
|
|
break;
|
|
default:
|
|
uscita.err_title = "Errore in ricerca_commessa_impianto.";
|
|
uscita.err_detail = "Tipo Ricerca non corretto";
|
|
uscita.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
//return StatusCode(StatusCodes.Status400BadRequest, uscita);
|
|
st = StatusCodes.Status400BadRequest;
|
|
lis.Add(uscita);
|
|
break;
|
|
}
|
|
|
|
return StatusCode(st, lis);
|
|
}
|
|
|
|
/// <summary>Ricerca Commessa NUOVAreturn:ActionResult</summary>
|
|
[HttpGet("ricerca_commessa_impianto2")]
|
|
public async Task<ActionResult<IEnumerable<Output_Ricerca>>> ricerca_commessa_impianto2(int tipo, string token, string? codimp, string? indirizzo_imp, string? cli, string? comm)
|
|
{
|
|
Output_Ricerca uscita = new Output_Ricerca();
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
//Console.WriteLine(string.Format("*********** {2} INIZIO Chiamata al metodo ricerca_commessa_impianto2: tipo:{0} file: {1} ", ten, tipo, DateTime.Now.ToString()));
|
|
//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)
|
|
{
|
|
case 1:
|
|
#region ricerca commessa
|
|
try
|
|
{
|
|
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
_VT_Commesse = _VT_Comm.Comm;
|
|
var l = await _VT_Commesse.Where(t => t.lacodazi.Equals(ten2)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.ToUpper().Contains(codimp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.andescri != null && t.andescri.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(comm))
|
|
{
|
|
l = l.Where(t => t.lacodcom != null && t.lacodcom.ToUpper().Contains(comm.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
|
|
foreach (CommesseVT i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaVT(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
|
|
}
|
|
//else if(ten.Equals(Clienti.Marrocco))
|
|
//{
|
|
|
|
// // qui devo filtrare per tecnico capoogruppo come faccio nella ricerca commesse del timesheet
|
|
// _comm = getCommesseByTenant(ten);
|
|
// var l = await _comm.OrderByDescending(t => t.ladatchi).ToListAsync();
|
|
// List<Commessa> commesse_filtrate = new List<Commessa>();
|
|
// _commDesc = _Marro_commDesc.Commdesc;
|
|
// var commesse_tecnico = _commDesc.Where((t => t.latecsup != null && t.latecsup.Equals(tecnico))).ToList();
|
|
// foreach (CommessaDesc c in commesse_tecnico)
|
|
// {
|
|
// var co = _comm.Where(t => t.laserial.Equals(c.laserial)).ToList();
|
|
// if (co != null && co.Count > 0)
|
|
// {
|
|
// commesse_filtrate.Add(co.First());
|
|
// }
|
|
// }
|
|
// if(commesse_filtrate.Count()==0)
|
|
// {
|
|
// commesse_filtrate = l;
|
|
// }
|
|
// if (!string.IsNullOrEmpty(codimp))
|
|
// {
|
|
// commesse_filtrate = commesse_filtrate.Where(t => t.imcodimp != null && t.imcodimp.ToUpper().Contains(codimp.ToUpper())).ToList();
|
|
// }
|
|
// if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
// {
|
|
// commesse_filtrate = commesse_filtrate.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
// }
|
|
// if (!string.IsNullOrEmpty(cli))
|
|
// {
|
|
// commesse_filtrate = commesse_filtrate.Where(t => t.andescri != null && t.andescri.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
// }
|
|
// if (!string.IsNullOrEmpty(comm))
|
|
// {
|
|
// commesse_filtrate = commesse_filtrate.Where(t => t.lacodcom != null && t.lacodcom.ToUpper().Contains(comm.ToUpper())).ToList();
|
|
// }
|
|
// commesse_filtrate = commesse_filtrate.Take(300).ToList();
|
|
|
|
// foreach (Commessa i in commesse_filtrate)
|
|
// {
|
|
// Output_Ricerca o = new Output_Ricerca();
|
|
// o = fillOutputRicerca(i);
|
|
// lis.Add(o);
|
|
// }
|
|
// st = StatusCodes.Status200OK;
|
|
//}
|
|
else
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
//_comm = getCommesseByTenant(ten);
|
|
var l = await _comm.ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.ToUpper().Contains(codimp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.andescri != null && t.andescri.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(comm))
|
|
{
|
|
l = l.Where(t => t.lacodcom != null && t.lacodcom.ToUpper().Contains(comm.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
|
|
foreach (Commessa i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicerca(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
//}
|
|
|
|
|
|
//return StatusCode(StatusCodes.Status200OK, lis);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
uscita.err_title = "Errore in ricerca_commessa_impianto2.";
|
|
uscita.err_detail = ex.Message;
|
|
uscita.err_status_code = StatiRisposta.ErroreInterno;
|
|
//return StatusCode(StatusCodes.Status500InternalServerError, uscita);
|
|
st = StatusCodes.Status500InternalServerError;
|
|
lis.Add(uscita);
|
|
|
|
}
|
|
#endregion
|
|
break;
|
|
case 3:
|
|
#region ricerca IMPIANTO
|
|
//Radio Cliente, tipo 2, campi codimp e indirizzoImp
|
|
try
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
var l = await _VT_impia.Impia.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten2)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.ToUpper().Contains(codimp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
else
|
|
{
|
|
//_impianto = getImpiantiByTenant(ten);
|
|
var l = await _impianto.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(codimp))
|
|
{
|
|
l = l.Where(t => t.imcodimp != null && t.imcodimp.ToUpper().Contains(codimp.ToUpper())).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(indirizzo_imp))
|
|
{
|
|
l = l.Where(t => t.imindiri2 != null && t.imindiri2.ToUpper().Contains(indirizzo_imp.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
//}
|
|
}
|
|
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);
|
|
st = StatusCodes.Status500InternalServerError;
|
|
lis.Add(uscita);
|
|
}
|
|
#endregion
|
|
break;
|
|
case 2:
|
|
#region ricerca CLIENTE
|
|
try
|
|
{
|
|
//Radio Cliente, tipo 2, campi cli
|
|
if (ten.Equals(Clienti.VT))
|
|
{
|
|
var l = await _VT_impia.Impia.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten2)).ToListAsync();
|
|
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.descCliente != null && t.descCliente.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
else
|
|
{
|
|
//_impianto = getImpiantiByTenant(ten);
|
|
var l = await _impianto.Where(t => t.imcodazi != null && t.imcodazi.Equals(ten)).ToListAsync();
|
|
if (!string.IsNullOrEmpty(cli))
|
|
{
|
|
l = l.Where(t => t.descCliente != null && t.descCliente.ToUpper().Contains(cli.ToUpper())).ToList();
|
|
}
|
|
l = l.Take(300).ToList();
|
|
foreach (Impianto i in l)
|
|
{
|
|
Output_Ricerca o = new Output_Ricerca();
|
|
o = fillOutputRicercaByImpianto(i);
|
|
lis.Add(o);
|
|
}
|
|
st = StatusCodes.Status200OK;
|
|
}
|
|
}
|
|
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);
|
|
st = StatusCodes.Status500InternalServerError;
|
|
lis.Add(uscita);
|
|
}
|
|
#endregion
|
|
break;
|
|
default:
|
|
uscita.err_title = "Errore in ricerca_commessa_impianto2.";
|
|
uscita.err_detail = "Tipo Ricerca non corretto";
|
|
uscita.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
st = StatusCodes.Status400BadRequest;
|
|
lis.Add(uscita);
|
|
break;
|
|
}
|
|
|
|
return StatusCode(st, lis);
|
|
}
|
|
|
|
/// <summary>Salva la timbratuta in tabella Timbrature return:ActionResult Timbratura_out</summary>
|
|
[HttpPost]
|
|
[Route("chiamata/inserisci")]
|
|
public async Task<ActionResult<Chiamate_out>> Chiamata_Insert(string token, string codimp, string? codice_commessa)
|
|
{
|
|
Output_Chiamate tOut = new Output_Chiamate();
|
|
tOut.uscita = new Chiamate_out();
|
|
Input i = new Input();
|
|
try
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
|
|
Chiamate_out o = new Chiamate_out();
|
|
Prog cpwarnNumChiamata=new Prog();
|
|
Prog cpwarnSeriale = new Prog();
|
|
|
|
Prog2 cpwarnNumChiamataDecimal = new Prog2();
|
|
Prog2 cpwarnSerialeDecimal = new Prog2();
|
|
|
|
string serialeChiamata = string.Empty;
|
|
string progChiamata = string.Empty;
|
|
string tablecodeProg = string.Empty;
|
|
string warncodeProg = string.Empty;
|
|
string tablecodeSer = string.Empty;
|
|
string warncodeSer = string.Empty;
|
|
decimal? serialeLetto = 0;
|
|
decimal? progressivoLetto = 0;
|
|
string esercizio = Convert.ToString(DateTime.Today.Year);
|
|
|
|
//lettura seriali e progressivi
|
|
|
|
//string ten2 = getClaimValueByToken(token, "tenant2");
|
|
_VT_prog = _VT_progtable.progr;
|
|
var t = await _VT_prog.Where(t => t.azienda.Equals(ten2)).ToListAsync();
|
|
foreach (Progressivo ch in t)
|
|
{
|
|
string tipoprog = string.Empty;
|
|
tipoprog = ch.tipo_prog;
|
|
int? val = 0;
|
|
val = ch.val_prog;
|
|
if (!string.IsNullOrEmpty(tipoprog) && tipoprog.Equals("NUM_CHIAMA"))
|
|
{
|
|
progChiamata = Convert.ToString(val);
|
|
progressivoLetto = val;
|
|
}
|
|
if (!string.IsNullOrEmpty(tipoprog) && tipoprog.Equals("SER_CHIAMA"))
|
|
{
|
|
serialeChiamata = Convert.ToString(val);
|
|
serialeLetto = val;
|
|
}
|
|
}
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// //string ten2 = getClaimValueByToken(token, "tenant2");
|
|
// _VT_prog = _VT_progtable.progr;
|
|
// var t = await _VT_prog.Where(t => t.azienda.Equals(ten2)).ToListAsync();
|
|
// foreach (Progressivo ch in t)
|
|
// {
|
|
// string tipoprog = string.Empty;
|
|
// tipoprog = ch.tipo_prog;
|
|
// int? val = 0;
|
|
// val = ch.val_prog;
|
|
// if (!string.IsNullOrEmpty(tipoprog) && tipoprog.Equals("NUM_CHIAMA"))
|
|
// {
|
|
// progChiamata = Convert.ToString(val);
|
|
// progressivoLetto = val;
|
|
// }
|
|
// if (!string.IsNullOrEmpty(tipoprog) && tipoprog.Equals("SER_CHIAMA"))
|
|
// {
|
|
// serialeChiamata = Convert.ToString(val);
|
|
// serialeLetto = val;
|
|
// }
|
|
// }
|
|
// break;
|
|
//}
|
|
|
|
//inserisco
|
|
//2024-04-23: codice_commessa posto a nullable (quando inserisco una chiamata selezionando solo l'impianto)
|
|
//gestisco la ricerca del seriale
|
|
string serial_comm = string.Empty;
|
|
|
|
if (!string.IsNullOrEmpty(codice_commessa))
|
|
{
|
|
serial_comm = await leggiSerialeByCodCommessaVT(ten2, codice_commessa);
|
|
}
|
|
tOut.uscita = await inserimentoChiamata2(ten, tecnico, codimp, serialeChiamata, progChiamata, serial_comm, ten2, tenConf);
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// if (!string.IsNullOrEmpty(codice_commessa))
|
|
// {
|
|
// serial_comm = await leggiSerialeByCodCommessaVT(ten2, codice_commessa);
|
|
// }
|
|
// tOut.uscita = await inserimentoChiamata2(ten, tecnico, codimp, serialeChiamata, progChiamata, serial_comm,ten2, tenConf);
|
|
// break;
|
|
// default:
|
|
// if(!string.IsNullOrEmpty(codice_commessa))
|
|
// {
|
|
// 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);
|
|
// break;
|
|
//}
|
|
|
|
//aggiornamento seriali e progressivi
|
|
string serialeUpdate = string.Empty;
|
|
float numeroUpdate = 0;
|
|
|
|
serialeLetto = serialeLetto + 1;
|
|
int val2 = Convert.ToInt32(serialeLetto);
|
|
await aggiornaprogressivoVT(ten2, "SER_CHIAMA", val2);
|
|
serialeUpdate = tOut.uscita.chserial;
|
|
|
|
progressivoLetto = progressivoLetto + 1;
|
|
val2 = Convert.ToInt32(progressivoLetto);
|
|
await aggiornaprogressivoVT(ten2, "NUM_CHIAMA", val2);
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// serialeLetto = serialeLetto + 1;
|
|
// int val = Convert.ToInt32(serialeLetto);
|
|
// await aggiornaprogressivoVT(ten2, "SER_CHIAMA", val);
|
|
// serialeUpdate = tOut.uscita.chserial;
|
|
|
|
// progressivoLetto = progressivoLetto + 1;
|
|
// val = Convert.ToInt32(progressivoLetto);
|
|
// await aggiornaprogressivoVT(ten2, "NUM_CHIAMA", val);
|
|
|
|
// break;
|
|
//}
|
|
|
|
i.codice_impianto = tOut.uscita.chcodimp;
|
|
i.seriale_chiamata = tOut.uscita.chserial;
|
|
i.ora_ini_rapportino = Convert.ToString(tOut.uscita.chora);
|
|
i.min_ini_rapportino = Convert.ToString(tOut.uscita.chmin);
|
|
|
|
tOut.chiamate_Out = await presaInCarico(i, token);
|
|
|
|
_chiamate = getChiamateByTenant(ten);
|
|
|
|
var callNew = await _chiamate.Where(
|
|
t => t.chserial.Equals(serialeUpdate)
|
|
).FirstAsync();
|
|
|
|
o = fillChiamateOut(callNew, ten);
|
|
|
|
tOut.err_status_code = StatiRisposta.Ok;
|
|
return StatusCode(StatusCodes.Status200OK, o);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
tOut.uscita.err_title = ex.Message;
|
|
tOut.uscita.err_detail = errmsg;
|
|
tOut.uscita.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, tOut.uscita);
|
|
}
|
|
//return tOut;
|
|
}
|
|
|
|
private Output_Ricerca fillOutputRicerca(Commessa 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;
|
|
if(appoCli.Length>25)
|
|
{
|
|
appoCli = appoCli.Substring(0, 25);
|
|
}
|
|
sb.AppendLine("<b>Cli <b>" + appoCli);
|
|
}
|
|
r.itemList = sb.ToString();
|
|
sb.Clear();
|
|
|
|
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();
|
|
|
|
r.codice_impianto = i.imcodimp;
|
|
r.descrizione_impianto = i.imdescri;
|
|
r.imindiri1 = i.imindiri1;
|
|
r.imindiri2 = i.imindiri2;
|
|
r.imindiri3 = i.imindiri3;
|
|
r.imindiri4 = i.imindiri4;
|
|
r.imindiri5 = i.imindiri5;
|
|
r.cap_impianto = i.imcodcap;
|
|
r.provincia_impianto = i.improvin;
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.AppendLine("<b>Imp: <b>" + i.imcodimp);
|
|
|
|
if (!string.IsNullOrEmpty(i.imdescri))
|
|
{
|
|
sb.AppendLine( i.imdescri);
|
|
}
|
|
string via = !string.IsNullOrEmpty(i.imindiri1) ? i.imindiri1.Trim() : string.Empty;
|
|
string indiri = !string.IsNullOrEmpty(i.imindiri2) ? i.imindiri2.Trim() : string.Empty;
|
|
string num = string.Empty;
|
|
if (i.imindiri3 != null && i.imindiri3.Value > 0)
|
|
{
|
|
num = i.imindiri3.ToString().Trim();
|
|
}
|
|
string num2 = !string.IsNullOrEmpty(i.imindiri4) ? i.imindiri4.Trim() : string.Empty;
|
|
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))
|
|
{
|
|
sb.AppendLine(i.imrefref);
|
|
}
|
|
r.itemList = sb.ToString();
|
|
sb.Clear();
|
|
|
|
return r;
|
|
}
|
|
private ChiamateTable fillChiamateTableInput(ChiamateTable i, string codimp, string tecnico, string tenant, string serialeLetto, string progLetto, string seriale_commessa)
|
|
{
|
|
|
|
DateTime adesso = DateTime.Now;
|
|
ChiamateTable o = new ChiamateTable();
|
|
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;
|
|
|
|
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;
|
|
//switch (tenant)
|
|
//{
|
|
// case Clienti.LW:
|
|
// _impianto = _LW_impianti.Impia;
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// _impianto = _Sys_impianti.Impia;
|
|
// break;
|
|
// default:
|
|
// // code block
|
|
// break;
|
|
//}
|
|
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
|
|
string new_serial = string.Empty;
|
|
|
|
int ser = int.Parse(lastSerial);
|
|
ser++;
|
|
new_serial = ser.ToString();
|
|
new_serial = new_serial.PadLeft(10, '0');
|
|
|
|
return new_serial;
|
|
}
|
|
private async Task<Chiamate_out> inserimentoChiamata2(string ten, string tecnico, string codimp, string serLetto, string progLetto, string codice_commessa, string ten2,string tenConf)
|
|
{
|
|
Chiamate_out c = new Chiamate_out();
|
|
|
|
|
|
string serialeTemplate = string.Empty;
|
|
|
|
ChiamateTable t = new ChiamateTable();
|
|
ChiamateTableTaskManager tm = new ChiamateTableTaskManager();
|
|
var tt = new List<ChiamateTable>();
|
|
var ttTaskManager = new List<ChiamateTableTaskManager>();
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
if (!ten.Equals(ten2))
|
|
{
|
|
ten = ten2;
|
|
}
|
|
_chiatable = getChiamateTableByTenant(ten);
|
|
//_chiatableTaskManager = getChiamateTableTaskManagerByTenant(ten);
|
|
|
|
_confLette = await readConf(ten2);
|
|
serialeTemplate = _confLette.seriale_template_chi;
|
|
tt = await _chiatable.Where(t => t.chcodazi != null && t.chcodazi.Equals(ten2) && t.chserial != null && t.chserial.Equals(serialeTemplate)).ToListAsync();
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.VT:
|
|
// _confLette = await readConf(ten2);
|
|
// serialeTemplate = _confLette.seriale_template_chi;
|
|
// tt = await _chiatable.Where(t => t.chcodazi != null && t.chcodazi.Equals(ten2) && t.chserial != null && t.chserial.Equals(serialeTemplate)).ToListAsync();
|
|
// break;
|
|
// case Clienti.LW:
|
|
// case Clienti.Syscom:
|
|
|
|
// _confLette = await readConf(tenConf);
|
|
// serialeTemplate = _confLette.seriale_template_chi;
|
|
// ttTaskManager = await _chiatableTaskManager.Where(t => t.chcodazi != null && t.chcodazi.Equals(ten2) && t.chserial != null && t.chserial.Equals(serialeTemplate)).ToListAsync();
|
|
// break;
|
|
// default:
|
|
// _confLette = await readConf(tenConf);
|
|
// serialeTemplate = _confLette.seriale_template_chi;
|
|
// tt = await _chiatable.Where(t => t.chcodazi != null && t.chcodazi.Equals(ten) && t.chserial != null && t.chserial.Equals(serialeTemplate)).ToListAsync();
|
|
// break;
|
|
//}
|
|
|
|
t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
using (var tranVT = _VT_chiatable.Database.BeginTransaction())
|
|
{
|
|
await _VT_chiatable.Chi.AddAsync(t);
|
|
await _VT_chiatable.SaveChangesAsync();
|
|
tranVT.Commit();
|
|
}
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// case Clienti.Gitoga:
|
|
// case Clienti.Lifta:
|
|
// //GITOGA e LIFTA sono comunque dentro il db di Marrocco
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten,serLetto,progLetto, codice_commessa);
|
|
// using (var tranMarro = _Marro_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_chiatable.Chi.AddAsync(t);
|
|
// await _Marro_chiatable.SaveChangesAsync();
|
|
// tranMarro.Commit();
|
|
// }
|
|
// break;
|
|
|
|
// case Clienti.Siet:
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
// using (var tranSiet = _Siet_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_chiatable.Chi.AddAsync(t);
|
|
// await _Siet_chiatable.SaveChangesAsync();
|
|
// tranSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var tranSicilia = _Sicilia_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_chiatable.Chi.AddAsync(t);
|
|
// await _Sicilia_chiatable.SaveChangesAsync();
|
|
// tranSicilia.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var tranPMS = _Pms_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_chiatable.Chi.AddAsync(t);
|
|
// await _Pms_chiatable.SaveChangesAsync();
|
|
// tranPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var tranVT = _VT_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_chiatable.Chi.AddAsync(t);
|
|
// await _VT_chiatable.SaveChangesAsync();
|
|
// tranVT.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Tedesco:
|
|
// t = fillChiamateTableInput(tt.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var tranTedes = _Tedes_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Tedes_chiatable.Chi.AddAsync(t);
|
|
// await _Tedes_chiatable.SaveChangesAsync();
|
|
// tranTedes.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
|
|
// tm = await fillChiamateTableTaskManagerInput(ttTaskManager.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var tranLW = _LW_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _LW_chiatable.Chi.AddAsync(tm);
|
|
// await _LW_chiatable.SaveChangesAsync();
|
|
// tranLW.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// tm = await fillChiamateTableTaskManagerInput(ttTaskManager.FirstOrDefault(), codimp, tecnico, ten, serLetto, progLetto, codice_commessa);
|
|
|
|
// using (var transys = _Sys_chiatable.Database.BeginTransaction())
|
|
// {
|
|
// await _Sys_chiatable.Chi.AddAsync(tm);
|
|
// await _Sys_chiatable.SaveChangesAsync();
|
|
// transys.Commit();
|
|
// }
|
|
// break;
|
|
|
|
// default:
|
|
|
|
// break;
|
|
//}
|
|
|
|
_chiamate = getChiamateByTenant(ten);
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.LW:
|
|
// case Clienti.Syscom:
|
|
// var chiamata_newTM = _chiamate.Where(x => x.chserial.Equals(tm.chserial)).FirstOrDefault();
|
|
// c = fillChiamateOut(chiamata_newTM, ten);
|
|
// break;
|
|
|
|
// default:
|
|
// var chiamata_new = _chiamate.Where(x => x.chserial.Equals(t.chserial)).FirstOrDefault();
|
|
// c = fillChiamateOut(chiamata_new, ten);
|
|
// break;
|
|
//}
|
|
|
|
return c;
|
|
}
|
|
private async Task<Chiamate_out> presaInCarico(Input model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
Chiamate_out calltec_out = new Chiamate_out();
|
|
Chiamate calltec = new Chiamate();
|
|
if (await checkChiamataPresa(ten, model.seriale_chiamata, TipoRapportino.PresaInCarico,ten2) == 0)
|
|
{
|
|
|
|
_confLette = await readConf(tenConf);
|
|
string newSerial = string.Empty;
|
|
newSerial = await getSeriale(token);
|
|
Rapp_New r = await fillRappNewByInput(model, token, newSerial, _confLette);
|
|
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Marrocco:
|
|
// using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Marro_rapp.Rapps.AddAsync(r);
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Ferrari:
|
|
// using (var transaction = _Ferra_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Ferra_rapp.Rapps.AddAsync(r);
|
|
// await _Ferra_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sicilia:
|
|
// using (var transaction = _Sicilia_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sicilia_rapp.Rapps.AddAsync(r);
|
|
// await _Sicilia_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Discovery:
|
|
// using (var transaction = _Disco_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Disco_rapp.Rapps.AddAsync(r);
|
|
// await _Disco_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Sarom:
|
|
// using (var transaction = _Sarom_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Sarom_rapp.Rapps.AddAsync(r);
|
|
// await _Sarom_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Gitoga:
|
|
// using (var transactionGit = _Gitoga_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Gitoga_rapp.Rapps.AddAsync(r);
|
|
// await _Gitoga_rapp.SaveChangesAsync();
|
|
// transactionGit.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Lifta:
|
|
// using (var transactionLif = _Lifta_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Lifta_rapp.Rapps.AddAsync(r);
|
|
// await _Lifta_rapp.SaveChangesAsync();
|
|
// transactionLif.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Siet:
|
|
// using (var transactionSiet = _Siet_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Siet_rapp.Rapps.AddAsync(r);
|
|
// await _Siet_rapp.SaveChangesAsync();
|
|
// transactionSiet.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _Pms_rapp.Database.BeginTransaction())
|
|
// {
|
|
// await _Pms_rapp.Rapps.AddAsync(r);
|
|
// await _Pms_rapp.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.VT:
|
|
// using (var transactionvt = _VT_rapptable.Database.BeginTransaction())
|
|
// {
|
|
// await _VT_rapptable.Rapps.AddAsync(r);
|
|
// await _VT_rapptable.SaveChangesAsync();
|
|
// transactionvt.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
|
|
using (var transactionvt = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
await _VT_rapptable.Rapps.AddAsync(r);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transactionvt.Commit();
|
|
}
|
|
|
|
//restituisco la chiamata
|
|
calltec = await getChiamataBySerial(model.seriale_chiamata, token);
|
|
calltec_out = fillChiamateOut(calltec, ten);
|
|
calltec.err_status_code = StatiRisposta.Ok;
|
|
|
|
}
|
|
else
|
|
{
|
|
calltec_out.err_title = "Impossibile prendere in carico la chiamata";
|
|
calltec_out.err_detail = "Chiamata precendentemente presa in carico: " + model.seriale_chiamata;
|
|
calltec_out.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
}
|
|
return calltec_out;
|
|
}
|
|
private async Task<ChiamataSeriale_out> aggiornaSeriale(string tenant, string nuovoSeriale)
|
|
{
|
|
ChiamataSeriale_out cso = new ChiamataSeriale_out();
|
|
|
|
string cpcccchk = getCpccchk(10);
|
|
//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);
|
|
//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();
|
|
|
|
string cpcccchk = getCpccchk(10);
|
|
//switch (tenant)
|
|
//{
|
|
// 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 = nuovoProg;
|
|
// entitasViewModel.cpccchk = cpcccchk;
|
|
|
|
// _Sicilia_cpwarn.Entry(entitasViewModel).State = EntityState.Modified;
|
|
// await _Sicilia_cpwarn.SaveChangesAsync();
|
|
// transactionSicilia.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.PMS:
|
|
// using (var transactionPMS = _PMS_cpwarn.Database.BeginTransaction())
|
|
// {
|
|
// _cpwarns = getCpwarnByTenant(tenant);
|
|
// Prog2 entitasViewModel = _cpwarns.Where(p => p.tablecode.Equals(tablecode) && p.warncode.Equals(warncode)).FirstOrDefault();
|
|
// entitasViewModel.autonum = nuovoProg;
|
|
// entitasViewModel.cpccchk = cpcccchk;
|
|
|
|
// _PMS_cpwarn.Entry(entitasViewModel).State = EntityState.Modified;
|
|
// await _PMS_cpwarn.SaveChangesAsync();
|
|
// transactionPMS.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.Syscom:
|
|
// using (var transactionSys = _Sys_cpwarn.Database.BeginTransaction())
|
|
// {
|
|
// _cpwarns = getCpwarnByTenant(tenant);
|
|
// Prog2 entitasViewModel = _cpwarns.Where(p => p.tablecode.Equals(tablecode) && p.warncode.Equals(warncode)).FirstOrDefault();
|
|
// entitasViewModel.autonum = nuovoProg;
|
|
// entitasViewModel.cpccchk = cpcccchk;
|
|
|
|
// _Sys_cpwarn.Entry(entitasViewModel).State = EntityState.Modified;
|
|
// await _Sys_cpwarn.SaveChangesAsync();
|
|
// transactionSys.Commit();
|
|
// }
|
|
// break;
|
|
// case Clienti.LW:
|
|
// using (var transactionLW = _LW_cpwarn.Database.BeginTransaction())
|
|
// {
|
|
// _cpwarns = getCpwarnByTenant(tenant);
|
|
// Prog2 entitasViewModel = _cpwarns.Where(p => p.tablecode.Equals(tablecode) && p.warncode.Equals(warncode)).FirstOrDefault();
|
|
// entitasViewModel.autonum = nuovoProg;
|
|
// entitasViewModel.cpccchk = cpcccchk;
|
|
|
|
// _LW_cpwarn.Entry(entitasViewModel).State = EntityState.Modified;
|
|
// await _LW_cpwarn.SaveChangesAsync();
|
|
// transactionLW.Commit();
|
|
// }
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
return cso;
|
|
}
|
|
private async Task<Progressivo_out> aggiornaprogressivoVT(string tenant, string tipoProg, int valore)
|
|
{
|
|
Progressivo_out cso = new Progressivo_out();
|
|
|
|
string cpcccchk = getCpccchk(10);
|
|
Progressivo model = new Progressivo();
|
|
//model.tipo_prog = tipoProg;
|
|
//model.azienda = tenant;
|
|
//model.val_prog = valore;
|
|
var p =await _VT_progtable.progr.Where(t => t.azienda.Equals(tenant) && t.tipo_prog.Equals(tipoProg)).ToListAsync();
|
|
model = p.FirstOrDefault();
|
|
model.val_prog = valore;
|
|
try
|
|
{
|
|
|
|
using (var transaction = _VT_progtable.Database.BeginTransaction())
|
|
{
|
|
_VT_progtable.Entry(model).State = EntityState.Modified;
|
|
await _VT_progtable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
cso.azienda = model.azienda;
|
|
cso.tipo_prog = model.tipo_prog;
|
|
cso.val_prog = model.val_prog;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
cso.err_detail = errmsg;
|
|
|
|
}
|
|
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();
|
|
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();
|
|
return cpwarn;
|
|
}
|
|
private async Task<Prog2> leggiCpwarnProgDecimal(string tenant, string tablecode, string codiceEsercizio)
|
|
{
|
|
string _ten = tenant;
|
|
var str = tenant;
|
|
str = Regex.Replace(str, @" ", "");
|
|
//autorun decimal
|
|
//_cpwarns = getCpwarnByTenant(tenant);
|
|
var cpwarn = await _cpwarns.Where(p => p.tablecode != null && p.tablecode.Contains(tablecode) && p.tablecode.Contains(codiceEsercizio) && p.tablecode.Contains(tenant.TrimEnd())).FirstAsync();
|
|
return cpwarn;
|
|
}
|
|
private async Task<Prog2> leggiCpwarnSerialeDecimal(string tenant, string tablecode)
|
|
{
|
|
//autorun decimal
|
|
//_cpwarns = getCpwarnByTenant(tenant);
|
|
var cpwarn = await _cpwarns.Where(p => p.tablecode != null && p.tablecode.Contains(tablecode) && p.tablecode.Contains(tenant.TrimEnd())).FirstAsync();
|
|
return cpwarn;
|
|
}
|
|
private async Task<string> leggiSerialeByCodCommessa(string tenant, string codice_commessa)
|
|
{
|
|
string serial = string.Empty;
|
|
//_comm = getCommesseByTenant(tenant);
|
|
var ser = await _comm.Where(p => p.lacodcom!=null && p.lacodcom.Equals(codice_commessa)).FirstAsync();
|
|
serial = ser.laserial;
|
|
return serial;
|
|
}
|
|
private async Task<string> leggiSerialeByCodCommessaVT(string tenant, string codice_commessa)
|
|
{
|
|
string serial = string.Empty;
|
|
_VT_Commesse = _VT_Comm.Comm;
|
|
|
|
//var t = await _VT_Commesse.Where(t => t.lacodazi.Equals(tenant)).ToListAsync();
|
|
var ser = await _VT_Commesse.Where(p => p.lacodcom != null && p.lacodcom.Equals(codice_commessa) && p.lacodazi.Equals(tenant)).FirstAsync();
|
|
serial = ser.laserial;
|
|
return serial;
|
|
}
|
|
#endregion
|
|
|
|
#region VIRTUAL TASK
|
|
/// <summary>Login iniziale return:ActionResult</summary>
|
|
[HttpPost("loginTechnicalVT")]
|
|
public async Task<ActionResult<LoginOut>> loginTechnicalVT([FromBody] LoginModel model)
|
|
{
|
|
LoginOut o = new LoginOut();
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(model.Username) || string.IsNullOrEmpty(model.Password))
|
|
{
|
|
o.err_detail = "Username e Password non possono essere vuoti.";
|
|
o.err_title = "Username e Password non possono essere vuoti.";
|
|
o.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status200OK, o);
|
|
}
|
|
else
|
|
{
|
|
_tecnici = _VT_tecnici.Tecnici;
|
|
|
|
//var tecnico = await _tecnici.Where(t => t.tcuser.Trim() == model.Username.Trim() && t.tcpwd.Trim() == model.Password.Trim() && t.tccodazi == model.Tenant).Take(1).ToListAsync();
|
|
//var tecnico = await _tecnici.Where(t => t.tcuser == model.Username && t.tcpwd == model.Password && t.tccodazi == model.Tenant).Take(1).ToListAsync();
|
|
var tecnico = await _tecnici.Where(t => t.tcuser == model.Username && t.tcpwd == model.Password && t.tccodute==1).Take(1).ToListAsync();
|
|
if (tecnico == null || (tecnico != null && tecnico.Count == 0))
|
|
{
|
|
o.err_detail = "Username o Password non trovati.";
|
|
o.err_title = "Username o Password non trovati.";
|
|
o.err_status_code = StatiRisposta.OperazioneNonAmmessa;
|
|
return StatusCode(StatusCodes.Status404NotFound, o);
|
|
}
|
|
else
|
|
{
|
|
var authClaims = new List<Claim>
|
|
{
|
|
new Claim(ClaimTypes.Name, model.Username),
|
|
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
|
new Claim("tenant", model.Tenant),
|
|
new Claim("tenant2", tecnico.First().tccodazi),
|
|
new Claim("tccodice", tecnico.First().tccodice),
|
|
new Claim("superAdmin", !string.IsNullOrEmpty (tecnico.First().tcsuper)?tecnico.First().tcsuper:"N"),
|
|
};
|
|
var authSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["JWT:Secret"]));
|
|
var token = new JwtSecurityToken(
|
|
issuer: _configuration["JWT:ValidIssuer"],
|
|
audience: _configuration["JWT:ValidAudience"],
|
|
expires: DateTime.Now.AddMonths(3),
|
|
claims: authClaims,
|
|
signingCredentials: new SigningCredentials(authSigningKey, SecurityAlgorithms.HmacSha256)
|
|
);
|
|
string tok = new JwtSecurityTokenHandler().WriteToken(token);
|
|
_token = tok;
|
|
|
|
|
|
o.Tok = tok;
|
|
o.Tcdescri = tecnico.First().Tcdescri;
|
|
o.Tccodice = tecnico.First().tccodice;
|
|
o.Tcsuper = tecnico.First().tcsuper;
|
|
o.Tenant = tecnico.First().tccodazi;
|
|
//o.tciden = tecnico.First().tciden;
|
|
|
|
Conf cc = new Conf();
|
|
//le configurazioni devono essere lette per tenant 2 non per VIRTU
|
|
//_confLette = await readConf(model.Tenant);
|
|
_confLette = await readConf(tecnico.First().tccodazi);
|
|
|
|
cc.abilita_naviga = _confLette.abilita_naviga;
|
|
cc.abilita_telefona = _confLette.abilita_telefona;
|
|
cc.abilita_chiamate = _confLette.abilita_chiamate;
|
|
cc.abilita_barcode = _confLette.abilita_barcode;
|
|
|
|
cc.abilita_manutenzioni = _confLette.abilita_manutenzioni;
|
|
cc.chiamate_accetta = _confLette.chiamate_accetta;
|
|
cc.chiamate_accetta_barcode = _confLette.chiamate_accetta_barcode;
|
|
cc.chiamate_accetta_offline = _confLette.chiamate_accetta_offline;
|
|
cc.chiamate_rifiuta = _confLette.chiamate_rifiuta;
|
|
cc.chiamate_rifiuta_barcode = _confLette.chiamate_rifiuta_barcode;
|
|
cc.chiamate_rifiuta_offline = _confLette.chiamate_rifiuta_offline;
|
|
cc.chiamate_chiudi_barcode = _confLette.chiamate_chiudi_barcode;
|
|
cc.chiamate_firma_barcode = _confLette.chiamate_firma_barcode;
|
|
cc.chiamate_chiudi_salva_barcode = _confLette.chiamate_chiudi_salva_barcode;
|
|
cc.chiamate_chiudi_salva_offline = _confLette.chiamate_chiudi_salva_offline;
|
|
|
|
cc.manutenzioni_accetta = _confLette.manutenzioni_accetta;
|
|
cc.manutenzioni_rifiuta = _confLette.manutenzioni_rifiuta;
|
|
cc.manutenzioni_accetta_barcode = _confLette.manutenzioni_accetta_barcode;
|
|
cc.manutenzioni_accetta_offline = _confLette.manutenzioni_accetta_offline;
|
|
cc.manutenzioni_chiudi_barcode = _confLette.manutenzioni_chiudi_barcode;
|
|
cc.manutenzioni_firma_barcode = _confLette.manutenzioni_firma_barcode;
|
|
cc.manutenzioni_chiudi_salva_barcode = _confLette.manutenzioni_chiudi_salva_barcode;
|
|
cc.manutenzioni_chiudi_salva_offline = _confLette.manutenzioni_chiudi_salva_offline;
|
|
|
|
cc.dpi_checkbox = _confLette.dpi_checkbox;
|
|
|
|
cc.anagrafica = _confLette.anagrafica;
|
|
cc.stato_finale = _confLette.stato_finale;
|
|
cc.descrizione_intervento = _confLette.descrizione_intervento;
|
|
cc.composizione_impianto = _confLette.composizione_impianto;
|
|
cc.note_intervento = _confLette.note_intervento;
|
|
cc.esito_intervento = _confLette.esito_intervento;
|
|
cc.ora_inizio_fine = _confLette.ora_inizio_fine;
|
|
cc.materiali = _confLette.materiali;
|
|
cc.diritto_chiamata = _confLette.diritto_chiamata;
|
|
cc.manodopera = _confLette.manodopera;
|
|
cc.spese_viaggio = _confLette.spese_viaggio;
|
|
cc.tipo_pagamento = _confLette.tipo_pagamento;
|
|
cc.note_pagamento = _confLette.note_pagamento;
|
|
cc.causale = _confLette.causale;
|
|
|
|
cc.time_sheet = _confLette.time_sheet;
|
|
cc.time_sheet_offline = _confLette.time_sheet_offline;
|
|
cc.costo_orario = _confLette.costo_orario;
|
|
cc.ftp_port = _confLette.ftp_port;
|
|
cc.manutenzioni_rifiuta_barcode = _confLette.manutenzioni_rifiuta_barcode;
|
|
cc.storico = _confLette.storico;
|
|
cc.storico_tecnico = _confLette.storico_tecnico;
|
|
cc.storico_interventi = _confLette.storico_interventi;
|
|
cc.storico_impianto = _confLette.storico_impianto;
|
|
cc.ricerca_impianti = _confLette.ricerca_impianti;
|
|
|
|
cc.ora_inizio_fine_automatica = _confLette.ora_inizio_fine_automatica;
|
|
cc.stampa_orario = _confLette.stampa_orario;
|
|
cc.intestazione_stampa = _confLette.intestazione_stampa;
|
|
cc.seriale_template_chi = _confLette.seriale_template_chi;
|
|
cc.abilita_inserimento_chiamate = _confLette.abilita_inserimento_chiamate;
|
|
|
|
o.Config = cc;
|
|
|
|
//cerco le aziende collegate
|
|
List<AziendaRif> l = new List<AziendaRif>();
|
|
string ten = model.Tenant;
|
|
bool bCercaAzcoll = false;
|
|
//switch (ten)
|
|
//{
|
|
// case Clienti.Discovery:
|
|
// bCercaAzcoll = true;
|
|
// break;
|
|
//}
|
|
if (bCercaAzcoll)
|
|
{
|
|
//_azi_coll = getAziendeRifByTenant(ten);
|
|
var a = await _azi_coll.Where(t => t.piazihoc != null && t.piazihoc.Equals(ten) && t.picodtec != null && t.picodtec.Trim().Equals(o.Tccodice.Trim())).ToListAsync();
|
|
if (a.Any())
|
|
{
|
|
|
|
foreach (AziendaRif appo in a)
|
|
{
|
|
string logo = !string.IsNullOrEmpty(appo.pilogurl) ? appo.pilogurl.Trim() : string.Empty;
|
|
//var uriBuilder = new UriBuilder(Request.Scheme, Request.Host.Host, Request.Host.Port ?? -1);
|
|
//logo = uriBuilder + logo;
|
|
appo.pilogurl = logo;
|
|
l.Add(appo);
|
|
}
|
|
|
|
}
|
|
}
|
|
o.aziende_coll = l;
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, o);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
o.err_detail = err;
|
|
o.err_title = err;
|
|
o.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, o);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: Tecnici per azienda</summary>
|
|
[HttpGet("tecniciList")]
|
|
public async Task<ActionResult<IEnumerable<TecniciTable>>> tecniciList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<TecniciTable> ilist = new List<TecniciTable>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_tecTable = _VT_tectable.Tectable;
|
|
|
|
|
|
var t = await _tecTable.Where(
|
|
t => t.tccodazi.Equals(ten)
|
|
&& t.tcuser != null
|
|
).ToListAsync();
|
|
|
|
foreach (TecniciTable ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
/// <summary>VIRTUAL TASK: Tecnici per azienda</summary>
|
|
[HttpGet("tecniciListAll")]
|
|
public async Task<ActionResult<IEnumerable<TecniciTable>>> tecniciListAll(string usr,string pwd)
|
|
{
|
|
try
|
|
{
|
|
List<TecniciTable> ilist = new List<TecniciTable>();
|
|
_tecTable = _VT_tectable.Tectable;
|
|
var t = await _tecTable.Where(
|
|
t => t.tcpwd.Equals(pwd)
|
|
&& t.tcuser.Equals(usr)
|
|
).ToListAsync();
|
|
|
|
foreach (TecniciTable ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
/// <summary>VIRTUAL TASK: crea un tecnico return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("tecnici/add")]
|
|
public async Task<ActionResult<TecniciTable>> addtecnico([FromBody] TecniciTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.tccodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_tectable.Database.BeginTransaction())
|
|
{
|
|
await _VT_tectable.Tectable.AddAsync(model);
|
|
await _VT_tectable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un tecnico return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("tecnici/del")]
|
|
public async Task<ActionResult<TecniciTable>> deltecnico(string codice, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_tecTable = _VT_tectable.Tectable;
|
|
var t = await _tecTable.Where(t => t.tccodice == codice && t.tccodazi == ten).ToListAsync();
|
|
|
|
TecniciTable model = t.First();
|
|
model.tcdatobs = DateTime.Now;
|
|
try
|
|
{
|
|
using (var transaction = _VT_tectable.Database.BeginTransaction())
|
|
{
|
|
_VT_tectable.Entry(model).State = EntityState.Modified;
|
|
await _VT_tectable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica un tecnico return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("tecnici/mod")]
|
|
public async Task<ActionResult<TecniciTable>> modtecnico([FromBody] TecniciTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.tccodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_tectable.Database.BeginTransaction())
|
|
{
|
|
_VT_tectable.Entry(model).State = EntityState.Modified;
|
|
await _VT_tectable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>VIRTUAL TASK: Codici di chiusura</summary>
|
|
[HttpGet("chiusureVtList")]
|
|
public async Task<ActionResult<IEnumerable<ChiusureTable>>> chiusureVtList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<ChiusureTable> ilist = new List<ChiusureTable>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
_chiuTable = _VT_chiutable.Chiutable;
|
|
|
|
var t = await _chiuTable.Where(t => t.cccodazi.Equals(ten) && t.codtobso==null).ToListAsync();
|
|
|
|
foreach (ChiusureTable ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea un codice chiusura return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiusure/add")]
|
|
public async Task<ActionResult<ChiusureTable>> addchiusura([FromBody] ChiusureTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.cccodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_chiutable.Database.BeginTransaction())
|
|
{
|
|
await _VT_chiutable.Chiutable.AddAsync(model);
|
|
await _VT_chiutable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un codice chiusura return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiusure/del")]
|
|
public async Task<ActionResult<ChiusureTable>> delchiusura(string codice, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_chiuTable = _VT_chiutable.Chiutable;
|
|
var cod = await _chiuTable.Where(t => t.cccodice == codice && t.cccodazi == ten ).ToListAsync();
|
|
|
|
ChiusureTable model = cod.First();
|
|
model.codtobso = DateTime.Now;
|
|
try
|
|
{
|
|
//using (var transaction = _VT_chiutable.Database.BeginTransaction())
|
|
//{
|
|
// _VT_chiutable.Entry(model).State = EntityState.Deleted;
|
|
// await _VT_chiutable.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
//}
|
|
using (var transaction = _VT_chiutable.Database.BeginTransaction())
|
|
{
|
|
_VT_chiutable.Entry(model).State = EntityState.Modified;
|
|
await _VT_chiutable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica un codice chiusura return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiusure/mod")]
|
|
public async Task<ActionResult<ChiusureTable>> modchiusura([FromBody] ChiusureTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.cccodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_chiutable.Database.BeginTransaction())
|
|
{
|
|
_VT_chiutable.Entry(model).State = EntityState.Modified;
|
|
await _VT_chiutable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: anagrafiche clienti per azienda</summary>
|
|
[HttpGet("anagraficheList")]
|
|
public async Task<ActionResult<IEnumerable<Anag>>> anagraficheList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<AnagVT> ilist = new List<AnagVT>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_clientiVT = _VT_anag.Anag;
|
|
|
|
var t = await _clientiVT.Where(
|
|
t => t.antipcon.Equals("C")
|
|
&& t.andtobso == null
|
|
&& t.ancodazi.Equals(ten)
|
|
).ToListAsync();
|
|
|
|
foreach (AnagVT ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una anagrafica return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("anagrafiche/add")]
|
|
public async Task<ActionResult<AnagTable>> addAnagrafica([FromBody] AnagTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
model.annumlis = null;
|
|
model.andtobso = null;
|
|
model.ancodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_anagtable.Database.BeginTransaction())
|
|
{
|
|
await _VT_anagtable.Anagtable.AddAsync(model);
|
|
await _VT_anagtable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
/// <summary>VIRTUAL TASK: crea una anagrafica return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("anagrafiche/addCommImp")]
|
|
public async Task<ActionResult<AnagTable>> addAnagraficaCommessaImpianto([FromBody] AnagCommImp model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
model.cli.annumlis = null;
|
|
model.cli.andtobso = null;
|
|
model.cli.ancodazi = ten;
|
|
model.cli.antipcon = "C";
|
|
model.imp.imcodazi = ten;
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
model.comm.latipcli = "C";
|
|
model.comm.lacodazi = ten2;
|
|
|
|
|
|
try
|
|
{
|
|
|
|
var strategy = _VT_anagtable.Database.CreateExecutionStrategy();
|
|
await strategy.ExecuteAsync(async () =>
|
|
{
|
|
|
|
using var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
|
|
await _VT_anagtable.Anagtable.AddAsync(model.cli);
|
|
await _VT_impiatable.Impia.AddAsync(model.imp);
|
|
await _VT_CommTable.CommTable.AddAsync(model.comm);
|
|
|
|
await _VT_anagtable.SaveChangesAsync();
|
|
await _VT_impiatable.SaveChangesAsync();
|
|
await _VT_CommTable.SaveChangesAsync();
|
|
|
|
scope.Complete();
|
|
});
|
|
|
|
|
|
//await _VT_anagtable.Anagtable.AddAsync(model.cli);
|
|
//await _VT_anagtable.SaveChangesAsync();
|
|
|
|
////step 1: INSERISCO IMPIANTO
|
|
//_VT_impiatable.Database.UseTransaction(transaction.GetDbTransaction());
|
|
//await _VT_impiatable.Impia.AddAsync(model.imp);
|
|
//await _VT_impiatable.SaveChangesAsync();
|
|
|
|
////step 2: inserimento commessa
|
|
//_VT_CommTable.Database.UseTransaction(transaction.GetDbTransaction());
|
|
//await _VT_CommTable.CommTable.AddAsync(model.comm);
|
|
//await _VT_CommTable.SaveChangesAsync();
|
|
|
|
//transaction.Commit();
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
/// <summary>VIRTUAL TASK: modifica una anagrafica return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("anagrafiche/mod")]
|
|
public async Task<ActionResult<AnagTable>> modAnagrafica([FromBody] AnagTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.ancodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_anagtable.Database.BeginTransaction())
|
|
{
|
|
_VT_anagtable.Entry(model).State = EntityState.Modified;
|
|
await _VT_anagtable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una anagrafica (valorizza data obsolescenza) return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("anagrafiche/del")]
|
|
public async Task<ActionResult<AnagTable>> delAnagrafica([FromBody] AnagTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.ancodazi = ten;
|
|
model.andtobso = DateTime.Now;
|
|
try
|
|
{
|
|
using (var transaction = _VT_anagtable.Database.BeginTransaction())
|
|
{
|
|
_VT_anagtable.Entry(model).State = EntityState.Modified;
|
|
await _VT_anagtable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: rapp_new per azienda</summary>
|
|
[HttpGet("rappnewList")]
|
|
public async Task<ActionResult<IEnumerable<Rapp_New_View>>> rappnewList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Rapp_New_View> ilist = new List<Rapp_New_View>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_rapp_new_view = _VT_rapp.Rapps;
|
|
|
|
var t = await _rapp_new_view.Where(t => t.azienda_chiamata.Equals(ten)).Take(100).ToListAsync();
|
|
|
|
foreach (Rapp_New_View ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una rappnew return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("rappnew/add")]
|
|
public async Task<ActionResult<Rapp_New>> addRappnew([FromBody] Rapp_New model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.azienda_chiamata = ten;
|
|
model.azienda_impianto = ten;
|
|
model.azienda_tecnico = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
await _VT_rapptable.Rapps.AddAsync(model);
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica una anagrafica return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("rappnew/mod")]
|
|
public async Task<ActionResult<Rapp_New>> modRappnew([FromBody] Rapp_New model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.azienda_chiamata = ten;
|
|
model.azienda_impianto = ten;
|
|
model.azienda_tecnico = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_rapptable.Database.BeginTransaction())
|
|
{
|
|
_VT_rapptable.Entry(model).State = EntityState.Modified;
|
|
await _VT_rapptable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una rapp_new return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("rappnew/del")]
|
|
public async Task<ActionResult<Rapp_New>> delRappnew(string serialeRapportino, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_rapp_new = _VT_rapptable.Rapps;
|
|
var t = await _rapp_new.Where(t => t.seriale_rapportino.Equals(serialeRapportino) && t.azienda_chiamata.Equals(ten)).ToListAsync();
|
|
|
|
Rapp_New model = t.First();
|
|
try
|
|
{
|
|
//using (var transaction = _Marro_rapp.Database.BeginTransaction())
|
|
//{
|
|
// _Marro_rapp.Entry(model).State = EntityState.Deleted;
|
|
// await _Marro_rapp.SaveChangesAsync();
|
|
// transaction.Commit();
|
|
//}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: impianti per azienda</summary>
|
|
[HttpGet("impiantiList")]
|
|
public async Task<ActionResult<IEnumerable<ImpiantoTable>>> impiantiList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Impianto> ilist = new List<Impianto>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_impianto = _VT_impia.Impia;
|
|
|
|
var t = await _impianto.Where(t => t.imcodazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Impianto ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: impianti per azienda</summary>
|
|
[HttpGet("impiantiListMngr")]
|
|
public async Task<ActionResult<IEnumerable<ImpiantoTable>>> impiantiListMngr(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Impianto> ilist = new List<Impianto>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_impianto = _VT_impiaMngr.Impia;
|
|
|
|
var t = await _impianto.Where(t => t.imcodazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Impianto ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea un impianto return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("impianti/add")]
|
|
public async Task<ActionResult<ImpiantoTable>> addImpianto([FromBody] ImpiantoTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.imcodazi = ten;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_impiatable.Database.BeginTransaction())
|
|
{
|
|
await _VT_impiatable.Impia.AddAsync(model);
|
|
await _VT_impiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
//co_out.err_title = ex.Message;
|
|
//co_out.err_detail = errmsg;
|
|
//co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
//return co_out;
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica un impianto return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("impianto/mod")]
|
|
public async Task<ActionResult<ImpiantoTable>> modImpianto([FromBody] ImpiantoTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.imcodazi = ten;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_impiatable.Database.BeginTransaction())
|
|
{
|
|
_VT_impiatable.Entry(model).State = EntityState.Modified;
|
|
await _VT_impiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un impianto return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("impianto/del")]
|
|
public async Task<ActionResult<ImpiantoTable>> delImpianto(string imcodimp, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_impiaTable = _VT_impiatable.Impia;
|
|
var t = await _impiaTable.Where(t => t.imcodimp.Equals(imcodimp) && t.imcodazi.Equals(ten)).ToListAsync();
|
|
|
|
ImpiantoTable model = t.First();
|
|
model.imfinatt = DateTime.Now;
|
|
try
|
|
{
|
|
using (var transaction = _VT_impiatable.Database.BeginTransaction())
|
|
{
|
|
_VT_impiatable.Entry(model).State = EntityState.Modified;
|
|
await _VT_impiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: chiamate per azienda</summary>
|
|
[HttpGet("chiamateList")]
|
|
public async Task<ActionResult<IEnumerable<ChiamateTable>>> chiamateList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Chiamate> ilist = new List<Chiamate>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_chiamate = _VT_chia.Chiamate;
|
|
|
|
var t = await _chiamate.Where(t => t.chcodazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Chiamate ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: chiamate per azienda</summary>
|
|
[HttpGet("chiamateListMngr")]
|
|
public async Task<ActionResult<IEnumerable<Chiamate>>> chiamateListMngr(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Chiamate> ilist = new List<Chiamate>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_chiamate = _VT_chiaMngr.Chiamate;
|
|
|
|
var t = await _chiamate.Where(t => t.chcodazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Chiamate ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una chiamata return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamata/add")]
|
|
public async Task<ActionResult<ChiamateTable>> addChiamata([FromBody] ChiamateTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.chcodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_chiatable.Database.BeginTransaction())
|
|
{
|
|
await _VT_chiatable.Chi.AddAsync(model);
|
|
await _VT_chiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica una chiamata return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamata/mod")]
|
|
public async Task<ActionResult<ChiamateTable>> modChiamata([FromBody] ChiamateTable model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.chcodazi = ten;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_chiatable.Database.BeginTransaction())
|
|
{
|
|
_VT_chiatable.Entry(model).State = EntityState.Modified;
|
|
await _VT_chiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
//co_out.err_title = ex.Message;
|
|
//co_out.err_detail = errmsg;
|
|
//co_out.err_status_code = StatiRisposta.ErroreInterno;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
//return co_out;
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una chiamata return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("chiamata/del")]
|
|
public async Task<ActionResult<ChiamateTable>> delChiamata(string chserial, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_chiatable = _VT_chiatable.Chi;
|
|
var t = await _chiatable.Where(t => t.chserial.Equals(chserial) && t.chcodazi.Equals(ten)).ToListAsync();
|
|
|
|
ChiamateTable model = t.First();
|
|
try
|
|
{
|
|
using (var transaction = _VT_chiatable.Database.BeginTransaction())
|
|
{
|
|
_VT_chiatable.Entry(model).State = EntityState.Deleted;
|
|
await _VT_chiatable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: progressivi per azienda</summary>
|
|
[HttpGet("progressiviList")]
|
|
public async Task<ActionResult<IEnumerable<Progressivo>>> progressiviList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Progressivo> ilist = new List<Progressivo>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_prog = _VT_progtable.progr;
|
|
|
|
var t = await _VT_prog.Where(t => t.azienda.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Progressivo ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica un progressivo return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("progressivo/mod")]
|
|
public async Task<ActionResult<ChiamateTable>> modProgressivo([FromBody] Progressivo model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.azienda = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_progtable.Database.BeginTransaction())
|
|
{
|
|
_VT_progtable.Entry(model).State = EntityState.Modified;
|
|
await _VT_progtable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: dati azienda</summary>
|
|
[HttpGet("aziendeList")]
|
|
public async Task<ActionResult<IEnumerable<AziendaRif>>> aziendeList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<AziendaRif> ilist = new List<AziendaRif>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_azi_coll = _VT_azi.Azi;
|
|
|
|
var t = await _azi_coll.Where(t => t.pirifazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (AziendaRif ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una azienda return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("azienda/add")]
|
|
public async Task<ActionResult<AziendaRif>> addAzienda([FromBody] AziendaRif model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
model.piazihoc = ten;
|
|
model.pirifazi = ten2;
|
|
_confLette = await readConf(ten2);
|
|
try
|
|
{
|
|
using (var transaction = _VT_azi.Database.BeginTransaction())
|
|
{
|
|
await _VT_azi.Azi.AddAsync(model);
|
|
await _VT_azi.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica un progressivo return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("azienda/mod")]
|
|
public async Task<ActionResult<AziendaRif>> modAzienda([FromBody] AziendaRif model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
model.piazihoc = ten;
|
|
model.pirifazi = ten2;
|
|
try
|
|
{
|
|
using (var transaction = _VT_azi.Database.BeginTransaction())
|
|
{
|
|
_VT_azi.Entry(model).State = EntityState.Modified;
|
|
await _VT_azi.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una azienda return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("azienda/del")]
|
|
public async Task<ActionResult<AziendaRif>> delAzienda(string picodtec, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
_azi_coll = _VT_azi.Azi;
|
|
var t = await _azi_coll.Where(t => t.piazihoc.Equals(ten) && t.pirifazi.Equals(ten2) && t.picodtec.Equals(picodtec)).ToListAsync();
|
|
|
|
AziendaRif model = t.First();
|
|
try
|
|
{
|
|
using (var transaction = _VT_azi.Database.BeginTransaction())
|
|
{
|
|
_VT_azi.Entry(model).State = EntityState.Deleted;
|
|
await _VT_azi.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>VIRTUAL TASK: registrazioni</summary>
|
|
[HttpGet("registrazioniList")]
|
|
public async Task<ActionResult<IEnumerable<Registrazione>>> registrazioniList()
|
|
{
|
|
try
|
|
{
|
|
List<Registrazione> ilist = new List<Registrazione>();
|
|
//string ten = getClaimValueByToken(token, "tenant2");
|
|
//string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_regi = _VT_reg.Reg;
|
|
|
|
//var t = await _azi_coll.Where(t => t.pirifazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Registrazione ch in _VT_regi)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una registrazione return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("registrazioni/add")]
|
|
public async Task<ActionResult<Registrazione>> addRegistrazione([FromBody] Registrazione model)
|
|
{
|
|
try
|
|
{
|
|
using (var transaction = _VT_reg.Database.BeginTransaction())
|
|
{
|
|
await _VT_reg.Reg.AddAsync(model);
|
|
await _VT_reg.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica una registrazione return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("registrazioni/mod")]
|
|
public async Task<ActionResult<Registrazione>> modregistrazione([FromBody] Registrazione model)
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
//string ten2 = getClaimValueByToken(token, "tenant2");
|
|
//model.piazihoc = ten;
|
|
//model.pirifazi = ten2;
|
|
try
|
|
{
|
|
using (var transaction = _VT_reg.Database.BeginTransaction())
|
|
{
|
|
_VT_reg.Entry(model).State = EntityState.Modified;
|
|
await _VT_reg.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una registrazione return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("registrazioni/del")]
|
|
public async Task<ActionResult<Registrazione>> delRegistrazione(int Id)
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
//string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
_VT_regi = _VT_reg.Reg;
|
|
var t = await _VT_regi.Where(t => t.Id==Id ).ToListAsync();
|
|
|
|
Registrazione model = t.First();
|
|
try
|
|
{
|
|
using (var transaction = _VT_reg.Database.BeginTransaction())
|
|
{
|
|
_VT_reg.Entry(model).State = EntityState.Deleted;
|
|
await _VT_reg.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: registrazioni</summary>
|
|
[HttpGet("AziendePresentiList")]
|
|
public async Task<ActionResult<IEnumerable<AziendaPres>>> AziendePresentiList()
|
|
{
|
|
try
|
|
{
|
|
List<AziendaPres> ilist = new List<AziendaPres>();
|
|
//string ten = getClaimValueByToken(token, "tenant2");
|
|
//string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_AziPresenti = _VT_AziPres.Aziende;
|
|
|
|
//var t = await _azi_coll.Where(t => t.pirifazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (AziendaPres ch in _VT_AziPresenti)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>VIRTUAL TASK: commesse</summary>
|
|
[HttpGet("commesseList")]
|
|
public async Task<ActionResult<IEnumerable<CommesseVT>>> commesseList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<CommesseVT> ilist = new List<CommesseVT>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
//string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_Commesse = _VT_Comm.Comm;
|
|
|
|
var t = await _VT_Commesse.Where(t => t.lacodazi.Equals(ten)).ToListAsync();
|
|
|
|
foreach (CommesseVT ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea una commessa return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("commesseVT/add")]
|
|
public async Task<ActionResult<CommesseVT_Table>> addCommessaVT([FromBody] CommesseVT_Table model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
model.latipcli = "C";
|
|
model.lacodazi = ten2;
|
|
try
|
|
{
|
|
using (var transaction = _VT_CommTable.Database.BeginTransaction())
|
|
{
|
|
await _VT_CommTable.CommTable.AddAsync(model);
|
|
await _VT_CommTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica una commessa return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("commesseVT/mod")]
|
|
public async Task<ActionResult<CommesseVT_Table>> modCommessaVT([FromBody] CommesseVT_Table model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_CommTable.Database.BeginTransaction())
|
|
{
|
|
_VT_CommTable.Entry(model).State = EntityState.Modified;
|
|
await _VT_CommTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una commessa (valorizza data obsolescenza) return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("commesseVT/del")]
|
|
public async Task<ActionResult<CommesseVT_Table>> delCommessaVT([FromBody] CommesseVT_Table model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
|
|
model.ladatchi = DateTime.Now;
|
|
try
|
|
{
|
|
using (var transaction = _VT_CommTable.Database.BeginTransaction())
|
|
{
|
|
_VT_CommTable.Entry(model).State = EntityState.Modified;
|
|
await _VT_CommTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>VIRTUAL TASK: dati Azienda</summary>
|
|
[HttpGet("datiaziendaList")]
|
|
public async Task<ActionResult<IEnumerable<DatiAzienda>>> datiaziendaList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<DatiAzienda> ilist = new List<DatiAzienda>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
//string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_DatiAzi =_VT_DatiAzienda.Dati;
|
|
|
|
var t = await _VT_DatiAzi.Where(t => t.azienda.Equals(ten)).ToListAsync();
|
|
|
|
foreach (DatiAzienda ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: crea dati azienda return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("datiazienda/add")]
|
|
public async Task<ActionResult<DatiAzienda>> addDatiAzienda([FromBody] DatiAzienda model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
_confLette = await readConf(ten2);
|
|
//model.latipcli = "C";
|
|
//model.lacodazi = ten2;
|
|
try
|
|
{
|
|
using (var transaction = _VT_DatiAzienda.Database.BeginTransaction())
|
|
{
|
|
await _VT_DatiAzienda.Dati.AddAsync(model);
|
|
await _VT_DatiAzienda.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
//devo fare la copia del logo e metterlo nella cartella del server a partire dal logo scritto in tabella
|
|
model = await readImgAndSave(model.azienda, model.tecnico, _confLette.path_buoni);
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: modifica una commessa return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("datiazienda/mod")]
|
|
public async Task<ActionResult<DatiAzienda>> modDatiAzienda([FromBody] DatiAzienda model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_DatiAzienda.Database.BeginTransaction())
|
|
{
|
|
_VT_DatiAzienda.Entry(model).State = EntityState.Modified;
|
|
await _VT_DatiAzienda.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una dati azienda return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("datiazienda/del")]
|
|
public async Task<ActionResult<DatiAzienda>> delDatiAzienda(string azienda, string tecnico)
|
|
{
|
|
//string ten = getClaimValueByToken(token, "tenant");
|
|
//string ten2 = getClaimValueByToken(token, "tenant2");
|
|
|
|
_VT_DatiAzi = _VT_DatiAzienda.Dati;
|
|
var t = await _VT_DatiAzi.Where(t => t.azienda.Equals(azienda) && t.tecnico.Equals(tecnico)).ToListAsync();
|
|
|
|
DatiAzienda model = t.First();
|
|
try
|
|
{
|
|
using (var transaction = _VT_DatiAzienda.Database.BeginTransaction())
|
|
{
|
|
_VT_DatiAzienda.Entry(model).State = EntityState.Deleted;
|
|
await _VT_DatiAzienda.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella una dati azienda return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("datiazienda/saveFile")]
|
|
public async Task<ActionResult<DatiAzienda>> saveFileDatiAzienda(string azienda, string tecnico, string pathSrv)
|
|
{
|
|
DatiAzienda model=new DatiAzienda();
|
|
try
|
|
{
|
|
model = await readImgAndSave(azienda,tecnico,pathSrv);
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: legge e salva su server return:ActionResult</summary>
|
|
private async Task<DatiAzienda> readImgAndSave(string azienda, string tecnico, string pathSrv)
|
|
{
|
|
_VT_DatiAzi = _VT_DatiAzienda.Dati;
|
|
var t = await _VT_DatiAzi.Where(t => !string.IsNullOrEmpty(t.azienda) && t.azienda.Equals(azienda)
|
|
&& !string.IsNullOrEmpty(t.tecnico) && t.tecnico.Equals(tecnico)).ToListAsync();
|
|
|
|
DatiAzienda model = t.First();
|
|
|
|
string path = string.Empty;
|
|
string nomeFile = string.Empty;
|
|
nomeFile = getNomeFile(model.url_logo);
|
|
if(!string.IsNullOrEmpty(nomeFile))
|
|
{
|
|
nomeFile = nomeFile.Trim();
|
|
}
|
|
|
|
|
|
//previene aziende più corte di 5 caratteri
|
|
string aziendaFolder = string.Empty;
|
|
if (!string.IsNullOrEmpty(azienda))
|
|
{
|
|
aziendaFolder = azienda.Trim();
|
|
}
|
|
path = pathSrv;
|
|
path = path +@"\"+ aziendaFolder + @"\" + nomeFile;
|
|
SaveByteArrayToFileWithBinaryWriter(model.logo, path);
|
|
return model;
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: salvataggio su disco</summary>
|
|
public static void SaveByteArrayToFileWithBinaryWriter(byte[] data, string filePath)
|
|
{
|
|
using var writer = new BinaryWriter(System.IO.File.OpenWrite(filePath));
|
|
writer.Write(data);
|
|
//System.IO.File.WriteAllBytes("Foo.txt", data);
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: ricava il nome del file a partire dal path web </summary>
|
|
public static string getNomeFile(string path)
|
|
{
|
|
string nome = string.Empty;
|
|
string[] words = path.Split('/');
|
|
int l = words.Length;
|
|
nome = words[l - 1];
|
|
return nome;
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: dati Azienda</summary>
|
|
[HttpGet("rapportiniList")]
|
|
public async Task<ActionResult<IEnumerable<Rapportino>>> rapportiniList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Rapportino> ilist = new List<Rapportino>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
//string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_VT_rapport = _VT_Rapportini.Rapportini;
|
|
|
|
var t = await _VT_rapport.Where(t => t.azienda_impianto.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Rapportino ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: inserisce buono</summary>
|
|
[HttpGet("buoni/add")]
|
|
public async Task<ActionResult<Buoni>> addBuoni([FromBody] Buoni model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
model.dt_ins = DateTime.Now;
|
|
//model.lacodazi = ten2;
|
|
try
|
|
{
|
|
using (var transaction = _VT_Buoni.Database.BeginTransaction())
|
|
{
|
|
await _VT_Buoni.buoni.AddAsync(model);
|
|
await _VT_Buoni.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: Timbrature da App</summary>
|
|
[HttpGet("timbratureList")]
|
|
public async Task<ActionResult<IEnumerable<Timbratura>>> timbratureList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Timbratura> ilist = new List<Timbratura>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_timbr = _VT_timbr.Timbr;
|
|
|
|
|
|
var t = await _timbr.Where(
|
|
t => t.azienda.Equals(ten)
|
|
).ToListAsync();
|
|
|
|
foreach (Timbratura ch in t)
|
|
{
|
|
ilist.Add(ch);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, ilist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: lista articoli per azienda</summary>
|
|
[HttpGet("articoliList")]
|
|
public async Task<ActionResult<IEnumerable<Articoli>>> ArticoliList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Articoli> alist = new List<Articoli>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_articoliTable = _VT_articoliTable.Articoli;
|
|
|
|
var art = await _articoliTable.Where(x => x.Azienda.Equals(ten)).ToListAsync();
|
|
|
|
foreach (Articoli a in art)
|
|
{
|
|
alist.Add(a);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, alist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : crea nuovo articolo return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("articolo/add")]
|
|
public async Task<ActionResult<Articoli>> addArticolo([FromBody] Articoli model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.Azienda = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_articoliTable.Database.BeginTransaction())
|
|
{
|
|
await _VT_articoliTable.Articoli.AddAsync(model);
|
|
await _VT_articoliTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : modifica articolo return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("articolo/mod")]
|
|
public async Task<ActionResult<Articoli>> modArticolo([FromBody] Articoli model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.Azienda = ten;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_articoliTable.Database.BeginTransaction())
|
|
{
|
|
_VT_articoliTable.Entry(model).State = EntityState.Modified;
|
|
await _VT_articoliTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un articolo return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("articolo/del")]
|
|
public async Task<ActionResult<Articoli>> delArticolo(string artcodice, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_articoliTable = _VT_articoliTable.Articoli;
|
|
var art = await _articoliTable.Where(a => a.SlCodice.Equals(artcodice) && a.Azienda.Equals(ten)).ToListAsync();
|
|
|
|
Articoli model = art.First();
|
|
model.DataObso = DateTime.Now;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_articoliTable.Database.BeginTransaction())
|
|
{
|
|
_VT_articoliTable.Entry(model).State = EntityState.Modified;
|
|
await _VT_articoliTable.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: lista mag_new per azienda</summary>
|
|
[HttpGet("VTMagNewList")]
|
|
public async Task<ActionResult<IEnumerable<Vt_Mag_New>>> VTMagNewList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<Vt_Mag_New> mnlist = new List<Vt_Mag_New>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_magNewVT = _VT_MagNew.MagNewVt;
|
|
|
|
var listaMn = await _magNewVT.Where(x => x.Azienda.Equals(ten)).ToListAsync();
|
|
foreach (Vt_Mag_New mg in listaMn)
|
|
{
|
|
mnlist.Add(mg);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, mnlist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err); ;
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: lista Magazzini per azienda</summary>
|
|
[HttpGet("magazziniVTList")]
|
|
public async Task<ActionResult<IEnumerable<MagazziniVT>>> MagazziniVTList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<MagazziniVT> maglist = new List<MagazziniVT>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_magazziniVT = _VT_Magazzini.Magazzini;
|
|
|
|
var magazziniList = await _magazziniVT.Where(x => x.Azienda.Equals(ten)).ToListAsync();
|
|
foreach (MagazziniVT magaz in magazziniList)
|
|
{
|
|
maglist.Add(magaz);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, maglist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : crea nuovo magazzino return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("magazziniVT/add")]
|
|
public async Task<ActionResult<MagazziniVT>> addMagazzinoVT([FromBody] MagazziniVT model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.Azienda = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_Magazzini.Database.BeginTransaction())
|
|
{
|
|
await _VT_Magazzini.Magazzini.AddAsync(model);
|
|
await _VT_Magazzini.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : modifica magazzino return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("magazziniVT/mod")]
|
|
public async Task<ActionResult<MagazziniVT>> modMagazzino([FromBody] MagazziniVT model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.Azienda = ten;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_Magazzini.Database.BeginTransaction())
|
|
{
|
|
_VT_Magazzini.Entry(model).State = EntityState.Modified;
|
|
await _VT_Magazzini.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un magazzino return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("magazziniVT/del")]
|
|
public async Task<ActionResult<MagazziniVT>> delMagazzino(string magCodice, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_magazziniVT = _VT_Magazzini.Magazzini;
|
|
var art = await _magazziniVT.Where(a => a.Mgcodmag.Equals(magCodice) && a.Azienda.Equals(ten)).ToListAsync();
|
|
|
|
MagazziniVT model = art.First();
|
|
model.DataObso = DateTime.Now;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_Magazzini.Database.BeginTransaction())
|
|
{
|
|
_VT_Magazzini.Entry(model).State = EntityState.Modified;
|
|
await _VT_Magazzini.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: lista Codici segnalazioni per azienda</summary>
|
|
[HttpGet("CodiciSegnalazioniVTList")]
|
|
public async Task<ActionResult<IEnumerable<CodiceSegnalazione>>> CodSegnVTList(string token)
|
|
{
|
|
try
|
|
{
|
|
List<CodiceSegnalazione> codSegnlist = new List<CodiceSegnalazione>();
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
_codSegnVT = _VT_CodSegn.CodSegn;
|
|
|
|
var codiciSegnList = await _codSegnVT.Where(x => x.cscodazi.Equals(ten)).ToListAsync();
|
|
foreach (CodiceSegnalazione codS in codiciSegnList)
|
|
{
|
|
codSegnlist.Add(codS);
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, codSegnlist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string err = "Errore: " + ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, err); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : crea nuovo codice segnalazione return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("CodiciSegnalazioniVT/add")]
|
|
public async Task<ActionResult<MagazziniVT>> addCodSegnVT([FromBody] CodiceSegnalazione model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.cscodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_CodSegn.Database.BeginTransaction())
|
|
{
|
|
await _VT_CodSegn.CodSegn.AddAsync(model);
|
|
await _VT_CodSegn.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg); ;
|
|
}
|
|
}
|
|
|
|
///<summary> VIRTUAL TASK : modifica codice segnalazione return: ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("CodiciSegnalazioniVT/mod")]
|
|
public async Task<ActionResult<CodiceSegnalazione>> modCodSegnVT([FromBody] CodiceSegnalazione model, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
model.cscodazi = ten;
|
|
try
|
|
{
|
|
using (var transaction = _VT_CodSegn.Database.BeginTransaction())
|
|
{
|
|
_VT_CodSegn.Entry(model).State = EntityState.Modified;
|
|
await _VT_CodSegn.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
/// <summary>VIRTUAL TASK: cancella un codice segnalazione return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("CodiciSegnalazioniVT/del")]
|
|
public async Task<ActionResult<CodiceSegnalazione>> delCodSegn(string codSegn, string token)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant2");
|
|
_codSegnVT = _VT_CodSegn.CodSegn;
|
|
var art = await _codSegnVT.Where(a => a.cscodice.Equals(codSegn) && a.cscodazi.Equals(ten)).ToListAsync();
|
|
|
|
CodiceSegnalazione model = art.First();
|
|
model.DataObso = DateTime.Now;
|
|
|
|
try
|
|
{
|
|
using (var transaction = _VT_CodSegn.Database.BeginTransaction())
|
|
{
|
|
_VT_CodSegn.Entry(model).State = EntityState.Modified;
|
|
await _VT_CodSegn.SaveChangesAsync();
|
|
transaction.Commit();
|
|
}
|
|
return StatusCode(StatusCodes.Status200OK, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string errmsg = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
|
return StatusCode(StatusCodes.Status500InternalServerError, errmsg);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Logging
|
|
/// <summary>Upload return:ActionResult</summary>
|
|
[HttpPost]
|
|
[Route("log/scrivi")]
|
|
public async Task<IActionResult> scriviLog( string token, string mex)
|
|
{
|
|
string ten = getClaimValueByToken(token, "tenant");
|
|
string ten2 = getClaimValueByToken(token, "tenant2");
|
|
string tenConf = getClaimValueByToken(token, "tenantConfigurazioni");
|
|
string tecnico = getClaimValueByToken(token, "tccodice");
|
|
|
|
if (string.IsNullOrEmpty(ten))
|
|
{
|
|
ten = tenConf;
|
|
}
|
|
string dataLog = DateTime.Now.ToString();
|
|
|
|
try
|
|
{
|
|
string ver = Request.Headers["X-App-Version"];
|
|
var re = Request;
|
|
var headers = re.Headers;
|
|
StringValues x = default(StringValues);
|
|
if (headers.ContainsKey("X-App-Version"))
|
|
{
|
|
var m = headers.TryGetValue("X-App-Version", out x);
|
|
}
|
|
|
|
Console.WriteLine(string.Format("*********** {0} LOG: tenant:{1} tenant2: {2} tenantConf: {3} tecnico:{4}", dataLog,ten, ten2, tenConf, tecnico));
|
|
if (!string.IsNullOrEmpty(ver))
|
|
{
|
|
Console.WriteLine(string.Format("versione app: {0} ", ver));
|
|
}
|
|
Console.WriteLine(string.Format("{0} ", mex));
|
|
Console.WriteLine(string.Format("*********** {0} FINE LOG: tenant:{1} tenant2: {2} tenantConf: {3} tecnico:{4}", dataLog,ten, ten2, tenConf, tecnico));
|
|
return Ok(new { count = 1, mex.Length });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
string errMsg = string.Empty;
|
|
if (ex.Message != null)
|
|
{
|
|
sb.AppendLine(ex.Message);
|
|
}
|
|
if (ex.InnerException != null)
|
|
{
|
|
sb.AppendLine(ex.InnerException.Message);
|
|
}
|
|
errMsg = sb.ToString();
|
|
|
|
|
|
Console.WriteLine(string.Format("*********** {0} ERRORE LOG: tenant:{1} tenant2: {2} tenantConf: {3} tecnico:{4}", dataLog, ten, ten2, tenConf, tecnico));
|
|
Console.WriteLine(string.Format("{0} ", errMsg));
|
|
Console.WriteLine(string.Format("*********** {0} Fine ERRORE LOG: tenant:{1} tenant2: {2} tenantConf: {3} tecnico:{4}", dataLog, ten, ten2, tenConf, tecnico));
|
|
return StatusCode(StatusCodes.Status500InternalServerError, "Error: " + errMsg);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|