Beispiel #1
0
        //级别
        private static bool UserRank(string strRank, string op)
        {
            ParseExpression pe = new ParseExpression();

            pe.UserFunctions = (IExpParsing) new DoExpParsing();
            pe.ChangeExpression("curuserrank" + op + strRank);

            object oValue = pe.Value();

            return((bool)oValue);
        }
Beispiel #2
0
        /// <summary>
        /// 解析被授权对象的表达式
        /// </summary>
        /// <param name="strExpression">被授权对象的表达式</param>
        /// <param name="objType">输出参数,被授权对象的类型</param>
        /// <param name="objID">输出参数,被授权对象ID</param>
        /// <param name="objParentID">输出参数,被授权对象的父对象的ID</param>
        /// <param name="userAccessLevel">输出参数,被授权对象中限定的人员级别</param>
        /// <param name="pe">表达式解析类</param>
        public static void getObjInfo(string strExpression, out string objType, out string objID, out string objParentID, out string userAccessLevel, ParseExpression pe)
        {
            objType         = string.Empty;
            objID           = string.Empty;
            objParentID     = string.Empty;
            userAccessLevel = string.Empty;

            string strTemp;

            string[] strList;
            strTemp = string.Format("GetBelongTo({0})", DoExpParsing.AddDoubleQuotationMark(strExpression));
            pe.ChangeExpression(strTemp);

            strList = pe.Value().ToString().Split(new char[] { ',', ';' });

            if (strList.Length > 0 && strList[0] != string.Empty)
            {
                objType = strList[0];
            }
            if (strList.Length > 1)
            {
                objID = strList[1];
            }
            if (strList.Length > 2)
            {
                objParentID = strList[2];
            }

            if (objType != "USERS")
            {
                strTemp = string.Format("GetUserRank({0})", DoExpParsing.AddDoubleQuotationMark(strExpression));
                pe.ChangeExpression(strTemp);
                strList = pe.Value().ToString().Split(new char[] { ',', ';' });
                if (strList.Length > 1)
                {
                    userAccessLevel = strList[1];
                }
            }
        }
		/// <summary>
		/// 解析被授权对象的表达式
		/// </summary>
		/// <param name="strExpression">被授权对象的表达式</param>
		/// <param name="objType">输出参数,被授权对象的类型</param>
		/// <param name="objID">输出参数,被授权对象ID</param>
		/// <param name="objParentID">输出参数,被授权对象的父对象的ID</param>
		/// <param name="userAccessLevel">输出参数,被授权对象中限定的人员级别</param>
		/// <param name="pe">表达式解析类</param>
		public static void getObjInfo(string strExpression, out string objType, out string objID, out string objParentID, out string userAccessLevel, ParseExpression pe)
		{
			objType = string.Empty;
			objID = string.Empty;
			objParentID = string.Empty;
			userAccessLevel = string.Empty;

			string strTemp;
			string[] strList;
			strTemp = string.Format("GetBelongTo({0})", DoExpParsing.AddDoubleQuotationMark(strExpression));
			pe.ChangeExpression(strTemp);

			strList = pe.Value().ToString().Split(new char[] { ',', ';' });

			if (strList.Length > 0 && strList[0] != string.Empty)
				objType = strList[0];
			if (strList.Length > 1)
				objID = strList[1];
			if (strList.Length > 2)
				objParentID = strList[2];

			if (objType != "USERS")
			{
				strTemp = string.Format("GetUserRank({0})", DoExpParsing.AddDoubleQuotationMark(strExpression));
				pe.ChangeExpression(strTemp);
				strList = pe.Value().ToString().Split(new char[] { ',', ';' });
				if (strList.Length > 1)
				{
					userAccessLevel = strList[1];
				}
			}

		}
		//级别
		private static bool UserRank(string strRank, string op)
		{
			ParseExpression pe = new ParseExpression();

			pe.UserFunctions = (IExpParsing)new DoExpParsing();
			pe.ChangeExpression("curuserrank" + op + strRank);

			object oValue = pe.Value();

			return (bool)oValue;
		}