コード例 #1
0
        /// <summary>
        /// Send Worker response to Pipe.
        /// </summary>
        private void Send(List <DocumentResult> documentList)
        {
            var documentCollection = new PrintDocumentCollection
            {
                Documents          = documentList,
                DatasetName        = _mDatasetName,
                TotalDocumentCount = _mTotalDocumentCount
            };
            var message = new PipeMessageEnvelope
            {
                Body = documentCollection
            };

            OutputDataPipe.Send(message);
            IncreaseProcessedDocumentsCount(documentList.Count);
        }
コード例 #2
0
        /// <summary>
        /// Processes the data.
        /// </summary>
        public void ValidateDocuments(List <DocumentResult> printDocuments)
        {
            if (bulkPrintServiceRequestBEO == null)
            {
                return;
            }
            var targetDirectoryPath = Path.Combine(sharedLocation, bulkPrintServiceRequestBEO.Name);
            var notReady            = new List <DocumentResult>();
            var sourcedir           = new DirectoryInfo(targetDirectoryPath);
            var separatorFileList   = sourcedir.GetFiles();

            try
            {
                foreach (DocumentResult documentResult in printDocuments)
                {
                    string fieldValue;
                    fieldValue = documentResult.DocumentControlNumber;
                    if (documentResult.Fields != null && documentResult.Fields.Any())
                    {
                        foreach (var field in documentResult.Fields)
                        {
                            if (field == null)
                            {
                                continue;
                            }
                            if (String.IsNullOrEmpty(field.Name))
                            {
                                continue;
                            }
                            if (field.Name.Equals(bulkPrintServiceRequestBEO.FieldName))
                            {
                                fieldValue = !string.IsNullOrEmpty(field.Value) ? field.Value.Trim() : fieldValue;
                            }
                        }
                    }

                    var document = separatorFileList.Where(x => x.Name.Equals(string.Format("{0}.pdf", fieldValue)));
                    if (!document.Any())
                    {
                        if (documentResult.CreatedDate > DateTime.Now.AddMinutes(-5))
                        {
                            notReady.Add(documentResult);
                        }
                        else
                        {
                            Tracer.Info("Print Validation Worker - Failed Document: {0}", documentResult.DocumentControlNumber);
                            LogMessage(documentResult, false, DocumentFailedDuetoTimeOutError);
                        }
                    }
                    else
                    {
                        LogMessage(documentResult, true, "Document queued to printer");
                    }
                }

                if (notReady.Any())
                {
                    var documentCollection = new PrintDocumentCollection {
                        Documents = notReady, TotalDocumentCount = totalDocumentCount
                    };
                    var message = new PipeMessageEnvelope {
                        Body = documentCollection, IsPostback = true
                    };
                    InputDataPipe.Send(message);
                }
                else
                {
                    UpdateAuditLog();
                }
            }
            catch (IOException ex)
            {
                ex.AddDbgMsg("Directory = {0}", sourceLocation);
                ReportToDirector(ex);
                ex.Trace().Swallow();
            }
            catch (Exception ex)
            {
                ReportToDirector(ex);
                ex.Trace().Swallow();
                UpdateAuditLog();
            }
        }
コード例 #3
0
        /// <summary>
        /// Processes the data.
        /// </summary>
        public void ValidateDocuments(List<DocumentResult> printDocuments)
        {
            if (bulkPrintServiceRequestBEO == null) return;
            var targetDirectoryPath = Path.Combine(sharedLocation, bulkPrintServiceRequestBEO.Name);
            var notReady = new List<DocumentResult>();
            var sourcedir = new DirectoryInfo(targetDirectoryPath);
            var separatorFileList = sourcedir.GetFiles();
            try
            {
                foreach (DocumentResult documentResult in printDocuments)
                {
                    string fieldValue;
                    fieldValue = documentResult.DocumentControlNumber;
                    if (documentResult.Fields != null && documentResult.Fields.Any())
                    {
                        foreach (var field in documentResult.Fields)
                        {
                            if (field == null) continue;
                            if (String.IsNullOrEmpty(field.Name)) continue;
                            if (field.Name.Equals(bulkPrintServiceRequestBEO.FieldName)) fieldValue = !string.IsNullOrEmpty(field.Value) ? field.Value.Trim() : fieldValue;
                    }
                    }

                    var document = separatorFileList.Where(x => x.Name.Equals(string.Format("{0}.pdf", fieldValue)));
                    if (!document.Any())
                    {
                        if (documentResult.CreatedDate > DateTime.Now.AddMinutes(-5))
                        {
                            notReady.Add(documentResult);
                        }
                        else
                        {
                            Tracer.Info("Print Validation Worker - Failed Document: {0}", documentResult.DocumentControlNumber);
                            LogMessage(documentResult, false, DocumentFailedDuetoTimeOutError);
                        }
                    }
                    else
                    {
                        LogMessage(documentResult, true, "Document queued to printer");
                    }
                }

                if (notReady.Any())
                {
                    var documentCollection = new PrintDocumentCollection { Documents = notReady, TotalDocumentCount = totalDocumentCount };
                    var message = new PipeMessageEnvelope { Body = documentCollection, IsPostback = true };
                    InputDataPipe.Send(message);
                }
                else
                {

                    UpdateAuditLog();
                }
            }
            catch (IOException ex)
            {
                ex.AddDbgMsg("Directory = {0}", sourceLocation);
                ReportToDirector(ex);
                ex.Trace().Swallow();
            }
            catch (Exception ex)
            {
                ReportToDirector(ex);
                ex.Trace().Swallow();
                UpdateAuditLog();
            }
        }
コード例 #4
0
 /// <summary>
 /// Send Worker response to Pipe.
 /// </summary>
 private void Send(List<DocumentResult> documentList)
 {
     var documentCollection = new PrintDocumentCollection
     {
         Documents = documentList,
         DatasetName = _mDatasetName,
         TotalDocumentCount = _mTotalDocumentCount
     };
     var message = new PipeMessageEnvelope
     {
         Body = documentCollection
     };
     OutputDataPipe.Send(message);
     IncreaseProcessedDocumentsCount(documentList.Count);
 }