示例#1
0
 public void Execute(INode sender, EventParams paramsValue)
 {
     if (GetEnabled())
     {
         ILayoutDisableable layoutDisableable = (ILayoutDisableable)FindParent(typeof(ILayoutDisableable));
         if (layoutDisableable != null)
         {
             layoutDisableable.DisableLayout();
         }
         try
         {
             if (DoBeforeExecute(sender, paramsValue))
             {
                 FinishExecute(sender, paramsValue);
             }
         }
         finally
         {
             if (layoutDisableable != null)
             {
                 layoutDisableable.EnableLayout();
             }
         }
     }
 }
示例#2
0
 protected void DoCompleted(EventParams paramsValue)
 {
     if (OnCompleted != null)
     {
         OnCompleted(this, paramsValue);
     }
 }
示例#3
0
 /// <remarks> Creates and sends a ViewActionEvent. </remarks>
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if (Source != null)
     {
         Source.HandleEvent(new ViewActionEvent(_action));
     }
 }
示例#4
0
 private void DoAfterExecute(EventParams paramsValue)
 {
     if (_afterExecute != null)
     {
         _afterExecute.Execute(this, paramsValue);
     }
 }
示例#5
0
 protected internal void PerformDefault(DataLink link, EventParams paramsValue)
 {
     if (_enabled && link.Active)
     {
         InternalPerformDefault(link, _targetColumns.Split(';', ','), paramsValue);
     }
 }
示例#6
0
 /// <summary> Calls the other action. </summary>
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if (_action != null)
     {
         _action.Execute(this, paramsValue);
     }
 }
示例#7
0
 /// <summary> Executes each child action sequentially. </summary>
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     // Don't use a foreach here to avoid the possibility that the action changes the form and throws the enumerator changed error
     for (int count = 0; count < (Children != null ? Children.Count : 0); count++)
     {
         ((IAction)Children[count]).Execute(this, paramsValue);
     }
 }
示例#8
0
        private void BeforeExecuteCompleted(INode sender, EventParams paramsValue)
        {
            IBlockable blockable = _beforeExecute as IBlockable;

            if (blockable != null)
            {
                blockable.OnCompleted -= new NodeEventHandler(BeforeExecuteCompleted);
            }
            FinishExecute(sender, paramsValue);
        }
示例#9
0
 /// <summary> Executes the IAction child conditionally. </summary>
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     foreach (Node localNode in Children)
     {
         if (localNode is IAction && EvaluateCondition())
         {
             ((IAction)localNode).Execute(this, paramsValue);
         }
     }
 }
示例#10
0
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if (_document != String.Empty)
     {
         _params = paramsValue;
         if ((_mode == FormMode.Delete) && !ConfirmDelete)
         {
             SourceLink.Source.DataView.Delete();
         }
         else
         {
             _mainSourceParams = paramsValue["AParams"] as DataParams;
             try
             {
                 IFormInterface form = HostNode.Session.LoadForm(this, _document, new FormInterfaceHandler(InternalBeforeActivateForm));
                 try
                 {
                     form.OnClosed += new EventHandler(OnClosedHandler);
                     form.TopMost   = TopMost;
                     InternalAfterActivateForm(form);
                     bool forceAcceptReject = (_onFormAccepted != null) || (_onFormRejected != null) || (OnFormAcceptedEvent != null) || (OnFormRejectedEvent != null);
                     if ((_mode != FormMode.None) || (SourceLinkType != SourceLinkType.None) || forceAcceptReject)
                     {
                         if (forceAcceptReject)
                         {
                             form.ForceAcceptReject = true;
                         }
                         form.Show
                         (
                             (IFormInterface)FindParent(typeof(IFormInterface)),
                             new FormInterfaceHandler(FormAccepted),
                             new FormInterfaceHandler(FormRejected),
                             _mode
                         );
                     }
                     else
                     {
                         form.Show(_mode);
                     }
                 }
                 catch
                 {
                     form.Dispose();
                     throw;
                 }
             }
             finally
             {
                 _mainSourceParams = null;
             }
         }
     }
 }
示例#11
0
        // Action

        /// <remarks> Sets the next request property of the hostnode.</remarks>
        /// <seealso cref="IHost.NextRequest"/>
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            Request request = HostNode.NextRequest;

            if (request == null)
            {
                HostNode.NextRequest = new Request(Document);
            }
            else
            {
                request.Document = Document;
            }
        }
示例#12
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);
            }
        }
示例#13
0
        /// <summary> Sets the target member to value. </summary>
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            string value;

            if (_source == null)
            {
                value = _value;
            }
            else
            {
                value = _source.DataView.Fields[_columnName].AsString;
            }
            ReflectionUtility.SetInstanceMember(_node, _memberName, value);
        }
示例#14
0
        /// <summary>
        /// Executes the given action, hooking the OnCompleted if it is a Blockable action.
        /// </summary>
        /// <param name="action"></param>
        protected void BlockableExecute(IAction action, EventParams paramsValue)
        {
            IBlockable blockable = action as IBlockable;

            if (blockable != null)
            {
                blockable.OnCompleted += new NodeEventHandler(BlockableCompleted);
                blockable.Disposed    += new EventHandler(BlockableDisposed);
            }

            action.Execute(this, paramsValue);

            if (blockable == null)
            {
                DoCompleted(paramsValue);
            }
        }
