Exemplo n.º 1
0
    }//

    /// <summary>
    /// --NB. fare la stored, che crei la VIEW per ogni tabella da Paginare
    /// -------NB.-----moved in Pager--------this.prepareLavagnaDynamicPortion();
    /// </summary>
    /// <param name="int_ref_candidato_id"></param>
    private void loadData(int int_ref_candidato_id)
    {
        // NB. where_tail template:  and ref_candidato_id = 14 --@ref_candidato_id
        string where_tail = " and ref_candidato_id = " + int_ref_candidato_id.ToString() + " ";
        //
        int int_txtRowsInPage = default(int);

        try
        {
            System.Web.UI.WebControls.TextBox txtRowsInPage =
                (System.Web.UI.WebControls.TextBox)(this.PageLengthManager1.FindControl("txtRowsInPage"));
            int_txtRowsInPage = int.Parse(txtRowsInPage.Text);
        }
        catch
        {
        }
        //
        CacherDbView cacherDbView = new CacherDbView(
            this.Session
            , where_tail
            , ViewNameDecorator.ViewNameDecorator_SERVICE(this.Session.SessionID)
            , new CacherDbView.SpecificViewBuilder(
                Entity.Proxies.usp_ViewCacher_specific_CREATE_documento_SERVICE.usp_ViewCacher_specific_CREATE_documento
                )
            , int_txtRowsInPage
            //
            , this.Request
            , this.grdDatiPaginati
            , this.pnlPageNumber
            );

        if (null != cacherDbView)
        {
            this.Session["CacherDbView"] = cacherDbView;
            cacherDbView.Pager_EntryPoint(
                this.Session
                , this.Request
                , this.grdDatiPaginati
                , this.pnlPageNumber
                );
        }
        else
        {
            throw new System.Exception("Presentation::cvMultiRead::loadData() failed CacherDbView Ctor. ");
        }
    }// end loadData()
Exemplo n.º 2
0
    protected void btnRowsInPage_Click(object sender, EventArgs e)
    {
        object obj_CacherDbView = this.Session["CacherDbView"];

        if (null == obj_CacherDbView)
        {
            return;// on page; not yet loaded, the View.
        }
        else
        {
            try
            {
                System.Web.UI.WebControls.GridView grdDatiPaginati = (System.Web.UI.WebControls.GridView)Parent.FindControl("grdDatiPaginati");
                System.Web.UI.WebControls.Panel    pnlPageNumber   = (System.Web.UI.WebControls.Panel)Parent.FindControl("pnlPageNumber");
                CacherDbView cacherDbView  = (CacherDbView)(obj_CacherDbView);
                int          tmpRowsInPage = int.Parse(this.txtRowsInPage.Text);
                //----range check-------
                if (0 >= tmpRowsInPage)
                {
                    throw new System.Exception(" non-positive number of rowsPerPage required. ");
                }
                else
                {
                    cacherDbView.RowsInChunk = tmpRowsInPage;
                }
                //
                cacherDbView.Pager_EntryPoint(
                    this.Session
                    , this.Request
                    , grdDatiPaginati
                    , pnlPageNumber
                    );
            }
            catch (System.Exception ex)
            {
                LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                    "Presentation::PrimeGrid: failed to change page lenght: ex = " + ex.Message
                    , 0);
            }
        }
    } //
Exemplo n.º 3
0
    /// <summary>
    /// NB. la query-tail che si costruisce in questa funzione va collegata obbligatoriamente in
    /// "and" con la query-tail presente nella stored, in quanto essa utilizza tale tail per
    /// evitare un prodotto cartesiano fra candidati e categorie.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDoPostback_Click(object sender, EventArgs e)
    {
        // NB. primo "and implicito.
        string queryTail         = " and ";
        string indexOfAllSectors = null;

        try
        {
            indexOfAllSectors = ((int)(this.Session["indexOfAllSectors"])).ToString();
        }
        catch // all
        {     // indexOfAllSectors will remain null.
        }
        //
        if (
            null == this.ddlSettori.SelectedItem ||
            "0" == this.ddlSettori.SelectedItem.Value ||// no sector selected.
            null == this.ddlSettori.SelectedItem.Value ||// managed ex.
            indexOfAllSectors == this.ddlSettori.SelectedItem.Value   // all sectors selected.
            )
        {
            // invalid "sector" characterization -> where condition omitted.
        }
        else
        {
            queryTail += " " + this.ddlSettori.SelectedItem.Value + " = c.id_settore ";
        }
        //
        if (queryTail.Length > 5)// something added to the initial "and"->add another logical connector
        {
            if (this.rdeAnd_settore_nominativo.Selected)
            {
                queryTail += " and ";
            }
            else if (this.rdeOr_settore_nominativo.Selected)
            {
                queryTail += " or ";
            }
            else
            {
                throw new System.Exception("Debug needed on page queryCaqndidato ! ");
            }
        }
        else// nothing added to the initial "and" -> DON'T add another logical connector.
        {
        }

        /* 2011.04.19
         * NB. a query like the following does not work, se sono stati inseriti MOLTEPLICI spazi:
         * select * from candidato where nominativo like '%Di Franza%'
         * it needs to be patched like this, in order to work:
         * select * from candidato where nominativo like '%Di%Franza%'
         *
         */
        string txtNominativoFiltering = this.txtNominativo.Text.Trim();

        txtNominativoFiltering = txtNominativoFiltering.Replace(' ', '%');  // NB. see note above.
        txtNominativoFiltering = txtNominativoFiltering.Replace('\'', '%'); // NB. single apex is a reserved char in SQL.
        queryTail += " c.nominativo like '%" + txtNominativoFiltering + "%'";
        //
        // it's necessary to add another logical connector.
        if (this.rdeAnd_nominativo_abstract.Selected)
        {
            queryTail += " and ";
        }
        else if (this.rdeOr_nominativo_abstract.Selected)
        {
            queryTail += " or ";
        }
        else
        {
            throw new System.Exception("Debug needed on page queryCaqndidato ! ");
        }
        queryTail += " c.note like '%" + this.txtAbstract.Text.Trim() + "%'";
        //
        //----here ends the query-tail building code and starts the query execution.
        //
        System.Web.UI.WebControls.TextBox txtRowsInPage = null;
        int int_txtRowsInPage = default(int);

        try
        {
            txtRowsInPage =
                (System.Web.UI.WebControls.TextBox)(this.PageLengthManager1.FindControl("txtRowsInPage"));
            int_txtRowsInPage = int.Parse(txtRowsInPage.Text);
        }
        catch
        {// on error sends zero rows per page, to Pager.
        }
        //
        CacherDbView cacherDbView = new CacherDbView(
            this.Session
            , queryTail
            , ViewNameDecorator.ViewNameDecorator_SERVICE(this.Session.SessionID)
            , new CacherDbView.SpecificViewBuilder(
                Entity.Proxies.usp_ViewCacher_specific_CREATE_candidato_SERVICE.usp_ViewCacher_specific_CREATE_candidato
                )
            , int_txtRowsInPage
            //
            , this.Request
            , this.grdDatiPaginati
            , this.pnlPageNumber
            );

        if (null != cacherDbView)
        {
            this.Session["CacherDbView"] = cacherDbView;
            cacherDbView.Pager_EntryPoint(
                this.Session
                , this.Request
                , this.grdDatiPaginati
                , this.pnlPageNumber
                );
        }
        else
        {
            throw new System.Exception("Presentation::queryCandidato::loadData() failed CacherDbView Ctor. ");
        }
    } // end btnDoPostback()
