Example #1
0
        public dataTableResult <DTO.PersonList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.PersonList>();
            //Get all the records
            IQueryable <Person> q = GetAll();

            result.totalCount = q.Count();
            //
            //Search based on search-bar string
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }
            if (o.showWorkers == true)
            {
                IndexViewBase.getWorkers(o, ref q);
            }
            if (o.showNotWorkers == true)
            {
                IndexViewBase.getNotWorkers(o, ref q);
            }
            if (o.showExpiredWorkers == true)
            {
                IndexViewBase.getExpiredWorkers(o,
                                                WorkOrder.iExpired,
                                                ref q);
            }
            if (o.showSExWorkers == true)
            {
                IndexViewBase.getSExWorkers(o,
                                            Worker.iSanctioned,
                                            Worker.iExpelled,
                                            ref q);
            }
            if (o.showActiveWorkers == true)
            {
                IndexViewBase.GetActiveWorkers(Worker.iActive,
                                               ref q);
            }
            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);

            result.filteredCount = q.Count();
            result.totalCount    = GetAll().Count();
            result.query         = q.ProjectTo <DTO.PersonList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }