Пример #1
0
    private void BindList()
    {
        CatId   = (int)Util.Val(Request.QueryString["catid"]);
        OrderBy = (int)Util.Val(Request.QueryString["ob"]);
        SortBy  = (int)Util.Val(Request.QueryString["sb"]);

        //Get the current file path
        string ParamURL = Request.CurrentExecutionFilePath + "?&catid=" + CatId;

        int GetPage = (int)Util.Val(Request.QueryString["page"]);

        int iPage;

        if (string.IsNullOrEmpty(this.Request.QueryString["page"]))
        {
            iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page
        }
        else
        {
            iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value
        }

        //Initialize pagesize and pageindex
        int PageSize  = pagerlinks.DefaultPageSize;
        int PageIndex = iPage;

        try
        {
            //Get category datasource object
            ArticleCategoryProvider GetCategory = new ArticleCategoryProvider(CatId, OrderBy, SortBy, PageIndex, PageSize);

            //Instantiate pager link object
            pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetCategory.RecordCount, PlaceHolder1);

            string artcatname;
            artcatname     = GetCategory.Category;
            lbcatname.Text = GetCategory.Category;
            lbcount.Text   = "(" + GetCategory.RecordCount.ToString() + ")";

            //Display numeric pager link
            lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage);

            //Display the top right corner pager counter
            lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;

            //Display the bottom pager counter
            lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;

            ArticleCat.DataSource = GetCategory.GetCategories();
            ArticleCat.DataBind();

            //Release allocated memory
            GetCategory = null;
            Pager       = null;
        }
        catch
        {
        }
    }
Пример #2
0
    //Return databind
    private void BindList()
    {
        SortBy  = (int)Util.Val(Request.QueryString["sid"]);
        Sort_By = (int)Util.Val(Request.QueryString["sb"]);

        iPage      = 1;
        psPageSize = 10;
        lbps.Text  = " - Displaying <b>10</b> records per page";

        //Get the current file path
        string ParamURL = Request.CurrentExecutionFilePath + "?sid=" + SortBy;

        int GetPage = (int)Util.Val(Request.QueryString["page"]);

        if (!string.IsNullOrEmpty(this.Request.QueryString["page"]))
        {
            iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value
        }

        if (!string.IsNullOrEmpty(this.Request.QueryString["ps"]))
        {
            psPageSize = (int)Util.Val(Request.QueryString["ps"]); //Grab the querystring pagesize value
            lbps.Text  = " - Displaying <b>" + psPageSize + "</b> records per page";
        }

        if (psPageSize > 50)
        {
            psPageSize = 10;
        }

        int Layout = (int)Util.Val(Request.QueryString["layout"]);

        //Initialize variable for preferred layout dropdown menu
        SelectedValuePrefLayout = Utility.PreferredLayoutSelectedValue(Layout);
        pLayout = Utility.PreferredLayout(Layout);

        RecipeSort.RepeatColumns = Utility.PreferredLayout(Layout);

        //Initialize variable use for dynamic pagesize dropdown menu.
        psOrderBy   = SortBy;
        psSortBy    = Sort_By;
        psPageIndex = iPage;

        //Initialize pagesize and pageindex
        int PageSize  = psPageSize;
        int PageIndex = iPage;

        try
        {
            //We only display top 100 recipes for the sort.aspx page
            int TotalRecords = 100;

            //Sort.aspx goes up to 5 pages only 100/5 = 5 pages
            int MaxSortPageSize = 5;

            //Get category datasource object
            RecipeSortProvider GetRecipe = new RecipeSortProvider(SortBy, Sort_By, PageIndex, PageSize);

            //Instantiate pager link object
            pagerlinks Pager = new pagerlinks(PageIndex, PageSize, TotalRecords, MaxSortPageSize, PlaceHolder1);

            //Dsiplay pager links
            lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, SortBy, Sort_By, GetPage, pLayout);

            //Display the top right corner pager counter
            lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;

            //Display the bottom pager counter
            lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;

            //Bind Generic List to a repeater
            RecipeSort.DataSource = GetRecipe.GetRecipeSort();
            RecipeSort.DataBind();

            //Release allocated memory
            GetRecipe = null;

            //Release allocated memory
            Pager = null;
        }
        catch
        {
        }
    }
