using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic;
using System.Text;
using Domain;

namespace Dao.Implement
{
    public class HotelAirControlRepository : RepositoryBase<HotelAirControl>, IHotelAirControlRepository
    {
        public IQueryable<HotelAirControl> LoadAllByPage(out long total, int page, int rows, string order, string sort)
        {
            var list = this.LoadAll();
            total = list.LongCount();
            list = list.OrderBy(sort + " " + order);
            list = list.Skip((page - 1) * rows).Take(rows);
            return list;
        }

        public List<HotelAirControl> LoadByHotelID(int hotelID)
        {
            return this.LoadAll().Where(r => r.SysHotel.ID == hotelID).ToList();
        }

        public List<HotelAirControl> LoadAll(int hotelID, int conditionType, bool activeIndicator)
        {
            return this.LoadAll().Where(r => r.SysHotel.ID == hotelID && r.ConditionType == conditionType && r.ActiveIndicator == activeIndicator).ToList();
        }
    }
}
