using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NHibernate; using NHibernate.Linq; using Sleis.Models; using Sleis.Infrastructure; namespace Sleis.Data { public class PublicControlDevicePollutantData : BaseData, IControlDevicePollutantData { public bool DeleteAllByControlDevice(int controlDeviceId, ISession session) { ISQLQuery query = session.CreateSQLQuery("DELETE from P_CTRL_DEVC_POLLUTANT where CTRL_DEVC_ID = :controlDeviceId"); query.SetInt32("controlDeviceId", controlDeviceId); return query.ExecuteUpdate() > 0; } /* Obsolete Logic. Get all of this in BaseData public List GetControlDevicePollutant(int controlDeviceId) where T : ControlDevicePollutant { using (ISession session = GetSession()) { return (from d in session.Query() where d.DeviceId == controlDeviceId select d).ToList (); } } public void SaveOrUpdate(ISession session, T entity) where T : ControlDevicePollutantBase { session.SaveOrUpdate(entity); } public void Update(ISession session, T entity) where T : ControlDevicePollutantBase { session.Update(entity); } public void Delete(ISession session, T entity) where T : ControlDevicePollutantBase { session.Delete(entity); } public void Delete(T entity) where T : ControlDevicePollutantBase { using (ISession session = GetSession()) { session.Delete(entity); } } */ } }