コード例 #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);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public dataTableResult <DTO.EventList> GetIndexView(viewOptions o)
        {
            var result = new dataTableResult <DTO.EventList>();
            //Get all the records
            IQueryable <Event> q = GetEvents(o.personID);

            result.totalCount = q.Count();
            //Search based on search-bar string
            if (!string.IsNullOrEmpty(o.sSearch))
            {
                q = GetEvents(o.personID)
                    .Where(p => p.notes.Contains(o.sSearch));
            }

            //Sort the Persons based on column selection
            switch (o.sortColName)
            {
            case "dateupdated": q = o.orderDescending ? q.OrderByDescending(p => p.dateupdated) : q.OrderBy(p => p.dateupdated); break;

            default: q = o.orderDescending ? q.OrderByDescending(p => p.dateupdated) : q.OrderBy(p => p.dateupdated); break;
            }

            //Limit results to the display length and offset
            result.filteredCount = q.Count();
            result.query         = q.ProjectTo <DTO.EventList>(map.ConfigurationProvider)
                                   .Skip(o.displayStart)
                                   .Take(o.displayLength)
                                   .AsEnumerable();
            return(result);
        }
コード例 #3
0
        public static void waGrouping(viewOptions o, ref IQueryable <WorkAssignment> q, ILookupRepository lRepo)
        {
            switch (o.wa_grouping)
            {
            case "open": q = q.Where(p => p.workerAssignedID == null &&
                                     p.workOrder.statusID == WorkOrder.iActive);
                break;

            case "assigned": q = q.Where(p => p.workerAssignedID != null &&
                                         p.workOrder.statusID == WorkOrder.iActive); break;

            case "requested":
                q = q.Where(p => p.workerAssignedID == null &&
                            p.workOrder.workerRequestsDDD.Any() == true &&
                            p.workOrder.statusID == WorkOrder.iActive);

                break;

            case "skilled": q = q.Join(lRepo.GetAllQ(),
                                       wa => wa.skillID,
                                       sk => sk.ID,
                                       (wa, sk) => new { wa, sk })
                                .Where(jj => jj.sk.speciality == true &&
                                       jj.wa.workerAssignedDDD == null &&
                                       jj.wa.workOrder.statusID == WorkOrder.iActive)
                                .Select(jj => jj.wa);
                break;

            case "completed":
                q = q.Where(wa => wa.workOrder.statusID == WorkOrder.iCompleted);
                break;
            }
        }
コード例 #4
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);
        }
コード例 #5
0
        public static void search(viewOptions o, ref IQueryable <WorkOrder> q)
        {
            bool     isDateTime = false;
            DateTime parsedTime;

            if (isDateTime = DateTime.TryParse(o.sSearch, out parsedTime))
            {
                if (isMonthSpecific.IsMatch(o.sSearch))  //Regex for month/year
                {
                    q = q.Where(p => SqlServerDbFunctionsExtensions
                                .DateDiffMonth(null, p.dateTimeofWork, parsedTime) == 0 ? true : false);
                }
                if (isDaySpecific.IsMatch(o.sSearch))  //Regex for day/month/year
                {
                    q = q.Where(p => SqlServerDbFunctionsExtensions
                                .DateDiffDay(null, p.dateTimeofWork, parsedTime) == 0 ? true : false);
                }
                if (isTimeSpecific.IsMatch(o.sSearch)) //Regex for day/month/year time
                {
                    q = q.Where(p => SqlServerDbFunctionsExtensions
                                .DateDiffHour(null, p.dateTimeofWork, parsedTime) == 0 ? true : false);
                }
            }
            else
            {
                q = q
                    .Where(p => p.ID.ToString().Contains(o.sSearch) ||
                           p.paperOrderNum.ToString().Contains(o.sSearch) ||
                           p.contactName.Contains(o.sSearch) ||
                           p.workSiteAddress1.Contains(o.sSearch) ||
                           p.updatedby.Contains(o.sSearch));
            }
        }
コード例 #6
0
 public static void search(viewOptions o, ref IQueryable <Email> q)
 {
     q = q.Where(p => //p.active.ToString().Contains(o.sSearch) ||
                 p.subject.Contains(o.sSearch) ||
                 p.emailTo.Contains(o.sSearch) ||
                 p.updatedby.Contains(o.sSearch));
 }
