public int FetchCount() { CustomersDataContext customersDataContext = new CustomersDataContext(); count = customersDataContext.GetCount(dateFrom, dateTo).ToList().First().Count.Value; return(count); }
public IList <Customer> FetchRange(int startIndex, int pageCount, out int overallCount) { CustomersDataContext customersDataContext = new CustomersDataContext(); IList <Customer> customersResult; startIndex = startIndex + 1; // SQL index starts at 1. int endIndex = startIndex + pageCount - 1; // GetCustomers returns items with indices startIndex through endIndex, inclusive. overallCount = count; // In this case it's ok not to get the count again because we're assuming the data in the database is not changing. customersResult = customersDataContext.GetSortedFilteredCustomers(startIndex, endIndex, this.dateFrom, this.dateTo, this.sortField).ToList(); return(customersResult); }