137 lines
5.2 KiB
C#
137 lines
5.2 KiB
C#
///
|
|
/// Copyright (c) 2015-2017 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Results.Entities
|
|
{
|
|
public class WaterMeterData
|
|
{
|
|
public virtual int Id { get; protected set; }
|
|
|
|
public virtual string ProductName { get; set; }
|
|
public virtual string Producer { get; set; }
|
|
|
|
public virtual double DN { get; set; } /// [mm]
|
|
public virtual double L { get; set; } /// [mm]
|
|
public virtual Config.Entities.Mounting Mounting { get; set; } /// H / V / S / F
|
|
|
|
public virtual bool NewQnames { get; set; } /// Yes = Q3... No = Qn...
|
|
public virtual double Q4_Qmax { get; set; } /// [m3/h]
|
|
public virtual double Q3_Qn { get; set; } /// [m3/h]
|
|
public virtual double Q2_Qt { get; set; } /// [m3/h]
|
|
public virtual double Q1_Qmin { get; set; } /// [m3/h]
|
|
|
|
public virtual string MetrologicalClass { get; set; }
|
|
public virtual Config.Entities.TemperatureClass TemperatureClass { get; set; }
|
|
public virtual Config.Entities.PressureLossClass PressureLossClass { get; set; }
|
|
public virtual Config.Entities.MaxAdmissiblePressure MaxAdmissiblePressure { get; set; }
|
|
public virtual Config.Entities.FlowProfileSensitivityClass FlowProfileSensitivityClass { get; set; }
|
|
|
|
public virtual string ApprovalInfo { get; set; }
|
|
public virtual string Certificate { get; set; }
|
|
|
|
public virtual double PulsesPerLtr { get; set; }
|
|
|
|
/// Concerns compound water meters
|
|
public virtual string ProducerAux { get; set; }
|
|
public virtual double Q3_Qn_Aux { get; set; } /// [m3/h]
|
|
public virtual string MetrologicalClassAux { get; set; }
|
|
public virtual string ApprovalInfoAux { get; set; }
|
|
|
|
public virtual Config.Entities.Medium Medium { get; set; }
|
|
|
|
public virtual string Text1 { get; set; }
|
|
public virtual string Text2 { get; set; }
|
|
public virtual string Text3 { get; set; }
|
|
public virtual string Text4 { get; set; }
|
|
public virtual string Text5 { get; set; }
|
|
|
|
public virtual bool Compound { get; set; }
|
|
public virtual bool HeatMeter { get; set; }
|
|
|
|
#if ORACLE_DB
|
|
public virtual int WMTypeId { get; set; }
|
|
#endif
|
|
|
|
public WaterMeterData()
|
|
{
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Method to compare the content of two entities
|
|
/// </summary>
|
|
/// <param name="wmd">Second entity to compare with</param>
|
|
/// <returns>first = two entities are equal (except of Id)</returns>
|
|
public virtual bool Equals(WaterMeterData wmd)
|
|
{
|
|
if (!ProductName.Equals(wmd.ProductName)) return false;
|
|
if (!Producer.Equals(wmd.Producer)) return false;
|
|
|
|
if (DN != wmd.DN) return false;
|
|
if (L != wmd.L) return false;
|
|
if (Mounting != wmd.Mounting) return false;
|
|
|
|
if (NewQnames != wmd.NewQnames) return false;
|
|
if (Q4_Qmax != wmd.Q4_Qmax) return false;
|
|
if (Q3_Qn != wmd.Q3_Qn) return false;
|
|
if (Q2_Qt != wmd.Q2_Qt) return false;
|
|
if (Q1_Qmin != wmd.Q1_Qmin) return false;
|
|
|
|
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
|
|
if (!TemperatureClass.Equals(wmd.TemperatureClass)) return false;
|
|
if (!PressureLossClass.Equals(wmd.PressureLossClass)) return false;
|
|
if (!MaxAdmissiblePressure.Equals(wmd.MaxAdmissiblePressure)) return false;
|
|
if (!FlowProfileSensitivityClass.Equals(wmd.FlowProfileSensitivityClass)) return false;
|
|
|
|
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
|
|
if (Certificate != wmd.Certificate) return false;
|
|
|
|
if (PulsesPerLtr != wmd.PulsesPerLtr) return false;
|
|
|
|
if (ProducerAux != wmd.ProducerAux) return false;
|
|
if (Q3_Qn_Aux != wmd.Q3_Qn_Aux) return false;
|
|
if (MetrologicalClassAux != wmd.MetrologicalClassAux) return false;
|
|
if (ApprovalInfoAux != wmd.ApprovalInfoAux) return false;
|
|
|
|
if (Medium != wmd.Medium) return false;
|
|
|
|
if (Text1 != wmd.Text1) return false;
|
|
if (Text2 != wmd.Text2) return false;
|
|
if (Text3 != wmd.Text3) return false;
|
|
if (Text4 != wmd.Text4) return false;
|
|
if (Text5 != wmd.Text5) return false;
|
|
|
|
if (Compound != wmd.Compound) return false;
|
|
if (HeatMeter != wmd.HeatMeter) return false;
|
|
|
|
#if ORACLE_DB
|
|
if (WMTypeId != wmd.WMTypeId) return false;
|
|
#endif
|
|
return true;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Adds an item to the list if it does not occur there
|
|
/// </summary>
|
|
/// <param name="list">List of items</param>
|
|
/// <param name="item">Item to add to the list or find there</param>
|
|
/// <returns>Item from the list (existing or added)</returns>
|
|
public static WaterMeterData UpdateList(IList<WaterMeterData> list, WaterMeterData item)
|
|
{
|
|
if (item == null) return null; /// Null item is not stored in the list
|
|
|
|
WaterMeterData found = list.FirstOrDefault<WaterMeterData>(x => x.Equals(item));
|
|
|
|
if (found != null) return found; /// The same item found in the list, The found item returned
|
|
|
|
list.Add(item); /// Item not fund in the list, it is added to the list
|
|
return item;
|
|
}
|
|
}
|
|
}
|