Michele: modifica estrazione excel (controllo null), modifica model rapportini + Modifica Display name Dati azienda

This commit is contained in:
michele 2024-04-09 16:28:15 +02:00
parent e230502421
commit 21b32c2c71
4 changed files with 108 additions and 9 deletions

View File

@ -163,7 +163,6 @@ namespace VirtualTask.Controllers
modelList = modelList.Where(x => x.data_rapportino.GetValueOrDefault().Date >= dataIni.Date).ToList();
}
}
var workbook = new XLWorkbook();
workbook.AddWorksheet("sheetName");
@ -186,11 +185,19 @@ namespace VirtualTask.Controllers
{
var colonna = 1;
//righe per ogni elemento nel modelList
//righe per ogni item nel modelList
foreach (var prop in item.GetType().GetProperties())
{
ws.Cell(row + 2, colonna).Value = prop.GetValue(item).ToString();
//controllo se item null assegno stringa vuota
//perchè se null da errore quando scrive l'excel
if (prop.GetValue(item) != null)
{
ws.Cell(row + 2, colonna).Value = prop.GetValue(item).ToString();
}
else
{
ws.Cell(row + 2, colonna).Value = string.Empty;
}
colonna++;
}

View File

@ -18,11 +18,11 @@ namespace VirtualTask.Models
/// <summary>url del logo esposto</summary>
public string? url_logo { get; set; }
[Display(Name = "Intestazione Logo")]
[Display(Name = "Logo")]
/// <summary>logo</summary>
public IFormFile? logo { get; set; }
[Display(Name = "Testo")]
[Display(Name = "Intestazione")]
/// <summary>testo azienda rapportino</summary>
public string? testo_buono { get; set; }
}

View File

@ -21,12 +21,12 @@ namespace VirtualTask.Models
public string? url_logo { get; set; }
[Required]
[Display(Name = "Intestazione Logo")]
[Display(Name = "Logo")]
/// <summary>logo</summary>
public byte[]? logo { get; set; }
[Required]
[Display(Name = "Testo")]
[Display(Name = "Intestazione")]
/// <summary>testo azienda rapportino</summary>
public string? testo_buono { get; set; }

View File

@ -17,7 +17,6 @@ namespace VirtualTask.Models
/// <summary>
/// Codice Impianto
/// </summary>
[Display(Name = "Impianto")]
public string? codice_impianto { get; set; }
@ -35,5 +34,98 @@ namespace VirtualTask.Models
/// Data rapportino
/// </summary>
public DateTime? data_rapportino { get; set; }
/// <summary>
/// Codice Cliente
/// </summary>
public string? ancodice { get; set; }
/// <summary>Ragione Sociale</summary>
public string? andescri { get; set; }
/// <summary>ora inizio rapportino</summary>
public string? ora_ini_rapportino { get; set; }
/// <summary>ora inizio rapportino</summary>
public string? ora_fin_rapportino { get; set; }
/// <summary>min inizio rapportino</summary>
public string? min_ini_rapportino { get; set; }
/// <summary>min inizio rapportino</summary>
public string? min_fin_rapportino { get; set; }
/// <summary>codice chiusura 1</summary>
public string? codice_chiusura_1 { get; set; }
/// <summary>codice chiusura 2</summary>
public string? codice_chiusura_2 { get; set; }
/// <summary>codice chiusura 3</summary>
public string? codice_chiusura_3 { get; set; }
/// <summary>codice chiusura 4</summary>
public string? codice_chiusura_4 { get; set; }
/// <summary>codice chiusura 5</summary>
public string? codice_chiusura_5 { get; set; }
/// <summary>codice chiusura 6</summary>
public string? codice_chiusura_6 { get; set; }
/// <summary>codice chiusura 7</summary>
public string? codice_chiusura_7 { get; set; }
/// <summary>codice chiusura 8</summary>
public string? codice_chiusura_8 { get; set; }
/// <summary>codice chiusura 9</summary>
public string? codice_chiusura_9 { get; set; }
/// <summary>codice chiusura 10</summary>
public string? codice_chiusura_10 { get; set; }
/// <summary>descrizione int</summary>
public string? descrizione_intervento { get; set; }
/// <summary>tecnico</summary>
public string? codice_tecnico { get; set; }
/// <summary>firma</summary>
public string? firma { get; set; }
/// <summary>cod intervento</summary>
public string? codice_intervento { get; set; }
/// <summary></summary>
public string? note_intervento { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? ore_lavoro { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? materiale { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? diritto_chiamata { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? manodopera { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? spese_viaggio { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(7, 2)")]
public decimal? anticipo { get; set; }
/// <summary></summary>
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(9, 2)")]
public decimal? totale { get; set; }
}
}