コード例 #7
0
ファイル: IndexViewBase.cs プロジェクト: scotmoor/Machete
        public static void search(viewOptions o, ref IQueryable <WorkAssignment> q, ILookupRepository lRepo)
        {
            bool     isDateTime = false;
            DateTime parsedTime;

            if (isDateTime = DateTime.TryParse(o.sSearch, out parsedTime))
            {
                filterOnDatePart(o.sSearch, parsedTime, ref q);
            }
            else
            {
                o.sSearch = o.sSearch.ToLower();
                q         = q
                            .Join(lRepo.GetAllQ(), wa => wa.skillID, sk => sk.ID, (wa, sk) => new { wa, sk })
                            .Where(p =>
                                   p.wa.workOrder.paperOrderNum.ToString().Contains(o.sSearch) ||
                                   (p.wa.description != null && p.wa.description.ToLower().Contains(o.sSearch)) ||
                                   p.sk.text_EN.ToLower().Contains(o.sSearch) ||
                                   p.sk.text_ES.ToLower().Contains(o.sSearch) ||
                                   p.wa.workOrder.contactName.ToLower().Contains(o.sSearch) ||
                                   p.wa.workOrder.zipcode.ToString().Contains(o.sSearch) ||
                                   p.wa.workOrder.Employer.name.ToLower().Contains(o.sSearch) ||
                                   //p.dateupdated.ToString().ContainsOIC(param.sSearch) ||
                                   p.wa.updatedby.ToLower().Contains(o.sSearch)).Select(p => p.wa);
            }
        }
コード例 #8
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);
        }
コード例 #9
0
 public static void search(viewOptions o, ref IQueryable <Lookup> q)
 {
     q = q
         .Where(p => p.text_EN.Contains(o.sSearch) ||
                p.text_ES.Contains(o.sSearch) ||
                p.category.Contains(o.sSearch) ||
                p.subcategory.Contains(o.sSearch));
 }
コード例 #10
0
 public static void filterOnWorkorder(viewOptions o, ref IQueryable <Email> q)
 {
     if (o.woid == 0)
     {
         return;
     }
     q = q.SelectMany(email => email.WorkOrders.Where(w => w.ID == o.woid), (email, wo) => email);
 }
コード例 #11
0
 public static void search(viewOptions o, ref IQueryable <ActivitySignin> q)
 {
     q = q.Where(asi => SqlFunctions.StringConvert((decimal)asi.dwccardnum).Contains(o.sSearch) ||
                 asi.person.firstname1.Contains(o.sSearch) ||
                 asi.person.firstname2.Contains(o.sSearch) ||
                 asi.person.lastname1.Contains(o.sSearch) ||
                 asi.person.lastname2.Contains(o.sSearch)
                 );
 }
コード例 #12
0
 public static void search(viewOptions o, ref IQueryable <WorkerSignin> q)
 {
     q = q.Where(wsi => SqlFunctions.StringConvert((decimal)wsi.dwccardnum).Contains(o.sSearch) ||
                 wsi.worker.Person.firstname1.Contains(o.sSearch) ||
                 wsi.worker.Person.firstname2.Contains(o.sSearch) ||
                 wsi.worker.Person.lastname1.Contains(o.sSearch) ||
                 wsi.worker.Person.lastname2.Contains(o.sSearch)     //||
                 );
 }
コード例 #13
0
 public static void search(viewOptions o, ref IQueryable <Worker> q)
 {
     q = q.Where(p => p.dwccardnum.ToString().Contains(o.sSearch) ||
                 p.Person.firstname1.Contains(o.sSearch) ||
                 p.Person.firstname2.Contains(o.sSearch) ||
                 p.Person.lastname1.Contains(o.sSearch) ||
                 p.Person.lastname2.Contains(o.sSearch)
                 );
 }
コード例 #14
0
 public static void search(viewOptions o, ref IQueryable <WorkerSignin> q)
 {
     q = q.Where(wsi => wsi.dwccardnum.ToString().Contains(o.sSearch) ||
                 wsi.worker.Person.firstname1.ToUpper().Contains(o.sSearch.ToUpper()) ||
                 wsi.worker.Person.firstname2.ToUpper().Contains(o.sSearch.ToUpper()) ||
                 wsi.worker.Person.lastname1.ToUpper().Contains(o.sSearch.ToUpper()) ||
                 wsi.worker.Person.lastname2.ToUpper().Contains(o.sSearch.ToUpper())
                 );
 }
