コード例 #1
0
        internal static PagingCollection <loan> GetPaginatedLoanListByPage(int page, string areaName)
        {
            PagingCollection <loan> pager = new PagingCollection <loan>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <loan> loans = null;

            if (areaName == "ALL")
            {
                loans = db.loans.Include("customer").Include("employee").Where(e => (e.LOAN_STATUS == true)).ToList();
            }
            else
            {
                loans = db.loans.Include("customer").Include("employee").Where(e => (e.LOAN_STATUS == true && e.customer.area.AREA_NAME == areaName)).ToList();
            }

            loans = loans.OrderByDescending(q => q.START_DATE).ToList();

            pager.Collection  = loans.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = loans.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #2
0
        internal static PagingCollection <employee> GetPaginatedQuickSearchedEmployeeListByPage(string _searchText, int page)
        {
            PagingCollection <employee> pager = new PagingCollection <employee>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <employee> employees = null;

            if (_searchText != "")
            {
                employees = db.employees.Where
                                (e =>
                                (
                                    e.FIRST_NAME == _searchText ||
                                    e.LAST_NAME == _searchText
                                    //|| e.hrm_contacts.Where(c => c.HOME == searche.hrm_contacts.Single().HOME)
                                ) && e.STATUS == true).ToList();
            }
            else
            {
                employees = db.employees.Where(e => e.STATUS == true).ToList();
            }
            pager.Collection  = employees.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = employees.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #3
0
        internal static PagingCollection <loan_type> GetPaginatedQuickSearchedLoanTypeListByPage(string _searchText, int page)
        {
            PagingCollection <loan_type> pager = new PagingCollection <loan_type>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <loan_type> loan_types = null;

            if (_searchText != "")
            {
                loan_types = db.loan_type.Where
                                 (ln =>
                                 (
                                     ln.LOAN_TYPE_ID == _searchText
                                     //|| e.hrm_contacts.Where(c => c.HOME == searche.hrm_contacts.Single().HOME)
                                 )).ToList();
            }
            else
            {
                loan_types = db.loan_type.ToList();
            }
            pager.Collection  = loan_types.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = loan_types.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #4
0
        internal static Util.PagingCollection <employee_cash> GetPaginatedQuickSearchedEmployeePaymentListByPage(int page, DateTime _dateFrom, DateTime _dateTo)
        {
            _dateTo = _dateTo.AddSeconds(86399);

            PagingCollection <employee_cash> pager = new PagingCollection <employee_cash>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            var emp_paymentList = db.employee_cash.Where
                                      (emPay =>
                                      (
                                          emPay.TRANSACTION_DATE_TIME >= _dateFrom.Date &&
                                          emPay.TRANSACTION_DATE_TIME <= _dateTo.Date

                                      )).ToList();

            emp_paymentList = emp_paymentList.GroupBy(emp => new { FK_EMPLOYEE_ID = emp.FK_EMPLOYEE_ID, TYPE = emp.TYPE, TRANSACTION_DATE_TIME = emp.TRANSACTION_DATE_TIME.Value.Date }).Select(pay => new employee_cash
            {
                TRANSACTION_DATE_TIME = pay.Key.TRANSACTION_DATE_TIME,
                FK_EMPLOYEE_ID        = pay.Key.FK_EMPLOYEE_ID,
                AMOUNT = pay.Sum(x => x.AMOUNT),
                TYPE   = pay.Key.TYPE
            }).OrderBy(x => (x.TRANSACTION_DATE_TIME.Value.Date)).ToList();

            //emp_paymentList = (from p in emp_paymentList
            //                  group p by new{ TRANSACTION_DATE_TIME = p.TRANSACTION_DATE_TIME, FK_EMPLOYEE_ID=p.FK_EMPLOYEE_ID});

            pager.Collection  = emp_paymentList.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = emp_paymentList.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #5
0
        public PagingCollection <JsonLocation> GetAllPages(int ItemsPerPage, string OrderBy, string SearchTerm, string SortOrder = "ASC")
        {
            var             allLocations      = this.GetAllLocations();
            List <Location> workingCollection = new List <Location>();

            // WHERE?
            if (SearchTerm != string.Empty)
            {
                workingCollection.AddRange(allLocations.Where(n =>
                                                              n.Name.Contains(SearchTerm) ||
                                                              n.Address.Address1.Contains(SearchTerm) ||
                                                              n.Address.Address2.Contains(SearchTerm) ||
                                                              n.Address.Locality.Contains(SearchTerm) ||
                                                              n.Address.Region.Contains(SearchTerm) ||
                                                              n.Address.PostalCode.Contains(SearchTerm) ||
                                                              n.Address.CountryCode.Contains(SearchTerm)));

                // workingCollection.AddRange(allLocations.Where(n => n.Name.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.Address1.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.Address2.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.Locality.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.Region.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.PostalCode.Contains(SearchTerm)));
                // workingCollection.AddRange(allLocations.Where(n => n.Address.CountryCode.Contains(SearchTerm)));
            }
            else
            {
                workingCollection = allLocations.ToList();
            }

            // ORDER?
            // orderedColl = new IOrderedEnumerable<Location>();
            if (OrderBy != string.Empty)
            {
                switch (OrderBy.ToLower())
                {
                case "name":
                    workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.Name).ToList() : workingCollection.OrderByDescending(n => n.Name).ToList();
                    break;

                case "locationtype":
                    workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.LocationType.Name).ToList() : workingCollection.OrderByDescending(n => n.LocationType.Name).ToList();
                    break;
                }
            }
            else
            {
                workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.Name).ToList() : workingCollection.OrderByDescending(n => n.Name).ToList();
            }

            // create paging collection
            PagingCollection <JsonLocation> pagingColl = new PagingCollection <JsonLocation>(Repositories.LocationRepo.ConvertToJsonLocations(workingCollection));

            pagingColl.PageSize = ItemsPerPage;

            return(pagingColl);
        }
コード例 #6
0
        //Check into paging via Page<T> and SQL
        //Via Rusty:
        //  "Merchello.Web.Search folder" & two methods (Page<Guid> GetPagedKeys()) are from my ProductRepository class in Merchello.Core.Persistence
        //  petapoco's Page<T> object is really nice for paging natively in SQL

        public PagingCollection <IndexedLocation> GetAllPages(int ItemsPerPage, string OrderBy, string SearchTerm, string SortOrder = "ASC")
        {
            //TODO: Check if a direct search would be faster than LINQ
            //var searcher = locationIndexManager.uLocateLocationSearcher;
            //var searchCriteria = searcher.CreateSearchCriteria("*");
            //var searchResults = searcher.Search(searchCriteria.SearchIndexType, true);

            var allLocations = this.GetLocations();
            List <IndexedLocation> workingCollection = new List <IndexedLocation>();

            // WHERE?
            if (SearchTerm != string.Empty)
            {
                var lowerTerm = SearchTerm.ToLower();

                workingCollection.AddRange(allLocations.Where(n =>
                                                              n.Name.ToLower().Contains(lowerTerm) ||
                                                              n.Address1.ToLower().Contains(lowerTerm) ||
                                                              n.Address2.ToLower().Contains(lowerTerm) ||
                                                              n.Locality.ToLower().Contains(lowerTerm) ||
                                                              n.Region.ToLower().Contains(lowerTerm) ||
                                                              n.PostalCode.ToLower().Contains(lowerTerm) ||
                                                              n.CountryCode.ToLower().Contains(lowerTerm)));
            }
            else
            {
                workingCollection = allLocations.ToList();
            }

            // ORDER?
            // orderedColl = new IOrderedEnumerable<EditableLocation>();
            if (OrderBy != string.Empty)
            {
                switch (OrderBy.ToLower())
                {
                case "name":
                    workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.Name).ToList() : workingCollection.OrderByDescending(n => n.Name).ToList();
                    break;

                case "locationtype":
                    workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.LocationTypeName).ToList() : workingCollection.OrderByDescending(n => n.LocationTypeName).ToList();
                    break;
                }
            }
            else
            {
                workingCollection = SortOrder == "ASC" ? workingCollection.OrderBy(n => n.Name).ToList() : workingCollection.OrderByDescending(n => n.Name).ToList();
            }

            // create paging collection
            PagingCollection <IndexedLocation> pagingColl = new PagingCollection <IndexedLocation>(workingCollection);

            pagingColl.PageSize = ItemsPerPage;

            return(pagingColl);
        }
