Beispiel #1
0
 public static void CollectDataSetParamGroup(INode node, List <DataSetParamGroup> groups)
 {
     foreach (INode localNode in node.Children)
     {
         BaseArgument argument = localNode as BaseArgument;
         if (argument != null)
         {
             argument.CollectDataSetParamGroup(groups);
         }
     }
 }
Beispiel #2
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            var form = paramsValue["AForm"] as IFormInterface;

            if (form != null && form.MainSource != null && form.MainSource.Active && form.MainSource.DataView != null && form.MainSource.DataView.Active)
            {
                var localParamsValue = new Alphora.Dataphor.DAE.Runtime.DataParams();
                foreach (DataField field in form.MainSource.DataView.Fields)
                {
                    localParamsValue.Add(new DAE.Runtime.DataParam(field.Name, field.DataType, DAE.Language.Modifier.Out, field.AsNative));
                }
                BaseArgument.ApplyArguments(this, localParamsValue);
            }
        }
Beispiel #3
0
 public static void ApplyArguments(INode node, DAE.Runtime.DataParams paramsValue)
 {
     if (node != null)
     {
         foreach (Node localNode in node.Children)
         {
             BaseArgument argument = localNode as BaseArgument;
             if (argument != null)
             {
                 argument.ApplyArguments(paramsValue);
             }
         }
     }
 }
Beispiel #4
0
 public static DAE.Runtime.DataParams CollectArguments(INode node)
 {
     DAE.Runtime.DataParams paramsValue = null;
     if (node != null)
     {
         foreach (Node localNode in node.Children)
         {
             BaseArgument argument = localNode as BaseArgument;
             if (argument != null)
             {
                 argument.CollectArguments(ref paramsValue);
             }
         }
     }
     return(paramsValue);
 }
Beispiel #5
0
        protected override bool EvaluateCondition()
        {
            bool result = false;

            if (Condition != String.Empty)
            {
                DAE.Runtime.DataParams localParamsValue = BaseArgument.CollectArguments(this);
                DAE.IServerProcess     process          = HostNode.Session.DataSession.ServerSession.StartProcess(new DAE.ProcessInfo(HostNode.Session.DataSession.ServerSession.SessionInfo));
                try
                {
                    ErrorList         errors = new ErrorList();
                    DAE.IServerScript script = process.PrepareScript(String.Format("select {0}", Condition));
                    try
                    {
                        DAE.IServerBatch          batch = script.Batches[0];
                        DAE.IServerExpressionPlan plan  = batch.PrepareExpression(localParamsValue);
                        try
                        {
                            errors.AddRange(plan.Messages);
                            using (IDataValue dataValue = plan.Evaluate(localParamsValue))
                                result = dataValue == null ? false : (bool)dataValue.AsNative;
                        }
                        finally
                        {
                            batch.UnprepareExpression(plan);
                        }
                    }
                    finally
                    {
                        process.UnprepareScript(script);
                    }

                    HostNode.Session.ReportErrors(HostNode, errors);
                }
                finally
                {
                    HostNode.Session.DataSession.ServerSession.StopProcess(process);
                }

                BaseArgument.ApplyArguments(this, localParamsValue);
            }
            return(result);
        }
Beispiel #6
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            var localParamsValue = new Alphora.Dataphor.DAE.Runtime.DataParams();
            var process          = HostNode.Session.DataSession.UtilityProcess;

            foreach (KeyValuePair <string, object> entry in paramsValue)
            {
                localParamsValue.Add
                (
                    new Alphora.Dataphor.DAE.Runtime.DataParam
                    (
                        entry.Key,
                        // If null, arbitrarily use string
                        entry.Value == null
                                                        ? process.DataTypes.SystemString
                                                        : Alphora.Dataphor.DAE.Client.DataSession.ScalarTypeFromNativeType(process, entry.Value.GetType()),
                        DAE.Language.Modifier.Out,
                        entry.Value
                    )
                );
            }
            BaseArgument.ApplyArguments(this, localParamsValue);
        }
Beispiel #7
0
        // Action

        /// <summary> Runs script on the local server. </summary>
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            DAE.Runtime.DataParams localParamsValue = BaseArgument.CollectArguments(this);

            if (_script != String.Empty)
            {
                Guid enlistWithATID = Guid.Empty;

                if ((_enlistWith != null) && (_enlistWith.DataView != null) && _enlistWith.DataView.Active && (_enlistWith.DataView.ApplicationTransactionServer != null))
                {
                    enlistWithATID = _enlistWith.DataView.ApplicationTransactionServer.ApplicationTransactionID;
                }

                DAE.IServerProcess process = HostNode.Session.DataSession.ServerSession.StartProcess(new DAE.ProcessInfo(HostNode.Session.DataSession.ServerSession.SessionInfo));
                try
                {
                    if (enlistWithATID != Guid.Empty)
                    {
                        process.JoinApplicationTransaction(enlistWithATID, false);
                    }

                    ErrorList errors = new ErrorList();

                    DAE.IServerScript script = process.PrepareScript(_script);
                    try
                    {
                        foreach (DAE.IServerBatch batch in script.Batches)
                        {
                            if (batch.IsExpression())
                            {
                                DAE.IServerExpressionPlan plan = batch.PrepareExpression(localParamsValue);
                                try
                                {
                                    errors.AddRange(plan.Messages);

                                    if (plan.DataType is DAE.Schema.TableType)
                                    {
                                        plan.Close(plan.Open(localParamsValue));
                                    }
                                    else
                                    {
                                        plan.Evaluate(localParamsValue).Dispose();
                                    }
                                }
                                finally
                                {
                                    batch.UnprepareExpression(plan);
                                }
                            }
                            else
                            {
                                DAE.IServerStatementPlan plan = batch.PrepareStatement(localParamsValue);
                                try
                                {
                                    errors.AddRange(plan.Messages);

                                    plan.Execute(localParamsValue);
                                }
                                finally
                                {
                                    batch.UnprepareStatement(plan);
                                }
                            }
                        }
                    }
                    finally
                    {
                        process.UnprepareScript(script);
                    }

                    HostNode.Session.ReportErrors(HostNode, errors);
                }
                finally
                {
                    HostNode.Session.DataSession.ServerSession.StopProcess(process);
                }

                BaseArgument.ApplyArguments(this, localParamsValue);
            }
        }