using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Basic.BLL
{
    /// <summary>
    /// 管理员
    /// </summary>
    public class manager_role
    {
        /// <summary>
        /// 检查是否有权限
        /// </summary>
        public bool Exists(int role_id, string channel_name, string action_type)
        {
            Model.manager_role model = new DAL.manager_role().GetModel(role_id);
            if (model != null)
            {
                if (model.role_type == 1)
                {
                    return true;
                }
                Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == channel_name && p.action_type == action_type);
                if (modelt != null)
                {
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// 检查是否有权限
        /// </summary>
        public bool Exists(int role_id, int channel_id, string action_type)
        {
            Model.manager_role model = new DAL.manager_role().GetModel(role_id);
            if (model != null)
            {
                if (model.role_type == 1)
                {
                    return true;
                }
                Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_id == channel_id && p.action_type == action_type);
                if (modelt != null)
                {
                    return true;
                }
            }
            return false;
        }
    }
}