Ejemplo n.º 1
0
        /// <summary>
        /// Clean Zip files in shared space
        /// </summary>
        private void CleanZipFilesInSharedSpace()
        {
            string sharedLocation = CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.BaseSharedPath);

            sharedLocation = Path.Combine(Path.Combine(sharedLocation, Constants.DeliveryOptions), Constants.TargetDirectoryPath);
            DirectoryInfo dir = new DirectoryInfo(sharedLocation);

            if (dir.Exists)
            {
                FileInfo[] files = dir.GetFiles();
                if (files.Length > 0)
                {
                    int             interval      = int.Parse(ConfigurationManager.AppSettings[Constants.CleanFolderInHours]);
                    List <FileInfo> filesToDelete = files.Where(o => o.Extension.Contains(Constants.ZipExtension) && o.CreationTime <= DateTime.Now.AddHours(-interval)).ToList();
                    if (filesToDelete.Count > 0)
                    {
                        foreach (FileInfo t in filesToDelete)
                        {
                            try
                            {
                                t.Delete();
                            }
                            catch (Exception ex)
                            {
                                EvLog.WriteEntry(Constants.ErrorInDeletingDirectory + t.FullName, Constants.ErrorInDeletingDirectory + t.FullName + Constants.DueTo + ex.Message, EventLogEntryType.Error);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the overridden DoAtomicWork method.
        /// </summary>
        /// <param name="task">print Job Task</param>
        /// <param name="jobParameters">Email Job Parameters</param>
        /// <returns>If Atomic work was successful</returns>
        protected override bool DoAtomicWork(BaseJobTaskBusinessEntity task, BaseJobBEO jobParameters)
        {
            bool success         = true;
            bool isSendPerformed = false;
            SendEmailServiceRequestBEO request = null;

            if (task != null)
            {
                bool isMailSent = false;
                try
                {
                    request = (SendEmailServiceRequestBEO)XmlUtility.DeserializeObject(jobParameters.BootParameters, typeof(SendEmailServiceRequestBEO));
                    string emailDocumentConfigurations = GetEmailDocumentConfigurations();
                    success = SendEmailBO.CreateTemperaryFolder(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), request.RequestedBy.UserId, request.Documents[task.TaskNumber - 1], emailDocumentConfigurations);
                    if (task.TaskNumber == request.Documents.Count)
                    {
                        isSendPerformed = true;
                        //Compress the temporary folder
                        SendEmailBO.CompressFolder(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), emailDocumentConfigurations);
                        //Construct Zip folder
                        isMailSent = SendEmailBO.ComposeAndSendEmail(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), request, emailDocumentConfigurations);
                        //Send Notification on success/failure of email job
                        SendEmailBO.SendNotification(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), isMailSent);
                    }
                    EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobParameters.JobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Success + Constants.ForTaskNumber + task.TaskNumber, EventLogEntryType.Information);
                }
                catch (Exception exp)
                {
                    exp.Trace();
                    isMailSent = false;
                    //Send Notification on success/failure of email job
                    if (isSendPerformed)
                    {
                        SendEmailBO.SendNotification(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), isMailSent);
                    }

                    //Update Delivery Status to Failed
                    DeliveryOptionsBO.UpdateDeliveryStatus(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
                    EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobParameters.JobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Failed + Constants.ForTaskNumber + task.TaskNumber + Constants.Colon + exp.Message, EventLogEntryType.Error);

                    if (request != null && request.Documents.Count > 0)
                    {
                        DocumentIdentifierBEO documentIdentifier = request.Documents[task.TaskNumber - 1];
                        TaskLogInfo.TaskKey = SendEmailBO.GetDcnFieldValue(documentIdentifier.MatterId, documentIdentifier.CollectionId, documentIdentifier.DocumentId);
                    }
                    TaskLogInfo.AddParameters(Constants.Event_Job_DoAtomicWork_Failed + Constants.Colon + exp.Message);
                    if (task.TaskNumber == request.Documents.Count && !isSendPerformed)
                    {
                        EVJobException jobException = new EVJobException(ErrorCodes.ProblemInDoAtomicWork, exp, TaskLogInfo);
                        throw (jobException);
                    }
                    else
                    {
                        EVTaskException taskException = new EVTaskException(ErrorCodes.ProblemInDoAtomicWork, exp, TaskLogInfo);
                        throw (taskException);
                    }
                }
            }
            return(success);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     This is the overriden Shutdown() method.
        /// </summary>
        /// <param name="jobParameters">Input settings / parameters of the job.</param>
        protected override void Shutdown(GlobalReplaceJobBEO jobParameters)
        {
            try
            {
                LogMessage(Constants.ShutdownLogMessage, false, LogCategory.Job, null);
                GetGlobalReplaceBEO(jobParameters.BootParameters);

                JobLogInfo.CustomMessage = Constants.JobSummary;
                JobLogInfo.AddParameters(Constants.JobName, Constants.JOB_NAME);
                JobLogInfo.AddParameters(Constants.EV_AUDIT_ACTUAL_STRING, jobParameters.ActualString);
                JobLogInfo.AddParameters(Constants.EV_AUDIT_REPLACE_STRING, jobParameters.ReplaceString);
            }
            catch (EVException ex)
            {
                EvLog.WriteEntry(Constants.JOB_NAME + Constants.ShutdownErrorMessage, ex.ToUserString(),
                                 EventLogEntryType.Error);
                LogException(jobParameters.JobId, ex, Constants.ShutdownErrorMessage, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInJobExecution);
            }
            catch (Exception ex)
            {
                EvLog.WriteEntry(Constants.JOB_NAME + Constants.ShutdownErrorMessage, ex.Message,
                                 EventLogEntryType.Error);
                LogException(jobParameters.JobId, ex, Constants.ShutdownErrorMessage, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInJobExecution);
            }
            finally
            {
                _mMatter         = null;
                _mOrginatorField = null;
            }
        }
