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

namespace Dao.Implement
{
    public class AlarmSettingRepository : RepositoryBase<AlarmSetting>, IAlarmSettingRepository
    {
        public IQueryable<AlarmSetting> LoadAll(char type)
        {
            return LoadAllFromCache().Where(r => r.Type == type);
        }

        public AlarmSetting Get(int hotelID, char type, string code)
        {
            return LoadAllFromCache().FirstOrDefault(r => r.HotelID == hotelID && r.Type == type && r.Code == code);
        }

        public AlarmSetting Get(int hotelID, char type, int modalTypeId)
        {
            return LoadAllFromCache().FirstOrDefault(r => r.HotelID == hotelID && r.Type == type && r.ModalTypeID == modalTypeId);
        }

        public AlarmSetting Get(int hotelID, char type, string code, int modalTypeId)
        {
            return LoadAllFromCache().FirstOrDefault(r => r.HotelID == hotelID && r.Type == type && r.Code == code && r.ModalTypeID == modalTypeId);
        }
    }
}
