Пример #1
0
        /// <summary>
        /// 通过指定的条件类别和对象定位条件
        /// </summary>
        /// <param name="conditionType"></param>
        /// <param name="conditionObject"></param>
        /// <returns></returns>
        public static QCCondition SelectQCCondition(QCConditionType conditionType, object conditionObject)
        {
            IList <QCCondition> kindConditions = new List <QCCondition>();

            foreach (QCCondition qcc in _allConditions)
            {
                if (qcc._conditionType == conditionType)
                {
                    kindConditions.Add(qcc.Clone());
                }
            }

            string objtype = Qcsv.ConditionType2String(conditionType);

            if (string.IsNullOrEmpty(objtype))
            {
                foreach (QCCondition qcc in kindConditions)
                {
                    if (qcc.JudgeSetting == conditionObject.ToString())
                    {
                        return(qcc);
                    }
                }
            }
            else
            {
                foreach (QCCondition qcc in kindConditions)
                {
                    QCParams qcp = new QCParams(qcc.JudgeSetting);
                    if (Qcsv.JudgeObjIsEqualProps(Type.GetType(objtype), conditionObject, qcp))
                    {
                        return(qcc);
                    }
                }
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// 通过指定的条件类别和对象定位条件
        /// </summary>
        /// <param name="resultType"></param>
        /// <param name="resultObject"></param>
        /// <returns></returns>
        public static QCResult SelectQCResult(QCResultType resultType, object resultObject)
        {
            IList <QCResult> kindResults = new List <QCResult>();

            foreach (QCResult qcr in _allResults)
            {
                if (qcr._type == resultType)
                {
                    kindResults.Add(qcr.Clone());
                }
            }

            string objtype = Qcsv.ResultType2String(resultType);

            if (string.IsNullOrEmpty(objtype))
            {
                foreach (QCResult qcr in kindResults)
                {
                    if (qcr.JudgeSetting == resultObject.ToString())
                    {
                        return(qcr);
                    }
                }
            }
            else
            {
                foreach (QCResult qcr in kindResults)
                {
                    QCParams qcp = new QCParams(qcr.JudgeSetting);
                    if (Qcsv.JudgeObjIsEqualProps(Type.GetType(objtype), resultObject, qcp))
                    {
                        return(qcr);
                    }
                }
            }
            return(null);
        }