Пример #1
0
        /// <summary>
        /// Log message
        /// </summary>
        /// <param name="data"></param>
        public void LogData(object data)
        {
            var list1 = data as List <JobWorkerLog <LoadFileDocumentParserLogInfo> >;

            if (null != list1)//Load File Record Parser
            {
                if (list1.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list1.Select(ConstructWorkerLog <LoadFileDocumentParserLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list1.Count);
                }
                return;
            }

            var list2 = data as List <JobWorkerLog <LoadFileParserLogInfo> >;

            if (null != list2)//Load File Parser
            {
                if (list2.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list2.Select(ConstructWorkerLog <LoadFileParserLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list2.Count);
                }
                return;
            }

            var list3 = data as List <JobWorkerLog <OverlaySearchLogInfo> >;

            if (null != list3)//Load File Parser
            {
                if (list3.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list3.Select(ConstructWorkerLog <OverlaySearchLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list3.Count);
                }
                return;
            }

            var list4 = data as List <JobWorkerLog <VaultLogInfo> >;

            if (null != list4)//Load File Parser
            {
                if (list4.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list4.Select(ConstructWorkerLog <VaultLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list4.Count);
                }
                return;
            }

            var list5 = data as List <JobWorkerLog <SearchIndexLogInfo> >;

            if (null != list5)//Load File Parser
            {
                if (list5.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list5.Select(ConstructWorkerLog <SearchIndexLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list5.Count);
                }
                return;
            }

            var list6 = data as List <JobWorkerLog <NearNativeLogInfo> >;

            if (null != list6)//Load File Parser
            {
                if (list6.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list6.Select(ConstructWorkerLog <NearNativeLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list6.Count);
                }
                return;
            }

            var list7 = data as List <JobWorkerLog <EdLoaderParserLogInfo> >;

            if (null != list7)//Load File Parser
            {
                if (list7.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list7.Select(ConstructWorkerLog <EdLoaderParserLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list7.Count);
                }
                return;
            }

            var list8 = data as List <JobWorkerLog <DcbParserLogInfo> >;

            if (null != list8)//Load File Parser
            {
                if (list8.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list8.Select(ConstructWorkerLog <DcbParserLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list8.Count);
                }
                return;
            }

            var list9 = data as List <JobWorkerLog <EDocsExtractionLogInfo> >;

            if (null != list9)//Load File Parser
            {
                if (list9.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list9.Select(ConstructWorkerLog <EDocsExtractionLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list9.Count);
                }
                return;
            }

            var list10 = data as List <JobWorkerLog <ProductionParserLogInfo> >;

            if (null != list10)//Load File Parser
            {
                if (list10.Any())
                {
                    List <ProductionWorkerLogBEO> workerLogList =
                        list10.Select(ConstructProductionWorkerLog <ProductionParserLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertProductionJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list10.Count);
                }
                return;
            }

            var list11 = data as List <JobWorkerLog <ReviewsetLogInfo> >;

            if (null != list11)//Load File Parser
            {
                if (list11.Any())
                {
                    List <ReviewsetLogBEO> workerLogList =
                        list11.Select(ConstructReviewsetWorkerLog <ReviewsetLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertReviewsetJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list11.Count);
                }
                return;
            }

            #region Export
            var list12 = data as List <JobWorkerLog <ExportMetadataLogInfo> >;
            if (null != list12)//Load File Parser
            {
                if (list12.Any())
                {
                    List <ExportWorkerLogBEO> workerLogList =
                        list12.Select(ConstructExportWorkerLog <ExportMetadataLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertExportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list12.Count);
                }
                return;
            }

            var list13 = data as List <JobWorkerLog <ExportStartupLogInfo> >;
            if (null != list13)//Load File Parser
            {
                if (list13.Any())
                {
                    List <ExportWorkerLogBEO> workerLogList =
                        list13.Select(ConstructExportWorkerLog <ExportStartupLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertExportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list13.Count);
                }
                return;
            }

            var list14 = data as List <JobWorkerLog <ExportFileCopyLogInfo> >;
            if (null != list14)//Load File Parser
            {
                if (list14.Any())
                {
                    List <ExportWorkerLogBEO> workerLogList =
                        list14.Select(ConstructExportWorkerLog <ExportFileCopyLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertExportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list14.Count);
                }
                return;
            }

            var list15 = data as List <JobWorkerLog <ExportLoadFileWritterLogInfo> >;
            if (null != list15)//Load File Parser
            {
                if (list15.Any())
                {
                    List <ExportWorkerLogBEO> workerLogList =
                        list15.Select(ConstructExportWorkerLog <ExportLoadFileWritterLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertExportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list15.Count);
                }
                return;
            }

            var list16 = data as List <JobWorkerLog <LawImportLogInfo> >;
            if (null != list16)//Law Import
            {
                if (list16.Any())
                {
                    List <ImportWorkerLogBEO> workerLogList =
                        list16.Select(ConstructWorkerLog <LawImportLogInfo>).ToList();
                    JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(workerLogList);
                    IncreaseProcessedDocumentsCount(list16.Count);
                }
                return;
            }
            #endregion

            var list17 = data as List <JobWorkerLog <LogInfo> >;
            if (null != list17)
            {
                if (list17.Any())
                {
                    int JobRunId = (!String.IsNullOrEmpty(PipelineId)) ? Convert.ToInt32(PipelineId) : 0;
                    int jobID    = JobMgmtDAO.GetJobIdFromJobRunId(JobRunId);
                    foreach (JobWorkerLog <LogInfo> log in list17)
                    {
                        if (log.WorkerRoleType != "PrintValidationWorker") // Don't do Insert for "PrintValidationWorker"
                        {
                            byte[] binaryData = DatabaseBroker.SerializeObjectBinary <LogInfo>(log.LogInfo);
                            DatabaseBroker.InsertTaskDetails((int)log.JobRunId, (int)log.CorrelationId, binaryData);
                        }
                        Helper.UpdateTaskLog(jobID, (int)log.JobRunId, (int)log.CorrelationId, string.IsNullOrEmpty(log.LogInfo.TaskKey) ? string.Empty : log.LogInfo.TaskKey, Helper.SerializeObject <LogInfo>(log.LogInfo), log.LogInfo.IsError, System.DateTime.UtcNow.AddMinutes(-5), System.DateTime.UtcNow, string.Empty);
                    }

                    IncreaseProcessedDocumentsCount(list17.Count);
                }
                return;
            }

            var listBulkTagLog = data as List <JobWorkerLog <TagLogInfo> >;
            if (null != listBulkTagLog && listBulkTagLog.Any())
            {
                var workerLogList = listBulkTagLog.Select(ConstructBulkTagWorkerLog <TagLogInfo>).ToList();
                JobMgmtDAO.BulkInsertJobTaskWorkerLog(workerLogList);
                IncreaseProcessedDocumentsCount(workerLogList.Count);
                return;
            }

            var listNearDupeLog = data as List <JobWorkerLog <NearDuplicationLogInfo> >;
            if (null != listNearDupeLog && listNearDupeLog.Any()) //Near Duplication Job
            {
                var workerLogList =
                    listNearDupeLog.Select(ConstructNearDuplicationWorkerLog <NearDuplicationLogInfo>).ToList();
                JobMgmtDAO.BulkInsertJobTaskWorkerLog(workerLogList);
                IncreaseProcessedDocumentsCount(listNearDupeLog.Count);
                return;
            }

            var listTaggingLog = data as List <JobWorkerLog <LawImportTaggingLogInfo> >;
            if (null != listTaggingLog && listTaggingLog.Any())
            {
                List <ImportWorkerLogBEO> logList =
                    listTaggingLog.Select(ConstructWorkerLog <LawImportTaggingLogInfo>).ToList();
                JobMgmtDAO.BulkInsertImportJobTaskWorkerLog(logList);
                IncreaseProcessedDocumentsCount(listTaggingLog.Count);
                return;
            }

            var listLawSyncLog = data as List <JobWorkerLog <LawSyncLogInfo> >;
            if (null != listLawSyncLog && listLawSyncLog.Any()) //Law Sync Job
            {
                var workerLogList =
                    listLawSyncLog.Select(ConstructLawSyncWorkerLog).ToList();
                JobMgmtDAO.BulkInsertJobTaskWorkerLog(workerLogList);
                IncreaseProcessedDocumentsCount(listLawSyncLog.Count);
                return;
            }
        } // LogData
