169 lines
7.1 KiB
C#
169 lines
7.1 KiB
C#
using System;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using 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;
|
||
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();
|
||
|
||
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 = "";
|
||
|
||
}
|
||
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);
|
||
|
||
#region Gestione dell'assistente
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
|
||
// recupero il nome e cognome del cliente
|
||
Cliente cliente = Cliente.getCliente(tipoRete + codPB, codiceFiscaleCliente);
|
||
|
||
if (cliente != null)
|
||
{
|
||
nomeCliente = cliente.Nome;
|
||
cognomeCliente = cliente.Cognome;
|
||
}
|
||
|
||
//string nomeCognome = "";
|
||
|
||
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)
|
||
{
|
||
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;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Chiude la popup e svuota la sessione.
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//protected void lnkBtnEsci_Click(object sender, EventArgs e)
|
||
//{
|
||
// Session.RemoveAll();
|
||
|
||
// //Response.Write(ConfigurationManager.AppSettings["URL_CLOSING_REPORTMANGER"].ToString());
|
||
// //Response.End();
|
||
// Response.Redirect(ConfigurationManager.AppSettings["URL_CLOSING_REPORTMANGER"].ToString());
|
||
// //Response.Redirect("http://bfwscb01t:8080/ConsulenzaEvoluta/integration/closeStampeFrame.jsp");
|
||
|
||
// //string command = "closeAll()";
|
||
// //ClientScript.RegisterClientScriptBlock(typeof(string), "messaggioErrore",
|
||
// // "<script language=\"javascript\" type=\"text/javascript\">" + "\n" +
|
||
// // "<!--" + "\n" +
|
||
// // command + "\n" +
|
||
// // "//-->" + "\n" +
|
||
// // "</script>");
|
||
//}
|
||
|
||
}
|