public override object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai)
        {
            SysProcess process = pi.Process;

            if (process.ProcessEntity == null)
            {
                throw new ApplicationException("流程实体为空");
            }
            SysOneMoreRelation relation = expr.Relation;

            if (relation == null)
            {
                throw new ApplicationException("表达式的关系为空");
            }
            if (!relation.ChildEntityId.HasValue)
            {
                throw new ApplicationException("表达式的子实体为空");
            }
            if (!process.EntityId.HasValue)
            {
                throw new ApplicationException("流程的实体为空");
            }
            if (expr.Relation.ChildEntityId.Value != process.EntityId.Value)
            {
                throw new ApplicationException("不正确的关系");
            }
            if (!relation.ParentEntityId.HasValue)
            {
                throw new ApplicationException("关系的父实体为空");
            }
            if (!relation.ChildFieldId.HasValue)
            {
                throw new ApplicationException("关系的ChildFieldId为空");
            }
            long local1 = relation.ChildFieldId.Value;

            if (relation.ChildField == null)
            {
                throw new ApplicationException("关系的对应字段为空");
            }
            SysEntity  processEntity = pi.Process.ProcessEntity;
            int        objectId      = pi.ObjectId;
            EntityData data          = cache.GetObject(processEntity, objectId);
            SysEntity  parentEntity  = relation.ParentEntity;

            if (data.ContainsKey(relation.ChildField.FieldName))
            {
                int num2 = Convert.ToInt32(data[relation.ChildField.FieldName]);
                if (num2 != 0)
                {
                    object obj2 = cache.GetObject(parentEntity, num2)[expr.Field.FieldName];
                    expr_cache.Add(expr, obj2);
                    return(obj2);
                }
            }
            throw new ApplicationException(string.Format("计算表达式时需要字段{0},但其未赋值或为空", relation.ChildField.FieldName));
        }
Пример #2
0
        public override object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai)
        {
            SysEntity processEntity = pi.Process.ProcessEntity;
            int       objectId      = pi.ObjectId;
            object    obj2          = cache.GetObject(processEntity, objectId)[expr.Field.FieldName];

            expr_cache.Add(expr, obj2);
            return(obj2);
        }
        public override object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai)
        {
            SysProcess process        = pi.Process;
            SysEntity  activityEntity = process.ActivityEntity;

            if (activityEntity == null)
            {
                throw new ApplicationException("活动实体为空");
            }
            SysOneMoreRelation relation = expr.Relation;

            if (relation == null)
            {
                throw new ApplicationException("表达式的关系为空");
            }
            if (!relation.ChildEntityId.HasValue)
            {
                throw new ApplicationException("表达式的子实体为空");
            }
            if (!process.ActivityEntityId.HasValue)
            {
                throw new ApplicationException("活动的实体为空");
            }
            if (expr.Relation.ChildEntityId.Value != process.ActivityEntityId.Value)
            {
                throw new ApplicationException("不正确的关系");
            }
            if (!relation.ParentEntityId.HasValue)
            {
                throw new ApplicationException("关系的父实体为空");
            }
            if (!relation.ChildFieldId.HasValue)
            {
                throw new ApplicationException("关系的ChildFieldId为空");
            }
            long local1 = relation.ChildFieldId.Value;

            if (relation.ChildField == null)
            {
                throw new ApplicationException("关系的对应字段为空");
            }
            int        activityInstanceId = ai.ActivityInstanceId;
            EntityData data         = cache.GetObject(activityEntity, activityInstanceId);
            SysEntity  parentEntity = relation.ParentEntity;
            int        num2         = Convert.ToInt32(data[relation.ChildField.FieldName]);
            object     obj2         = cache.GetObject(parentEntity, num2)[expr.Field.FieldName];

            expr_cache.Add(expr, obj2);
            return(obj2);
        }
Пример #4
0
        public override object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai)
        {
            if (!expr.DataType.HasValue)
            {
                throw new ApplicationException("未指定常量的数据类型");
            }
            if (string.IsNullOrWhiteSpace(expr.ConstValue))
            {
                throw new ApplicationException("未指定常量的值");
            }
            object obj2 = DataTypeHelper.GetHelper((DataTypeEnum)expr.DataType.Value).ConvertFromString(expr.ConstValue);

            expr_cache.Add(expr, obj2);
            return(obj2);
        }
        public override object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai)
        {
            if (!expr.OperationType.HasValue)
            {
                throw new ApplicationException("操作类型为空");
            }
            if (!expr.LeftId.HasValue)
            {
                throw new ApplicationException("左变量为空");
            }
            if (!expr.RightId.HasValue)
            {
                throw new ApplicationException("右变量为空");
            }
            object             obj2  = expr_cache.GetValue(expr.LeftId.Value);
            object             obj3  = expr_cache.GetValue(expr.RightId.Value);
            ConstantExpression left  = Expression.Constant(obj2);
            ConstantExpression right = Expression.Constant(obj3);
            object             obj4  = Expression.Lambda(Expression.MakeBinary((ExpressionType)expr.OperationType.Value, left, right), new ParameterExpression[0]).Compile().DynamicInvoke(new object[0]);

            expr_cache.Add(expr, obj4);
            return(obj4);
        }
Пример #6
0
 public abstract object GetValue(SysExpression expr, EntityCache cache, ExpressionCache expr_cache, SysProcessInstance pi, SysActivityInstance ai);