示例#15
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            EnsureModuleHostDisposed();

            _moduleHost = HostNode.Session.CreateHost();
            try
            {
                _moduleHost.Load(ModuleExpression, null);
                _moduleHost.Open();
                ((IAction)_moduleHost.FindNode(_actionName)).Execute(this, paramsValue);
            }
            catch
            {
                EnsureModuleHostDisposed();
                throw;
            }
        }
示例#16
0
        /// <summary>
        /// Returns true if the before execute action is not a Blockable node, meaning that the FinishExecute should be called immediately.
        /// </summary>
        /// <param name="paramsValue"></param>
        /// <returns></returns>
        private bool DoBeforeExecute(INode sender, EventParams paramsValue)
        {
            if (_beforeExecute != null)
            {
                IBlockable blockable = _beforeExecute as IBlockable;
                if (blockable != null)
                {
                    blockable.OnCompleted += new NodeEventHandler(BeforeExecuteCompleted);
                }

                _beforeExecute.Execute(this, paramsValue);

                // return true to indicate the FinishExecute should be called immediately
                // return false to indicate the FinishExecute should be called on the ExecuteCompleted of the BeforeExecute action
                return(blockable == null);
            }

            return(true);
        }
示例#17
0
        protected virtual void OnClosedHandler(object sender, EventArgs e)
        {
            if (_onFormClose != null)
            {
                _onFormClose.Execute(this, new EventParams("AForm", sender));
            }

            // Disable the source(s) first before disestablishing the link
            ((IFormInterface)sender).BroadcastEvent(new DisableSourceEvent());

            if (_sourceLink != null)
            {
                _sourceLink.TargetSource = null;
            }

            DoCompleted(_params);

            _params = null;
        }
示例#18
0
 /// <remarks> Performs the search. </remarks>
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if ((Source != null) && (Source.DataView != null))
     {
         DAE.Schema.Order saveOrder = null;
         if ((Source.Order == null) || (Source.Order.Columns.Count != 1) || (Source.Order.Columns[0].Column.Name != _columnName))
         {
             saveOrder          = Source.Order;
             Source.OrderString = String.Format("order {{ {0} }}", _columnName);
         }
         try
         {
             DAE.Schema.RowType rowType = new DAE.Schema.RowType();
             rowType.Columns.Add(new DAE.Schema.Column(_columnName, (Source.DataView.TableType.Columns[_columnName]).DataType));
             using (DAE.Runtime.Data.Row row = new DAE.Runtime.Data.Row(Source.DataView.Process.ValueManager, rowType))
             {
                 ((DAE.Runtime.Data.Scalar)row.GetValue(_columnName)).AsString = _value;
                 if (Mode == FindActionMode.Nearest)
                 {
                     Source.DataView.FindNearest(row);
                 }
                 else
                 {
                     bool found = Source.DataView.FindKey(row);
                     if (!found && (Mode == FindActionMode.ExactOnly))
                     {
                         throw new ClientException(ClientException.Codes.ValueNotFound, _value);
                     }
                 }
             }
         }
         finally
         {
             if (saveOrder != null)
             {
                 Source.Order = saveOrder;
             }
         }
     }
 }
示例#19
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            if (HasScript())
            {
                Assembly   assembly = GetCompiledAssembly();
                ScriptBase script   = CreateScript(assembly);

                try
                {
                    SetNodeReferences(script);
                    script.Execute(sender, paramsValue);
                }
                catch (AbortException)
                {
                    throw;
                }
                catch (Exception exception)
                {
                    throw new ClientException(ClientException.Codes.ScriptExecutionError, exception, Name);
                }
            }
        }
示例#20
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);
        }
示例#21
0
 private void BlockableCompleted(INode sender, EventParams paramsValue)
 {
     DetachBlockable(sender as IBlockable);
     DoCompleted(paramsValue);
 }
示例#22
0
        // Action

        /// <remarks> Clears the next request property of the hostnode. </remarks>
        /// <seealso cref="IHost.NextRequest"/>
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            HostNode.NextRequest = null;
        }
示例#23
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);
            }
        }
示例#24
0
        protected override void InternalPerformDefault(DataLink link, string[] targetColumns, EventParams paramsValue)
        {
            var sourceColumns = _sourceColumns.Split(',', ';');

            for (int i = 0; i < Math.Min(sourceColumns.Length, targetColumns.Length); i++)
            {
                var sourceField = _source[sourceColumns[i].Trim()];
                var targetField = link.DataSet[targetColumns[i].Trim()];
                if (sourceField.HasValue())
                {
                    targetField.AsNative = sourceField.AsNative;
                }
                else
                {
                    targetField.ClearValue();
                }
            }
        }
示例#25
0
 protected abstract void InternalPerformDefault(DataLink link, string[] targetColumns, EventParams paramsValue);
示例#26
0
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     LookupUtility.DoLookup(this, new FormInterfaceHandler(LookupFormAccept), new FormInterfaceHandler(LookupFormReject), null);
 }
示例#27
0
 protected override void InternalExecute(Alphora.Dataphor.Frontend.Client.INode sender, Alphora.Dataphor.Frontend.Client.EventParams paramsValue)
 {
     ((Web.Session)HostNode.Session).OnBeforeRenderBody += new RenderHandler(SessionBeforeRender);
 }
示例#28
0
 protected abstract void InternalExecute(INode sender, EventParams paramsValue);
示例#29
0
 private void FinishExecute(INode sender, EventParams paramsValue)
 {
     InternalExecute(sender, paramsValue);
     DoAfterExecute(paramsValue);
 }
示例#30
0
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     HostNode.Session.InvokeHelp((sender == null ? this : sender), _helpKeyword, _helpKeywordBehavior, _helpString);
 }