示例#1
0
        private PurchasePolicy CreatePolicy(PolicyType type, string subject, OperatorType op, int id1, int id2)
        {
            PurchasePolicy policy = null;

            switch (op)
            {
            case OperatorType.AND:
                policy = new AndOperator(type, subject, GetPolicy(id1), GetPolicy(id2), SessionPolicies.Count);
                break;

            case OperatorType.OR:
                policy = new OrOperator(type, subject, GetPolicy(id1), GetPolicy(id2), SessionPolicies.Count);
                break;

            case OperatorType.NOT:
                policy = new NotOperator(type, subject, GetPolicy(id1), null, SessionPolicies.Count);
                break;
            }
            SessionPolicies.Add(policy);
            return(policy);
        }
示例#2
0
        private bool Equals(NotOperator obj)
        {
            bool answer = true;

            if (_cond1 == null)
            {
                answer = answer && (obj._cond1 == null);
            }
            if (Subject == null)
            {
                answer = answer && (obj.Subject == null);
            }
            if (_cond1 != null)
            {
                answer = answer && (_cond1.Equals(obj._cond1));
            }
            if (Subject != null)
            {
                answer = answer && (Subject.Equals(obj.Subject));
            }
            answer = answer && obj.ID.Equals(ID) && obj.Type.Equals(Type);
            return(answer);
        }