/// <summary>
        /// Override onInit Base Page: Setto di dafault It
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            objDictionary  = new Dizionario();
            objTestiPagine = new TestiPagine();
            objUtilita     = new Utilita();

            qNAZ_ID_NAZIONE           = 1;//it
            Session["NAZ_ID_NAZIONE"] = 1;

            switch (qNAZ_ID_NAZIONE)
            {
            case 1:
                qCultureInfoName = "it";
                break;

            case 3:
                qCultureInfoName = "en";
                break;

            default:
                qCultureInfoName = "it";
                break;
            }

            objDizionarioUI  = objDictionary.GetDictionary(qNAZ_ID_NAZIONE);
            objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE);

            objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE;
            getCulture();

            //objSistema.Read();
            if (Page.Header != null)
            {
                this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE");
            }

            base.OnInit(e);
        }
Esempio n. 2
0
        /// <summary>
        /// Override onInit Base Page: Controllo Sessioni
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            objDictionary  = new Dizionario();
            objTestiPagine = new TestiPagine();
            objUtilita     = new Utilita(); //Utilizzato per i permessi di accesso

            try
            {
                //Controllo se l'utente è autenticato
                if (!User.Identity.IsAuthenticated)
                {
                    Exception ex = new Exception("Unauthenticated user. Please log in.");
                    throw ex;
                }

                //Controllo se ci sono delle variabili in Session
                if (Session.Count == 0)
                {
                    Exception ex = new Exception("Session Timed Out. Please log in again.");
                    throw ex;
                }
                idLoggedUser = Convert.ToInt32(Session["UTE_ID_UTENTE"]);
            }
            catch (Exception ecc)
            {
                string strERROR = ecc.Message.Replace("'", "");
                // Gestione messaggistica all'utente e trace in DB dell'errore
                ExceptionPolicy.HandleException(ecc, "Propagate Policy");
                Response.Write(@"<script type='text/javascript'>
                                    try
                                    {
                                        if(window.opener)
                                        {   
                                            if(window.opener.parent.frames)
                                                window.opener.parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"';                                                                                                          
                                            else
                                                window.opener.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"';   
                                                             self.close();
                                        }
                                        else
                                        {
                                           if(parent.frames)
                                                parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"';
                                           else
                                                document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"';     
                                        }
                                    }
                                    catch(e)
                                    {
                                       self.close();                  
                                    }
                              </script>");
                Response.End();
            }

            //Spostato da PageLoad INIZIO ----------------------
            if (Session["NAZ_ID_NAZIONE"] != null)
            {
                qNAZ_ID_NAZIONE = Convert.ToInt32(Session["NAZ_ID_NAZIONE"]);
            }
            else
            {
                qNAZ_ID_NAZIONE = Convert.ToInt32(Request.QueryString["NAZ_ID_NAZIONE"]);
            }
            switch (qNAZ_ID_NAZIONE)
            {
            case 1:
                qCultureInfoName = "it";
                break;

            case 3:
                qCultureInfoName = "en";
                break;

            default:
                qCultureInfoName = "it";
                break;
            }
            dizionarioPermessi = (Dictionary <string, int>)Session["dizionarioPermessi"];

            objDizionarioUI = objDictionary.GetDictionary(qNAZ_ID_NAZIONE);

            objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE);

            objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE;
            getCulture();

            if (Page.Header != null)
            {
                this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE");
            }

            base.OnInit(e);
        }
Esempio n. 3
0
    protected override void OnInit(EventArgs e)
    {
        try
        {
            ButtonReset.ServerClick += new EventHandler(ButtonReset_Click);

            objSessioniUtenti = new SessioniUtenti();

            #region Login with WS

            objUtente              = new Utente();
            objClienti             = new Clienti();
            objCentriDiCosto       = new Centri_di_costo();
            objDictionary          = new Dizionario();
            objSistema             = new Sistema();
            objErrori              = new Errori();
            objRuoliUtente         = new RuoliUtente();
            objCrossUtenteWorkflow = new CrossUtenteWorkflow();
            objUtilita             = new Utilita();

            string acronimoCliente = string.Empty;
            string UrlReferrer     = string.Empty;
            objSistema.Read();

            //Questa parte di codice serve per gestire il fatto di non andare in eccezione se il certificato
            //SSl è scaduto.
            ServicePointManager.ServerCertificateValidationCallback =
                new RemoteCertificateValidationCallback(
                    delegate(
                        object sender2,
                        X509Certificate certificate,
                        X509Chain chain,
                        SslPolicyErrors sslPolicyErrors)
            {
                return(true);
            });
            //Fine


            if (hLingua.SelectedValue != "")
            {
                objDizionarioUI = objDictionary.GetDictionary((int)Convert.ToInt32(hLingua.SelectedValue));
            }
            else
            {
                objDizionarioUI = objDictionary.GetDictionary((int)objSistema.Naz_id_nazione);
            }

            #endregion

            ButtonLogin.ServerClick += new EventHandler(ButtonLogin_Click);

            this.PreRender += new System.EventHandler(this.frm_LGN_PreRender);

            base.OnInit(e);
        }
        catch (Exception ex)

        {
            // Gestione messaggistica all'utente e trace in DB dell'errore
            ExceptionPolicy.HandleException(ex, "Propagate Policy");
        }
    }