Ejemplo n.º 1
0
        }     //Ctor

        public Cacher(
            SpecificViewBuilder parSpecificViewBuilder
            , string parViewName_uno
            , string parViewName_due
            , bool isInDoubleSplit // when a temporary first view is required, to add RowNumber in a second turn.
            )
        {
            if (null != parSpecificViewBuilder)
            {
                this.specificViewBuilder = parSpecificViewBuilder;// delegate
                if (
                    null == parViewName_uno || "" == parViewName_uno.Trim() ||
                    null == parViewName_due || "" == parViewName_due.Trim()
                    )
                {
                    throw new System.Exception("CacherDbView::Ctor: illegal view name(s).");
                }// else can continue.
                this.viewName = parViewName_due;// the first one is not cached.
                int viewCreation_res = this.specificViewBuilder(
                    parViewName_uno
                    , parViewName_due
                    );
                System.Data.DataTable dtViewRowCardinality =
                    Entity_materie.Proxies.usp_ViewCacher_generic_LOAD_length_SERVICE.usp_ViewCacher_generic_LOAD_length(
                        this.viewName);
                if (
                    null == dtViewRowCardinality ||
                    0 >= dtViewRowCardinality.Rows.Count
                    )
                {
                    LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                        " exception :  CacherDbView Ctor failed querying the VIEW row-cardinality. check for View existence. "
                        , 0);
                }// else continue
                if (null != dtViewRowCardinality)
                {// TODO passare a func return val ?
                    this.rowCardinalityTotalView = (int)(dtViewRowCardinality.Rows[0].ItemArray[0]);
                }
            } // else : not a valid delegate -> do not Construct.
        }     //Ctor
Ejemplo n.º 2
0
 public Cacher(
     SpecificViewBuilder parSpecificViewBuilder
     , string parViewName
     , string whereTail
     )
 {
     if (null != parSpecificViewBuilder)
     {
         this.specificViewBuilder = parSpecificViewBuilder;// delegate
         if (
             null == parViewName ||
             "" == parViewName.Trim()
             )
         {
             throw new System.Exception("CacherDbView::Ctor: illegal view name.");
         }// else can continue.
         this.viewName = parViewName;
         int viewCreation_res = this.specificViewBuilder(whereTail, this.viewName);
         System.Data.DataTable dtViewRowCardinality =
             Entity_materie.Proxies.usp_ViewCacher_generic_LOAD_length_SERVICE.usp_ViewCacher_generic_LOAD_length(
                 this.viewName);
         if (
             null == dtViewRowCardinality ||
             0 >= dtViewRowCardinality.Rows.Count
             )
         {
             LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                 " exception :  CacherDbView Ctor failed querying the VIEW row-cardinality. check for View existence. "
                 , 0);
         }// else continue
         if (null != dtViewRowCardinality)
         {// TODO passare a func return val ?
             this.rowCardinalityTotalView = (int)(dtViewRowCardinality.Rows[0].ItemArray[0]);
         }
     } // else : not a valid delegate -> do not Construct.
 }     //Ctor
Ejemplo n.º 3
0
    private SpecificViewBuilder specificViewBuilder = null;// cached, for re-building on View-refresh.



    /// <summary>
    /// Ctor()
    /// - CacherDbView creates a dbView onConstruction
    /// NB. crucial for the Ctor() success is the call to this.GetChunk(firstPage)
    /// this.GetChunk() sets this.Session[CacherDbView] and this is the condition to
    /// let the dbView available; otherwise every call to
    /// </summary>
    public CacherDbView(
        //---first the Cacher needs:
        System.Web.SessionState.HttpSessionState Session
        , string where_tail
        , string view_signature
        , SpecificViewBuilder specificViewBuilder
        , int RowsInChunk
        //---below follows the Pager need:
        , System.Web.HttpRequest Request
        , System.Web.UI.WebControls.GridView grdDatiPaginati
        , System.Web.UI.WebControls.Panel pnlPageNumber
        )
    {
        if (
            null == view_signature ||
            "" == view_signature.Trim() ||
            char.IsDigit(view_signature[0])
            )
        {
            throw new System.Exception("CacherDbView::Ctor: illegal view name.");
        }// else can continue.
        this.ViewName = view_signature;
        //
        try
        {
            this.doDestruction();// NB. be sure to drop omonimous objects, before a new fill( eg. for a different DataGrid in the same Session).
            //
            this.specificViewBuilder = specificViewBuilder;
            this.specificViewBuilder(where_tail, this.ViewName);
            //
            this.where_tail = where_tail;
            //
            if (RowsInChunk > 0)
            {
                this.RowsInChunk = RowsInChunk;
            }
            else
            {
                this.RowsInChunk = 5;// default.
            }
            //
            System.Data.DataTable dtViewRowCardinality =
                Entity.Proxies.usp_ViewCacher_generic_LOAD_length_SERVICE.usp_ViewCacher_generic_LOAD_length(
                    view_signature);
            if (
                null == dtViewRowCardinality ||
                0 >= dtViewRowCardinality.Rows.Count
                )
            {
                LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs(
                    " exception :  CacherDbView Ctor failed querying the VIEW row-cardinality. check for View existence. "
                    , 0);
            }// else continue
            this.rowCardinality = (int)(dtViewRowCardinality.Rows[0].ItemArray[0]);
            //
            //---done with the Cacher, now do the Pager.
            // now fill the first page, after the View creation.
            this.Pager_EntryPoint( //    --- TODO debug
                Session
                , Request
                , grdDatiPaginati
                , pnlPageNumber
                );
        }
        catch (System.Exception ex)// the provided DataTable might be null;
        {
            // Logging
            string m = ex.Message;
            throw new System.Exception(" CacherDbView Ctor failed creating the VIEW. ");
        }
    }// end Ctor