Ejemplo n.º 1
0
        private void refreshPagingInfo(Direction direction, int Page)
        {
            int CurrentPage = (int)XCurrentPage.Value;

            if (direction.Equals(Direction.Refresh))
            {
                CurrentPage = Page;
            }

            int RecordsPerPage = (int)XRecordsPerPage.Value;

            TableRecords = _controller.getMaxAllPaging();
            MaxPage      = TableRecords / RecordsPerPage;
            int rest = TableRecords % RecordsPerPage;

            switch (direction)
            {
            case Direction.First:     // Show all
                CurrentPage = 0;
                break;

            case Direction.Previous:     // Show all
                if (CurrentPage > 0)
                {
                    CurrentPage--;
                }
                break;

            case Direction.Refresh:     // Show all

                break;

            case Direction.Next:     // Show all
                if (CurrentPage < MaxPage)
                {
                    CurrentPage++;
                }
                break;

            case Direction.Last:     // Show all
                CurrentPage = MaxPage;
                break;

            default:
                break;
            }
            XCurrentPage.Value = CurrentPage;
            _controller.getAllSinglePage((CurrentPage * RecordsPerPage), RecordsPerPage);
        }