Modifica esportazione excel timbrature: corretto errore quando si faceva click su exporta senza aver fatto cerca

This commit is contained in:
michele 2024-09-16 17:25:50 +02:00
parent 83f212a185
commit 424bf98e9d

View File

@ -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();