189 lines
9.3 KiB
C#
189 lines
9.3 KiB
C#
using System;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
//ISPB >>>
|
||
//using ClassLibraryWS.bancafideuram.nac.ads4ws;
|
||
using System.Configuration;
|
||
|
||
public partial class top : System.Web.UI.Page
|
||
{
|
||
//Utente utenteAut;
|
||
private string nomeCliente = string.Empty;
|
||
private string cognomeCliente = string.Empty;
|
||
private string asName = "";
|
||
Utente utenteAccessoDaPortale;
|
||
|
||
/// <summary>
|
||
/// Caricamento della pagina
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
lbl_AppVersion.Text = "ver. " + WebConfigParameter.getParameter("Version");
|
||
btnLogout.ToolTip = "Click per USCIRE dall'applicazione";
|
||
lbl_dataOdierna.Text = DateTime.Now.ToLongDateString();
|
||
asName = Request.QueryString.Get("asName");
|
||
|
||
if (Request.QueryString.Get("TIPORETE").Equals("S"))
|
||
this.imgLogo.Src = "~/Images/logoSeiNEWspi.gif";
|
||
|
||
utenteAccessoDaPortale = GetUtenteAutorizzato.getUtenteHDUS();
|
||
bool AccessoNoSessioneAutorizzato = false;
|
||
|
||
if (Request.QueryString.Get("CODPB") != null && !Request.QueryString.Get("CODPB").Trim().Equals("") &&
|
||
Request.QueryString.Get("TIPORETE") != null && !Request.QueryString.Get("TIPORETE").Trim().Equals("") &&
|
||
(Request.QueryString.Get("CODCLIENTE") == null || Request.QueryString.Get("CODCLIENTE").Trim().Equals(""))
|
||
)
|
||
{ AccessoNoSessioneAutorizzato = true; }
|
||
|
||
if (utenteAccessoDaPortale != null && utenteAccessoDaPortale.UtenteAutorizzatoApplicazione)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (AccessoNoSessioneAutorizzato)
|
||
{
|
||
// Label1.Text = "";
|
||
// lblCF.Text = "";
|
||
// lblImpersonificazione.Text = "";
|
||
string codiceFiscaleCliente = Request.QueryString.Get("codCliente");
|
||
string tipoRete = Request.QueryString.Get("tipoRete");
|
||
string codPB = Request.QueryString.Get("codPB");
|
||
string token = Request.QueryString.Get("token");
|
||
|
||
// codAssistente <20> il codice dell'assistente del PB.
|
||
// Viene valorizzato uguale al codPB se l'utente loggato non <20> un assistente, oppure con il proprio codice assistente nel caso in cui lo sia.
|
||
string codAssistente = string.IsNullOrEmpty(Request.QueryString.Get("codAs")) ? codPB : Request.QueryString.Get("codAs");
|
||
bool _isUtenteAssistente = !codAssistente.Equals(codPB);
|
||
if (Session["UtenteImpersonificatoDiSessione"] != null)
|
||
{
|
||
Utente utenteImpersonificato = Utente.DeserializeMessage(Session["UtenteImpersonificatoDiSessione"].ToString());
|
||
Utente utenteAssistente = null;
|
||
|
||
if (_isUtenteAssistente)
|
||
utenteAssistente = Utente.GetProfiloUtente(tipoRete + codAssistente, null); // utente assistente
|
||
|
||
|
||
if (utenteImpersonificato.IsUtenteImpersonificato)
|
||
{
|
||
Utente utenteLoggato = Utente.DeserializeMessage(Session["UtenteLoggatoDiSessione"].ToString());
|
||
|
||
//if(asName != "")
|
||
lbl_Utente.Text = utenteLoggato.Nome + " " + utenteLoggato.Cognome;
|
||
//else
|
||
// lbl_Utente.Text = asName.Replace('_', ' ');
|
||
lblImpersonificazione.Visible = true;
|
||
lblAgente.Visible = true;
|
||
lblAgente.Text = _isUtenteAssistente ? utenteAssistente.Cognome + " " + utenteAssistente.Nome : utenteImpersonificato.Cognome + " " + utenteImpersonificato.Nome;
|
||
}
|
||
else
|
||
{
|
||
// Utente non Impersonificato
|
||
lbl_Utente.Text = _isUtenteAssistente ? utenteAssistente.Nome + " " + utenteAssistente.Cognome : utenteImpersonificato.Nome + " " + utenteImpersonificato.Cognome;
|
||
lblImpersonificazione.Visible = false;
|
||
lblAgente.Visible = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
lbl_Utente.Text = "[UTENTE NON TROVATO]";
|
||
//d.lisena 10/07/2013 Aggiungo questa eccezione per verificare l'errore di Session = null, dovuto al fatto che il server vmbfwvrepsei non <20> stato inserito nei trusted sites (errore che si verifica solo in produzione)
|
||
throw new Exception("Errore gestito: Oggetto Session non valorizzato");
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
if (!Page.IsPostBack)
|
||
{
|
||
string codiceFiscaleCliente = Request.QueryString.Get("codCliente");
|
||
string tipoRete = Request.QueryString.Get("tipoRete");
|
||
string codPB = Request.QueryString.Get("codPB");
|
||
string token = Request.QueryString.Get("token");
|
||
|
||
// codAssistente <20> il codice dell'assistente del PB.
|
||
// Viene valorizzato uguale al codPB se l'utente loggato non <20> un assistente, oppure con il proprio codice assistente nel caso in cui lo sia.
|
||
string codAssistente = string.IsNullOrEmpty(Request.QueryString.Get("codAs")) ? codPB : Request.QueryString.Get("codAs");
|
||
bool _isUtenteAssistente = !codAssistente.Equals(codPB);
|
||
|
||
// recupero il nome e cognome del cliente
|
||
Cliente cliente = Cliente.getCliente(tipoRete + codPB, codiceFiscaleCliente);
|
||
if (cliente != null )
|
||
{
|
||
nomeCliente = cliente.Nome;
|
||
cognomeCliente = cliente.Cognome;
|
||
if ((cognomeCliente.Length >= 31 && nomeCliente.Length != 0) && (cognomeCliente.Contains(",") || nomeCliente.Contains(",")))
|
||
{
|
||
// Caso COINTESTATARIO (Nome va a capo sul Cognome)
|
||
cognomeCliente = cognomeCliente + (cognomeCliente.Length == 31 ? " " : "") + nomeCliente;
|
||
nomeCliente = "";
|
||
}
|
||
}
|
||
|
||
if (Session["UtenteImpersonificatoDiSessione"] != null)
|
||
{
|
||
Utente utenteImpersonificato = Utente.DeserializeMessage(Session["UtenteImpersonificatoDiSessione"].ToString());
|
||
Utente utenteAssistente = null;
|
||
|
||
if (_isUtenteAssistente)
|
||
utenteAssistente = Utente.GetProfiloUtente(tipoRete + codAssistente, null); // utente assistente
|
||
|
||
|
||
if (utenteImpersonificato.IsUtenteImpersonificato)
|
||
{
|
||
Utente utenteLoggato = Utente.DeserializeMessage(Session["UtenteLoggatoDiSessione"].ToString());
|
||
|
||
lbl_Utente.Text = utenteLoggato.Nome + " " + utenteLoggato.Cognome;
|
||
|
||
lblImpersonificazione.Visible = true;
|
||
lblAgente.Visible = true;
|
||
lblAgente.Text = _isUtenteAssistente ? utenteAssistente.Cognome + " " + utenteAssistente.Nome : utenteImpersonificato.Cognome + " " + utenteImpersonificato.Nome;
|
||
}
|
||
else
|
||
{
|
||
// Utente non Impersonificato
|
||
lbl_Utente.Text = _isUtenteAssistente ? utenteAssistente.Nome + " " + utenteAssistente.Cognome : utenteImpersonificato.Nome + " " + utenteImpersonificato.Cognome;
|
||
lblImpersonificazione.Visible = false;
|
||
lblAgente.Visible = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
lbl_Utente.Text = "[UTENTE NON TROVATO]";
|
||
//d.lisena 10/07/2013 Aggiungo questa eccezione per verificare l'errore di Session = null, dovuto al fatto che il server vmbfwvrepsei non <20> stato inserito nei trusted sites (errore che si verifica solo in produzione)
|
||
throw new Exception("Errore gestito: Oggetto Session non valorizzato");
|
||
}
|
||
|
||
// Gestione delle persone giuridiche e delle fiduciarie
|
||
if (cliente.Definizione == Cliente.TipoDefinizione.PersonaGiuridica || cliente.Definizione == Cliente.TipoDefinizione.Fiduciaria)
|
||
{
|
||
if (cliente.Definizione == Cliente.TipoDefinizione.Fiduciaria)
|
||
{
|
||
//string[] txb_ClienteNSGSplittato = Request.QueryString.Get("codcliente").Split(Convert.ToChar("@"));
|
||
lbl_Cliente.Text = cognomeCliente + " " + nomeCliente.Replace("$", "") +" - " + cliente.CodiceMandatoFiduciaria;
|
||
lblCF.Text = "Cod. fiscale / P. IVA";
|
||
lbl_CodFiscaleCliente.Style["left"] = "790px";
|
||
lbl_CodFiscaleCliente.Text = cliente.PIVAFiduciaria;
|
||
}
|
||
else
|
||
{
|
||
lbl_Cliente.Text = cognomeCliente + " " + nomeCliente;
|
||
lbl_CodFiscaleCliente.Text = codiceFiscaleCliente;
|
||
}
|
||
}
|
||
else // persona fisica
|
||
{
|
||
lbl_Cliente.Text = nomeCliente + " " + cognomeCliente;
|
||
lbl_CodFiscaleCliente.Text = codiceFiscaleCliente;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
if (asName != "")
|
||
lbl_Utente.Text = asName.Replace('_', ' ');
|
||
}
|
||
}
|