Ejemplo n.º 4
0
 private void UpdateHouse()
 {
     try
     {
         evBusiness = new EvBusiness();
         Ev ev = new Ev();
         ev.Adres          = richtxtAdres.Text;
         ev.Esyali         = checkBox1.Checked;
         ev.EvTurId        = int.Parse(cmboxEvTur.SelectedValue.ToString());
         ev.Fiyat          = int.Parse(txtEvFiyat.Text);
         ev.Kat            = int.Parse(masktxtEvKat.Text);
         ev.KiralikSatilik = cmboxIslemTur.SelectedItem.ToString();
         ev.Metrekare      = int.Parse(masktxtMetreKare.Text);
         ev.MusteriId      = int.Parse(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString());
         ev.OdaSayi        = int.Parse(masktxtOdaSayi.Text);
         ev.Resim          = resimYolu;
         evBusiness.UpdateHouse(duzenlenecekId, ev);
         MessageBox.Show("Başarıyla Kaydedildi-- anasayfaya yonlendirilceksiniz", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception exception)
     {
         MessageBox.Show("Girdiğinz değelerde hata ile karşılaşışdı Tekrar deneyin...", "hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
         var evlog = new EvLog();
         using (StreamWriter writer = new StreamWriter(evlog.fullpath, true))
         {
             writer.WriteLine(exception.Message + "\tEv Duzenleme Başarısız\t" + System.DateTime.Now.ToString());
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This method helps to generate tasks to group duplicate documents from vault and  search sub-system
        /// </summary>
        private void GeneratetasksForGroupOperation(List <DocumentHashMapEntity> lsDocumentHash,
                                                    string strDuplicateFiledVal)
        {
            if (lsDocumentHash.Count > 0)
            {
                foreach (var docHasMap in lsDocumentHash)
                {
                    _task = new DeduplicationJobTaskBEO
                    {
                        IsGroup                = true,
                        CollectionId           = docHasMap.CollectionId.ToString(),
                        MatterId               = _matterId,
                        DocumentReferenceId    = docHasMap.DocumentReferenceId,
                        HashValue              = docHasMap.HashValue,
                        DuplicateField         = strDuplicateFiledVal,
                        DuplicateDocumentCount = lsDocumentHash.Count
                    };
                    _taskNumber++;
                    _task.TaskNumber   = _taskNumber;
                    _task.TaskComplete = false;
                    _task.TaskPercent  = 100.0 / lsDocumentHash.Count;
                    _task.TaskKey      = DocumentBO.GetDCNNumber(_matterId, docHasMap.CollectionId.ToString(),
                                                                 docHasMap.DocumentReferenceId, _createdByUserName);
                    _tasks.Add(_task);

                    var document = _vault.GetDocumentMasterData(new Guid(_task.CollectionId), _task.DocumentReferenceId);
                    GroupingLogInfo(document, docHasMap, lsDocumentHash);
                }
                TaskCount        = _tasks.Count;
                _affectedDocList = _lsAffectedDocument;
                EvLog.WriteEntry(_jobid + Constants.GenerateTaskGrouping, string.Empty, EventLogEntryType.Information);
            }
        }
 private void btnKaydet_Click(object sender, EventArgs e)
 {
     if (CustomersNullControl() == false)
     {
         MessageBox.Show("eksik degerleri doldurun", "hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         try
         {
             AddCustomer();
             Update_Datagridview_();
             Clear_Form();
         }
         catch (Exception exception)
         {
             MessageBox.Show("Girdiğinz değelerde hata ile karşılaşışdı Tekrar deneyin...", "hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
             var evlog = new EvLog();
             using (StreamWriter writer = new StreamWriter(evlog.fullpath, true))
             {
                 writer.WriteLine(exception.Message + "\tEv Kaydetme Başarısız\t" + System.DateTime.Now.ToString());
             }
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// This is the overridden Initialize() method.
        /// </summary>
        /// <param name="jobId">Job Identifier.</param>
        /// <param name="jobRunId">Job Run Identifier.</param>
        /// <param name="bootParameters">Boot Parameters.</param>
        /// <param name="createdBy">Created By Guid</param>
        /// <returns>jobParameters</returns>
        protected override BaseJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
        {
            m_UserBusinessEntity = null;
            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_Initialize_Start, EventLogEntryType.Information);
                //Create Folders for Temporary Storage
                this.CreateFoldersForTemperoryStorage();
                //Clean Source Directory
                this.CleanSharedSpaceForSourceDirectory();
                //Clean Zip Files
                this.CleanZipFilesInSharedSpace();
                //filling properties of the job parameter
                this.m_Job.JobId                = jobId;
                this.m_Job.JobRunId             = jobRunId;
                this.m_Job.JobName              = Constants.EmailJob;
                this.m_UserBusinessEntity       = UserBO.GetUserUsingGuid(createdBy);
                this.m_Job.JobScheduleCreatedBy = (this.m_UserBusinessEntity.DomainName.Equals(Constants.NotApplicable)) ? this.m_UserBusinessEntity.UserId : this.m_UserBusinessEntity.DomainName + Constants.PathSeperator + this.m_UserBusinessEntity.UserId;
                this.m_Job.JobTypeName          = Constants.EmailDocuments;
                // Default settings
                this.m_Job.StatusBrokerType          = BrokerType.Database;
                this.m_Job.CommitIntervalBrokerType  = BrokerType.ConfigFile;
                this.m_Job.CommitIntervalSettingType = SettingType.CommonSetting;

                if (bootParameters != null)
                {
                    this.m_Job.BootParameters = bootParameters;
                }
                else
                {
                    DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
                    throw new EVException().AddDbgMsg("{0}:{1}:{2}", jobId, Constants.EmailJobInitialisation, Constants.XmlNotWellFormed).AddResMsg(ErrorCodes.XmlStringNotWellFormed);
                }
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_Initialize_Success, EventLogEntryType.Information);
            }
            catch (EVException ex)
            {
                //Send Email Failure notification
                SendEmailBO.SendNotification(jobId.ToString(CultureInfo.InvariantCulture), false);
                DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_Initialize_Failed + Constants.Colon + ex.ToUserString(), EventLogEntryType.Information);
                this.JobLogInfo.AddParameters(Constants.Event_Job_Initialize_Failed + Constants.Colon + ex.ToUserString());
                EVJobException jobException = new EVJobException(ErrorCodes.ProblemInJobInitialization, ex, this.JobLogInfo);
                throw (jobException);
            }
            catch (Exception ex)
            {
                //Send Email Failure notification
                SendEmailBO.SendNotification(jobId.ToString(CultureInfo.InvariantCulture), false);
                //Update Delivery Status to Failed
                DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
                //Handle exception in initialize
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_Initialize_Failed + Constants.Colon + ex.Message, EventLogEntryType.Information);
                this.JobLogInfo.AddParameters(Constants.Event_Job_Initialize_Failed + Constants.Colon + ex.Message);
                EVJobException jobException = new EVJobException(ErrorCodes.ProblemInJobInitialization, ex, this.JobLogInfo);
                throw (jobException);
            }
            return(m_Job);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes Job BEO
        /// </summary>
        /// <param name="jobId">DataSet Delete Identifier</param>
        /// <param name="jobRunId">DataSet Delete Run Identifier</param>
        /// <param name="bootParameters">Boot parameters</param>
        /// <param name="createdBy">DataSet Delete created by</param>
        /// <returns>DataSet Delete Job Business Entity</returns>
        protected override DeleteDataSetJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
        {
            try
            {
                m_WindowSize    = 100;
                m_ReadChunkSize = 1000;
                m_NumberOfTasks = 0;
                //Message that job has been initialized.
                LogMessage(String.Format(Constants.JobInitialized, jobId), false, LogCategory.Job, null);
                EvLog.WriteEntry(String.Format(Constants.JobInitialized, jobId), String.Format(Constants.JobInitialized, jobId));
                // Set Job level properties to DataSet Delete Job business entity object.
                _deleteDataSetJobBeo = new DeleteDataSetJobBEO {
                    JobId = jobId, JobRunId = jobRunId
                };
                if (bootParameters != null)
                {
                    DeleteDataSetJobBEO deleteDataSetData = GetDataSetDeleteBEO(bootParameters);
                    //Log
                    LogMessage(String.Format(Constants.JobBootParameterParsed, jobId), false, LogCategory.Job, null);
                    EvLog.WriteEntry(String.Format(Constants.JobBootParameterParsed, jobId), String.Format(Constants.JobBootParameterParsed, jobId),
                                     EventLogEntryType.Information);

                    if (deleteDataSetData != null)
                    {
                        _deleteDataSetJobBeo.BootParameters = bootParameters;
                        _deleteDataSetJobBeo.DataSetId      = deleteDataSetData.DataSetId;
                        _deleteDataSetJobBeo.DataSetName    = deleteDataSetData.DataSetName;
                        _deleteDataSetJobBeo.DeletedBy      = deleteDataSetData.DeletedBy;
                        _deleteDataSetJobBeo.CollectionId   = deleteDataSetData.CollectionId;
                        _deleteDataSetJobBeo.MatterId       = deleteDataSetData.MatterId;
                    }
                    else
                    {
                        LogMessage(String.Format(Constants.JobXMLNotWellFramed, jobId), false, LogCategory.Job, null);
                        EvLog.WriteEntry(String.Format(Constants.JobXMLNotWellFramed, jobId),
                                         String.Format(Constants.JobXMLNotWellFramed, jobId), EventLogEntryType.Error);
                        throw new EVException().AddResMsg(ErrorCodes.ImpXmlFormatErrorId);
                    }
                }
                _deleteDataSetJobBeo.JobScheduleCreatedBy = createdBy;
                _deleteDataSetJobBeo.JobTypeName          = Constants.JobName;
                _deleteDataSetJobBeo.JobScheduleCreatedBy = createdBy;
            }
            catch (EVException ex)
            {
                LogToEventLog(ex, GetType(), MethodInfo.GetCurrentMethod().Name, jobId, jobRunId);
                HandleJobException(GetEvExceptionDescription(ex), ex, ErrorCodes.ProblemInJobInitialization);
            }
            catch (Exception ex)
            {
                // Handle exception
                LogMessage(ex, GetType(), MethodInfo.GetCurrentMethod().Name, EventLogEntryType.Error, jobId, jobRunId);
                HandleJobException(String.Format(Constants.JobInitializeException, jobId), ex, ErrorCodes.ProblemInJobInitialization);
            }
            //return DataSet Delete Job Business Entity
            return(_deleteDataSetJobBeo);
        }
        /// <summary>
        /// Initializes Job BEO
        /// </summary>
        /// <param name="jobId">Job Identifier</param>
        /// <param name="jobRunId">Job Run Identifier</param>
        /// <param name="bootParameters">Boot parameters</param>
        /// <param name="createdBy">Job created by</param>
        /// <returns>Job Business Entity</returns>
        protected override BaseJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
        {
            var jobBEO = new BaseJobBEO();

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobId.ToString(CultureInfo.InvariantCulture),
                                 Constants.Event_Job_Initialize_Start, EventLogEntryType.Information);
                //Initialize the JobBEO object
                jobBEO.JobId    = jobId;
                jobBEO.JobRunId = jobRunId;
                jobBEO.JobName  = Constants.JobTypeName + " " + DateTime.UtcNow;
                //fetch UserEntity
                var userBusinessEntity = UserBO.GetUserUsingGuid(createdBy);
                createdByUserGuid = createdBy;
                if (userBusinessEntity != null)
                {
                    jobBEO.JobScheduleCreatedBy = (userBusinessEntity.DomainName.Equals("N/A"))
                        ? userBusinessEntity.UserId
                        : userBusinessEntity.DomainName + "\\" + userBusinessEntity.UserId;
                }
                jobBEO.JobTypeName = Constants.JobTypeName;
                // Default settings
                jobBEO.StatusBrokerType          = BrokerType.Database;
                jobBEO.CommitIntervalBrokerType  = BrokerType.ConfigFile;
                jobBEO.CommitIntervalSettingType = SettingType.CommonSetting;

                if (bootParameters != null)
                {
                    jobBEO.BootParameters = bootParameters;
                }
                else
                {
                    EvLog.WriteEntry(jobId + ":" + Constants.Event_Job_Initialize_Start, Constants.XmlNotWellFormed,
                                     EventLogEntryType.Information);
                    throw new EVException().AddResMsg(ErrorCodes.XmlStringNotWellFormed);
                }
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobId.ToString(CultureInfo.InvariantCulture),
                                 Constants.Event_Job_Initialize_Success, EventLogEntryType.Information);
            }
            catch (EVJobException ex)
            {
                isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInJobInitialization, string.Empty);
            }
            catch (Exception ex)
            {
                isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInJobInitialization, string.Empty);
            }
            return(jobBEO);
        }
 /// <summary>
 /// Logs messages as required by ED Loader Job. Created as a separate function so that the job has a consistent way of logging messages.
 /// </summary>
 /// <param name="message"> Message to be logged</param>
 /// <param name="consumerClass"> Import job class type using this function </param>
 /// <param name="messageLocation"> Location from which message is being logged - normally it's function name </param>
 /// <param name="eventLogEntryType"> Error or Message or Audit entry </param>
 /// <param name="jobId"> Job Identifier </param>
 /// <param name="jobRunId"> Job instance identifier </param>
 public static void LogMessage(string message, Type consumerClass, string messageLocation,
                               EventLogEntryType eventLogEntryType, int jobId, int jobRunId)
 {
     EvLog.WriteEntry(consumerClass.ToString(),
                      "Job ID: " + jobId
                      + Constants.NextLineCharacter + "Job Run ID: " + jobRunId
                      + Constants.NextLineCharacter + "Location: " + messageLocation
                      + Constants.NextLineCharacter + ((message.Equals(string.Empty)) ? string.Empty : "Details: " + message),
                      eventLogEntryType);
 }
Ejemplo n.º 11
0
 /// <summary>
 ///     Logs messages as required by ED Loader Job. Created as a separate function so that the job has a consistent way of
 ///     logging messages.
 /// </summary>
 /// <param name="message"> Message to be logged</param>
 /// <param name="consumerClass"> Import job class type using this function </param>
 /// <param name="messageLocation"> Location from which message is being logged - normally it's function name </param>
 /// <param name="eventLogEntryType"> Error or Message or Audit entry </param>
 /// <param name="jobId"> Job Identifier </param>
 /// <param name="jobRunId"> Job instance identifier </param>
 public static void LogMessage(string message, Type consumerClass, string messageLocation,
                               EventLogEntryType eventLogEntryType, int jobId, int jobRunId)
 {
     //// Errors are always logged, if levels of logging is set to true, events are always logged.
     EvLog.WriteEntry(consumerClass.ToString(),
                      "Job ID: " + jobId
                      + Constants.NextLineCharacter + "Job Run ID: " + jobRunId
                      + Constants.NextLineCharacter + "Location: " + messageLocation
                      + Constants.NextLineCharacter + ((message.Equals(string.Empty)) ? string.Empty : "Details: " + message),
                      eventLogEntryType);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// This method helps to generate tasks for performing delete duplicate documents from vault and search sub-system
        /// </summary>
        private void GeneratetasksForDeleteOperation(IEnumerable <DocumentHashMapEntity> lsDocumentHash,
                                                     List <string> lsdupDoc)
        {
            var dupDocToDelete = (from docHash in lsDocumentHash
                                  where lsdupDoc.Contains(docHash.DocumentReferenceId + docHash.CollectionId)
                                  select docHash).GroupBy(d => d.CollectionId);

            if (dupDocToDelete != null && dupDocToDelete.Any())
            {
                foreach (var docGroup in dupDocToDelete)
                {
                    var duplicateBatches = docGroup.Batch(100);
                    foreach (var batch in duplicateBatches)
                    {
                        _task = new DeduplicationJobTaskBEO {
                            IsDelete = true
                        };
                        _taskNumber++;
                        _task.TaskNumber   = _taskNumber;
                        _task.MatterId     = _matterId;
                        _task.CollectionId = docGroup.Key.ToString();
                        _task.DeleteDocumentList.AddRange(batch.Select(d => d.DocumentReferenceId));
                        //_task.DocumentReferenceId = documentHash.DocumentReferenceId;
                        //_task.HashValue = documentHash.HashValue;
                        _task.TaskComplete = false;
                        //_task.TaskPercent = 100.0 / lsdupDoc.Count;
                        _task.TaskKey = string.Format("Task # {0} - JobRunId : {1}", _task.TaskNumber, _jobrunId);
                        _tasks.Add(_task);
                    }
                }
            }

            _tasks.SafeForEach(t => t.TaskPercent = (100.0 / _tasks.Count));

            var nonDupDocs = (from docHash in lsDocumentHash
                              where !lsdupDoc.Contains(docHash.DocumentReferenceId + docHash.CollectionId)
                              select docHash);

            if (nonDupDocs != null && nonDupDocs.Any())
            {
                foreach (var docHash in nonDupDocs)
                {
                    OriginalDocumentsLogInfo(docHash.CollectionId, docHash.DocumentReferenceId);
                }
            }

            TaskCount        = _tasks.Count;
            _affectedDocList = _lsAffectedDocument;
            EvLog.WriteEntry(_jobid.ToString(CultureInfo.InvariantCulture), Constants.GenerateTaskDelete,
                             EventLogEntryType.Information);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// This is the overridden Initialize() method.
 /// </summary>
 /// <param name="jobId">Job Identifier.</param>
 /// <param name="jobRunId">Job Run Identifier.</param>
 /// <param name="bootParameters">Boot Parameters.</param>
 /// <param name="createdBy">string</param>
 /// <returns>jobParameters</returns>
 protected override BaseJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
 {
     try
     {
         EvLog.WriteEntry(Constants.JobTypeName + Constants.Hypen + jobId.ToString(CultureInfo.InvariantCulture), Constants.EventJobInitializeStart, EventLogEntryType.Information);
         //Create Folders for Temporary storage
         this.CreateFoldersForTemperoryStorage();
         //Clean shared Space
         this.CleanSharedSpace();
         //filling properties of the job parameter
         this.m_Job.JobId                = jobId;
         this.m_Job.JobRunId             = jobRunId;
         this.m_Job.JobName              = Constants.PrintJobName;
         this.m_UserBusinessEntity       = UserBO.GetUserUsingGuid(createdBy);
         this.m_Job.JobScheduleCreatedBy = (this.m_UserBusinessEntity.DomainName.Equals(Constants.NA)) ? this.m_UserBusinessEntity.UserId : this.m_UserBusinessEntity.DomainName.ConcatStrings(new List <string> {
             Constants.PathSeperator, this.m_UserBusinessEntity.UserId
         });
         this.m_Job.JobTypeName = Constants.PrintJobTypeName;
         // Default settings
         this.m_Job.StatusBrokerType          = BrokerType.Database;
         this.m_Job.CommitIntervalBrokerType  = BrokerType.ConfigFile;
         this.m_Job.CommitIntervalSettingType = SettingType.CommonSetting;
         if (bootParameters != null)
         {
             this.m_Job.BootParameters = bootParameters;
             //Update the delivery status to "running" state
             DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Running);
             EvLog.WriteEntry(Constants.JobTypeName + Constants.Hypen + jobId.ToString(CultureInfo.InvariantCulture), Constants.EventJobInitializeSuccess, EventLogEntryType.Information);
         }
         else
         {
             DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
             EvLog.WriteEntry(jobId + Constants.Colon + Constants.PrintJobInitialisation, Constants.JobXmlNotWellFormed, EventLogEntryType.Information);
             throw new EVException().AddResMsg(ErrorCodes.XmlStringNotWellFormed);
         }
     }
     catch (EVException ex)
     {
         DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
         EvLog.WriteEntry(Constants.JobTypeName + Constants.Hypen + jobId.ToString(CultureInfo.InvariantCulture), Constants.EventJobInitializeFailed + " : " + ex.ToUserString() + ":" + ex.InnerException + ":" + ex.StackTrace, EventLogEntryType.Information);
         LogException(this.JobLogInfo, ex, LogCategory.Job, string.Empty, ErrorCodes.ProblemInJobInitialization);
     }
     catch (Exception ex)
     {
         DeliveryOptionsBO.UpdateDeliveryStatus(jobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
         //Handle exception in initialize
         EvLog.WriteEntry(Constants.JobTypeName + Constants.Hypen + jobId.ToString(CultureInfo.InvariantCulture), Constants.EventJobInitializeFailed + " : " + ex.Message, EventLogEntryType.Information);
         LogException(this.JobLogInfo, ex, LogCategory.Job, string.Empty, ErrorCodes.ProblemInJobInitialization);
     }
     return(m_Job);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Logs messages as required by Alerts Job. Created as a separate function so that the job has a consistent way of logging messages.
        /// </summary>
        /// <param name="message">Message to be logged</param>
        /// <param name="messageLocation">Location from which message is being logged - normally it's function name</param>
        /// <param name="eventLogEntryType">Error or Message or Audit entry</param>
        /// <param name="searchAlertTask">Alert Task</param>
        private static void LogMessage(string message, string messageLocation, EventLogEntryType eventLogEntryType,
                                       SearchAlertsTaskBEO searchAlertTask)
        {
            var msg = ((searchAlertTask != null)
                ? Constants.LOG_MESSAGE_TITLE1 + Constants.LOG_MESSAGE_TITLE4
                       + searchAlertTask.SearchAlert.AlertId.ToString().Trim() + Constants.NEXT_LINE_CHARACTER +
                       Constants.LOG_MESSAGE_TITLE5
                       + searchAlertTask.SearchAlert.Name.Trim() + Constants.NEXT_LINE_CHARACTER
                : string.Empty)
                      + Constants.LOG_MESSAGE_TITLE2 + messageLocation + Constants.NEXT_LINE_CHARACTER
                      + ((message.Equals(string.Empty)) ? string.Empty : Constants.LOG_MESSAGE_TITLE3 + message);

            EvLog.WriteEntry(Constants.LOG_SOURCE, msg, eventLogEntryType);
        }
Ejemplo n.º 15
0
        /// <summary>
        ///  Override version of Initialize
        /// </summary>
        /// <param name="jobId">Job Id</param>
        /// <param name="jobRunId">Run Id</param>
        /// <param name="bootParameters">Parameters xml</param>
        /// <param name="createdByGuid">User Guid</param>
        /// <returns>Job Business Object</returns>
        protected override DeduplicationJobBEO Initialize(int jobId, int jobRunId, string bootParameters,
                                                          string createdByGuid)
        {
            DeduplicationJobBEO jobBeo = null;

            try
            {
                jobBeo = new DeduplicationJobBEO {
                    JobId = jobId, JobName = Constants.JobName, JobRunId = jobRunId
                };
                var userEntityOfJobOwner = UserBO.GetUserUsingGuid(createdByGuid);
                jobBeo.JobScheduleCreatedBy = (userEntityOfJobOwner.DomainName.Equals("N/A"))
                    ? userEntityOfJobOwner.UserId
                    : userEntityOfJobOwner.DomainName + "\\" + userEntityOfJobOwner.UserId;

                jobBeo.JobTypeName = Constants.JobTypeName;
                _createdByUserName = jobBeo.JobScheduleCreatedBy;
                EvLog.WriteEntry(jobId.ToString(CultureInfo.InvariantCulture), Constants.EVENT_JOB_INITIALIZATION_VALUE,
                                 EventLogEntryType.Information);
                jobBeo.StatusBrokerType          = BrokerType.Database;
                jobBeo.CommitIntervalBrokerType  = BrokerType.ConfigFile;
                jobBeo.CommitIntervalSettingType = SettingType.CommonSetting;
                var deduplicationProfileBeo = GetDeduplicationProfileBEO(bootParameters);
                if (deduplicationProfileBeo != null)
                {
                    jobBeo.DatasetInfo.Clear();
                    deduplicationProfileBeo.DatasetInfo.SafeForEach(o => jobBeo.DatasetInfo.Add(o));
                    jobBeo.CompareType = deduplicationProfileBeo.CompareType;
                    jobBeo.Algorithm   = deduplicationProfileBeo.Algorithm;
                    jobBeo.IsDelete    = deduplicationProfileBeo.IsDelete && deduplicationProfileBeo.IsDelete;

                    jobBeo.IsGroup = deduplicationProfileBeo.IsGroup && deduplicationProfileBeo.IsGroup;
                }
                else
                {
                    EvLog.WriteEntry(jobId.ToString(CultureInfo.InvariantCulture),
                                     Constants.EVENT_JOB_INITIALIZATION_KEY, EventLogEntryType.Information);
                    JobLogInfo.AddParameters(Constants.EVENT_JOB_INITIALIZATION_KEY);
                }
            }
            catch (Exception exp)
            {
                EvLog.WriteEntry(jobId + Constants.EVENT_INITIALIZATION_EXCEPTION_VALUE, exp.Message,
                                 EventLogEntryType.Error);
                LogException(jobId, exp, Constants.EVENT_INITIALIZATION_EXCEPTION_VALUE, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInJobInitialization);
            }
            return(jobBeo);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// This Method is used to insert the Task Details in database
        /// </summary>
        /// <typeparam name="TaskType">TaskType Specific to a Job</typeparam>
        /// <param name="taskList">List of tasks</param>
        /// <param name="jobRunId">Job Run Id</param>
        /// <returns>return True, successful insertion of task details</returns>
        internal static bool InsertTaskDetails<TaskType>(Tasks<TaskType> taskList, int jobRunId)
        {
            bool result = false;
            DateTime startTime = DateTime.UtcNow;

            foreach (TaskType task in taskList)
            {
                int taskNumber = Convert.ToInt32(GetParameterValue<TaskType>(task, Constants.PropertyNameTaskNumber));
                byte[] binaryData = DatabaseBroker.SerializeObjectBinary<TaskType>(task);
                result = DatabaseBroker.InsertTaskDetails(jobRunId, taskNumber, binaryData);
            }

            EvLog.WriteEntry(Constants.TaskInsertionTime, Convert.ToString((DateTime.UtcNow - startTime)), EventLogEntryType.Information);
            return result;
        }
Ejemplo n.º 17
0
 public void AddHouse(Ev ev)
 {
     try
     {
         evData.AddHouse(ev);
     }
     catch (Exception exception)
     {
         var evlog = new EvLog();
         using (StreamWriter writer = new StreamWriter(evlog.fullpath, true))
         {
             writer.WriteLine(exception.Message + "\tEv Kaydetme Başarısız\t" + System.DateTime.Now.ToString());
         }
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Initializes Job BEO
        /// </summary>
        /// <param name="jobId">Job Identifier</param>
        /// <param name="jobRunId">Job Run Identifier</param>
        /// <param name="bootParameters">Boot parameters</param>
        /// <param name="createdBy">Job created by</param>
        /// <returns>Job Business Entity</returns>
        protected override BaseJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
        {
            BaseJobBEO jobBeo = new BaseJobBEO();

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_Initialize_Start, EventLogEntryType.Information);
                //Initialize the JobBEO object
                jobBeo.JobId    = jobId;
                jobBeo.JobRunId = jobRunId;
                jobBeo.JobName  = Constants.JobTypeName + " " + DateTime.UtcNow;
                //fetch UserEntity
                UserBusinessEntity userBusinessEntity = UserBO.GetUserUsingGuid(createdBy);
                jobBeo.JobScheduleCreatedBy = (userBusinessEntity.DomainName.Equals("N/A")) ? userBusinessEntity.UserId : userBusinessEntity.DomainName + "\\" + userBusinessEntity.UserId;
                userBusinessEntity          = null;
                jobBeo.JobTypeName          = Constants.JobTypeName;
                // Default settings
                jobBeo.StatusBrokerType          = BrokerType.Database;
                jobBeo.CommitIntervalBrokerType  = BrokerType.ConfigFile;
                jobBeo.CommitIntervalSettingType = SettingType.CommonSetting;

                if (bootParameters != null)
                {
                    jobBeo.BootParameters = bootParameters;
                }
                else
                {
                    throw new EVException().AddDbgMsg("{0}:{1}:{2}", jobId, Constants.Event_Job_Initialize_Start, Constants.XmlNotWellFormed).
                          AddResMsg(ErrorCodes.XmlStringNotWellFormed);
                }
                Tracer.Info("{0} - {1}:{2}", Constants.JobTypeName, jobId, Constants.Event_Job_Initialize_Success);
            }
            catch (EVJobException ex)
            {
                _isJobFailed = true;
                ex.AddDbgMsg("{0}:{1}", Constants.JobTypeName, MethodInfo.GetCurrentMethod().Name);
                throw;
            }
            catch (Exception ex)
            {
                _isJobFailed = true;
                ex.AddDbgMsg("{0}:{1}", Constants.JobTypeName, MethodInfo.GetCurrentMethod().Name);
                JobLogInfo.AddParameters("Problem in" + Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name);
                EVJobException jobException = new EVJobException(ErrorCodes.InitializeError, ex, JobLogInfo);
                throw (jobException);
            }
            return(jobBeo);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// This method helps to get all original documents under a collection
 /// </summary>
 private void GetOriginalDocuments(IEnumerable <string> lsCollectionId)
 {
     try
     {
         var docCount =
             lsCollectionId.Select(collection => _vault.GetDocumentCountForCollection(new Guid(collection)))
             .Aggregate(0, (current, count) => current + count);
         NoOfDocumentProcessed = docCount;
     }
     catch (Exception ex)
     {
         EvLog.WriteEntry(_jobid + Constants.ErrorForOriginalDocuments, ex.Message, EventLogEntryType.Error);
         LogException(_jobid, ex, Constants.ErrorForOriginalDocuments, LogCategory.Job, string.Empty,
                      ErrorCodes.ProblemInGenerateTasks);
     }
 }
 /// <summary>
 /// Logs messages as required by ED Loader Job. Created as a separate function so that the job has a consistent way of logging messages.
 /// </summary>
 /// <param name="message"> Message to be logged</param>
 /// <param name="consumerClass"> Import job class type using this function </param>
 /// <param name="messageLocation"> Location from which message is being logged - normally it's function name </param>
 /// <param name="eventLogEntryType"> Error or Message or Audit entry </param>
 /// <param name="jobID"> Job Identifier </param>
 /// <param name="jobRunId"> Job instance identifier </param>
 public static void LogMessage(string message, Type consumerClass, string messageLocation,
                               EventLogEntryType eventLogEntryType, int jobID, int jobRunId)
 {
     try
     {
         EvLog.WriteEntry(consumerClass.ToString(),
                          "Job ID: " + jobID
                          + Constants.NextLineCharacter + "Job Run ID: " + jobRunId
                          + Constants.NextLineCharacter + "Location: " + messageLocation
                          + Constants.NextLineCharacter +
                          ((message.Equals(string.Empty)) ? string.Empty : "Details: " + message), eventLogEntryType);
     }
     catch
     {
     } // No error logging a message can be captured and handled
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Generates Concvert DCB Link tasks
        /// </summary>
        /// <param name="jobParameters">Job BEO</param>
        /// <param name="previouslyCommittedTaskCount"> </param>
        /// <returns>List of Job Tasks (BEOs)</returns>
        protected override Tasks <ConvertDCBLinkTaskBusinessEntityObject> GenerateTasks(BaseJobBEO jobParameters, out int previouslyCommittedTaskCount)
        {
            Tasks <ConvertDCBLinkTaskBusinessEntityObject> tasks = null;

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Start, EventLogEntryType.Information);
                previouslyCommittedTaskCount = 0;
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobId, MethodInfo.GetCurrentMethod().Name, EventLogEntryType.Information);
                tasks = GetTaskList <BaseJobBEO, ConvertDCBLinkTaskBusinessEntityObject>(jobParameters);
                previouslyCommittedTaskCount = tasks.Count;
                if (tasks.Count <= 0)
                {
                    ConvertDCBLinkTaskBusinessEntityObject convertDcbLinkTask = new ConvertDCBLinkTaskBusinessEntityObject();
                    convertDcbLinkTask = (ConvertDCBLinkTaskBusinessEntityObject)XmlUtility.DeserializeObject(jobParameters.BootParameters, typeof(ConvertDCBLinkTaskBusinessEntityObject));
                    _query             = ApplicationConfigurationManager.GetValue(Constants.SearchQuery);
                    _createdByUserGuid = convertDcbLinkTask.CreateByUserGuid;
                    string pageSize = "1";
                    DocumentQueryEntity docQueryEntity = GetDocumentQueryEntity(convertDcbLinkTask.DatasetId.ToString(CultureInfo.InvariantCulture), _query, pageSize);
                    docQueryEntity.TransactionName = "ConvertDCBLinksToCaseMap - GenerateTasks";
                    ReviewerSearchResults searchResults = JobSearchHandler.GetSearchResults(docQueryEntity);
                    if (searchResults.TotalRecordCount > 0)
                    {
                        convertDcbLinkTask.TaskNumber   = 1;
                        convertDcbLinkTask.TaskPercent  = 100;
                        convertDcbLinkTask.TaskComplete = false;
                    }
                    _documentCount = searchResults.TotalHitCount;
                    tasks.Add(convertDcbLinkTask);
                }
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Success, EventLogEntryType.Information);
            }
            catch (EVJobException ex)
            {
                _isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                throw;
            }
            catch (Exception ex)
            {
                _isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                EVJobException jobException = new EVJobException(ErrorCodes.GenerateTasksError, ex, JobLogInfo);
                throw (jobException);
            }
            return(tasks);
        }
        /// <summary>
        /// Before job shuts down, shall update job next run
        /// </summary>
        /// <param name="jobParameters">Job Business Object</param>
        protected override void Shutdown(BaseJobBEO jobParameters)
        {
            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobId, Constants.Event_Job_ShutDown,
                                 EventLogEntryType.Information);

                #region Notification section

                //get job details
                var jobDetails = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString());
                if (jobDetails != null && jobDetails.NotificationId > 0)
                {
                    var defaultMessage = string.Empty;
                    defaultMessage = isJobFailed
                        ? string.Format(Constants.NotificationErrorMessageFormat,
                                        !string.IsNullOrEmpty(requestDescription) ? requestDescription : Constants.TaskName)
                        : documentCount > 0
                            ? string.Format(Constants.NotificationSuccessMessageFormat,
                                            !string.IsNullOrEmpty(requestDescription)
                                    ? requestDescription
                                    : Constants.TaskName, documentCount,
                                            ApplicationConfigurationManager.GetValue(Constants.CaseMapUrl), conversionId, fileType)
                            : string.Format(Constants.NotificationSuccessMessageFormatZeroDocs,
                                            !string.IsNullOrEmpty(requestDescription) ? requestDescription : Constants.TaskName);
                    CustomNotificationMessage = defaultMessage;
                }
                JobLogInfo.AddParameters(Constants.CreatedBy, jobParameters.JobScheduleCreatedBy);
                JobLogInfo.AddParameters(Constants.DocumentIncludedInXml, Convert.ToString(documentCount));

                #endregion
            }
            catch (EVJobException ex)
            {
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInShutDown, string.Empty);
            }
            catch (Exception ex)
            {
                isJobFailed = true;
                // Handle exception in Generate Tasks
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInShutDown, string.Empty);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Logs messages as required by ED Loader Job. Created as a separate function so that the job has a consistent way of logging messages.
        /// </summary>
        /// <param name="message"> Message to be logged</param>
        /// <param name="consumerClass"> Import job class type using this function </param>
        /// <param name="messageLocation"> Location from which message is being logged - normally it's function name </param>
        /// <param name="eventLogEntryType"> Error or Message or Audit entry </param>
        /// <param name="jobId"> Job Identifier </param>
        /// <param name="jobRunId"> Job instance identifier </param>
        public static void LogMessage(string message, Type consumerClass, string messageLocation, EventLogEntryType eventLogEntryType, int jobId, int jobRunId)
        {
            try
            {
                //// Errors are always logged, if levels of logging is set to true, events are always logged.
                //if (eventLogEntryType == EventLogEntryType.Error)
                //    shallIlog = true;

                EvLog.WriteEntry(consumerClass.ToString(),
                                 Constants.JobID + jobId
                                 + Constants.NextLineCharacter + Constants.JobRunID + jobRunId
                                 + Constants.NextLineCharacter + Constants.JobLocation + messageLocation
                                 + Constants.NextLineCharacter + ((message.Equals(string.Empty)) ? string.Empty : "Details: " + message), eventLogEntryType);
            }
            catch (Exception)
            { } // No error logging a message can be captured and handled
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Get the configuration parameters used for print document
        /// </summary>
        /// <returns>string</returns>
        private static string GetPrintDocumentConfigurations()
        {
            string sharedLocation      = CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.BaseSharedPath);
            string sourceDirectoryPath = Path.Combine(Path.Combine(sharedLocation, Constants.DeliveryOptions), Constants.SourceDirectoryPath);
            string targetDirectoryPath = Path.Combine(Path.Combine(sharedLocation, Constants.DeliveryOptions), Constants.TargetDirectoryPath);
            string toReturn            = string.Empty;

            try
            {
                toReturn = Constants.TargetDirectory.ConcatStrings(new List <string>
                {
                    Constants.PipeSeperator,
                    targetDirectoryPath,
                    Constants.Comma,
                    Constants.SourceDirectory,
                    Constants.PipeSeperator,
                    sourceDirectoryPath,
                    Constants.Comma,
                    Constants.RedactitUri,
                    Constants.PipeSeperator,
                    CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.QueueServerUrl),
                    Constants.Comma,
                    Constants.CallBackUri,
                    Constants.PipeSeperator,
                    CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.PrintCallBackUri),
                    Constants.Comma,
                    Constants.WaitAttemptsCount,
                    Constants.PipeSeperator,
                    ConfigurationManager.AppSettings[Constants.WaitAttemptsCount],
                    Constants.Comma,
                    Constants.DeleteSourceFiles,
                    Constants.PipeSeperator,
                    ConfigurationManager.AppSettings[Constants.DeleteSourceFiles],
                    Constants.Comma,
                    Constants.RedactItPostSupported,
                    Constants.PipeSeperator,
                    ConfigurationManager.AppSettings[Constants.RedactItPostSupported]
                });
            }
            catch (Exception exp)
            {
                EvLog.WriteEntry(Constants.GetPrintDocumentConfigurations, exp.Message + Constants.Colon + exp.StackTrace, EventLogEntryType.Error);
            }
            return(toReturn);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// This is the overridden GenerateTasks() method.
        /// </summary>
        /// <param name="jobParameters">Input settings / parameters of the job.</param>
        /// <param name="previouslyCommittedTaskCount">integer</param>
        /// <returns>List of tasks to be performed.</returns>
        protected override Tasks <BaseJobTaskBusinessEntity> GenerateTasks(BaseJobBEO jobParameters, out int previouslyCommittedTaskCount)
        {
            previouslyCommittedTaskCount = 0;
            Tasks <BaseJobTaskBusinessEntity> tasks = new Tasks <BaseJobTaskBusinessEntity>();

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobParameters.JobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Start, EventLogEntryType.Information);

                //De serialize the Boot parameters
                SendEmailServiceRequestBEO request = (SendEmailServiceRequestBEO)XmlUtility.DeserializeObject(jobParameters.BootParameters, typeof(SendEmailServiceRequestBEO));
                int i = 0;

                //Construct The Task
                if (tasks.Count <= 0)
                {
                    int docCount = request.Documents.Count;
                    for (int k = 0; k < docCount; k++)
                    {
                        BaseJobTaskBusinessEntity task = new BaseJobTaskBusinessEntity
                        {
                            TaskNumber   = ++i,
                            TaskComplete = false,
                            TaskPercent  = (float)100 / docCount
                        };
                        //Construct The Task
                        tasks.Add(task);
                    }
                }
            }
            catch (Exception ex)
            {
                //Send Email Failure notification
                SendEmailBO.SendNotification(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), false);
                //Update Delivery Status to Failed
                DeliveryOptionsBO.UpdateDeliveryStatus(jobParameters.JobId.ToString(CultureInfo.InvariantCulture), (short)PrintToFileServiceStateBEO.Failed);
                EvLog.WriteEntry(Constants.JobTypeName + Constants.Hyphen + jobParameters.JobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Failed + ":" + ex.Message, EventLogEntryType.Error);
                //LogInfo logMsg = new LogInfo();
                JobLogInfo.AddParameters(Constants.Event_Job_GenerateTask_Failed + Constants.Colon + ex.Message);
                EVJobException jobException = new EVJobException(ErrorCodes.ProblemInGenerateTasks, ex, JobLogInfo);
                throw (jobException);
            }
            return(tasks);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// This method helps to get all duplicate documents for a collection whose hash value count>0
        /// </summary>
        private List <string> GetDuplicatesDocuments(List <DocumentHashMapEntity> lsDocumentHash)
        {
            #region Pre-condition asserts

            lsDocumentHash.ShouldNotBe(null);

            #endregion

            var lsdupDoc = new List <string>();
            try
            {
                if (lsDocumentHash.Count > 0)
                {
                    var tempHash = lsDocumentHash[0].HashValue;
                    for (var i = 1; i < lsDocumentHash.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(tempHash) && tempHash == lsDocumentHash[i].HashValue)
                        {
                            lsdupDoc.Add(lsDocumentHash[i].DocumentReferenceId + lsDocumentHash[i].CollectionId);
                        }
                        else
                        {
                            tempHash = lsDocumentHash[i].HashValue;
                        }
                    }
                    NoOfDuplicate = lsdupDoc.Count;
                }
            }
            catch (Exception ex)
            {
                EvLog.WriteEntry(_jobid + Constants.ErrorForDuplicateDocumentsCount, ex.Message, EventLogEntryType.Error);
                LogException(_jobid, ex, Constants.ErrorForDuplicateDocumentsCount, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInGenerateTasks);
            }

            #region Post-condition asserts

            lsDocumentHash.ShouldNotBe(null);

            #endregion

            return(lsdupDoc);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Before job shuts down, Update the log.
 /// </summary>
 /// <param name="jobParameters">Job Business Object</param>
 protected override void Shutdown(BaseJobBEO jobParameters)
 {
     try
     {
         CleanSharedSpace();
     }
     catch (EVJobException ex)
     {
         EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
         throw;
     }
     catch (Exception ex)
     {
         // Handle exception in Generate Tasks
         EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
         EVJobException jobException = new EVJobException(ErrorCodes.ProblemInJobExecution, ex, JobLogInfo);
         throw (jobException);
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// This method helps to get all the Duplicate counts in a collection whose hash value count>0 (which is combination of original docs+ duplicate docs)
        /// </summary>
        private List <DocumentHashMapEntity> GetDocumentHashValues(IEnumerable <DeduplicationDatasetBEO> lsDataset,
                                                                   string algorithm, string compareType)
        {
            List <DocumentHashMapEntity> lsDocumentHash = null;

            try
            {
                var lsCollectionId = new List <string>();

                foreach (var datasetInfo in lsDataset)
                {
                    lsCollectionId.Add(datasetInfo.CollectionId);
                    if (_matterId == string.Empty)
                    {
                        _matterId = datasetInfo.MatterId.ToString(CultureInfo.InvariantCulture);
                    }
                }
                var hashTypeId = GetHashTypeId(algorithm, compareType);
                _vault = VaultRepository.CreateRepository(Convert.ToInt64(_matterId));

                var lsCollectionTemp = lsCollectionId.Select(collection => new Guid(collection)).ToList();
                if (lsCollectionId.Count > 1)
                {
                    lsDocumentHash = _vault.GetDocumentDuplicatesAcrossCollections(lsCollectionTemp, hashTypeId);
                }
                else
                {
                    DataSetCollectionId = lsCollectionTemp[0];
                    lsDocumentHash      = _vault.GetDocumentDuplicatesByHashValue(lsCollectionTemp[0], hashTypeId,
                                                                                  string.Empty);
                }
                GetOriginalDocuments(lsCollectionId);
            }
            catch (Exception ex)
            {
                EvLog.WriteEntry(_jobid + Constants.EVENT_GENERATE_TASK_KEY,
                                 Constants.ErrorForDocumentHashValues + ex.Message);
                LogException(_jobid, ex, Constants.ErrorForOriginalDocuments, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInGenerateTasks);
            }
            return(lsDocumentHash);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// This method helps to Log Info for which filler outs original documents from duplicate
        /// documents and collects there bates no. to be shown to user.This is called for Action Type-Delete
        /// </summary>
        private void OriginalDocumentsLogInfo(Guid collectionId, string documentReferenceId)
        {
            try
            {
                //  List<AffectedDocument> lsAffectedDocument1 = new List<AffectedDocument>();
                var document = _vault.GetDocumentMasterData(collectionId, documentReferenceId);
                if (document != null)
                {
                    var objAffectedDocuments = new AffectedDocument
                    {
                        CollectionId = document.CollectionId.ToString(),
                        DocId        = document.DocumentReferenceId
                    };
                    if (!String.IsNullOrEmpty(document.NativeFilePath))
                    {
                        var strFileInfo = document.NativeFilePath;
                        var strFile     = strFileInfo.Split(Convert.ToChar(@"\"));
                        objAffectedDocuments.Name = strFile[strFile.Length - 1];
                    }
                    else
                    {
                        objAffectedDocuments.Name = document.DocumentTitle;
                    }

                    if (document.DocumentTitle != null)
                    {
                        objAffectedDocuments.BatesNumber = document.DocumentTitle;
                    }

                    _lsAffectedDocument.Add(objAffectedDocuments);
                }
                _actionType = Constants.Action_Delete_Type;
            }
            catch (Exception ex)
            {
                EvLog.WriteEntry(_jobid + Constants.ErrorForOriginalDocumentForDelete, ex.Message,
                                 EventLogEntryType.Error); //Constants.EVENT_GENERATE_TASK_KEY,
                LogException(_jobid, ex, Constants.ErrorForOriginalDocument, LogCategory.Job, string.Empty,
                             ErrorCodes.ProblemInGenerateTasks);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Perform shutdown activities for a job if any.
        /// </summary>
        /// <param name="jobParameters">Job input parameters / settings obtained during Initialize()</param>
        protected override void Shutdown(DeduplicationJobBEO jobParameters)
        {
            EvLog.WriteEntry(jobParameters.JobId.ToString(CultureInfo.InvariantCulture),
                             Constants.EVENT_JOB_SHUTDOWN_KEY, EventLogEntryType.Information);

            #region LogDetails

            if (LogDetails != null)
            {
                LogDetails.NoOfDocAffected = (TaskCount - FailedTask);
                var strLogXml = CreateXMLPropertyString(LogDetails);
                var info      = new LogInfo {
                    CustomMessage = strLogXml
                };
                LogJobMessage(info, true);
            }
            // Update Job master with the success and failure count
            JobMgmtBO.UpdateJobResult(_jobid, _successCount, _failureCount,
                                      null);

            #endregion
        }