コード例 #7
0
        private void RefreshSearchedListByPage(int page)
        {
            PagingCollection <customer> _PagingCollection = CustomerService.GetPaginatedQuickSearchedCustomerListByPage(_searchText, page, "ALL");

            SearchedListCustomer = _PagingCollection.Collection;
            PagingList           = _PagingCollection.PagesList;

            SearchList.ItemsSource = SearchedListCustomer;
            SearchList.Items.Refresh();

            PagingListView.ItemsSource = PagingList;
            PagingListView.Items.Refresh();
        }
コード例 #8
0
        /// <summary>
        /// Render grid
        /// </summary>
        /// <param name="t">Grid to render</param>
        /// <param name="entities">Entities for render</param>
        /// <param name="mode">Template render mode</param>
        /// <param name="sorting">Grid sorting</param>
        /// <returns>Rendered grid as string</returns>
        public string Render(Type t, PagingCollection<object> entities, TemplateMode mode, GridSorting sorting)
        {
            var grid = this.reflector.Reflect(t, mode);

            if (sorting != null)
            {
                grid.Sorting = sorting;
            }

            grid.Rows = grid.Rows.OrderBy(r => r.Order).ToList();
            var headerRender = this.RenderHeader(grid);
            var bodyRender = this.RenderBody(grid, entities.CurrentPageCollection.ToList());
            return string.Format("<div class=\"enable-grid-hor-overflow\"><table class=\"table table-bordered entity-grid dataTable\">{0}{1}</table></div>{2}", headerRender, bodyRender, this.RenderPaginanation(entities));
        }
