예제 #1
0
    }// end GetNextChunk

    #region Pager

    /// <summary>
    ///
    /// NB. EntryPoint : every paging operation enters here.
    /// Request.Params["parPage"] e' il parametro che governa la selezione di pagina.
    /// E' un parametro http-get, contenuto nella url.
    /// Se il Ctor() ha fallito, il metodo abortisce. La verifica di successo del Ctor() e':
    /// null != Session["CacherDbView"]
    ///
    /// </summary>
    public void Pager_EntryPoint(
        System.Web.SessionState.HttpSessionState Session
        , System.Web.HttpRequest Request
        , System.Web.UI.WebControls.GridView grdDatiPaginati
        , System.Web.UI.WebControls.Panel pnlPageNumber
        )
    {
        object objCacherDbView = Session["CacherDbView"];

        if (null == objCacherDbView)
        {
            return;// component called when the cache is not yet ready -> return on empty page.
        }// else bring to DataBind().
        //
        string parPage          = Request.Params["parPage"];
        int    paginaDesiderata = 1;// default

        try
        {
            paginaDesiderata = int.Parse(parPage);
            if (
                this.rowCardinality < this.RowsInChunk || // caso di una sola pagina ed incompleta
                System.Math.Ceiling((double)this.rowCardinality / (double)this.RowsInChunk) < (double)paginaDesiderata    // pagine disponibili non arrivano al numero di pagina richiesto: NB. double needed to do not loose the last page_fraction.
                )
            {
                paginaDesiderata = 1;// back to default.
            }// else paginaDesiderata is possible.
        }
        catch
        {
            paginaDesiderata = 1;// default on missing or wrong get-parameter "parPage".
        }
        System.Data.DataTable dt = null;
        this.PageIndexManager(//----NB. internal call, for querying required-page data-----------------------------------------------------------
            Session
            , Request
            , paginaDesiderata
            , pnlPageNumber
            , out dt // the chunk-data, to be filled.
            );
        grdDatiPaginati.DataSource = dt;
        grdDatiPaginati.DataBind();
        //
        if (null != Session["DynamicPortionPtr"])// NB. tested: indispensable to renew it in Session, at every round-trip.
        {
            CacherDbView.DynamicPortionPtr dynamicPortionPtr =
                (CacherDbView.DynamicPortionPtr)(Session["DynamicPortionPtr"]);
            dynamicPortionPtr();// finally, call it.
        }// else nothing to be executed post-binding.
    }//
