Esempio n. 1
0
        private void FillReviewGrid()
        {
            panelList.Visible = true;
            panelEdit.Visible = false;

            // Get the status filter
            ReviewController.StatusFilter filter = ReviewController.StatusFilter.All;
            if (cmbStatus.SelectedValue == "0")
            {
                filter = ReviewController.StatusFilter.NotApproved;
            }
            else if (cmbStatus.SelectedValue == "1")
            {
                filter = ReviewController.StatusFilter.Approved;
            }

            // Get the review list...
            List <ReviewInfo> reviewList;
            ReviewController  controller = new ReviewController();

            if (cmbProduct.SelectedValue != Null.NullInteger.ToString())
            {
                // Select by product
                reviewList = controller.GetReviewsByProduct(PortalId, int.Parse(cmbProduct.SelectedValue), filter);
            }
            else if (cmbCategory.SelectedValue != Null.NullInteger.ToString())
            {
                // Select by category
                reviewList = controller.GetReviewsByCategory(PortalId, int.Parse(cmbCategory.SelectedValue), filter);
            }
            else
            {
                // Select all reviews
                reviewList = controller.GetReviews(PortalId, filter);
            }

            // Has page index been initialized?
            if (_nav.PageIndex == Null.NullInteger)
            {
                _nav.PageIndex = 0;
            }

            // Update the grid
            if (reviewList.Count <= grdReviews.PageSize)
            {
                grdReviews.AllowPaging = false;
            }
            grdReviews.DataSource       = reviewList;
            grdReviews.CurrentPageIndex = _nav.PageIndex;
            grdReviews.DataBind();
        }