Пример #1
0
 protected virtual void SaveCheckStatusComplete(string localTransactionId, CheckStatusComplete info)
 {
     if (!_documentManager.HasDocumentByName(localTransactionId, CHECK_STATUS_COMPLETE_FILE_NAME))
     {
         byte[]   content = _serializationHelper.SerializeWithLineBreaks(info);
         Document saveDoc = new Document(CHECK_STATUS_COMPLETE_FILE_NAME, CommonContentType.XML, content);
         saveDoc.DontAutoCompress = true;
         _documentManager.AddDocument(localTransactionId, CommonTransactionStatusCode.Completed, string.Empty, saveDoc);
     }
 }
Пример #2
0
        protected virtual bool ProcessOutstandingTransaction(NodeTransaction nodeTransaction)
        {
            try
            {
                if (HasTransactionBeenProcessed(nodeTransaction))
                {
                    return(false);
                }
                AppendAuditLogEvent("*** Begin processing network submission transaction \"{0}\" to {1} service \"{2}\" ...",
                                    nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName);

                AppendAuditLogEvent("Checking status of the network transaction \"{0}\" associated with the local transaction \"{1}\" ...",
                                    nodeTransaction.NetworkId, nodeTransaction.Id);

                TransactionStatus           transactionStatus = _transactionManager.RefreshNetworkStatus(nodeTransaction.Id);
                CommonTransactionStatusCode currentStatus     = transactionStatus.Status;

                AppendAuditLogEvent("The network transaction \"{0}\" associated with the local transaction \"{1}\" has a network status of \"{2}\" ...",
                                    nodeTransaction.NetworkId, nodeTransaction.Id, currentStatus.ToString());

                if ((currentStatus == CommonTransactionStatusCode.Completed) || (currentStatus == CommonTransactionStatusCode.Failed))
                {
                    AppendAuditLogEvent("Attempting to download documents for the network transaction \"{0}\" ...",
                                        nodeTransaction.NetworkId);

                    nodeTransaction.NetworkEndpointStatus = currentStatus;
                    _transactionManager.DownloadNetworkDocumentsAndAddToTransaction(nodeTransaction.Id, out currentStatus);

                    AppendAuditLogEvent("Any documents associated with the network transaction \"{0}\" were downloaded and saved.",
                                        nodeTransaction.NetworkId);

                    DoEmailNotifications(nodeTransaction);

                    CheckStatusComplete checkStatusComplete = new CheckStatusComplete(DateTime.Now);
                    SaveCheckStatusComplete(nodeTransaction.Id, checkStatusComplete);
                    return(true);
                }
                else
                {
                    AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.",
                                        nodeTransaction.NetworkId);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                AppendAuditLogEvent("ERROR: Failed to process network submission transaction \"{0}\" to {1} service \"{2}\" with exception: {3}.",
                                    nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName,
                                    ExceptionUtils.GetDeepExceptionMessage(ex));
                AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.",
                                    nodeTransaction.NetworkId);
                return(false);
            }
        }