public dataTableResult <DTO.ActivitySigninList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.ActivitySigninList>();
            IQueryable <ActivitySignin> q = GetAll();

            //
            if (o.date != null)
            {
                // good intentions marinated in panic
                q = q.Where(p =>
                            p.dateforsignin.DateBasedOn(ClientTimeZoneInfo) == o.date.Value.DateBasedOn(ClientTimeZoneInfo)
                            );
            }

            if (o.personID > 0)
            {
                IndexViewBase.GetAssociated(o.personID, ref q);
            }
            if (o.activityID != null)
            {
                q = q.Where(p => p.activityID == o.activityID);
            }
            //
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }

            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);
            result.filteredCount = q.Count();
            result.totalCount    = GetAll().Count();
            if (o.displayLength > 0)
            {
                result.query = q.ProjectTo <DTO.ActivitySigninList>(map.ConfigurationProvider)
                               .Skip(o.displayStart)
                               .Take(o.displayLength)
                               .AsEnumerable();
            }
            else
            {
                result.query = q.ProjectTo <DTO.ActivitySigninList>(map.ConfigurationProvider)
                               .AsEnumerable();
            }
            return(result);
        }
Exemplo n.º 2
0
        public dataTableResult <DTO.PersonList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.PersonList>();
            //Get all the records
            IQueryable <Person> q = repo.GetAllQ();

            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,
                                                lRepo.GetByKey(LCategory.memberstatus, LMemberStatus.Expired).ID,
                                                ref q);
            }
            if (o.showSExWorkers == true)
            {
                IndexViewBase.getSExWorkers(o,
                                            lRepo.GetByKey(LCategory.memberstatus, LMemberStatus.Sanctioned).ID,
                                            lRepo.GetByKey(LCategory.memberstatus, LMemberStatus.Expelled).ID,
                                            ref q);
            }
            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);

            result.filteredCount = q.Count();
            result.totalCount    = repo.GetAllQ().Count();
            result.query         = q.ProjectTo <DTO.PersonList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method returns the view data for the Worker Signin class.
        /// </summary>
        /// <param name="o">View options from DataTables</param>
        /// <returns>dataTableResult WorkerSigninList</returns>
        public dataTableResult <DTO.WorkerSigninList> GetIndexView(viewOptions o)
        {
            //
            var result = new dataTableResult <DTO.WorkerSigninList>();
            IQueryable <Domain.WorkerSignin> q = repo.GetAllQ();

            //
            if (o.date != null)
            {
                IndexViewBase.diffDays(o, ref q);
            }
            if (o.typeofwork_grouping != null)
            {
                IndexViewBase.typeOfWork(o, ref q);
            }
            IndexViewBase.waGrouping(o, ref q, wrServ);
            if (o.dwccardnum > 0)
            {
                IndexViewBase.dwccardnum(o, ref q);
            }
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }

            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);
            result.filteredCount = q.Count();
            result.totalCount    = repo.GetAllQ().Count();
            if (o.displayLength > 0)
            {
                result.query = q.ProjectTo <DTO.WorkerSigninList>(map.ConfigurationProvider)
                               .Skip(o.displayStart)
                               .Take(o.displayLength)
                               .AsEnumerable();
            }
            else
            {
                result.query = q.ProjectTo <DTO.WorkerSigninList>(map.ConfigurationProvider)
                               .AsEnumerable();
            }
            return(result);
        }
Exemplo n.º 4
0
        public dataTableResult <DTO.WorkerList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.WorkerList>();
            //Get all the records
            IQueryable <Worker> q = repo.GetAllQ();

            result.totalCount = q.Count();
            //Search based on search-bar string
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }
            //ORDER BY 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.query         = q.ProjectTo <DTO.WorkerList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public IEnumerable <DTO.LookupList> GetIndexView(viewOptions o)
        {
            //Get all the records
            IQueryable <Lookup> q = repo.GetAllQ();

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

            return(q.ProjectTo <DTO.LookupList>(map.ConfigurationProvider)
                   .Skip(o.displayStart)
                   .Take(o.displayLength)
                   .AsEnumerable());
        }
Exemplo n.º 7
0
        public dataTableResult <DTO.ActivityList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.ActivityList>();
            IQueryable <Activity> q = dbset.AsNoTracking();


            if (o.personID > 0 && o.attendedActivities == false)
            {
                IndexViewBase.getUnassociated(o.personID, ref q, db);
            }
            if (o.personID > 0 && o.attendedActivities == true)
            {
                IndexViewBase.getAssociated(o.personID, ref q, db);
            }
            if (!o.authenticated)
            {
                if (o.date == null)
                {
                    o.date = DateTime.Now;
                }
                IndexViewBase.unauthenticatedView((DateTime)o.date, ref q);
            }

            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q);
            }

            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);
            result.filteredCount = q.Count();
            result.totalCount    = TotalCount();
            result.query         = q.ProjectTo <DTO.ActivityList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
Exemplo n.º 8
0
        public dataTableResult <DTO.WorkAssignmentsList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.WorkAssignmentsList>();
            IQueryable <WorkAssignment> q = waRepo.GetAllQ();

            //
            //
            if (o.date != null)
            {
                IndexViewBase.diffDays((DateTime)o.date, ref q);
            }
            if (o.typeofwork_grouping > 0)
            {
                IndexViewBase.typeOfWork(o, ref q, lRepo);
            }
            if (o.woid > 0)
            {
                IndexViewBase.WOID(o, ref q);
            }
            if (o.personID > 0)
            {
                IndexViewBase.WID(o, ref q);
            }
            if (o.status > 0)
            {
                IndexViewBase.status(o, ref q);
            }
            if (o.showPending == false)
            {
                IndexViewBase.filterPending(o, ref q);
            }
            if (!string.IsNullOrEmpty(o.wa_grouping))
            {
                IndexViewBase.waGrouping(o, ref q, lRepo);
            }
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                IndexViewBase.search(o, ref q, lRepo);
            }
            if (o.dwccardnum > 0)
            {
                var worker = wRepo.GetById((int)o.dwccardnum);
                IndexViewBase.filterOnSkill(o, q, lRepo, worker);
            }
            //Sort the Persons based on column selection
            IndexViewBase.sortOnColName(o.sortColName, o.orderDescending, ref q);
            //e = e.ToList();
            result.filteredCount = q.Count();
            if (o.displayLength > 0)
            {
                result.query = q.ProjectTo <DTO.WorkAssignmentsList>(map.ConfigurationProvider)
                               .Skip(o.displayStart)
                               .Take(o.displayLength)
                               .AsEnumerable();
            }
            else
            {
                result.query = q.ProjectTo <DTO.WorkAssignmentsList>(map.ConfigurationProvider)
                               .AsEnumerable();
            }
            result.totalCount = waRepo.GetAllQ().Count();
            return(result);
        }