From d150bcea81ec41f4267e6d2dc85e6fdec289a540 Mon Sep 17 00:00:00 2001 From: esteban-gs Date: Sat, 30 Nov 2019 20:38:17 -0800 Subject: [PATCH] #519 #569 Dispatch Timezone and Lookup View --- Machete.Service/WorkAssignmentService.cs | 24 ++++++++++++++++++- .../Controllers/Legacy/ConfigController.cs | 8 +++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Machete.Service/WorkAssignmentService.cs b/Machete.Service/WorkAssignmentService.cs index 9df983d7a..020b4f202 100644 --- a/Machete.Service/WorkAssignmentService.cs +++ b/Machete.Service/WorkAssignmentService.cs @@ -94,7 +94,29 @@ public override WorkAssignment Get(int id) IQueryable q = waRepo.GetAllQ(); // // - if (o.date != null) IndexViewBase.diffDays((DateTime) o.date, ref q); + if (o.date != null) + { + var requestedDate = o.date.Value.DateBasedOn(_clientTimeZoneInfo); + var endOfDay = requestedDate.AddDays(1).AddMilliseconds(-1); + + DateTime sunday; + if (requestedDate.DayOfWeek == DayOfWeek.Saturday) + { + sunday = requestedDate.AddDays(1); + q = q.Where(p => + p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date >= requestedDate.Date + && p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date <= sunday.Date + ); + } + else + { + q = q.Where(p => p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date == requestedDate.Date); + } + + // 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); diff --git a/Machete.Web/Controllers/Legacy/ConfigController.cs b/Machete.Web/Controllers/Legacy/ConfigController.cs index 40c3d33d7..8c06f2b80 100644 --- a/Machete.Web/Controllers/Legacy/ConfigController.cs +++ b/Machete.Web/Controllers/Legacy/ConfigController.cs @@ -61,7 +61,7 @@ public LookupController(ILookupService serv, public ActionResult Index() { ViewBag.configCategories = def.configCategories(); - return View("~/Views/Config/Index.cshtml"); + return View("~/Views/Lookup/Index.cshtml"); } [Authorize(Roles = "Administrator, Manager")] public ActionResult AjaxHandler(jQueryDataTableParam param) @@ -90,7 +90,7 @@ public ActionResult Create() { var m = map.Map(new Lookup()); m.def = def; - return PartialView("~/Views/Config/Create.cshtml", m); + return PartialView("~/Views/Lookup/Create.cshtml", m); } /// /// @@ -127,7 +127,7 @@ public ActionResult Edit(int id) { var m = map.Map(serv.Get(id)); m.def = def; - return PartialView("~/Views/Config/Edit.cshtml", m); + return PartialView("~/Views/Lookup/Edit.cshtml", m); } /// /// @@ -160,7 +160,7 @@ public ActionResult View(int id) { var m = map.Map(serv.Get(id)); m.def = def; - return PartialView("~/Views/Config/Edit.cshtml", m); + return PartialView("~/Views/Lookup/Edit.cshtml", m); } /// ///