39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
using TBF;
|
|||
|
|
using NHibernate;
|
|||
|
|
using FluentNHibernate;
|
|||
|
|
|
|||
|
|
namespace TBF.Entities
|
|||
|
|
{
|
|||
|
|
public class Watermeter
|
|||
|
|
{
|
|||
|
|
public virtual int Id { get; protected set; } /// primary key
|
|||
|
|
|
|||
|
|
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
|
|||
|
|
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
|
|||
|
|
public virtual string CreateDescription { get; set; } /// Description
|
|||
|
|
|
|||
|
|
/// mapped
|
|||
|
|
public virtual string Serial { get; set; } /// serial number
|
|||
|
|
public virtual WMType WMType { get; set; } /// type of watermeter
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Load a watermeter from the database
|
|||
|
|
/// </summary>
|
|||
|
|
public static Watermeter LoadBySerialnr(string SerialNr)
|
|||
|
|
{
|
|||
|
|
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Database.WaterMeters)
|
|||
|
|
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
|
|||
|
|
.SetParameter("SerialNrParameter", SerialNr)
|
|||
|
|
.List<Watermeter>();
|
|||
|
|
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|