2025-04-15 12:10:19 +02:00

173 lines
8.6 KiB
C#

using System;
using System.Web;
public partial class Menu : System.Web.UI.Page
{
public string codCliente;
public string checkPrivacy;
public string tipoRete;
public string codPB;
public string token;
/// <summary>
/// Caricamento pagina del menu
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
#region Gestione Autorizzazione Gestione Controlli
Utente utente;
/******************************* Modifica per Aladdin 12-02-2021 - Pino **************************************************/
HttpContext contesto = HttpContext.Current;
/**************************************************************************************************************************/
if (Session["UtenteLoggatoDiSessione"] == null) // E' stato richiesto l'accesso da AccessoDaPortale bypassando l'accesso da CE.
{
string codiceApplicazione = WebConfigParameter.getParameter("CodiceApplicazione");
utente = Utente.GetAutorizzazioniAccessoGestioneControlli(User.Identity.Name, codiceApplicazione);
/******************************* Modifica per Aladdin 12-02-2021 - Pino **************************************************/
contesto.Session.Add("UserID", utente.UserId);
/*************************************************************************************************************************/
}
else
{
utente = Utente.DeserializeMessage(Session["UtenteLoggatoDiSessione"].ToString());
/******************************* Modifica per Aladdin 12-02-2021 - Pino **************************************************/
contesto.Session.Add("UserID", utente.UserId);
/*************************************************************************************************************************/
}
if (utente.UtenteAutorizzatoApplicazione && utente.ProfiloUtenteLoggato != ProfiloUtenteLoggato.MG)
{
GetUtenteAutorizzato.setUtenteGestioneControlli(utente);
}
#endregion
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 (GetUtenteAutorizzato.getAccessoPortaleAutorizzato())
{
if (!IsPostBack)
{
GestioneDocumenti.Visible = false;
ArchivioModelli.Visible = false;
RicercaDocumentiC6Massivi.Visible = true;
LinkDocumentiClienti.Attributes["onclick"] = "top.parent.CENTER.navigate('archivioDocumenti.aspx')";
LinkArchivioDocumentiC6Massivi.Attributes["onclick"] = "top.parent.CENTER.navigate('RicercaHD.aspx')";
}
}
else if (AccessoNoSessioneAutorizzato)
{
LinkReportcliente.Attributes.Clear();
LinkReportcliente.Style.Add("color", "Silver");
LinkDiagnosi.Attributes.Clear();
LinkDiagnosi.Enabled = false;
LinkDiagnosi.ForeColor = System.Drawing.Color.Silver;
LinkPianificazione.Attributes.Clear();
LinkPianificazione.Enabled = false;
LinkPianificazione.ForeColor = System.Drawing.Color.Silver;
LinkProposta.Attributes.Clear();
LinkProposta.Enabled = false;
LinkProposta.ForeColor = System.Drawing.Color.Silver;
LinkMonitoraggio.Attributes.Clear();
LinkMonitoraggio.Enabled = false;
LinkMonitoraggio.ForeColor = System.Drawing.Color.Silver;
//LinkReportRischio.Attributes.Clear(); //ISPB
//LinkReportRischio.Enabled = false; //ISPB
//LinkReportRischio.ForeColor = System.Drawing.Color.Silver; //ISPB
RicercaDocumentiC6Massivi.Visible = false;
LinkDocumentiClienti.Attributes["onClick"] = "parent.CENTER.location='archivioDocumenti.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Archivio Documenti&ambiente=prod'";
LinkArchivioModelli.Attributes["onClick"] = "parent.CENTER.location='archivioModelli.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Archivio Modelli&ambiente=prod'";
}
else
{
if (!IsPostBack)
{
GestioneDocumenti.Visible = true;
ArchivioModelli.Visible = true;
RicercaDocumentiC6Massivi.Visible = false;
}
codCliente = Request.QueryString.Get("codCliente").ToUpper();
tipoRete = Request.QueryString.Get("tipoRete").ToUpper();
codPB = Request.QueryString.Get("codPB").ToUpper();
token = Request.QueryString.Get("token");
checkPrivacy = Request.QueryString.Get("checkPrivacy");
if (ImpostaLinkMenu(codCliente, tipoRete, codPB) == false)
body1.Attributes.Add("onload", "redirectClientePotenziale()");
}
//ISPB link disabilitati per collaudo eliminare le righe dopo la pubblicazione
//LinkPianificazione.Visible = false;//ISPB
//LinkMonitoraggio.Visible = false;//ISPB
}
/// <summary>
/// Imposta i menu a seconda della tipologia del cliente (Prospect, Customer)
/// </summary>
/// <param name="codCliente"></param>
/// <param name="tipoRete"></param>
/// <param name="codPB"></param>
/// <returns></returns>
private bool ImpostaLinkMenu(string codCliente, string tipoRete, string codPB)
{
Cliente cliente = Cliente.getCliente(tipoRete + codPB, codCliente);
if (cliente.Tipologia == Cliente.TipoCliente.Prospect && checkPrivacy != "1")
{
//Disabilito i link ai report
LinkDiagnosi.Attributes.Clear();
LinkDiagnosi.Enabled = false;
LinkPianificazione.Attributes.Clear();
LinkPianificazione.Enabled = false;
LinkProposta.Attributes.Clear();
LinkProposta.Enabled = false;
LinkMonitoraggio.Attributes.Clear();
LinkMonitoraggio.Enabled = false;
//LinkReportRischio.Attributes.Clear(); //ISPB
//LinkReportRischio.Enabled = false; //ISPB
//LinkDocumentiClienti.Attributes.Clear(); //ISPB
//LinkDocumentiClienti.Disabled = true; //ISPB
//LinkArchivioModelli.Attributes.Clear(); //ISPB
//LinkArchivioModelli.Disabled = true; //ISPB
return false;
}
else
{
// CHIAMATA DAL MENU
LinkDiagnosi.Attributes["onClick"] = "parent.CENTER.location='reportDiagnosi.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Report Diagnosi&ambiente=prod'";
LinkDiagnosi.NavigateUrl = "#";
LinkPianificazione.Attributes["onClick"] = "parent.CENTER.location='reportPianificazione.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Report Pianificazione&ambiente=prod'";
LinkPianificazione.NavigateUrl = "#";
LinkProposta.Attributes["onClick"] = "parent.CENTER.location='reportProposta_NEW.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Report Proposta&ambiente=prod';";
LinkProposta.NavigateUrl = "#";
LinkMonitoraggio.NavigateUrl = "#";
LinkMonitoraggio.Attributes["onClick"] = "parent.CENTER.location='reportMonitoraggio_Alberatura.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Report Monitoraggio&ambiente=prod'";
//LinkReportRischio.Attributes["onClick"] = "parent.CENTER.location='reportRischioNew.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Report Rischio&ambiente=prod'"; //ISPB
//LinkReportRischio.NavigateUrl = "#"; //ISPB
LinkDocumentiClienti.Attributes["onClick"] = "parent.CENTER.location='archivioDocumenti.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Archivio Documenti&ambiente=prod'";
//LinkReportRischio dmo
LinkArchivioModelli.Attributes["onClick"] = "parent.CENTER.location='archivioModelli.aspx?" + Request.QueryString.ToString() + "&pathNav=Gestione stampe > Archivio Modelli&ambiente=prod'";
return true;
}
}
}