using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;
using NHibernate;
using System.Data;

namespace Dao.Implement
{
    public class ECO_DetailRepository: RepositoryBase<ECO_Detail>,IECO_DetailRepository
    {

        public int Add(ECO_Detail test)
        {
            object obj= this.Save(test);
            return int.Parse(obj.ToString());
        }


        public ECO_Detail GetDetail(int hotelid, int hostid)
        {
            return this.LoadAll().Where(A=>A.HostID==hostid&&A.HotelID==hotelid).FirstOrDefault();
        }


        public void ZeroRefresh()
        {
            Session.CreateSQLQuery("update ECO_Detail set IsTrigger=0;")
            .ExecuteUpdate();
        }
    }
}
