コード例 #1
0
        private bool IsLastPage(int currentPage)
        {
            int nrOfHotels = HotelService.GetListOfHotels().Count();
            int nrOfPages  = Int32.Parse(PageAction.GetNrOfPages(nrOfHotels, PAGE_LIMIT).ToString());

            if (currentPage == nrOfPages)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        private void DisplayHotels(int currentPage)
        {
            int nrOfHotels;
            int nrOfPages;

            var countyId = (int)countyComboBox.SelectedValue;
            var cityId   = (int)cityComboBox.SelectedValue;

            FilterType filterType = new FilterType(countyId, cityId);

            double       offset       = PageAction.CalculateOffset(currentPage, PAGE_LIMIT);
            List <Hotel> listOfHotels = HotelService.GetListByOffsetAndFilterType(PAGE_LIMIT, offset, filterType);

            if (listOfHotels.Count > 0)
            {
                InitializeDataGridView(listOfHotels);
                nrOfHotels = HotelService.GetTotalNrOfHotels(filterType);
                nrOfPages  = Convert.ToInt32(PageAction.GetNrOfPages(nrOfHotels, PAGE_LIMIT));

                SetPageNr(currentPage);
                //si butoanele disabled unde le faci? care butoane?
                SetEnabledButtons(currentPage, nrOfPages);
            }
        }