private void paidEventInvoked(object sender, ExternalDataEventArgs e)
        {
            var workflowEventArgs = e as WorkflowEventArgsWithInitiator;
            if (workflowEventArgs == null)
                return;

            TransitionInitiator = workflowEventArgs.InitiatorId;
            ImpersonatedIdentityId = workflowEventArgs.ImpersonatedIdentityId;
            LastCommand = WorkflowCommand.SetPaid;

            var paidCommandEventArgs = e as PaidCommandEventArgs;
            if (paidCommandEventArgs == null)
                return;

            var externalState = new BillDemandExternalState()
                                    {
                                        DocumentNumber = paidCommandEventArgs.DocumentNumber,
                                        PaymentDate =
                                            paidCommandEventArgs.PaymentDate.HasValue
                                                ? paidCommandEventArgs.PaymentDate.Value
                                                : DateTime.Now
                                    };

            Budget2WorkflowRuntime.BillDemandBuinessService.SetExternalParameters(WorkflowInstanceId, externalState);


        }
 public void SetExternalParameters(Guid billDemandUid, BillDemandExternalState externalState)
 {
     using (var scope = ReadCommittedSupressedScope)
     {
         using (var context = this.CreateContext())
         {
             BillDemand billDemand = GetBillDemand(context, billDemandUid);
             billDemand.DateOfPerformance = externalState.PaymentDate;
             billDemand.AccountNumber = externalState.DocumentNumber;
             context.SubmitChanges();
             context.spRecalcBillDemandCurrencySum(billDemandUid);
         }
         scope.Complete();
     }
 }
 private void CheckExternalStatus_ExecuteCode(object sender, EventArgs e)
 {
     _externalState = Budget2WorkflowRuntime.BillDemandExportService.GetBillDemandExternalStaus(WorkflowInstanceId);
 }