コード例 #9
0
        internal static PagingCollection <employee> GetPaginatedEmployeeListByPage(int page)
        {
            PagingCollection <employee> pager = new PagingCollection <employee>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            var employees = db.employees.Where(e => e.ISRESIGN == false && e.STATUS == true).ToList();

            pager.Collection  = employees.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = employees.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #10
0
        internal static PagingCollection <payment> PaymentListByLoanID(loan loan, int page)
        {
            PagingCollection <payment> pager = new PagingCollection <payment>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <payment> payments = db.payments.Where(pay => pay.FK_LOAN_ID == loan.ID).ToList();

            payments = payments.OrderByDescending(pay => pay.DATE_TIME).ToList();

            pager.Collection  = payments.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = payments.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #11
0
        internal static PagingCollection <customer> GetPaginatedQuickSearchedCustomerListByPage(string _searchText, int page, string areaName)
        {
            PagingCollection <customer> pager = new PagingCollection <customer>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <customer> customers = null;

            if (areaName == "ALL")
            {
                customers = db.customers.Where(e => (e.ISACTIVE == true)).ToList();
            }
            else
            {
                customers = db.customers.Where(e => (e.ISACTIVE == true && e.area.AREA_NAME == areaName)).ToList();
            }

            if (_searchText != "")
            {
                _searchText = _searchText.ToLower();
                customers   = customers.Where
                                  (e =>
                                  (
                                      e.ISACTIVE == true &&
                                      (e.FIRST_NAME.ToLower() + e.LAST_NAME.ToLower()).Contains(_searchText.Replace(" ", "")) ||
                                      e.FIRST_NAME.ToLower().Contains(_searchText) ||
                                      e.LAST_NAME.ToLower().Contains(_searchText) ||
                                      e.PHONE_HP1.ToLower().Contains(_searchText) ||
                                      e.ID_NUM.ToLower().Contains(_searchText)
                                  )).ToList();
            }
            else
            {
                customers = customers.Where(e => (e.ISACTIVE == true)).ToList();
            }
            customers = customers.OrderByDescending(cus => cus.FK_AREA_ID).ThenBy(cus => cus.CUSTOMER_ID).ToList();

            pager.Collection  = customers.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = customers.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #12
0
        private void RefreshSearchedListByPage(int page)
        {
            if (getSearchType() == 1)
            {
                PagingCollection <employee> _PagingCollection = EmployeeService.GetPaginatedQuickSearchedEmployeeListByPage(_searchText, page);
                SearchedListEmployee = _PagingCollection.Collection;
                PagingList           = _PagingCollection.PagesList;

                SearchList.ItemsSource = SearchedListEmployee;
                SearchList.Items.Refresh();
            }
            else if (getSearchType() == 0)
            {
                PagingCollection <customer> _PagingCollection = CustomerService.GetPaginatedQuickSearchedCustomerListByPage(_searchText, page, "ALL");
                SearchedListCustomer = _PagingCollection.Collection;
                PagingList           = _PagingCollection.PagesList;

                SearchList.ItemsSource = SearchedListCustomer;
                SearchList.Items.Refresh();
            }
            else if (getSearchType() == 2)
            {
                PagingCollection <loan_type> _PagingCollection = LoanTypeService.GetPaginatedQuickSearchedLoanTypeListByPage(_searchText, page);
                SearchedListLoanType = _PagingCollection.Collection;
                PagingList           = _PagingCollection.PagesList;

                SearchList.ItemsSource = SearchedListLoanType;
                SearchList.Items.Refresh();
            }
            else
            {
                PagingCollection <customer> _PagingCollection = CustomerService.GetPaginatedQuickSearchedCustomerListByPage(_searchText, page, "ALL");
                SearchedListCustomer = _PagingCollection.Collection;
                PagingList           = _PagingCollection.PagesList;

                SearchList.ItemsSource = SearchedListCustomer;
                SearchList.Items.Refresh();
            }

            PagingListView.ItemsSource = PagingList;
            PagingListView.Items.Refresh();
        }
コード例 #13
0
        internal static PagingCollection <loan> GetPaginatedQuickSearchedLoanListByPage(string _searchText, int page, Boolean _loanStatusActive, string areaName)
        {
            PagingCollection <loan> pager = new PagingCollection <loan>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <loan> loans = null;

            if (areaName == "ALL")
            {
                loans = db.loans.Include("customer").Include("employee").Where(e => (e.LOAN_STATUS == _loanStatusActive)).ToList();
            }
            else
            {
                loans = db.loans.Include("customer").Include("employee").Where(e => (e.LOAN_STATUS == _loanStatusActive && e.customer.area.AREA_NAME == areaName)).ToList();
            }

            loans = loans.Where
                        (e =>
                        (e.LOAN_ID.ToLower().Contains(_searchText.ToLower()) ||
                         e.FullLoanCode.ToLower().Replace(" ", "").Contains(_searchText.ToLower().Replace(" ", "")) ||
                         e.customer.ID_NUM.ToLower().Contains(_searchText.ToLower()) ||
                         e.customer.FullCustomerCode.ToLower().Replace(" ", "").Contains(_searchText.ToLower().Replace(" ", "")) ||
                         e.customer.FullCustomerCode.ToString().Contains(_searchText.ToLower())
                        )).ToList();

            loans = loans.OrderByDescending(ln => ln.START_DATE).ToList();
            loans = loans.Where(e => (e.LOAN_STATUS == _loanStatusActive)).ToList();

            if (_searchText == "")
            {
                loans = loans.ToList();
                loans = loans.OrderByDescending(ln => ln.START_DATE).ToList();
                loans = loans.Where(e => (e.LOAN_STATUS == _loanStatusActive)).ToList();
            }

            pager.Collection  = loans.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = loans.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #14
0
        internal static PagingCollection <loan> GetPaginatedQuickSearchedLoanListByPage(int page, string p, DateTime _dateFrom, DateTime _dateTo)
        {
            PagingCollection <loan> pager = new PagingCollection <loan>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            var loans = db.loans.Include("customer").Include("employee").Where
                            (ln => (
                                ln.LOAN_STATUS == true &&
                                (ln.customer.area.AREA_NAME == p || p == "ALL") &&
                                ln.START_DATE >= _dateFrom.Date &&
                                ln.START_DATE <= _dateTo.Date
                                )).ToList();

            pager.Collection  = loans.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = loans.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #15
0
        internal static PagingCollection <payment> GetPaginatedQuickSearchedPaymentListByPage(int page, string p, DateTime _dateFrom, DateTime _dateTo)
        {
            PagingCollection <payment> pager = new PagingCollection <payment>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            var payments = db.payments.Include("loan").Where
                               (pay => (
                                   pay.loan.LOAN_STATUS == true &&
                                   (pay.loan.customer.area.AREA_NAME == p || p == "ALL") &&
                                   pay.DATE_TIME >= _dateFrom.Date &&
                                   pay.DATE_TIME <= _dateTo.Date
                                   )).ToList();

            pager.Collection  = payments.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = payments.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #16
0
        private void refreshLoanPaymentList(int page)
        {
            PagingCollection <payment> _PagingCollection = Session.SelectedLoan.PAYMENT_LIST(page);

            PaymentL = _PagingCollection.Collection;
            List <PageData> PagingList = _PagingCollection.PagesList;

            PaymentList.ItemsSource = PaymentL;
            decimal sumPaid = Session.SelectedLoan.sumPaidByLoanID();

            sumPaidLable.Content = sumPaid.ToString();

            decimal totalPaid = Session.SelectedLoan.totalToPayByLoanID();

            totalToPayLable.Content = totalPaid.ToString();

            PaymentList.Items.Refresh();

            PagingListView.ItemsSource = PagingList;
            PagingListView.Items.Refresh();
        }
コード例 #17
0
        internal static PagingCollection <customer> GetPaginatedCustomerListByPage(int page, string areaName)
        {
            PagingCollection <customer> pager = new PagingCollection <customer>();
            int             pagesize          = pager.PageSize;
            int             offset            = pager.PageSize * (page - 1);
            List <customer> customers;

            if (areaName == "ALL")
            {
                customers = db.customers.Where(e => (e.ISACTIVE == true)).ToList();
            }
            else
            {
                customers = db.customers.Where(e => (e.ISACTIVE == true && e.area.AREA_NAME == areaName)).ToList();
            }

            customers = customers.OrderByDescending(cus => cus.FK_AREA_ID).ThenBy(cus => cus.CUSTOMER_ID).ToList();

            pager.Collection  = customers.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = customers.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #18
0
 public static PartialCollectionResponse <TSource> ToPartialCollectionResponse <TSource>(this PagingCollection <TSource> source)
     where TSource : class
 {
     return(new PartialCollectionResponse <TSource>(source, source.Offset, source.TotalCount));
 }
コード例 #19
0
 private void RefreshKeyIndexListByPage(int page)
 {
     BackgroundWorker worker = new BackgroundWorker();
     worker.DoWork += (o, ea) =>
     {
         _PagingCollection = VehicleStatService.GetKeyIndexListByPage(page);
         KeyIndexList = _PagingCollection.Collection;
         PagingList = _PagingCollection.PagesList;
         Dispatcher.Invoke((Action)(() => KeyIndexListView.ItemsSource = KeyIndexList));
         Dispatcher.Invoke((Action)(() => KeyIndexListView.Items.Refresh()));
         Dispatcher.Invoke((Action)(() => PagingListView.ItemsSource = PagingList));
         Dispatcher.Invoke((Action)(() => PagingListView.Items.Refresh()));
     };
     worker.RunWorkerCompleted += (o, ea) =>
     {
         //work has completed. you can now interact with the UI
         VehicleCategoryDetailsPage.Instance.BusyBar2.IsBusy = false;
     };
     //set the IsBusy before you start the thread
     VehicleCategoryDetailsPage.Instance.BusyBar2.IsBusy = true;
     worker.RunWorkerAsync();
 }
コード例 #20
0
 private void RefreshVehicleListByPage(int page)
 {
     BackgroundWorker worker = new BackgroundWorker();
     worker.DoWork += (o, ea) =>
     {
         _PagingCollection = VehicleService.GetSearchedVehicleListByPage(page,_searchText);
         VehicleList = _PagingCollection.Collection;
         PagingList = _PagingCollection.PagesList;
         Dispatcher.Invoke((Action)(() => SearchedVehicleListView.ItemsSource = VehicleList));
         Dispatcher.Invoke((Action)(() => SearchedVehicleListView.Items.Refresh()));
         Dispatcher.Invoke((Action)(() => PagingListView.ItemsSource = PagingList));
         Dispatcher.Invoke((Action)(() => PagingListView.Items.Refresh()));
     };
     worker.RunWorkerCompleted += (o, ea) =>
     {
         //work has completed. you can now interact with the UI
         VehicleViewDashBoard.Instance.BusyBar.IsBusy = false;
     };
     //set the IsBusy before you start the thread
     VehicleViewDashBoard.Instance.BusyBar.IsBusy = true;
     worker.RunWorkerAsync();
 }
コード例 #21
0
 public static PartialCollectionResponse <TResult> ToPartialCollectionResponse <TSource, TResult>(this PagingCollection <TSource> source, Func <TSource, TResult> selector)
     where TResult : class
     where TSource : class
 {
     return(new PartialCollectionResponse <TResult>(source.Select(selector).ToArray(), source.Offset, source.TotalCount));
 }
コード例 #22
0
        /// <summary>
        /// Render pagination
        /// </summary>
        /// <param name="collection">Paging collection</param>
        /// <returns>Rendered pagination</returns>
        private string RenderPaginanation(PagingCollection<object> collection)
        {           
            if (collection.PagesCount > 1  && collection.CurrentPage != 0)
            {
                var pagination = "<div><nav class=\"pull-right\"><ul class=\"pagination\">";
                pagination += string.Format("<li data-page=\"1\"><a href=\"#\" >{0}</a></li>", "Перв");
                if (collection.CurrentPage > 1)
                {
                    pagination += string.Format("<li data-page=\"{1}\"><a href=\"#\" >{0}</a></li>", "Пред", collection.CurrentPage - 1);
                    pagination += string.Format("<li data-page=\"{0}\"><a href=\"#\" >{0}</a></li>", collection.CurrentPage - 1);
                }

                pagination += string.Format("<li class=\"active\" data-page=\"{0}\"><a href=\"#\">{0}</a></li>", collection.CurrentPage);
                if (collection.CurrentPage < collection.PagesCount)
                {
                    pagination += string.Format("<li data-page=\"{0}\"><a href=\"#\">{0}</a></li>", collection.CurrentPage + 1);
                    pagination += string.Format("<li data-page=\"{1}\"><a href=\"#\">{0}</a></li>", "Cлед", collection.CurrentPage + 1);
                }

                pagination += string.Format("<li data-page=\"{1}\"><a href=\"#\" >{0}</a></li>", "Посл" , collection.PagesCount);
                pagination += "</ul></nav></div>";
                return pagination;
            }

            return string.Empty;
        }