Пример #3
0
    //Return databind
    private void BindList()
    {
        letter  = Request.QueryString["letter"].ToString();
        OrderBy = (int)Util.Val(Request.QueryString["ob"]);
        SortBy  = (int)Util.Val(Request.QueryString["sb"]);

        //Get the current file path
        string ParamURL = Request.CurrentExecutionFilePath + "?letter=" + letter;

        int GetPage = (int)Util.Val(Request.QueryString["page"]);

        if (string.IsNullOrEmpty(this.Request.QueryString["page"]))
        {
            iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page
        }
        else
        {
            iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value
        }

        if (string.IsNullOrEmpty(this.Request.QueryString["ps"]))
        {
            psPageSize = 10; //If request pagesize is empty, then assign default pagesize of 10
            lbps.Text  = " - Displaying <b>10</b> records per page";
        }
        else
        {
            psPageSize = (int)Util.Val(Request.QueryString["ps"]); //Grab the querystring pagesize value
            lbps.Text  = " - Displaying <b>" + psPageSize + "</b> records per page";
        }
        if (psPageSize > 50)
        {
            psPageSize = 10;
        }

        int Layout = (int)Util.Val(Request.QueryString["layout"]);

        //Initialize variable for preferred layout dropdown menu
        SelectedValuePrefLayout = Utility.PreferredLayoutSelectedValue(Layout);
        pLayout = Utility.PreferredLayout(Layout);

        RecipeCat.RepeatColumns = Utility.PreferredLayout(Layout);

        //Initialize variable use for dynamic pagesize dropdown menu.
        psLetter    = letter;
        psOrderBy   = OrderBy;
        psSortBy    = SortBy;
        psPageIndex = iPage;

        //Initialize pagesize and pageindex
        int PageSize  = psPageSize;
        int PageIndex = iPage;

        try
        {
            //Get datasource object
            RecipeAlphaLetterProvider GetRecipe = new RecipeAlphaLetterProvider(letter, OrderBy, SortBy, PageIndex, PageSize);

            //Instantiate pager link object
            pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetRecipe.RecordCount, PlaceHolder1);

            //Get recipe count and assign it to the label
            lblcount.Text = "(" + GetRecipe.RecordCount.ToString() + ") <b>Recipes Start with Letter " + letter + "</b>";

            //Display pager link
            lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage, pLayout);

            //Display the top right corner pager counter
            lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;

            //Display the bottom pager counter
            lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;

            //Get BLL object datasource
            RecipeCat.DataSource = GetRecipe.GetRecipeAlphabetLetter();
            RecipeCat.DataBind();

            //Release allocated memory
            GetRecipe = null;
            Pager     = null;
        }
        catch
        {
        }
    }
