77 lines
2.6 KiB
C#
77 lines
2.6 KiB
C#
///
|
|
/// Copyright (c) 2016 Sensus Metering Systems
|
|
///
|
|
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 string MetrologicalClass { get; set; }
|
|
public virtual string ApprovalInfo { get; set; }
|
|
public virtual double Q4_Qmax { get; set; } /// [m3/h]
|
|
public virtual double Qn { get; set; } /// [m3/h]
|
|
public virtual double Q3 { get; set; } /// [m3/h]
|
|
public virtual double Q2_Qt { get; set; } /// [m3/h]
|
|
public virtual double Q1_Qmin { get; set; } /// [m3/h]
|
|
public virtual bool Compound { get; set; }
|
|
#if IPERLST || IPERLST_SPECIAL
|
|
public virtual int WMTypeId { get; set; }
|
|
public virtual int WMTypeRev { 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 (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
|
|
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
|
|
if (Q4_Qmax != wmd.Q4_Qmax) return false;
|
|
if (Qn != wmd.Qn) return false;
|
|
if (Q3 != wmd.Q3) return false;
|
|
if (Q2_Qt != wmd.Q2_Qt) return false;
|
|
if (Q1_Qmin != wmd.Q1_Qmin) return false;
|
|
if (Compound != wmd.Compound) return false;
|
|
#if IPERLST || IPERLST_SPECIAL
|
|
if (WMTypeId != wmd.WMTypeId) return false;
|
|
if (WMTypeRev != wmd.WMTypeRev) 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;
|
|
}
|
|
}
|
|
}
|