示例#1
0
        /// <summary>
        /// 验证用户是否具有指定状态机制的操作权限
        /// </summary>
        /// <param name="moduleCode">模块编码</param>
        /// <param name="status">数据状态</param>
        /// <returns>执行结果</returns>
        public static bool VerifyStatus(string moduleCode, int status)
        {
            if (string.IsNullOrEmpty(UserStatus) || UserStatus.Length == 1)
            {
                return(false);
            }
            bool result = false;
            int  mi     = UserStatus.IndexOf(";" + moduleCode + "|");

            if (mi >= 0)
            {
                int ml = UserStatus.IndexOf(";", mi + 1);
                if (ml < 0)
                {
                    ml = UserStatus.Length;
                }
                string authString = UserStatus.Substring(mi + moduleCode.Length + 2, ml - mi - moduleCode.Length - 2);
                var    ckStat     = string.Format(",{0},", status);
                result = authString.Contains(ckStat);
            }
            return(result);
        }