diff --git a/Controllers/TimbratureController.cs b/Controllers/TimbratureController.cs index a50403d..c4e0e70 100644 --- a/Controllers/TimbratureController.cs +++ b/Controllers/TimbratureController.cs @@ -16,7 +16,7 @@ namespace VirtualTask.Controllers string tenant = string.Empty; string errMes = string.Empty; string admin = string.Empty; - string time_sheet=string.Empty; + string time_sheet = string.Empty; HttpClient client; private readonly IConfiguration _configuration; @@ -117,7 +117,6 @@ namespace VirtualTask.Controllers { SessionHelper helper = new SessionHelper(this); - token = helper.GetStringValue("tok"); apiUrl = helper.GetStringValue("apiUrl"); @@ -204,6 +203,18 @@ namespace VirtualTask.Controllers public IActionResult ExportExcel(DateTime dataIni, DateTime dataFin, string commessa, string? tecnico) { SessionHelper helper = new SessionHelper(this); + + //16/09/2024 messo questo controllo perchè se faccio esporta senza aver fatto cerca va in errore quando crea file excel. + if (tecnico.Equals("System.Collections.Generic.List`1[Microsoft.AspNetCore.Mvc.Rendering.SelectListItem]")) + { + tecnico = string.Empty; + } + + if (commessa.Equals("System.Collections.Generic.List`1[Microsoft.AspNetCore.Mvc.Rendering.SelectListItem]")) + { + commessa = string.Empty; + } + token = helper.GetStringValue("tok"); if (string.IsNullOrEmpty(token)) { @@ -233,6 +244,7 @@ namespace VirtualTask.Controllers { modelList = modelList.Where(x => x.data_timbratura.GetValueOrDefault().Date >= dataIni.Date).ToList(); } + if (dataFin.Date != DateTime.MinValue) { modelList = modelList.Where(x => x.data_timbratura.GetValueOrDefault().Date <= dataFin.Date).ToList();