Files

76 lines
2.1 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Egw.Window.Data
{
public class Profile
{
/// <summary>
/// ID del record
/// </summary>
public int ProfileID { get; set; }
/// <summary>
/// Codice esterno risorsa (opzionale)
/// </summary>
public string Code { get; set; } = string.Empty;
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// Spessore del profilo
/// </summary>
public double Thickness { get; set; } = 0;
/// <summary>
/// Versione serializzata info Threshold profilo
/// </summary>
public string ThreshDataRaw { get; set; } = "";
/// <summary>
/// Lista (ReadOnly) oggetti Threshold deserializzati
/// </summary>
[NotMapped]
public List<Threshold> ThresholdList
{
get
{
List<Threshold> answ = new List<Threshold>();
if (!string.IsNullOrEmpty(ThreshDataRaw))
{
answ = JsonConvert.DeserializeObject<List<Threshold>>(ThreshDataRaw) ?? new List<Threshold>();
}
return answ;
}
}
/// <summary>
/// Versione serializzata info ProfileData
/// </summary>
public string ProfDataRaw { get; set; } = "";
/// <summary>
/// Dizionario chiave/valore dei parametri del profilo
/// </summary>
[NotMapped]
public Dictionary<string, double> ProfileDataDict
{
get
{
Dictionary<string, double> answ = new Dictionary<string, double>();
if (!string.IsNullOrEmpty(ProfDataRaw))
{
answ = JsonConvert.DeserializeObject<Dictionary<string, double>>(ProfDataRaw) ?? new Dictionary<string, double>();
}
return answ;
}
}
}
}