コード例 #15
0
 public static void typeOfWork(viewOptions o, ref IQueryable <WorkAssignment> q, ILookupRepository lRepo)
 {
     q = q.Join(lRepo.GetAllQ(),
                wa => wa.skillID,
                sk => sk.ID,
                (wa, sk) => new { wa, sk })
         .Where(jj => jj.sk.typeOfWorkID == o.typeofwork_grouping)
         .Select(jj => jj.wa);
 }
コード例 #16
0
 public static void search(viewOptions o, ref IQueryable <ActivitySignin> q)
 {
     q = q.Where(asi => asi.dwccardnum.ToString().Contains(o.sSearch) ||
                 asi.person.firstname1.Contains(o.sSearch) ||
                 asi.person.firstname2.Contains(o.sSearch) ||
                 asi.person.lastname1.Contains(o.sSearch) ||
                 asi.person.lastname2.Contains(o.sSearch)
                 );
 }
コード例 #17
0
 /// <summary>
 /// Search text and date fields of an activity for a query.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="q"></param>
 /// <param name="lRepo"></param>
 public static void search(viewOptions o, ref IQueryable <Activity> q)
 {
     q = q.Where(p => p.notes.Contains(o.sSearch) ||
                 p.teacher.Contains(o.sSearch) ||
                 p.nameES.Contains(o.sSearch) ||
                 p.typeES.Contains(o.sSearch) ||
                 p.nameEN.Contains(o.sSearch) ||
                 p.typeEN.Contains(o.sSearch));
 }
コード例 #18
0
 public static void filterOnEmployer(viewOptions o, ref IQueryable <Email> q)
 {
     if (o.EmployerID == null)
     {
         return;
     }
     q = q.Where(ee => ee.ID == (int)o.EmployerID)
         .SelectMany(e => e.WorkOrders, (e, wo) => wo)
         .SelectMany(wwo => wwo.Emails, (wwo, email) => email);
 }
コード例 #19
0
 public static void search(viewOptions o, ref IQueryable <Worker> q)
 {
     q = q.Where(p => SqlFunctions.StringConvert((decimal)p.dwccardnum).Contains(o.sSearch) ||
                 p.Person.firstname1.Contains(o.sSearch) ||
                 p.Person.firstname2.Contains(o.sSearch) ||
                 p.Person.lastname1.Contains(o.sSearch) ||
                 p.Person.lastname2.Contains(o.sSearch) //||
                                                        //DbFunctions.p.memberexpirationdate.ToString().Contains(o.sSearch)
                 );
 }
コード例 #20
0
 public static void search <T>(viewOptions o, ref IEnumerable <T> e, IEnumerable <Worker> wcache) where T : Signin
 {
     e = e.Join(wcache, s => s.dwccardnum, w => w.dwccardnum, (s, w) => new { s, w })
         .Where(p => p.w.dwccardnum.ToString().ContainsOIC(o.sSearch) ||
                p.w.Person.firstname1.ContainsOIC(o.sSearch) ||
                p.w.Person.firstname2.ContainsOIC(o.sSearch) ||
                p.w.Person.lastname1.ContainsOIC(o.sSearch) ||
                p.w.Person.lastname2.ContainsOIC(o.sSearch))
         .Select(a => a.s);
 }
コード例 #21
0
 public static void search(viewOptions o, ref IQueryable <Person> q)
 {
     q = q
         .Where(p => SqlFunctions.StringConvert((decimal)p.Worker.dwccardnum).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));
 }
コード例 #22
0
 public static void search(viewOptions o, ref IQueryable <Employer> q)
 {
     q = q.Where(p => //p.active.ToString().Contains(o.sSearch) ||
                 p.name.Contains(o.sSearch) ||
                 p.address1.Contains(o.sSearch) ||
                 p.phone.Contains(o.sSearch) ||
                 p.cellphone.Contains(o.sSearch) ||
                 p.zipcode.Contains(o.sSearch) ||
                 p.email.Contains(o.sSearch) ||
                 p.city.Contains(o.sSearch));
 }
