From fdc8579ff4f853ca7f11252a5d762327bcc17b04 Mon Sep 17 00:00:00 2001 From: michele Date: Tue, 9 Jul 2024 16:49:13 +0200 Subject: [PATCH] MICHELE: risolto problema data timezone + paginazione che da errore --- Controllers/DestinazioniController.cs | 46 +++++++++++++++++---------- Views/Destinazioni/Index.cshtml | 13 ++++++-- Views/Giri/Index.cshtml | 10 +++--- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/Controllers/DestinazioniController.cs b/Controllers/DestinazioniController.cs index 959a11b..326c8bb 100644 --- a/Controllers/DestinazioniController.cs +++ b/Controllers/DestinazioniController.cs @@ -24,14 +24,35 @@ namespace SoftwayWeb.Controllers apiUrl = key; } - public IActionResult Index(string id, string? codAutista, DateTime dataGiro, /*Destinazioni_Out giro,*/ string? codMezzo, int? page = 1) + public IActionResult Index(string id, string? codAutista, DateTime dataGiro, string? codMezzo, int? page = 1) { helper = new SessionHelper(this); token = helper.GetStringValue("tok"); + + ViewBag.CodAutista = codAutista; + //if (codAutista == null) + //{ + // //ViewBag.CodAutista = "codAutista"; + // codAutista = ViewBag.CodAutista; + //} + + + //if (!string.IsNullOrEmpty(codAutista)) + //{ + // //modelList = modelList.Where(x => x.CodAutista.Contains(codAutista)).ToList(); + + // ViewData["CurrentFilter"] = codAutista; + + // ViewBag.Autista = codAutista; + //} + //else + //{ + // ViewData = ViewBag.CodAutista; + //} + urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo"; - //dataGiro = dataGiro.ToUniversalTime(); - //urlBase = urlBase + "autista=" + giro.CodAutista + "datGiro=" /*+ giro.DataGiro*/; - urlBase = urlBase + "?autista=" + codAutista.TrimEnd() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/; + string dataGi = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'"); + urlBase = urlBase + "?autista=" + codAutista.TrimEnd() + "&dataGiro=" + dataGi + "&mezzo=" + codMezzo; Uri baseAddress = new Uri(urlBase); client = new HttpClient(); client.BaseAddress = baseAddress; @@ -43,20 +64,13 @@ namespace SoftwayWeb.Controllers { string dato = response.Content.ReadAsStringAsync().Result; modelList = JsonConvert.DeserializeObject>(dato); - modelList = modelList.Where(x => x.serialeGiro == id && x.CodAutista.Contains(codAutista.TrimEnd())).ToList(); + modelList = modelList.Where(x => x.serialeGiro == id).ToList(); - if (!string.IsNullOrEmpty(codAutista)) - { - //modelList = modelList.Where(x => x.CodAutista.Contains(codAutista)).ToList(); + //ViewData["codAutista"] = codAutista; + //ViewBag.CodAutista = "codAutista"; + //ViewBag.DataGiro = dataGiro; + //ViewBag.CodMezzo = codMezzo; - ViewData["CurrentFilter"] = codAutista; - - ViewBag.Autista = codAutista; - } - else - { - ViewData["CurrentFilter"] = null; - } if (page != null && page < 1) { diff --git a/Views/Destinazioni/Index.cshtml b/Views/Destinazioni/Index.cshtml index d8d67c3..0497947 100644 --- a/Views/Destinazioni/Index.cshtml +++ b/Views/Destinazioni/Index.cshtml @@ -4,6 +4,7 @@ @using X.PagedList; @using X.PagedList.Mvc.Core; @using X.PagedList; + @{ ViewData["Title"] = "Lista Destinazioni"; Layout = "~/Views/Shared/_LayoutAreaRis.cshtml"; @@ -11,6 +12,11 @@

Lista destinazioni

+ +

@ViewBag.CodAutista

+ + + @*

Create New

@@ -144,11 +150,11 @@ @if (item.ConsFatta.consFattaFlagCons.Contains("S")) { - cons + cons } else { - nocons + nocons } } @@ -164,7 +170,7 @@     - notyet + notyet } @@ -202,6 +208,7 @@ @Html.HiddenFor(modelItem => item.ItemList) + @* @if (item.ConsFatta != null){ cons diff --git a/Views/Giri/Index.cshtml b/Views/Giri/Index.cshtml index 88c3dae..7a9b65d 100644 --- a/Views/Giri/Index.cshtml +++ b/Views/Giri/Index.cshtml @@ -87,11 +87,11 @@ @Html.DisplayFor(modelItem => item.parzialeImpRec) - nocons - nocons - nocons - nocons - nocons + nocons + nocons + nocons + nocons + nocons }