Пример #1
0
        public dataTableResult <Email> GetIndexView(viewOptions o)
        {
            var result           = new dataTableResult <Email>();
            IQueryable <Email> q = repo.GetAllQ();

            if (o.woid > 0)
            {
                IndexViewBase.filterOnWorkorder(o, ref q);
            }
            if (o.emailID.HasValue)
            {
                IndexViewBase.filterOnID(o, ref q);
            }
            if (o.EmployerID.HasValue)
            {
                IndexViewBase.filterOnEmployer(o, ref q);
            }
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }

            IEnumerable <Email> e = q.AsEnumerable();

            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref e);
            result.filteredCount = e.Count();
            result.totalCount    = repo.GetAllQ().Count();
            result.query         = e.Skip(o.displayStart).Take(o.displayLength);
            return(result);
        }