Пример #4
0
    //Return databind
    private void BindList()
    {
        CatId   = (int)Util.Val(Request.QueryString["catid"]);
        OrderBy = (int)Util.Val(Request.QueryString["ob"]);
        SortBy  = (int)Util.Val(Request.QueryString["sb"]);

        iPage      = 1;
        psPageSize = 10;
        lbps.Text  = " - Displaying <b>10</b> records per page";

        //Get the current file path
        string ParamURL = Request.CurrentExecutionFilePath + "?catid=" + CatId;

        int GetPage = (int)Util.Val(Request.QueryString["page"]);

        if (!string.IsNullOrEmpty(this.Request.QueryString["page"]))
        {
            iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value
        }

        if (!string.IsNullOrEmpty(this.Request.QueryString["ps"]))
        {
            psPageSize = (int)Util.Val(Request.QueryString["ps"]); //Grab the querystring pagesize value
            lbps.Text  = " - Displaying <b>" + psPageSize + "</b> records per page";
        }

        if (psPageSize > 50)
        {
            psPageSize = 10;
        }

        int Layout = (int)Util.Val(Request.QueryString["layout"]);

        //Initialize variable for preferred layout dropdown menu
        SelectedValuePrefLayout = Utility.PreferredLayoutSelectedValue(Layout);
        pLayout = Utility.PreferredLayout(Layout);

        RecipeCat.RepeatColumns = Utility.PreferredLayout(Layout);

        //Initialize variable use for dynamic pagesize dropdown menu.
        psCatId     = CatId;
        psOrderBy   = OrderBy;
        psSortBy    = SortBy;
        psPageIndex = iPage;

        //Initialize pagesize and pageindex
        int PageSize  = psPageSize;
        int PageIndex = iPage;

        try
        {
            //Get category datasource object
            RecipeCategoryProvider GetCategory = new RecipeCategoryProvider(CatId, OrderBy, SortBy, PageIndex, PageSize);

            //Instantiate pager object
            pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetCategory.RecordCount, PlaceHolder1);

            lblcatname2.Text = GetCategory.Category;
            lblcount.Text    = "(" + GetCategory.RecordCount.ToString() + ")";

            //Display pager links
            lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage, pLayout);

            //Display the top right corner pager counter
            lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;

            //Display the bottom pager counter
            lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;

            //Bind Generic List to a repeater
            RecipeCat.DataSource = GetCategory.GetCategories();
            RecipeCat.DataBind();

            //Deallocate object memory
            GetCategory = null;

            //Release object allocated memory
            Pager = null;
        }
        catch
        {
        }
    }
Пример #5
0
    private void BindList()
    {
        CatId      = (int)Util.Val(Request.QueryString["catid"]);
        strKeyword = Request.QueryString["find"].ToString();
        OrderBy    = (int)Util.Val(Request.QueryString["ob"]);
        SortBy     = (int)Util.Val(Request.QueryString["sb"]);

        //Get the current file path
        string ParamURL = Request.CurrentExecutionFilePath + "?find=" + strKeyword + "&catid=" + CatId;

        int GetPage = (int)Util.Val(Request.QueryString["page"]);

        int iPage;

        if (string.IsNullOrEmpty(this.Request.QueryString["page"]))
        {
            iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page
        }
        else
        {
            iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value
        }

        //Initialize pagesize and page index
        int PageSize  = pagerlinks.DefaultPageSize;
        int PageIndex = iPage;

        try
        {
            //Get category datasource object
            ArticleSearchProvider GetArticle = new ArticleSearchProvider(strKeyword, CatId, OrderBy, SortBy, PageIndex, PageSize);

            //Instantiate pager link object
            pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetArticle.RecordCount, PlaceHolder1);

            string strSearchIn;

            if (CatId == 0)
            {
                strSearchIn = "in all category.";
            }
            else
            {
                strSearchIn = "in <b>" + GetArticle.Category + "</b> category.";
            }

            //Get recipe count in category and assign it to the labale
            lbcount.Text = "(" + GetArticle.RecordCount.ToString() + ") recipes found for keyword (<b>" + strKeyword + "</b>) " + strSearchIn;

            //Display numeric pager link
            lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage);

            //Display the top right corner pager counter
            lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;

            //Display the bottom pager counter
            lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;

            //Bind Generic List to a repeater
            ArticleCat.DataSource = GetArticle.GetArticleSearchResult();
            ArticleCat.DataBind();

            //Release allocated memory
            GetArticle = null;
            Pager      = null;
        }
        catch
        {
            lblNorecordFound.Visible = true;
            lblNorecordFound.Text    = "&nbsp;&nbsp;&nbsp;No Article Found for the keyword (" + strKeyword + "). Please try again.";
        }
    }