private void Bind(int page) { // First get all of the assets in the cart CartFinder finder = new CartFinder { UserId = CurrentUser.UserId.GetValueOrDefault() }; finder.SortExpressions.Add(new DescendingSort(Cart.Columns.DateAdded.ToString())); finder.SortExpressions.Add(new DescendingSort(Cart.Columns.CartId.ToString())); List <Cart> items = Cart.FindMany(finder); // Filter out those assets that are not accessible by the current user var validItems = (from item in items where EntitySecurityManager.CanViewAssetInfo(CurrentUser, item.Asset) select item); // Get the asset count int total = validItems.Count(); // Set the page size SessionInfo.Current.UserSessionInfo.CartPageSize = PageSize; // Bind the asset list to relevant page CartRepeater.DataSource = items; CartRepeater.DataBind(); // Setup the top pager TopPager.CurrentPage = page; TopPager.PageSize = PageSize; TopPager.ItemCount = total; TopPager.CalculatePageCount(); // Setup the bottom pager BottomPager.CurrentPage = TopPager.CurrentPage; BottomPager.PageSize = TopPager.PageSize; BottomPager.ItemCount = TopPager.ItemCount; BottomPager.CalculatePageCount(); // Setup page variables CurrentPage = page; AssetCount = total; TotalPages = TopPager.PageCount; // Toggle no results panel CartResultsPanel.Visible = (items.Count > 0); CartNoResultsPanel.Visible = (items.Count == 0); }
private void Bind(int page) { // First get all of the items in the order OrderItemFinder finder = new OrderItemFinder { OrderId = CurrentOrderId }; List <OrderItem> items = OrderItem.FindMany(finder); // Filter out those assets that are not accessible by the current user var validItems = (from item in items where EntitySecurityManager.CanViewAssetInfo(CurrentUser, item.Asset) select item); // Get the asset count int total = validItems.Count(); // Set the page size SessionInfo.Current.UserSessionInfo.DownloadManagerPageSize = PageSize; // Bind the asset list to relevant page OrderItemsRepeater.DataSource = items; OrderItemsRepeater.DataBind(); // Setup the top pager TopPager.CurrentPage = page; TopPager.PageSize = PageSize; TopPager.ItemCount = total; TopPager.CalculatePageCount(); // Setup the bottom pager BottomPager.CurrentPage = TopPager.CurrentPage; BottomPager.PageSize = TopPager.PageSize; BottomPager.ItemCount = TopPager.ItemCount; BottomPager.CalculatePageCount(); // Setup page variables CurrentPage = page; AssetCount = total; TotalPages = TopPager.PageCount; // Toggle no results panel OrderDetailsPanel.Visible = (items.Count > 0); EmptyOrderPanel.Visible = (items.Count == 0); }