예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //		protected void Butt_ricerca_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        //		{
        //
        //
        //		SearchDocuments();
        //
        //		}

        private void Page_Load(object sender, System.EventArgs e)
        {
            //			// Put user code to initialize the page here
            //			userHome=(DocsPaVO.utente.utente) Session["userData"];
            //			userRuolo = (DocsPaVO.utente.ruolo) Session["userRuolo"];
            //			//chiamo il ws della ricerca

            Utils.startUp(this);

            if (GridManager.SelectedGrid == null || GridManager.SelectedGrid.GridType != GridTypeEnumeration.Document)
            {
                GridManager.SelectedGrid = GridManager.getUserGrid(GridTypeEnumeration.Document);
            }

            if (!IsPostBack)
            {
                if (Request.QueryString["gridper"] != string.Empty && Request.QueryString["gridper"] != null)
                {
                    change_from_grid = true;
                }
                else
                {
                    change_from_grid = false;
                }
            }

            if (Request.QueryString["numRes"] != string.Empty && Request.QueryString["numRes"] != null)
            {
                this.numResult = Request.QueryString["numRes"];
            }
            else
            {
                this.numResult = string.Empty;
            }

            schedaRicerca = (SchedaRicerca)Session[SchedaRicerca.SESSION_KEY];
            if (schedaRicerca == null)
            {
                //Inizializzazione della scheda di ricerca per la gestione delle
                //ricerche salvate
                DocsPaWR.Utente utente = (DocsPAWA.DocsPaWR.Utente)Session["userData"];
                DocsPaWR.Ruolo  ruolo  = (DocsPAWA.DocsPaWR.Ruolo)Session["userRuolo"];

                schedaRicerca = new SchedaRicerca(KEY_SCHEDA_RICERCA, utente, ruolo, this);
                Session[SchedaRicerca.SESSION_KEY] = schedaRicerca;
            }
            schedaRicerca.Pagina = this;
            if (!IsPostBack)
            {
                DocsPAWA.DocsPaWR.InfoUtente info = new DocsPAWA.DocsPaWR.InfoUtente();
                info = UserManager.getInfoUtente(this.Page);


                string valoreChiave = utils.InitConfigurationKeys.GetValue(info.idAmministrazione, "FE_MAX_LENGTH_OGGETTO");
                if (!string.IsNullOrEmpty(valoreChiave))
                {
                    caratteriDisponibili = int.Parse(valoreChiave);
                }

                txt_oggetto.MaxLength = caratteriDisponibili;
                clTesto.Value         = caratteriDisponibili.ToString();
                txt_oggetto.Attributes.Add("onKeyUp", "calcTesto(this,'" + caratteriDisponibili.ToString() + " ','DESCRIZIONE'," + clTesto.ClientID + ")");
                txt_oggetto.Attributes.Add("onchange", "calcTesto(this,'" + caratteriDisponibili.ToString() + " ','DESCRIZIONE'," + clTesto.ClientID + ")");
                //verifica se nuova ADL
                if ((Request.QueryString["ricADL"] != null) && (Request.QueryString["ricADL"] == "1") && (!IsPostBack))
                {
                    schedaRicerca.ElencoRicercheADL("D", true, ddl_Ric_Salvate, null);
                }
                else
                {
                    schedaRicerca.ElencoRicerche("D", true, ddl_Ric_Salvate);
                }
                //focus sul campo oggetto
                this.SetControlFocus(this.txt_oggetto.ClientID);

                // Visualizzazione pagina di ricerca nella selezione
                // di un criterio di ricerca salvato
                this.ddl_Ric_Salvate.Attributes.Add("onChange", "OnChangeSavedFilter();");

                // inizializzazione controlli di ricerca
                this.InitSearchOptions();

                // Impostazione messaggio per ricerca fulltext
                this.SetFullTextAlertMessage();

                #region filtro: Limitazione risultati ricerca

                this.droplistLimitaRisultatiRicerca.Visible       = true;
                this.droplistLimitaRisultatiRicerca.SelectedIndex = 0;

                DocsPaWR.Configurazione limitaRisultati;
                if (DocsPAWA.UserManager.getParametroConfigurazione(this.Page) != null)
                {
                    limitaRisultati = DocsPAWA.UserManager.getParametroConfigurazione(this.Page);
                    if (limitaRisultati.valore.Equals("0"))
                    {
                        this.droplistLimitaRisultatiRicerca.Visible = false;
                    }
                }

                #endregion
            }
            tastoInvio();
            //new ADL
            if ((!IsPostBack) &&
                (Request.QueryString["ricADL"] != null) &&
                (Request.QueryString["ricADL"] == "1") &&
                SiteNavigation.CallContextStack.CurrentContext.SessionState.Count > 0 &&
                SiteNavigation.CallContextStack.CurrentContext.SessionState["SchedaRicerca"] == null
                )
            {
                lblSearch.Text = "Ricerche Salvate Area di Lavoro";
                this.butt_ricerca_Click(null, null);
            }

            string new_search = string.Empty;
            if (ViewState["new_search"] != null)
            {
                new_search = ViewState["new_search"] as string;
                ViewState["new_search"] = null;
            }

            if (change_from_grid && string.IsNullOrEmpty(new_search))
            {
                if (schedaRicerca != null && schedaRicerca.FiltriRicerca != null)
                {
                    PopulateField(schedaRicerca.FiltriRicerca);
                }
                change_from_grid = false;
                this.SearchDocuments();
            }
        }