Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public dataTableResult <DTO.EmployersList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.EmployersList>();
            //Get all the records
            IQueryable <Employer> q = repo.GetAllQ();

            //Search based on search-bar string
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }

            if (o.onlineSource == true)
            {
                IndexViewBase.filterOnlineSource(o, ref q);
            }
            //Sort the Persons based on column selection
            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);
            //Limit results to the display length and offset
            result.filteredCount = q.Count();
            result.totalCount    = repo.GetAllQ().Count();
            result.query         = q.ProjectTo <DTO.EmployersList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
Example #2
0
        /// <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);
        }