예제 #2
0
    private int indexOfAllSectors; // it's one after the last id in the table.


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!VerificaLasciapassare.CanLogOn(
                this.Session,
                this.Request.UserHostAddress
                )
            )
        {
            this.Session["indexOfAllSectors"] = null;// be sure to clean.
            this.Response.Redirect("../errore.aspx");
        }// else il lasciapassare e' valido -> get in.
        //
        // PostBack or not, refresh in Session, the present addres of the DynamicPortion method, which has
        // to be called from PagerDbView. Such address changes at every round-trip( tested).
        CacherDbView.DynamicPortionPtr dynamicPortionPtr = new CacherDbView.DynamicPortionPtr(
            this.prepareLavagnaDynamicPortion);
        this.Session["DynamicPortionPtr"] = dynamicPortionPtr;
        //

        /*
         * NB. page state check.-----------------------------------------------------------------
         *
         */
        PageStateChecker.PageStateChecker_SERVICE(
            "zonaRiservata_queryCandidato"
            , this.Request
            , this.IsPostBack
            , this.Session
            );
        //----------------------------------------------- END  page state check.-----------------
        if (
            !this.IsPostBack &&//----------------------------------------------------false
            !(bool)(this.Session["IsReEntrant"])             //-----------------------------false
            )
        {                                                    // first absolute entrance
            //
            ComboManager.populate_Combo_ddlSettore_for_LOAD( //---primo popolamento.
                this.ddlSettori,
                0                                            // "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"] = 0;                 // NB.---cache across postbacks.-----
            //
            this.loadData(0);                                               // means no query.
        }
        else if (
            !this.IsPostBack &&//----------------------------------------------------false
            (bool)(this.Session["IsReEntrant"]) //------------------------------true
            )
        {                                       // coming from html-numbers of pager
            // needed combo-refresh, but re-select combo-Value from Session  --------
            //
            int int_comboSectors_selectedValue = (int)(this.Session["comboSectors_selectedValue"]); // NB.---cache across postbacks.-----
            ComboManager.populate_Combo_ddlSettore_for_LOAD(                                        //---primo popolamento.
                this.ddlSettori,
                int_comboSectors_selectedValue                                                      // "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.-----
            //
            // pager will load the new-chunk, based on a get-param.
            object obj_CacherDbView = this.Session["CacherDbView"];
            if (null != obj_CacherDbView)
            {
                ((CacherDbView)obj_CacherDbView).Pager_EntryPoint(
                    this.Session
                    , this.Request
                    , this.grdDatiPaginati
                    , this.pnlPageNumber
                    );
            }
            else
            {
                loadData(int_comboSectors_selectedValue); // TODO debug
                // don't throw new System.Exception(" queryCandidato::Page_Load . this.Session[CacherDbView] is null. ");
            }
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            !(bool)(this.Session["IsReEntrant"])   //------------------------------false
            )
        {
            // don't: throw new System.Exception(" impossible case: if IsReEntrant at least one entry occurred. ");
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            (bool)(this.Session["IsReEntrant"]) //-------------------------------true
            )
        {                                       // coming from combo-index-changed.
         // no combo-refresh.
         // drop the current view and create the new one, by delegate ddlSettoriRefreshQuery.
        } // no "else" possible: case mapping is complete.
    }     // end Page_Load
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!VerificaLasciapassare.CanLogOn(
                this.Session,
                this.Request.UserHostAddress
                )
            )
        {
            this.Session["indexOfAllSectors"] = null;// be sure to clean.
            this.Response.Redirect("../errore.aspx");
        }// else il lasciapassare e' valido -> get in.
        //
        // PostBack or not, refresh in Session, the present addres of the DynamicPortion method, which has
        // to be called from PagerDbView. Such address changes at every round-trip( tested).
        CacherDbView.DynamicPortionPtr dynamicPortionPtr = new CacherDbView.DynamicPortionPtr(
            this.prepareLavagnaDynamicPortion);
        this.Session["DynamicPortionPtr"] = dynamicPortionPtr;
        //

        /*
         * NB. page state check.-----------------------------------------------------------------
         *
         */
        PageStateChecker.PageStateChecker_SERVICE(
            "zonaRiservata_PrimeDataGrid"
            , this.Request
            , this.IsPostBack
            , this.Session
            );
        //----------------------------------------------- END  page state check.-----------------
        if (
            !this.IsPostBack &&//----------------------------------------------------false
            !(bool)(this.Session["IsReEntrant"]) //-----------------------------false
            )
        {                                        // first absolute entrance
            //
            this.fieldReader_withDefaults_();
            this.loadData(this.minKey, this.maxKey); // min==max means no query, min<max queries.
        }
        else if (
            !this.IsPostBack &&//----------------------------------------------------false
            (bool)(this.Session["IsReEntrant"]) //------------------------------true
            )
        {                                       // coming from html-numbers of pager
            // needed combo-refresh, but re-select combo-Value from Session  NB.  --------
            // pager will load the new-chunk, based on a get-param.
            object obj_CacherDbView = this.Session["CacherDbView"];
            if (null != obj_CacherDbView)
            {
                ((CacherDbView)obj_CacherDbView).Pager_EntryPoint(
                    this.Session
                    , this.Request
                    , this.grdDatiPaginati
                    , this.pnlPageNumber
                    );
            }
            else
            {
                this.fieldReader_withDefaults_();
                this.loadData(this.minKey, this.maxKey);// min==max means no query, min<max queries.
                LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                    " PrimeGrid::Page_Load . this.Session[CacherDbView] is null: re-built. "
                    , 0);
            }
            //
            System.Web.UI.WebControls.TextBox txtRowsInPage = null;
            try
            {
                txtRowsInPage =
                    (System.Web.UI.WebControls.TextBox)(this.PageLengthManager1.FindControl("txtRowsInPage"));
                txtRowsInPage.Text = ((CacherDbView)(this.Session["CacherDbView"])).RowsInChunk.ToString();
            }
            catch (System.Exception ex)
            {
                string dbg = ex.Message + "___" + ex.StackTrace;
            }
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            !(bool)(this.Session["IsReEntrant"])   //------------------------------false
            )
        {
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            (bool)(this.Session["IsReEntrant"]) //-------------------------------true
            )
        {                                       // coming from combo-index-changed.
         // system calls btn_delegate()
        }// no "else" possible: case mapping is complete.
    }// end Page_Load
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!VerificaLasciapassare.CanLogOn(
                this.Session,
                this.Request.UserHostAddress
                )
            )
        {
            this.Response.Redirect("../errore.aspx");
        }// else il lasciapassare e' valido -> get in.
        //
        //
        // PostBack or not, refresh in Session, the present addres of the DynamicPortion method, which has
        // to be called from PagerDbView. Such address changes at every round-trip( tested).
        CacherDbView.DynamicPortionPtr dynamicPortionPtr = new CacherDbView.DynamicPortionPtr(
            this.prepareLavagnaDynamicPortion);
        this.Session["DynamicPortionPtr"] = dynamicPortionPtr;
        //

        /*
         * NB. page state check.-----------------------------------------------------------------
         *
         */
        PageStateChecker.PageStateChecker_SERVICE(
            "zonaRiservata_cvMultiRead"
            , this.Request
            , this.IsPostBack
            , this.Session
            );
        //----------------------------------------------- END  page state check.-----------------
        if (
            !this.IsPostBack &&//----------------------------------------------------false
            !(bool)(this.Session["IsReEntrant"]) //-----------------------------false
            )
        {                                        // first absolute entrance
            object ref_candidato_id = this.Session["ref_candidato_id"];
            if (null == ref_candidato_id)
            {
                throw new System.Exception("ref_candidato_id cannot be missing, in this page.");
            }// else continue.
            int int_ref_candidato_id;
            try
            {
                int_ref_candidato_id = (int)ref_candidato_id;
                System.Data.DataTable tblCandidatoDescription =
                    Entity.Proxies.usp_candidato_LOAD_Description_SERVICE.usp_candidato_LOAD_Description(
                        int_ref_candidato_id
                        );
                // table should be as: {Kral Hannes,	Diritto Societario}
                // es. this.lblDeCuius.Text = "Gino Paoli / settore_BLA";
                this.lblDeCuius.Text =
                    (string)(tblCandidatoDescription.Rows[0].ItemArray[0])
                    + " / "
                    + (string)(tblCandidatoDescription.Rows[0].ItemArray[1]);
                //
                this.lblDeCuius.BackColor = System.Drawing.Color.Transparent;
            }
            catch (System.Exception ex)
            {
                string dbg = ex.Message;
                this.lblDeCuius.Text      = "Errore. Utilizzare i menu per il cambio pagina, non i bottoni della cache. ";
                this.lblDeCuius.BackColor = System.Drawing.Color.LightCoral;
                int_ref_candidato_id      = -1;// Proxy will manage.
            }
            //
            this.loadData(int_ref_candidato_id);
        }
        else if (
            !this.IsPostBack &&//----------------------------------------------------false
            (bool)(this.Session["IsReEntrant"]) //------------------------------true
            )
        {                                       // coming from html-numbers of pager
            //
            // pager will load the new-chunk, based on a get-param.
            object obj_CacherDbView = this.Session["CacherDbView"];
            if (null != obj_CacherDbView)
            {
                ((CacherDbView)obj_CacherDbView).Pager_EntryPoint(
                    this.Session
                    , this.Request
                    , this.grdDatiPaginati
                    , this.pnlPageNumber
                    );
            }
            else
            {
                throw new System.Exception(" candidatoLoad::Page_Load . this.Session[CacherDbView] is null. ");
            }
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            !(bool)(this.Session["IsReEntrant"])   //------------------------------false
            )
        {
        }
        else if (
            this.IsPostBack &&//------------------------------------------------------true
            (bool)(this.Session["IsReEntrant"]) //-------------------------------true
            )
        {                                       // coming from RowCommand buttons.
        }// no "else" possible: case mapping is complete.
    }//