Files
cms_thermo_active/Thermo.Active.Model/DTOModels/ThProd/DTOThermoProd.cs
T
2020-10-14 09:03:04 +02:00

53 lines
1.6 KiB
C#

using System;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.DTOModels.ThProd
{
public class DTOThermoProd
{
public TACT_PROD_CATEGORY Category { get; set; } = TACT_PROD_CATEGORY.ND;
public double Value { get; set; } = 0;
public string Name { get; set; } = "";
public string Label { get; set; } = "";
public string UM { get; set; } = "";
public int ScaleFactor { get; set; } = 1;
public int NumDec { get; set; } = 0;
public int MinVal { get; set; } = 0;
public int MaxVal { get; set; } = 100;
public override bool Equals(object obj)
{
if (!(obj is DTOThermoProd item))
return false;
if (!Category.Equals(item.Category))
return false;
// poiché il vuoto è con 2 decimali serve 10 volte risoluzione risp altro...
if (Math.Round(Math.Abs(Value - item.Value), 2) >= Constants.EPSILON / 10)
return false;
if (Name != item.Name)
return false;
if (Label != item.Label)
return false;
if (!UM.Equals(item.UM))
return false;
if (ScaleFactor != item.ScaleFactor)
return false;
if (NumDec != item.NumDec)
return false;
if (MinVal != item.MinVal)
return false;
if (MaxVal != item.MaxVal)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}