public IEnumerable <ApplicationEvent> Process(BankOperationProcessorCommand command)
        {
            Argument.NotNull(command, "command");
            var operation = command.BankOperation;

            if (operation.Status == ProcessStatus.Failed)
            {
                Logger.Warn("Operation #{0} has been already failed.", operation.Id);
                return(Enumerable.Empty <ApplicationEvent>());
            }
            if (operation.Status == ProcessStatus.Completed)
            {
                Logger.Warn("Operation #{0} has been already completed.", operation.Id);
                return(Enumerable.Empty <ApplicationEvent>());
            }
            var postponeDate = PostponeDateOrNull(operation);

            if (postponeDate != null)
            {
                var operationModel = command.BankOperation.ToModel <BankOperation, BankOperationModel>();
                var @event         = new OperationProgressEvent(command.OperationId, operationModel);
                return(new List <ApplicationEvent>
                {
                    new PostponedEvent(@event, postponeDate.Value)
                });
            }
            return(ProcessPending(command));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a new interface for performing backup and restore operations
 /// </summary>
 /// <param name="backend">The url for the backend to use</param>
 /// <param name="options">All required options</param>
 public Interface(string backend, Dictionary<string, string> options)
 {
     m_backend = backend;
     m_options = new Options(options);
     m_liveControl = new LiveControl.LiveControl(System.Threading.Thread.CurrentThread, m_options);
     OperationProgress += new OperationProgressEvent(Interface_OperationProgress);
 }