Example #1
0
        public void GetIndexView()
        {
            //
            //Arrange
            // get find latest workorder, get date from it, and add a day (make sure we're only records for this test)
            var Date = frb.ToServ <IWorkOrderService>().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 <DTO.WorkOrdersList> result = frb.ToServ <IWorkOrderService>().GetIndexView(o);
            //
            //Assert
            IEnumerable <DTO.WorkOrdersList> 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());
        }
Example #2
0
        public IHttpActionResult Get()
        {
            var vo = new viewOptions();

            vo.displayLength = 10;
            vo.displayStart  = 0;
            dataTableResult <DTO.EmployersList> list = serv.GetIndexView(vo);
            var result = list.query
                         .Select(
                e => map.Map <DTO.EmployersList, ViewModel.EmployersList>(e)
                ).AsEnumerable();

            return(Json(new { data = result }));
        }
        public ActionResult Get()
        {
            var vo = new viewOptions();

            vo.displayLength = 10;
            vo.displayStart  = 0;
            dataTableResult <DTO.WorkAssignmentsList> list = serv.GetIndexView(vo);
            var result = list.query
                         .Select(
                e => map.Map <DTO.WorkAssignmentsList, Machete.Web.ViewModel.Api.WorkAssignment>(e)
                ).AsEnumerable();

            return(new JsonResult(new { data = result }));
        }
Example #4
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     = "WOID",
         displayStart    = 0,
         displayLength   = 20
     };
 }
Example #5
0
        public IHttpActionResult Get()
        {
            var vo = new viewOptions();

            vo.displayLength = 500; // TODO dumping on the client; will address Angular using search later
            vo.displayStart  = 0;
            vo.employerGuid  = userSubject;
            vo.CI            = Thread.CurrentThread.CurrentCulture;
            dataTableResult <Service.DTO.WorkOrdersList> list = woServ.GetIndexView(vo);
            var result = list.query
                         .Select(
                e => map.Map <Service.DTO.WorkOrdersList, ViewModel.WorkOrder>(e)
                ).AsEnumerable();

            return(Json(new { data = result }));
        }
Example #6
0
        public ActionResult Get()
        {
            var vo = new viewOptions();

            vo.displayLength = 10;
            vo.displayStart  = 0;
            vo.employerGuid  = UserSubject;
            dataTableResult <DTO.WorkOrdersList> list = _serv.GetIndexView(vo);

            MapperHelpers.ClientTimeZoneInfo = _clientTimeZoneInfo;

            var result = list.query
                         .Select(
                e => _map.Map <DTO.WorkOrdersList, ViewModel.Api.WorkOrder>(e)
                ).AsEnumerable();

            return(new JsonResult(new { data = result }));
        }
        public ActionResult <IEnumerable <WorkOrderVM> > Get()
        {
            var vo = new viewOptions();

            vo.displayLength = 500; // TODO dumping on the client; will address Angular using search later
            vo.displayStart  = 0;
            vo.employerGuid  = UserSubject;
            vo.CI            = Thread.CurrentThread.CurrentCulture;
            dataTableResult <Service.DTO.WorkOrdersList> list = serv.GetIndexView(vo);

            MapperHelpers.ClientTimeZoneInfo = _clientTimeZoneInfo;

            var result = list.query
                         .Select(
                e => map.Map <Service.DTO.WorkOrdersList, WorkOrderVM>(e)
                ).AsEnumerable();

            return(Ok(new { data = result }));
        }
        public new ActionResult <WorkOrderVM> Get(
            [FromQuery] ApiRequestParams apiRequestParams)
        {
            var vo = new viewOptions();

            vo.displayLength = apiRequestParams.pageSize;
            vo.displayStart  = apiRequestParams.Skip;
            vo.employerGuid  = UserSubject;
            dataTableResult <DTO.WorkOrdersList> list = serv.GetIndexView(vo);

            MapperHelpers.ClientTimeZoneInfo = _clientTimeZoneInfo;

            var result = list.query
                         .Select(
                e => map.Map <DTO.WorkOrdersList, WorkOrderVM>(e)
                ).AsEnumerable();

            return(Ok(new { data = result }));
        }
 public void TestInitialize()
 {
     frb       = FluentRecordBaseFactory.Get();
     _dOptions = new viewOptions
     {
         CI      = new CultureInfo("en-US", false),
         sSearch = "",
         date    = TimeZoneInfo
                   .ConvertTimeToUtc(
             DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Unspecified),
             frb.ClientTimeZoneInfo
             ),
         dwccardnum      = null,
         woid            = null,
         orderDescending = true,
         sortColName     = "WOID",
         displayStart    = 0,
         displayLength   = 20
     };
 }
        public void GetIndexView_Filters_Workes_When_Skill_Codes_when_keyword_passed()
        {
            // Arrange
            viewOptions vo = new viewOptions
            {
                sSearch     = "skill: a, b ,c", // skill codes
                sortColName = "text_EN",
            };

            var skill1 = frb.ToServ <ILookupService>().Create(new Lookup
            {
                text_EN      = "special skill 1",
                text_ES      = "special skill 1",
                speciality   = true,
                ltrCode      = "a",
                level        = 1,
                category     = "skill",
                subcategory  = "general",
                wage         = 23,
                minHour      = 3,
                typeOfWorkID = 20
            }, "fake");
            var skill2 = frb.ToServ <ILookupService>().Create(new Lookup
            {
                text_EN      = "special skill 2",
                text_ES      = "special skill 2",
                ltrCode      = "b",
                speciality   = true,
                level        = 1,
                category     = "skill",
                subcategory  = "general",
                wage         = 23,
                minHour      = 3,
                typeOfWorkID = 20
            }, "fake");
            var skill3 = frb.ToServ <ILookupService>().Create(new Lookup
            {
                text_EN      = "special skill 3",
                text_ES      = "special skill 3",
                ltrCode      = "c",
                speciality   = true,
                level        = 1,
                category     = "skill",
                subcategory  = "general",
                wage         = 23,
                minHour      = 3,
                typeOfWorkID = 20
            }, "fake");

            var w = frb.AddWorker(skill1.ID, skill2.ID, skill3.ID);

            // Act
            dataTableResult <Service.DTO.PersonList> result = frb.ToServ <IPersonService>().GetIndexView(vo);

            // Assert
            Assert.IsTrue(result.filteredCount == 1);

            // Clean up
            frb.ToServ <ILookupService>().Delete(skill1.ID, "fake");
            frb.ToServ <ILookupService>().Delete(skill2.ID, "fake");
            frb.ToServ <ILookupService>().Delete(skill3.ID, "fake");
            frb.ToServ <IWorkerService>().Delete(w.ID, "test");
        }