文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>动态权限分配

动态权限分配

时间:2010-11-26  来源:初学软件

BLL层
/// <summary>
       /// 查询父节点
       /// </summary>
       /// <returns></returns>
        public static DataTable checkrole()
        {
            return roledal.checkrole();
        }
       /// <summary>
       /// 查询子节点
       /// </summary>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static DataTable checkroles(int pid)
        {
            return roledal.checkroles(pid);
        }
       /// <summary>
       /// 查询角色拥有的权限
       /// </summary>
       /// <param name="rid"></param>
       /// <returns></returns>
        public static DataTable chekrolerrid(int rid)
        {
            return roledal.chekrolerid(rid);
        }
       /// <summary>
        /// 判断节点是否存在
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static bool chekroleridandpid(int rid, int pid)
        {
           return  roledal.checkroleridandpid(rid, pid);
        }
       /// <summary>
       /// 添加一个节点
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static int insertrole(int rid, int pid)
        {
            return roledal.insertrole(rid,pid);
        }
       /// <summary>
       /// 删除一个节点
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static int deleterole(int rid, int pid)
        {
            return roledal.delererole(rid, pid);
        }

DAL层
   /// <summary>
       /// 查询父节点
       /// </summary>
       /// <returns></returns>
        public static DataTable checkrole()
        {
            string sql = "select P_Id,P_Name from Permission where ParentNOdeId=0 ";
            return DBHelper.GetDataSet(sql);
        }
       /// <summary>
       /// 查询子节点
       /// </summary>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static DataTable checkroles(int pid)
        {
            string sql = "select P_Id,P_Name from Permission where ParentNOdeId='" + pid + "'";
            return DBHelper.GetDataSet(sql);
        }
       /// <summary>
       /// 查询角色所拥有的权限
       /// </summary>
       /// <param name="rid"></param>
       /// <returns></returns>
        public static DataTable chekrolerid(int rid)
        {
            string sql = "select RP_Pid from Role_Per where RP_Rid='"+rid+"'";
            return DBHelper.GetDataSet(sql);
        }
       /// <summary>
       /// 判断节点是否存在
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static bool checkroleridandpid(int rid, int pid)
        {
            string sql = "select * from Role_Per where RP_Rid="+rid+"and RP_Pid="+pid+"";
            SqlDataReader dr= DBHelper.GetReader(sql);
            if (dr.Read())
            {
                dr.Close();
                return true;
            }
            else
            {
                dr.Close();
                return false;
            }
        }
       /// <summary>
       /// 添加一个节点
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static int insertrole(int rid, int pid)
        {
            string sql = "insert into Role_Per(RP_Rid,RP_Pid) values("+rid+","+pid+")";
            return DBHelper.ExecuteCommand(sql);
        }
       /// <summary>
       /// 删除一个节点
       /// </summary>
       /// <param name="rid"></param>
       /// <param name="pid"></param>
       /// <returns></returns>
        public static int delererole(int rid, int pid)
        {
            string sql = "delete Role_Per where RP_Rid="+rid+"and RP_Pid"+pid+"";
            return DBHelper.ExecuteCommand(sql);
        }

Model层和表就不写啦太麻烦啦

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载