316 lines
17 KiB
C#
316 lines
17 KiB
C#
using System;
|
||
using System.Data;
|
||
using System.Web;
|
||
using ConsulenzaEvoluta;
|
||
using ClassLibraryWS.bancafideuram.nac.anagrafica;
|
||
|
||
public partial class Frames : System.Web.UI.Page
|
||
{
|
||
public string codCliente;
|
||
public string codMandato;
|
||
public string tipoRete;
|
||
public string codPB;
|
||
public string codAs;
|
||
public string asName;
|
||
public string checkPrivacy;
|
||
public string codiceUtenteQueryString;
|
||
public string token;
|
||
public string userName = string.Empty;
|
||
public string codiceApplicazione = string.Empty;
|
||
public string urlCenter = string.Empty;
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||
|
||
#region Applicazione in OffLine
|
||
|
||
if ("True".Equals(WebConfigParameter.getParameter("offline"), StringComparison.OrdinalIgnoreCase))
|
||
Response.Redirect("offline.aspx");
|
||
|
||
#endregion
|
||
|
||
#region Log su accesso Utente Loggato
|
||
|
||
//StreamWriter swUtenteLoggato = new StreamWriter(HttpContext.Current.Server.MapPath("xml\\LogAccesso.txt"), true, System.Text.Encoding.Default);
|
||
|
||
//swUtenteLoggato.WriteLine();
|
||
//swUtenteLoggato.WriteLine();
|
||
//swUtenteLoggato.WriteLine("Sezione Utente loggato : codiceUtenteWindows=" + codiceUtenteWindows + ";UserId=" + utenteLoggatoAutorizzato.UserId);
|
||
//swUtenteLoggato.WriteLine(utenteLoggatoString.ToString());
|
||
//swUtenteLoggato.Close();
|
||
|
||
#endregion
|
||
|
||
if (GetUtenteAutorizzato.getAccessoPortaleAutorizzato())
|
||
{
|
||
urlCenter = "RicercaHD.aspx";
|
||
}
|
||
else 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(""))
|
||
)
|
||
{
|
||
tipoRete = Request.QueryString.Get("TIPORETE").ToUpper();
|
||
codMandato = Request.QueryString.Get("MANDATO").ToUpper();
|
||
codPB = Request.QueryString.Get("CODPB").ToUpper();
|
||
codAs = Request.QueryString.Get("CODAS") != null ? Request.QueryString.Get("CODAS").ToUpper() : string.Empty;
|
||
codiceUtenteQueryString = tipoRete.Trim() + codPB.Trim();
|
||
token = Request.QueryString.Get("TOKEN");
|
||
asName = Request.QueryString.Get("asName");
|
||
|
||
string AbilitazionePrimaria = string.Empty;
|
||
|
||
codiceApplicazione = WebConfigParameter.getParameter("CodiceApplicazione");
|
||
|
||
//ISPB
|
||
string codiceUtente = tipoRete + codPB;// Utente.GetCodiceUtente(userName); // <20> il codiceutente con cui andr<64> a interrogare la ConsulenzaBase.dbo.PromotoreBancario per recuperare le informazioni dell'utente loggato
|
||
|
||
Utente utenteLoggato_WS = Utente.GetAutorizzazioniAccessoGestioneControlli(userName, codiceApplicazione); // utente loggato (VINCENZO UT.PROVA 2 MAGRI), informazioni prese dai WS
|
||
Utente utenteLoggato = Utente.GetProfiloUtente(codiceUtente, utenteLoggato_WS.ProfiloUtenteLoggato); // utente loggato (VINCENZO UT.PROVA 2 MAGRI) , informazioni prese da DB
|
||
utenteLoggato.ProfiloUtenteLoggato = utenteLoggato_WS.ProfiloUtenteLoggato;
|
||
utenteLoggato.AbilitazionePrimaria = utenteLoggato_WS.AbilitazionePrimaria;
|
||
utenteLoggato.IsUtenteImpersonificato = utenteLoggato_WS.IsUtenteImpersonificato;
|
||
utenteLoggato.UtenteAutorizzatoApplicazione = utenteLoggato_WS.UtenteAutorizzatoApplicazione;
|
||
|
||
Utente utenteImpersonificato = Utente.GetProfiloUtente(codiceUtenteQueryString, null); // utente impersonificato (VIOTTI GIANCARLO)
|
||
utenteImpersonificato.AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
utenteImpersonificato.IsUtenteImpersonificato = utenteLoggato.IsUtenteImpersonificato;
|
||
utenteImpersonificato.UtenteAutorizzatoApplicazione = utenteLoggato.UtenteAutorizzatoApplicazione;
|
||
|
||
// FIX da valutare per TK T-300675-L4Y3
|
||
if (!codAs.Equals(codPB))
|
||
codiceUtenteQueryString = codiceUtente;
|
||
Utente utenteSoloPerAutorizzazione;
|
||
if (token != "")
|
||
utenteSoloPerAutorizzazione = Utente.GetAutorizzazioni(userName, codiceApplicazione, tipoRete, codiceUtenteQueryString, Convert.ToInt32(token));
|
||
|
||
// if (token != "" )//&& utenteSoloPerAutorizzazione.UtenteAutorizzatoApplicazione)
|
||
{
|
||
if (Request.Browser.Cookies)
|
||
{
|
||
#region utente Loggato (UtenteLoggatoDiSessione)
|
||
|
||
string utenteLoggatoString = Utente.SerializeMessage(utenteLoggato);
|
||
|
||
utenteLoggatoString = HttpUtility.UrlDecode(utenteLoggatoString.TrimStart().TrimEnd());
|
||
Session.Add("UtenteLoggatoDiSessione", utenteLoggatoString);
|
||
|
||
#endregion
|
||
|
||
#region utente Impersonificato (UtenteImpersonificatoDiSessione)
|
||
|
||
string utenteImpersonificatoString = Utente.SerializeMessage(utenteImpersonificato);
|
||
|
||
utenteImpersonificatoString = HttpUtility.UrlDecode(utenteImpersonificatoString.TrimStart().TrimEnd());
|
||
Session.Add("UtenteImpersonificatoDiSessione", utenteImpersonificatoString);
|
||
|
||
#endregion
|
||
}
|
||
else
|
||
{
|
||
AbilitazionePrimaria = string.Empty;
|
||
if (utenteLoggato != null)
|
||
if (utenteLoggato.AbilitazionePrimaria != null)
|
||
AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
|
||
Response.Redirect("error.aspx?UtenteWindows=" + userName + "&UtentePB=" + codiceUtenteQueryString + "&CodiceApplicazione=" + WebConfigParameter.getParameter("CODICEAPPLICAZIONE") + "&VersioneSIMPB=" + token.ToString() + "&AbilitazionePrimaria=" + AbilitazionePrimaria + " ( Cookies non attivi)");
|
||
}
|
||
}
|
||
|
||
//else
|
||
//{
|
||
// AbilitazionePrimaria = string.Empty;
|
||
// if (utenteLoggato != null)
|
||
// if (utenteLoggato.AbilitazionePrimaria != null)
|
||
// AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
|
||
// Response.Redirect("error.aspx?UtenteWindows=" + userName + "&UtentePB=" + codiceUtenteQueryString + "&CodiceApplicazione=" + WebConfigParameter.getParameter("CODICEAPPLICAZIONE") + "&VersioneSIMPB=" + token.ToString() + "&AbilitazionePrimaria=" + AbilitazionePrimaria + "&UtenteAutorizzato=" + utenteLoggato_WS.UtenteAutorizzatoApplicazione.ToString());
|
||
//}
|
||
|
||
}
|
||
else
|
||
{
|
||
Session.RemoveAll();
|
||
urlCenter = "blank.aspx";
|
||
|
||
codCliente = Request.QueryString.Get("CODCLIENTE").ToUpper();
|
||
codMandato= Request.QueryString.Get("MANDATO").ToUpper();
|
||
tipoRete = Request.QueryString.Get("TIPORETE").ToUpper();
|
||
codPB = Request.QueryString.Get("CODPB").ToUpper();
|
||
codAs = Request.QueryString.Get("CODAS") != null ? Request.QueryString.Get("CODAS").ToUpper() : string.Empty;
|
||
codiceUtenteQueryString = tipoRete.Trim() + codPB.Trim();
|
||
token = Request.QueryString.Get("TOKEN");
|
||
asName = Request.QueryString.Get("ASNAME");
|
||
|
||
string nomePB = string.Empty;
|
||
string cognomePB = string.Empty;
|
||
string nomeCliente = string.Empty;
|
||
string cognomeCliente = string.Empty;
|
||
|
||
Cliente cliente = Cliente.getCliente(tipoRete + codPB, codCliente, codMandato);
|
||
|
||
if (cliente != null)
|
||
{
|
||
nomePB = cliente.NomePB;
|
||
cognomePB = cliente.CognomePB;
|
||
checkPrivacy = cliente.PrivacyAccettata == true ? "1" : "0";
|
||
}
|
||
else
|
||
throw new Exception("Cliente non trovato");
|
||
|
||
#region Recupero token da AnagraficaWS.GetVersion
|
||
|
||
if (string.IsNullOrEmpty(token))
|
||
{
|
||
string codPortal = WebConfigParameter.getParameter("CODICEPORTALEPERVERSIONESIMPB");
|
||
|
||
ClassLibraryWS.bancafideuram.nac.token.InfoClient infoCliente = new ClassLibraryWS.bancafideuram.nac.token.InfoClient();
|
||
infoCliente.codiceApplicazione = WebConfigParameter.getParameter("CODICEAPPLICAZIONE").ToString();
|
||
infoCliente.codiceRete = tipoRete;
|
||
infoCliente.versioneDatabaseSIMPB = 0;
|
||
|
||
AnagraficaWS wsana = new AnagraficaWS();
|
||
ClassLibraryWS.bancafideuram.nac.token.TokenRes risposta = wsana.GetVersion(infoCliente, codPortal);
|
||
token = risposta.info.versioneDatabaseSIMPB.ToString();
|
||
}
|
||
|
||
#endregion
|
||
//ISPB ASUL >>>
|
||
#region InfoClient e ChiaveCliente di GlobalPosition e Anagrafica
|
||
|
||
//// Global Position
|
||
//ClassLibraryWS.bancafideuram.nac.globalposition.InfoClient _infoCliente_GlobalPosition2 = new ClassLibraryWS.bancafideuram.nac.globalposition.InfoClient();
|
||
//_infoCliente_GlobalPosition.codiceApplicazione = WebConfigParameter.getParameter("CODICEAPPLICAZIONE").ToString();
|
||
//_infoCliente_GlobalPosition.codiceRete = tipoRete;
|
||
//_infoCliente_GlobalPosition.versioneDatabaseSIMPB = int.Parse(token);
|
||
|
||
//ClassLibraryWS.bancafideuram.nac.globalposition.ChiaveCliente _chiaveCliente_GlobalPosition = new ClassLibraryWS.bancafideuram.nac.globalposition.ChiaveCliente();
|
||
//_chiaveCliente_GlobalPosition.codiceAgente = codPB;
|
||
//_chiaveCliente_GlobalPosition.codicefiscale = codCliente;
|
||
//_chiaveCliente_GlobalPosition.codiceRete = tipoRete;
|
||
//_chiaveCliente_GlobalPosition.potenzialeClienteNAC = true;
|
||
|
||
//// Anagrafica
|
||
//ClassLibraryWS.bancafideuram.nac.anagrafica.InfoClient _infoCliente_Anagrafica = new ClassLibraryWS.bancafideuram.nac.anagrafica.InfoClient();
|
||
//_infoCliente_Anagrafica.codiceApplicazione = WebConfigParameter.getParameter("CODICEAPPLICAZIONE").ToString();
|
||
//_infoCliente_Anagrafica.codiceRete = tipoRete;
|
||
//_infoCliente_Anagrafica.versioneDatabaseSIMPB = int.Parse(token);
|
||
|
||
//ClassLibraryWS.bancafideuram.nac.anagrafica.ChiaveCliente _chiaveCliente_Anagrafica = new ClassLibraryWS.bancafideuram.nac.anagrafica.ChiaveCliente();
|
||
//_chiaveCliente_Anagrafica.codiceAgente = codPB;
|
||
//_chiaveCliente_Anagrafica.codicefiscale = codCliente;
|
||
//_chiaveCliente_Anagrafica.codiceRete = tipoRete;
|
||
//_chiaveCliente_Anagrafica.potenzialeClienteNAC = true;
|
||
|
||
#endregion
|
||
|
||
#region Caricamento tabella Dettaglio_Asul
|
||
|
||
// Recupero i dati dalla Prometeia.GetContrattoSintesiPerClienteCaricamentoAsul
|
||
//DataTable dtDettaglioAsul = new DataTable();
|
||
//DataTable dtContrattoSintesiPerCliente = Prometeia.GetContrattoSintesiPerClienteCaricamentoAsul(_chiaveCliente_GlobalPosition, _infoCliente_GlobalPosition, cliente.ChiaveClientePB);
|
||
//DataRow[] rowsProdottiAsul = dtContrattoSintesiPerCliente.Select("tipoProdotto='ASUL'");
|
||
|
||
|
||
// elimino i dati dalla dettaglio_asul per chiaveClientePB
|
||
//BusinessManager.DeleteData_Into_DettaglioAsul(cliente.ChiaveClientePB);
|
||
|
||
// Richiamo il dettaglio asul per ogni asul trovato nel portafoglio del cliente.
|
||
|
||
//foreach (DataRow itemProdottoAsul in rowsProdottiAsul)
|
||
//{
|
||
// dtDettaglioAsul.Merge(Prometeia.GetContrattoUnitLinkedSaldo(_chiaveCliente_GlobalPosition, itemProdottoAsul["CODICECONTRATTO"].ToString(), _infoCliente_GlobalPosition, cliente.ChiaveClientePB));
|
||
//}
|
||
|
||
// Insert sulla DETTAGLIO_ASUL di ConsulenzaEvoluta
|
||
//if (dtDettaglioAsul.Rows.Count > 0)
|
||
// BusinessManager.InsertData_Into_DettaglioAsul(cliente.ChiaveClientePB, dtDettaglioAsul);
|
||
|
||
#endregion
|
||
//ISPB ASUL <<<<
|
||
#region Gestione Autorizzazione
|
||
|
||
if (WebConfigParameter.getParameter("Ambiente") == "esterno")
|
||
userName = User.Identity.Name;
|
||
else
|
||
userName = WebConfigParameter.getParameter("UtenzaWindowsAccessoHP");
|
||
|
||
//1) utente loggato (VINCENZO UT.PROVA 2 MAGRI)
|
||
//2) utente impersonificato (VIOTTI GIANCARLO)
|
||
|
||
string AbilitazionePrimaria = string.Empty;
|
||
|
||
codiceApplicazione = WebConfigParameter.getParameter("CodiceApplicazione");
|
||
|
||
//ISPB
|
||
string codiceUtente = tipoRete + codPB;// Utente.GetCodiceUtente(userName); // <20> il codiceutente con cui andr<64> a interrogare la ConsulenzaBase.dbo.PromotoreBancario per recuperare le informazioni dell'utente loggato
|
||
|
||
Utente utenteLoggato_WS = Utente.GetAutorizzazioniAccessoGestioneControlli(userName, codiceApplicazione); // utente loggato (VINCENZO UT.PROVA 2 MAGRI), informazioni prese dai WS
|
||
Utente utenteLoggato = Utente.GetProfiloUtente(codiceUtente, utenteLoggato_WS.ProfiloUtenteLoggato); // utente loggato (VINCENZO UT.PROVA 2 MAGRI) , informazioni prese da DB
|
||
utenteLoggato.ProfiloUtenteLoggato = utenteLoggato_WS.ProfiloUtenteLoggato;
|
||
utenteLoggato.AbilitazionePrimaria = utenteLoggato_WS.AbilitazionePrimaria;
|
||
utenteLoggato.IsUtenteImpersonificato = utenteLoggato_WS.IsUtenteImpersonificato;
|
||
utenteLoggato.UtenteAutorizzatoApplicazione = utenteLoggato_WS.UtenteAutorizzatoApplicazione;
|
||
|
||
Utente utenteImpersonificato = Utente.GetProfiloUtente(codiceUtenteQueryString, null); // utente impersonificato (VIOTTI GIANCARLO)
|
||
utenteImpersonificato.AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
utenteImpersonificato.IsUtenteImpersonificato = utenteLoggato.IsUtenteImpersonificato;
|
||
utenteImpersonificato.UtenteAutorizzatoApplicazione = utenteLoggato.UtenteAutorizzatoApplicazione;
|
||
|
||
// FIX da valutare per TK T-300675-L4Y3
|
||
if (!codAs.Equals(codPB))
|
||
codiceUtenteQueryString = codiceUtente;
|
||
|
||
Utente utenteSoloPerAutorizzazione = Utente.GetAutorizzazioni(userName, codiceApplicazione, tipoRete, codiceUtenteQueryString, Convert.ToInt32(token));
|
||
|
||
if (utenteSoloPerAutorizzazione.UtenteAutorizzatoApplicazione)
|
||
{
|
||
if (Request.Browser.Cookies)
|
||
{
|
||
#region utente Loggato (UtenteLoggatoDiSessione)
|
||
|
||
string utenteLoggatoString = Utente.SerializeMessage(utenteLoggato);
|
||
|
||
utenteLoggatoString = HttpUtility.UrlDecode(utenteLoggatoString.TrimStart().TrimEnd());
|
||
//if (asName == "")
|
||
Session.Add("UtenteLoggatoDiSessione", utenteLoggatoString);
|
||
//else
|
||
//Session.Add("UtenteLoggatoDiSessione", asName.Replace('_', ' '));
|
||
|
||
#endregion
|
||
|
||
#region utente Impersonificato (UtenteImpersonificatoDiSessione)
|
||
|
||
string utenteImpersonificatoString = Utente.SerializeMessage(utenteImpersonificato);
|
||
|
||
utenteImpersonificatoString = HttpUtility.UrlDecode(utenteImpersonificatoString.TrimStart().TrimEnd());
|
||
|
||
Session.Add("UtenteImpersonificatoDiSessione", utenteImpersonificatoString);
|
||
|
||
#endregion
|
||
}
|
||
else
|
||
{
|
||
AbilitazionePrimaria = string.Empty;
|
||
if (utenteLoggato != null)
|
||
if (utenteLoggato.AbilitazionePrimaria != null)
|
||
AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
|
||
Response.Redirect("error.aspx?UtenteWindows=" + userName + "&UtentePB=" + codiceUtenteQueryString + "&CodiceApplicazione=" + WebConfigParameter.getParameter("CODICEAPPLICAZIONE") + "&VersioneSIMPB=" + token.ToString() + "&AbilitazionePrimaria=" + AbilitazionePrimaria + " ( Cookies non attivi)");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
AbilitazionePrimaria = string.Empty;
|
||
if (utenteLoggato != null)
|
||
if (utenteLoggato.AbilitazionePrimaria != null)
|
||
AbilitazionePrimaria = utenteLoggato.AbilitazionePrimaria;
|
||
|
||
Response.Redirect("error.aspx?UtenteWindows=" + userName + "&UtentePB=" + codiceUtenteQueryString + "&CodiceApplicazione=" + WebConfigParameter.getParameter("CODICEAPPLICAZIONE") + "&VersioneSIMPB=" + token.ToString() + "&AbilitazionePrimaria=" + AbilitazionePrimaria + "&UtenteAutorizzato=" + utenteLoggato_WS.UtenteAutorizzatoApplicazione.ToString());
|
||
}
|
||
#endregion
|
||
}
|
||
}
|
||
}
|