tbf/Config/Entities/Watermeter.cs

41 lines
1.4 KiB
C#
Raw Normal View History

///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using FluentNHibernate;
namespace Config.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)
{
2015-12-31 21:48:22 +00:00
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(DBKind.Results)
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
.SetParameter("SerialNrParameter", SerialNr)
.List<Watermeter>();
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
return null;
}
}
}