/// <summary> /// Retrieve index view of work orders /// </summary> /// <param name="vo">viewOptions object</param> /// <returns>Table of work orders</returns> public dataTableResult <DTO.WorkOrdersList> GetIndexView(viewOptions o) { //Get all the records var result = new dataTableResult <DTO.WorkOrdersList>(); IQueryable <WorkOrder> q = repo.GetAllQ(); // if (o.EmployerID != null) { IndexViewBase.filterEmployer(o, ref q); } if (o.employerGuid != null) { IndexViewBase.filterEmployerByGuid(o, ref q); } if (o.status != null) { IndexViewBase.filterStatus(o, ref q); } if (o.onlineSource == true) { IndexViewBase.filterOnlineSource(o, ref q); } if (!string.IsNullOrEmpty(o.sSearch)) { IndexViewBase.search(o, ref q); } // TODO restore CultureInfo IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, /*o.CI.TwoLetterISOLanguageName*/ "en", ref q); // result.filteredCount = q.Count(); result.query = q.ProjectTo <DTO.WorkOrdersList>(map.ConfigurationProvider) .Skip(o.displayStart) .Take(o.displayLength) .AsEnumerable(); result.totalCount = repo.GetAllQ().Count(); return(result); }