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);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public IQueryable <WorkAssignmentSummary> GetSummary(string search)
        {
            IQueryable <WorkAssignment> query = waRepo.GetAllQ();

            if (!string.IsNullOrEmpty(search))
            {
                IndexViewBase.filterOnDatePart(search, ref query);
            }

            var sum_query = from wa in query
                            group wa by new
            {
                dateSoW = TimeZoneInfo
                          .ConvertTimeFromUtc(wa.workOrder.dateTimeofWork, _clientTimeZoneInfo).Date,
                wa.workOrder.statusID
            } into dayGroup
                select new WorkAssignmentSummary
            {
                date   = dayGroup.Key.dateSoW,
                status = dayGroup.Key.statusID,
                count  = dayGroup.Count()
            };

            return(sum_query);
        }
Example #3
0
        /// <summary>
        /// Retrieve WO summary results - count of work orders with each status type for each date
        /// </summary>
        /// <param name="search">Search string criteria</param>
        /// <returns>Work Order summary results</returns>
        public IQueryable <WorkOrderSummary> GetSummary(string search)
        {
            var workOrders = repo.GetAllQ();

            IQueryable <WorkOrder> query;

            if (string.IsNullOrEmpty(search))
            {
                query = workOrders;
            }
            else
            {
                query = IndexViewBase.filterDateTimeOfWork(workOrders, search);
            }

            var group_query = from wo in query
                              group wo by new {
                dateSoW = TimeZoneInfo.ConvertTimeFromUtc(wo.dateTimeofWork, _clientTimeZoneInfo).Date,
                wo.statusID
            } into dayGroup
                select new WorkOrderSummary
            {
                date   = dayGroup.Key.dateSoW,
                status = dayGroup.Key.statusID,
                count  = dayGroup.Count()
            };

            return(group_query);
        }
Example #4
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);
        }
Example #5
0
        /// <summary>
        /// Retrieve WO summary results - count of work orders with each status type for each date
        /// </summary>
        /// <param name="search">Search string criteria</param>
        /// <returns>Work Order summary results</returns>
        public IQueryable <WorkOrderSummary> GetSummary(string search)
        {
            IQueryable <WorkOrder> query;

            if (!string.IsNullOrEmpty(search))
            {
                query = IndexViewBase.filterDateTimeOfWork(repo.GetAllQ(), search);
            }
            else
            {
                query = repo.GetAllQ();
            }
            var group_query = from wo in query
                              group wo by new {
                dateSoW = DbFunctions.TruncateTime(wo.dateTimeofWork),
                wo.statusID
            } into dayGroup
                select new WorkOrderSummary()
            {
                date   = dayGroup.Key.dateSoW,
                status = dayGroup.Key.statusID,
                count  = dayGroup.Count()
            };

            return(group_query);
        }
Example #6
0
        public dataTableResult <ActivityList> GetIndexView(viewOptions o, string culture)
        {
            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 (!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);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public IQueryable <WorkAssignmentSummary> GetSummary(string search)
        {
            IQueryable <WorkAssignment> query = waRepo.GetAllQ();

            if (!string.IsNullOrEmpty(search))
            {
                IndexViewBase.filterOnDatePart(search, ref query);
            }

            var sum_query = from wa in query //LINQ
                            group wa by new
            {
                dateSoW = DbFunctions
                          .TruncateTime(wa.workOrder.dateTimeofWork),
                wa.workOrder.statusID
            } into dayGroup
                select new WorkAssignmentSummary()
            {
                date   = dayGroup.Key.dateSoW,
                status = dayGroup.Key.statusID,
                count  = dayGroup.Count()
            };

            return(sum_query);
        }
        /// <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 <WorkerSignin> q = GetAll();

            var unused = q.Count();

            if (o.date != null)
            {
                var requestedDate = o.date.Value.DateBasedOn(ClientTimeZoneInfo); // 12:00:00 AM client time
                var endOfDay      = requestedDate.AddDays(1).AddMilliseconds(-1);

                var qDates = q.Select(the => new { the.ID, the.dateforsignin }).ToList();

                var qIDs = qDates.Where(the =>
                                        the.dateforsignin.DateTimeFrom(ClientTimeZoneInfo) >= requestedDate &&
                                        the.dateforsignin.DateTimeFrom(ClientTimeZoneInfo) <= endOfDay)
                           .Select(the => the.ID);

                q = q.Where(wsi => qIDs.Contains(wsi.ID));
                var blah = q.Count();
            }

            if (o.typeofwork_grouping != null)
            {
                IndexViewBase.typeOfWork(o, ref q);
            }
            IndexViewBase.waGrouping(o, ref q, db.WorkerRequests.AsNoTracking().AsQueryable());
            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    = GetAll().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);
        }
Example #9
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);
        }
Example #10
0
 public static void search(viewOptions o, ref IQueryable <Person> q)
 {
     if (o.sSearch.Contains("skill:"))
     {
         IndexViewBase.filterBySkill(o, ref q);
     }
     else
     {
         q = q
             .Where(p => p.Worker.dwccardnum.ToString().Contains(o.sSearch) ||
                    p.firstname1.Contains(o.sSearch) ||
                    p.firstname2.Contains(o.sSearch) ||
                    p.lastname1.Contains(o.sSearch) ||
                    p.lastname2.Contains(o.sSearch) ||
                    p.phone.Contains(o.sSearch));
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public dataTableResult <DTO.ActivitySigninList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.ActivitySigninList>();
            IQueryable <ActivitySignin> q = repo.GetAllQ();

            //
            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    = repo.GetAllQ().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);
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
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());
        }
Example #15
0
        public dataTableResult <DTO.ActivityList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.ActivityList>();
            IQueryable <Activity> q = repo.GetAllQ();
            var asRepo = (IActivitySigninRepository)asServ.GetRepo();

            if (o.personID > 0 && o.attendedActivities == false)
            {
                IndexViewBase.getUnassociated(o.personID, ref q, repo, asRepo);
            }
            if (o.personID > 0 && o.attendedActivities == true)
            {
                IndexViewBase.getAssociated(o.personID, ref q, asRepo);
            }
            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    = repo.GetAllQ().Count();
            result.query         = q.ProjectTo <DTO.ActivityList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
        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);
        }