コード例 #23
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 <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);
        }
コード例 #24
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);
        }
コード例 #25
0
 public void TestInitialize()
 {
     frb = new FluentRecordBase();
     dOptions = new viewOptions
     {
         CI = new CultureInfo("en-US", false),
         sSearch = "",
         date = DateTime.Today,
         dwccardnum = null,
         woid = null,
         orderDescending = false,
         sortColName = "",
         displayStart = 0,
         displayLength = 20
     };
 }
コード例 #26
0
        public static void diffDays(viewOptions o, ref IQueryable <WorkAssignment> q)
        {
            DateTime sunday;

            if (o.date.Value.DayOfWeek == DayOfWeek.Saturday)
            {
                sunday = o.date.Value.AddDays(1);
                q      = q.Where(p => DbFunctions.DiffDays(p.workOrder.dateTimeofWork, o.date) == 0 ? true : false ||
                                 DbFunctions.DiffDays(p.workOrder.dateTimeofWork, sunday) == 0 ? true : false
                                 );
            }
            else
            {
                q = q.Where(p => DbFunctions.DiffDays(p.workOrder.dateTimeofWork, o.date) == 0 ? true : false);
            }
        }
コード例 #27
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));
     }
 }
コード例 #28
0
        /// <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);
        }
コード例 #29
0
ファイル: IndexViewBase.cs プロジェクト: scotmoor/Machete
        /// <summary>
        /// Search text and date fields of an activity for a query.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="q"></param>
        /// <param name="lRepo"></param>
        public static void search(viewOptions o, TimeZoneInfo clientTimeZoneInfo, ref IQueryable <Activity> q)
        {
            bool     isDateTime = false;
            DateTime parsedTime;

            if (isDateTime = DateTime.TryParse(o.sSearch, out parsedTime))
            {
                q = q.Where(p => p.dateStart.DateBasedOn(clientTimeZoneInfo) == parsedTime.Date);
            }
            else
            {
                q = q.Where(p => p.notes.Contains(o.sSearch) ||
                            p.teacher.Contains(o.sSearch) ||
                            p.nameES.Contains(o.sSearch) ||
                            p.typeES.Contains(o.sSearch) ||
                            p.nameEN.Contains(o.sSearch) ||
                            p.typeEN.Contains(o.sSearch));
            }
        }
コード例 #30
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);
        }
コード例 #31
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);
        }
コード例 #32
0
        public void GetIndexView()
        {
            //
            //Arrange
            var Date = frb.ToServWorkOrder().GetSummary().OrderByDescending(a => a.date).First().date.Value.AddDays(1);

            frb.AddWorkOrder(dateTimeOfWork: Date).AddWorkOrder(dateTimeOfWork: Date).AddWorkOrder(dateTimeOfWork: Date);
            frb.AddWorkOrder(dateTimeOfWork: Date).AddWorkOrder(dateTimeOfWork: Date).AddWorkOrder(dateTimeOfWork: Date);
            viewOptions o = new viewOptions();
            o.CI = new CultureInfo("en-US", false);
            o.sSearch = Date.ToShortDateString();
            o.EmployerID = null;
            o.status = null;
            o.orderDescending = true;
            o.displayStart = 0;
            o.displayLength = 20;
            o.sortColName = "WOID";
            //
            //Act
            dataTableResult<WorkOrder> result = frb.ToServWorkOrder().GetIndexView(o);
            //
            //Assert
            IEnumerable<WorkOrder> query = result.query.ToList();
            Assert.IsNotNull(result, "IEnumerable is Null");
            Assert.IsNotNull(query, "IEnumerable.query is null");
            Assert.AreEqual(6, query.Count(), "Expected 6, but GetIndexView returned {0} records", query.Count());
        }
コード例 #33
0
 public void TestInitialize()
 {
     frb = new FluentRecordBase();
     //frb.Initialize(new MacheteInitializer(), "macheteConnection");
     _dOptions = new viewOptions
     {
         CI = new CultureInfo("en-US", false),
         sSearch = "",
         date = DateTime.Today,
         dwccardnum = null,
         woid = null,
         orderDescending = true,
         sortColName = "WOID",
         displayStart = 0,
         displayLength = 20
     };
 }