Beispiel #1
0
        /// <summary>
        ///     Construct Near Duplication Log Info for Document
        /// </summary>
        private JobWorkerLog <NearDuplicationLogInfo> ConstructNearDuplicationLogInfoForDocument(bool isErrorInDatabase,
                                                                                                 bool isErrorInSearchEngine,
                                                                                                 DocumentMasterEntity documentInfo)
        {
            string documentControlNumber = documentInfo.DocumentTitle;
            var    nearDuplicationLog    = new JobWorkerLog <NearDuplicationLogInfo>
            {
                JobRunId =
                    (!string.IsNullOrEmpty(PipelineId))
                        ? Convert.ToInt64(PipelineId)
                        : 0,
                CorrelationId    = Convert.ToInt32(documentControlNumber.Replace(_dataset.DCNPrefix, string.Empty)),
                WorkerInstanceId = WorkerId,
                WorkerRoleType   = Constants.NearDuplicationEvUpdateWorkerRoleType,
                Success          = false,
                CreatedBy        = _jobParameter.CreatedBy,
                IsMessage        = false,
                LogInfo          = new NearDuplicationLogInfo
                {
                    DocumentControlNumber     = documentControlNumber,
                    IsFailureInDatabaseUpdate = isErrorInDatabase,
                    IsFailureInSearchUpdate   = isErrorInSearchEngine,
                    Information =
                        string.Format(
                            Constants.
                            NearDuplicationEvUpdateWorkerFailureMessage,
                            documentControlNumber)
                }
            };

            return(nearDuplicationLog);
        }
Beispiel #2
0
        /// <summary>
        /// This method helps to Log Info which groups duplicates and there original document in turn docs whose hash values count >0
        /// and groups them into a logical group say IsDuplicate replicate of each other.This helps the user to identify the docs in
        /// Document Data Viewer with the help of Red color identification.
        /// </summary>
        private void GroupingLogInfo(DocumentMasterEntity document, DocumentHashMapEntity docHasMap,
                                     List <DocumentHashMapEntity> lsDocumentHash)
        {
            try
            {
                if (_tempHashInfo == string.Empty)
                {
                    _tempHashInfo        = docHasMap.HashValue;
                    _objAffectedDocument = new AffectedDocument
                    {
                        CollectionId = document.CollectionId.ToString(),
                        DocId        = document.DocumentReferenceId
                    };
                    if (!String.IsNullOrEmpty(document.NativeFilePath))
                    {
                        var strFileInfo = document.NativeFilePath;
                        var strFile     = strFileInfo.Split(Convert.ToChar(@"\"));
                        _objAffectedDocument.Name = strFile[strFile.Length - 1];
                    }
                    else
                    {
                        _objAffectedDocument.Name = document.DocumentTitle;
                    }
                    if (document.DocumentTitle != null)
                    {
                        _objAffectedDocument.BatesNumber = document.DocumentTitle;
                    }
                    _lsBatesNo = new List <string>();
                    _isNew     = true;
                }
                if (_tempHashInfo != string.Empty && _isNew == false)
                {
                    if (_tempHashInfo == docHasMap.HashValue)
                    {
                        _lsBatesNo.Add(document.DocumentTitle);
                        if (_intCount == lsDocumentHash.Count) //task.DuplicateDocumentCount
                        {
                            _objAffectedDocument.DuplicateList.Clear();
                            _lsBatesNo.SafeForEach(o => _objAffectedDocument.DuplicateList.Add(o));
                            _lsAffectedDocument.Add(_objAffectedDocument);
                        }
                    }
                    else
                    {
                        _objAffectedDocument.DuplicateList.Clear();
                        _lsBatesNo.SafeForEach(o => _objAffectedDocument.DuplicateList.Add(o));
                        _lsAffectedDocument.Add(_objAffectedDocument);

                        _objAffectedDocument = null;
                        _lsBatesNo           = null;
                        _lsBatesNo           = new List <string>();
                        _objAffectedDocument = new AffectedDocument
                        {
                            CollectionId = document.CollectionId.ToString(),
                            DocId        = document.DocumentReferenceId
                        };
                        if (!String.IsNullOrEmpty(document.NativeFilePath))
                        {
                            var strFileInfo = document.NativeFilePath;
                            var strFile     = strFileInfo.Split(Convert.ToChar(@"\"));
                            _objAffectedDocument.Name = strFile[strFile.Length - 1];
                        }
                        else
                        {
                            _objAffectedDocument.Name = document.DocumentTitle;
                        }
                        if (document.DocumentTitle != null)
                        {
                            _objAffectedDocument.BatesNumber = document.DocumentTitle;
                        }
                        _tempHashInfo = docHasMap.HashValue;
                    }
                }
                _isNew = false;
                _intCount++;
            }
            catch (Exception ex)
            {
                EvLog.WriteEntry(_jobid + Constants.ErrorForBatesNumber, ex.Message, EventLogEntryType.Error);
                LogException(_jobid, ex, Constants.ErrorForBatesNumber, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInGenerateTasks);
            }
        }
 /// <summary>
 ///     Construct Near Duplication Log Info for Document
 /// </summary>
 private JobWorkerLog<NearDuplicationLogInfo> ConstructNearDuplicationLogInfoForDocument(bool isErrorInDatabase,
     bool isErrorInSearchEngine,
     DocumentMasterEntity documentInfo)
 {
     string documentControlNumber = documentInfo.DocumentTitle;
     var nearDuplicationLog = new JobWorkerLog<NearDuplicationLogInfo>
     {
         JobRunId =
             (!string.IsNullOrEmpty(PipelineId))
                 ? Convert.ToInt64(PipelineId)
                 : 0,
         CorrelationId = Convert.ToInt32(documentControlNumber.Replace(_dataset.DCNPrefix, string.Empty)),
         WorkerInstanceId = WorkerId,
         WorkerRoleType = Constants.NearDuplicationEvUpdateWorkerRoleType,
         Success = false,
         CreatedBy = _jobParameter.CreatedBy,
         IsMessage = false,
         LogInfo = new NearDuplicationLogInfo
         {
             DocumentControlNumber = documentControlNumber,
             IsFailureInDatabaseUpdate = isErrorInDatabase,
             IsFailureInSearchUpdate = isErrorInSearchEngine,
             Information =
                 string.Format(
                     Constants.
                         NearDuplicationEvUpdateWorkerFailureMessage,
                     documentControlNumber)
         }
     };
     return nearDuplicationLog;
 }