Пример #2
0
        /// <summary>
        /// Processes the data.
        /// </summary>
        /// <param name="printDocuments"></param>
        public void ProcessTheDocument(List <DocumentResult> printDocuments)
        {
            if (_mBootParameters == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(_mBootParameters.DataSet.CollectionId))
            {
                return;
            }
            // Get mapped printer
            _mMappedPrinterToNetwork =
                PrinterManagementBusiness.GetMappedPrinter(
                    new MappedPrinterIdentifierBEO(
                        _mBootParameters.Printer.UniqueIdentifier.Split(Constants.Split).Last(), true));
            // Create folder
            CreateFoldersForTemporaryStorage();


            //Get Dataset and Matter information for a given Collection Id
            _mDataSet = DataSetBO.GetDataSetDetailForCollectionId(_mBootParameters.DataSet.CollectionId);

            //Get DataSet Fields
            _mDataSet.DatasetFieldList.AddRange(
                DataSetBO.GetDataSetDetailForDataSetId(_mDataSet.FolderID).DatasetFieldList);
            // Get Matter information
            _mDataSet.Matter = MatterBO.GetMatterInformation(_mDataSet.FolderID);
            _mDatasetName    = _mDataSet.FolderName;


            var documents = new List <DocumentResult>();
            var documentIdentifierEntities = new List <DocumentIdentifierEntity>();

            foreach (var document in printDocuments)
            {
                try
                {
                    string errorCode;
                    var    separatorSheetFolder = Guid.NewGuid();
                    var    separatorSheet       = Path.Combine(Path.Combine(_mSharedLocation, _mBootParameters.Name),
                                                               Constants.SourceDirectoryPath, separatorSheetFolder.ToString(),
                                                               Constants.separatorHtml);
                    CreateseparatorSheet(separatorSheet, _mBootParameters.DataSet.MatterId,
                                         _mBootParameters.DataSet.CollectionId, document.DocumentID);
                    //Print the document set
                    var jobRunId = (!String.IsNullOrEmpty(PipelineId)) ? Convert.ToInt32(PipelineId) : 0;
                    var jobId    = JobMgmtDAO.GetJobIdFromJobRunId(jobRunId);
                    var status   = PrintDocumentSet(jobId.ToString(CultureInfo.InvariantCulture), _mBootParameters, document,
                                                    separatorSheet, out errorCode);
                    if (status)
                    {
                        document.CreatedDate = DateTime.Now;
                        documents.Add(document);
                        // Log the message using Log worker...
                        LogMessage(document, true, string.Empty);
                    }
                    else
                    {
                        // Log the message using Log worker...
                        LogMessage(document, false, errorCode);
                    }
                    if (_mDataSet != null &&
                        _mDataSet.Matter != null)
                    {
                        var documentIdentifierEntity = new DocumentIdentifierEntity();
                        documentIdentifierEntity.CollectionId        = document.CollectionID;
                        documentIdentifierEntity.Dcn                 = document.DocumentControlNumber;
                        documentIdentifierEntity.DocumentReferenceId = document.DocumentID;
                        documentIdentifierEntity.CollectionName      = _mDataSet.FolderName;
                        documentIdentifierEntities.Add(documentIdentifierEntity);
                    }
                }
                catch (Exception ex)
                {
                    //report to director and continue with other documents if there is error in printing a documents
                    ex.Trace().Swallow();
                    ReportToDirector(ex);
                }
            }
            if (documents.Count > 0)
            {
                Tracer.Info("Print Processing worker - Document Count: {0}",
                            documents.Count.ToString(CultureInfo.InvariantCulture));
                Send(documents);
                if (_mDataSet != null &&
                    _mDataSet.Matter != null
                    )
                {
                    AuditLogFacade.LogDocumentsPrinted(_mDataSet.Matter.FolderID, documentIdentifierEntities);
                }
            }
        }