コード例 #1
0
        protected virtual void SaveCheckStatusInfo(CheckStatusInfo info)
        {
            byte[]   content = _serializationHelper.SerializeWithLineBreaks(info);
            Document doc     = new Document(SUBMISSION_CHECK_STATUS_INFO_FILE_NAME, CommonContentType.XML, content);

            doc.DontAutoCompress = true;
            Document existingDoc = null;

            try
            {
                existingDoc = _documentManager.GetDocumentByName(_transaction.Id, SUBMISSION_CHECK_STATUS_INFO_FILE_NAME, false);
            }
            catch (FileNotFoundException)
            {
            }
            if (existingDoc != null)
            {
                _documentManager.DeleteDocument(_transaction.Id, existingDoc.Id);
            }
            _documentManager.AddDocument(_transaction.Id, CommonTransactionStatusCode.Completed, string.Empty, doc);
        }
コード例 #2
0
ファイル: NCTPlugin.cs プロジェクト: hkbadeq/opennode2-dotnet
        protected void AddReportDocumentToTransaction(string transactionId, bool succeeded)
        {
            string documentName = succeeded ? "Node20.Report" : "Node20.Error";

            try {
                _documentManager.GetDocumentByName(transactionId, documentName, false);
            }
            catch {
                return; // Already there
            }
            _documentManager.AddDocument(transactionId, CommonTransactionStatusCode.Processed,
                                         string.Empty, new Document(string.Empty, documentName, CommonContentType.Flat,
                                                                    CreateReportDocumentContent(succeeded)));
            AppendAuditLogEvent("Added report document \"{0}\" to transaction.", documentName);
        }
コード例 #3
0
        protected virtual bool DoProcessResponseDocuments(string localTransactionId, IList <string> documentNames, out Windsor.Node2008.WNOSDomain.Document zipResponseFile)
        {
            AppendAuditLogEvent("Attempting to process response documents for ICIS submission with transaction id \"{0}\"", _submissionTrackingDataType.SubmissionTransactionId);

            string responseZipFileName = FindResponseZipFileName(documentNames);

            AppendAuditLogEvent("Extracting response document content ...");

            zipResponseFile = _documentManager.GetDocumentByName(localTransactionId, responseZipFileName, true);

            string tempFolder = _settingsProvider.CreateNewTempFolderPath();

            _compressionHelper.UncompressDirectory(zipResponseFile.Content, tempFolder);

            string[] responseFiles = Directory.GetFiles(tempFolder);

            string responseAcceptedFilePath = FindResponseAcceptedFilePath(responseFiles);
            string responseRejectedFilePath = FindResponseRejectedFilePath(responseFiles);

            AppendAuditLogEvent("Loading response document content ...");

            AppendAuditLogEvent("Transforming accepted response file ...");
            string responseAcceptedTransformedFilePath = TransformResponseFile50(responseAcceptedFilePath);
            SubmissionResultList acceptedList          = _serializationHelper.Deserialize <SubmissionResultList>(responseAcceptedTransformedFilePath);

#if INCLUDE_TEST_SUBMIT_PROCESSOR
            if (DebugUtils.IsDebugging)
            {
                foreach (var submissionResultsDataType in acceptedList.SubmissionResult)
                {
                    if (string.IsNullOrEmpty(submissionResultsDataType.SubmissionTransactionId))
                    {
                        throw new ArgException("submissionResultsDataType.SubmissionTransactionId is null");
                    }
                }
            }
#endif // INCLUDE_TEST_SUBMIT_PROCESSOR

            AppendAuditLogEvent("Transforming rejected response file ...");
            string responseRejectedTransformedFilePath = TransformResponseFile50(responseRejectedFilePath);
            SubmissionResultList rejectedList          = _serializationHelper.Deserialize <SubmissionResultList>(responseRejectedTransformedFilePath);
#if INCLUDE_TEST_SUBMIT_PROCESSOR
            if (DebugUtils.IsDebugging)
            {
                foreach (var submissionResultsDataType in rejectedList.SubmissionResult)
                {
                    if (string.IsNullOrEmpty(submissionResultsDataType.SubmissionTransactionId))
                    {
                        throw new ArgException("submissionResultsDataType.SubmissionTransactionId is null");
                    }
                }
            }
#endif // INCLUDE_TEST_SUBMIT_PROCESSOR

            List <SubmissionResultsDataType> saveList = new List <SubmissionResultsDataType>(CollectionUtils.Count(acceptedList.SubmissionResult) +
                                                                                             CollectionUtils.Count(rejectedList.SubmissionResult));

            DateTime now = DateTime.Now;
            CollectionUtils.ForEach(acceptedList.SubmissionResult, delegate(SubmissionResultsDataType result)
            {
                //DebugUtils.AssertDebuggerBreak(result.SubmissionTransactionId == _submissionTrackingDataType.SubmissionTransactionId);
                result.CreatedDateTime = now;
                saveList.Add(result);
            });
            CollectionUtils.ForEach(rejectedList.SubmissionResult, delegate(SubmissionResultsDataType result)
            {
                //DebugUtils.AssertDebuggerBreak(result.SubmissionTransactionId == _submissionTrackingDataType.SubmissionTransactionId);
                result.CreatedDateTime = now;
                saveList.Add(result);
            });


            _baseDao.TransactionTemplate.Execute(delegate(Spring.Transaction.ITransactionStatus status)
            {
                try
                {
                    AppendAuditLogEvent("Saving response data to database ...");
                    Type mappingAttributesType = typeof(Windsor.Node2008.WNOSPlugin.ICISNPDES_50.MappingAttributes);

                    Dictionary <string, int> tableRowCounts = _objectsToDatabase.SaveToDatabase(saveList, _baseDao, false, mappingAttributesType);

                    AppendAuditLogEvent("Response data saved to database with the following insert row counts: {0}", CreateTableRowCountsString(tableRowCounts));
                }
                catch (Exception ex1)
                {
                    AppendAuditLogEvent("Failed to save response data to database, rolling back transaction: {0}", ExceptionUtils.GetDeepExceptionMessage(ex1));
                    throw;
                }

                ExecuteStoredProc();

                return(null);
            });

            return(true);
        }