Exemplo n.º 4
0
    }     // end Page_Load

    //    if (!VerificaLasciapassare.CanLogOn(
    //            this.Session,
    //            this.Request.UserHostAddress
    //            )
    //        )
    //    {
    //        this.Response.Redirect("../errore.aspx");
    //    }// else il lasciapassare e' valido -> get in.
    //    //
    //    /*
    //     * NB. page state check.-----------------------------------------------------------------
    //     *
    //     */
    //    PageStateChecker.PageStateChecker_SERVICE(
    //        "zonaRiservata_queryCandidato" // TODO add to "Timbro"
    //        , this.Request
    //        , this.IsPostBack
    //        , this.Session
    //    );
    //    //----------------------------------------------- END  page state check.-----------------
    //    //
    //    int sectorCardinality = 0;
    //    if (!this.IsPostBack)
    //    {
    //        // this.loadData();  which?
    //        ComboManager.populate_Combo_ddlSettore_for_LOAD(
    //            this.ddlSettore,
    //            null,// no pre-selection.
    //            out sectorCardinality
    //        );
    //    }// else don't.
    //    else
    //    {
    //        int tmp = sectorCardinality;
    //    }
    //}// end Page_Load.



    ///// <summary>
    ///// NB.----- query on the db_index, NOT on the combo index!------
    /////  mai usare:  this.ddlSettori.SelectedIndex
    ///// </summary>
    ///// <param name="sender"></param>
    ///// <param name="e"></param>
    //protected void ddlSettoriRefreshQuery(object sender, EventArgs e)
    //{
    //    int int_sector = default(int);
    //    try//---if ddlSettori.SelectedItem==null will throw.
    //    {
    //        int_sector = int.Parse(this.ddlSettori.SelectedItem.Value);
    //        this.Session["comboSectors_selectedValue"] = int_sector;// NB.---cache across postbacks.-----
    //    }
    //    catch (System.Exception ex)
    //    {
    //        string dbg = ex.Message;
    //        int_sector = -1;// invalid.
    //    }
    //    finally
    //    {
    //        this.loadData(int_sector);
    //    }
    //}// end ddlSettoriRefreshQuery



    /// <summary>
    /// NB.---deve essere il Pager a chiamarlo, quando fa DataBind()--this.prepareLavagnaDynamicPortion()
    /// </summary>
    /// <param name="choosenSector"></param>
    private void loadData(int choosenSector)
    {
        string queryTail;
        object obj_indexOfAllSectors = null;

        obj_indexOfAllSectors = this.Session["indexOfAllSectors"];
        if (
            null != obj_indexOfAllSectors
            )
        {
            try
            {
                this.indexOfAllSectors = (int)(obj_indexOfAllSectors);// NB.---cache across postbacks.-----
            }
            catch (System.Exception ex)
            {
                string dbg = ex.Message;
                throw new System.Exception(
                          "queryCandidato::loadData ex = "
                          + ex.Message
                          + " ___ stack = " + ex.StackTrace);
            }
        }
        else
        {
            LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                "queryCandidato::  Debug: Session[_indexOfAllSectors_] is null -> refreshing combo. "
                , 0
                );
            //
            ComboManager.populate_Combo_ddlSettore_for_LOAD( //---primo popolamento.
                this.ddlSettori,
                choosenSector                                // "null" or <0, for no preselection. Instead to preselect choose the ordinal; eg. 2=="Appalti", 0 for "choose your Sector", which performs no query.
                , out indexOfAllSectors
                );
            this.Session["indexOfAllSectors"]          = indexOfAllSectors; // NB.---cache across postbacks.-----
            this.Session["comboSectors_selectedValue"] = choosenSector;     // NB.---cache across postbacks.-----
        }
        //
        if (0 == choosenSector)
        {
            this.grdDatiPaginati.DataSource = null; //  --no query for this selection ---
            this.grdDatiPaginati.DataBind();
            this.prepareLavagnaDynamicPortion();    //-------NB.-------------------
            return;                                 // on page: --no query for this selection ---
        }
        else if (
            0 < choosenSector && // from 1
            this.indexOfAllSectors > choosenSector    // to the last existing Sector
            )
        {
            queryTail = " and id_settore = " + choosenSector.ToString();
        }
        else if (// "tutti i settori aziendali", i.e. select without "where-tail" -----
            this.indexOfAllSectors == choosenSector)
        {
            queryTail = "";// Proxy will manage it.
        }
        else//  indexes<-1: should never pass here.
        {
            throw new System.Exception(" queryCandidato::combo::indexes <0: should never pass here.");
        }
        //
        System.Web.UI.WebControls.TextBox txtRowsInPage = null;
        int int_txtRowsInPage = default(int);

        try
        {
            txtRowsInPage =
                (System.Web.UI.WebControls.TextBox)(this.PageLengthManager1.FindControl("txtRowsInPage"));
            int_txtRowsInPage = int.Parse(txtRowsInPage.Text);
        }
        catch
        {// on error sends zero rows per page, to Pager.
        }
        //
        CacherDbView cacherDbView = new CacherDbView(
            this.Session
            , queryTail
            , ViewNameDecorator.ViewNameDecorator_SERVICE(this.Session.SessionID)
            , new CacherDbView.SpecificViewBuilder(
                Entity.Proxies.usp_ViewCacher_specific_CREATE_candidato_SERVICE.usp_ViewCacher_specific_CREATE_candidato
                )
            , int_txtRowsInPage
            //
            , this.Request
            , this.grdDatiPaginati
            , this.pnlPageNumber
            );

        if (null != cacherDbView)
        {
            this.Session["CacherDbView"] = cacherDbView;
            cacherDbView.Pager_EntryPoint(
                this.Session
                , this.Request
                , this.grdDatiPaginati
                , this.pnlPageNumber
                );
        }
        else
        {
            throw new System.Exception("Presentation::queryCandidato::loadData() failed CacherDbView Ctor. ");
        }
    }// end loadData()
