コード例 #1
0
ファイル: RGP_Roles.cs プロジェクト: guangxb/learn
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        public bool RoleAuthorityExists(RedGlovePermission.Model.RGP_RoleAuthorityList model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from RGP_RoleAuthorityList where ");
            if (model.UserID != 0)//判断是角色权限还是用户权限
            {
                strSql.Append("UserID=@UserID");
            }
            else
            {
                strSql.Append("RoleID=@RoleID");
            }
            strSql.Append(" and ModuleID=@ModuleID and AuthorityTag=@AuthorityTag");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",       SqlDbType.Int,      4),
                new SqlParameter("@RoleID",       SqlDbType.Int,      4),
                new SqlParameter("@ModuleID",     SqlDbType.Int,      4),
                new SqlParameter("@AuthorityTag", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.RoleID;
            parameters[2].Value = model.ModuleID;
            parameters[3].Value = model.AuthorityTag;

            return(SqlServerHelper.Exists(strSql.ToString(), parameters));
        }
コード例 #2
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        public bool RoleAuthorityExists(RedGlovePermission.Model.RGP_RoleAuthorityList model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from RGP_RoleAuthorityList where ");
            if (model.UserID != 0)//判断是角色权限还是用户权限
            {
                strSql.Append("UserID=?UserID");
            }
            else
            {
                strSql.Append("RoleID=?RoleID");
            }
            strSql.Append(" and ModuleID=?ModuleID and AuthorityTag=?AuthorityTag");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("?UserID",       MySqlDbType.Int32,   11),
                new MySqlParameter("?RoleID",       MySqlDbType.Int32,   11),
                new MySqlParameter("?ModuleID",     MySqlDbType.Int32,   11),
                new MySqlParameter("?AuthorityTag", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.RoleID;
            parameters[2].Value = model.ModuleID;
            parameters[3].Value = model.AuthorityTag;

            return(RedGlovePermission.DBUtility.MySqlHelper.Exists(strSql.ToString(), parameters));
        }
コード例 #3
0
ファイル: UserHandle.cs プロジェクト: guangxb/learn
 /// <summary>
 /// 判断是否有模块访问权限
 /// </summary>
 /// <param name="ModuleID">模块ID</param>
 /// <param name="AuthorityTag">权限标识</param>
 /// <returns></returns>
 public static bool ValidationModule(int ModuleID, string AuthorityTag)
 {
     RedGlovePermission.BLL.RGP_Roles bll = new RedGlovePermission.BLL.RGP_Roles();
     RedGlovePermission.Model.RGP_RoleAuthorityList model = new RedGlovePermission.Model.RGP_RoleAuthorityList();
     model.UserID       = 0;
     model.RoleID       = SessionBox.GetUserSession().RoleID;
     model.ModuleID     = ModuleID;
     model.AuthorityTag = AuthorityTag;
     return(bll.RoleAuthorityExists(model));
 }
コード例 #4
0
ファイル: UserHandle.cs プロジェクト: nick117/ASP.NET.131
 /// <summary>
 /// 判断是否有模块访问权限
 /// </summary>
 /// <param name="ModuleID">模块ID</param>
 /// <param name="AuthorityTag">权限标识</param>
 /// <returns></returns>
 public static bool ValidationModule(int ModuleID, string AuthorityTag)
 {
     RedGlovePermission.BLL.RGP_Roles bll = new RedGlovePermission.BLL.RGP_Roles();
     RedGlovePermission.Model.RGP_RoleAuthorityList model= new RedGlovePermission.Model.RGP_RoleAuthorityList();
     model.UserID = 0;
     model.RoleID = SessionBox.GetUserSession().RoleID;
     model.ModuleID = ModuleID;
     model.AuthorityTag = AuthorityTag;
     return bll.RoleAuthorityExists(model);
 }