Exemplo n.º 5
0
    }// end Page_Load

    /// <summary>
    /// NB.---deve essere il Pager a chiamarlo, quando fa DataBind()--this.prepareLavagnaDynamicPortion()
    /// </summary>
    /// <param name="choosenSector"></param>
    private void loadData(
        int min_key
        , int max_key
        )
    {
        string queryTail; //  " where	ordinal  between  min and  max";

        //
        if (min_key == max_key)
        {
            this.lblStato.Text              = " zonaRiservata_PrimeDataGrid: min_key == max_key : means NO_ACTION, i.e. no query. ";
            this.lblStato.BackColor         = System.Drawing.Color.Green;
            this.grdDatiPaginati.DataSource = null; //  --no query for this selection ---
            this.grdDatiPaginati.DataBind();
            this.prepareLavagnaDynamicPortion();    //-------NB.-------------------
            return;                                 // on page: --no query for this selection ---
        }
        else if (
            min_key < max_key
            )
        {
            queryTail =
                " where	p.ordinal  between "
                + min_key.ToString()
                + " and "
                + max_key.ToString();
            //
            this.lblStato.Text      = "";
            this.lblStato.BackColor = System.Drawing.Color.Transparent;
        }
        else
        {
            this.lblStato.Text              = " zonaRiservata_PrimeDataGrid: min_key > max_key : Error: ";
            this.lblStato.BackColor         = System.Drawing.Color.Green;
            this.grdDatiPaginati.DataSource = null; //  --no query for this selection ---
            this.grdDatiPaginati.DataBind();
            this.prepareLavagnaDynamicPortion();    //-------NB.-------------------
            return;                                 // on page: --no query for this selection ---
        }
        //
        //
        int int_txtRowsInPage = default(int);

        try
        {
            System.Web.UI.WebControls.TextBox txtRowsInPage =
                (System.Web.UI.WebControls.TextBox)(this.PageLengthManager1.FindControl("txtRowsInPage"));
            int_txtRowsInPage = int.Parse(txtRowsInPage.Text);
        }
        catch
        {// on error sends zero rows per page, to Pager.
        }
        //
        CacherDbView cacherDbView = new CacherDbView(
            this.Session
            , queryTail
            , ViewNameDecorator.ViewNameDecorator_SERVICE(this.Session.SessionID)
            , new CacherDbView.SpecificViewBuilder(
                Entity.Proxies.usp_ViewCacher_specific_CREATE_Primes_SERVICE.usp_ViewCacher_specific_CREATE_Primes
                )
            , int_txtRowsInPage
            //
            , this.Request
            , this.grdDatiPaginati
            , this.pnlPageNumber
            );

        if (null != cacherDbView)
        {
            this.Session["CacherDbView"] = cacherDbView;
            cacherDbView.Pager_EntryPoint(
                this.Session
                , this.Request
                , this.grdDatiPaginati
                , this.pnlPageNumber
                );
        }
        else
        {
            throw new System.Exception("Presentation::PrimeGrid::loadData() failed CacherDbView Ctor. ");
        }
    }// end loadData()