/// <summary>
        ///     Sets the pipeline type specific parameters.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);
            PipelineType.ToString().ShouldBe("ImportLaw");

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof (LawImportBEO));
                var lawImportBeo = xmlStream.Deserialize(stream) as LawImportBEO;
                if (null == lawImportBeo)
                {
                    return;
                }
                JobName = lawImportBeo.ImportJobName;
                JobTypeName = "Law Import Job";
                LawCaseName = lawImportBeo.LawCaseName;

                ThreadsLinkingRequested = lawImportBeo.CreateThreads;
                FamiliesLinkingRequested = lawImportBeo.CreateFamilyGroups;
                MatterId = lawImportBeo.MatterId;

                // For the purposes of PeriodicPipelineServicingHook in ImportPipeline Overlay for Law import should always be false.
                // Overlay = lawImportBEO.ImportOptions != ImportOptionsBEO.AppendNew;
                IsOverlay = false;
            }
          
        }
        /// <summary>
        ///     Sets the pipeline type specific parameters.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);
            PipelineType.ToString().ShouldBe("ImportLaw");

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream    = new XmlSerializer(typeof(LawImportBEO));
                var lawImportBeo = xmlStream.Deserialize(stream) as LawImportBEO;
                if (null == lawImportBeo)
                {
                    return;
                }
                JobName     = lawImportBeo.ImportJobName;
                JobTypeName = "Law Import Job";
                LawCaseName = lawImportBeo.LawCaseName;

                ThreadsLinkingRequested  = lawImportBeo.CreateThreads;
                FamiliesLinkingRequested = lawImportBeo.CreateFamilyGroups;
                MatterId = lawImportBeo.MatterId;

                // For the purposes of PeriodicPipelineServicingHook in ImportPipeline Overlay for Law import should always be false.
                // Overlay = lawImportBEO.ImportOptions != ImportOptionsBEO.AppendNew;
                IsOverlay = false;
            }
        }
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            LawSyncBEO jobParameter = null;

            base.SetPipelineTypeSpecificParameters(activeJob);
            switch (JobTypeId)
            {
            case 40:
                jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(LawSyncBEO));
                break;

            case 41:
            {
                var reprocessJobParameter = (ConversionReprocessJobBeo)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(ConversionReprocessJobBeo));

                var baseConfig = ReconversionDAO.GetJobConfigInfo(Convert.ToInt32(reprocessJobParameter.OrginialJobId));
                jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(baseConfig.BootParameters, typeof(LawSyncBEO));
            }
            break;
            }
            if (jobParameter == null)
            {
                return;
            }
            MatterId  = jobParameter.MatterId;
            SyncImage = jobParameter.IsProduceImage;
            LawCaseId = jobParameter.LawCaseId;
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Sets the pipeline type specific parameters.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            switch (JobTypeId)
            {
            case 14:
                using (var stream = new StringReader(activeJob.BootParameters.ToString()))
                {
                    var xmlStream = new XmlSerializer(typeof(ImportBEO));
                    var importBeo = xmlStream.Deserialize(stream) as ImportBEO;
                    if (null != importBeo)
                    {
                        JobName     = importBeo.ImportJobName;
                        JobTypeName = importBeo.ImportTypeName;
                        SourcePath  = importBeo.Locations.First();

                        ThreadsLinkingRequested  = importBeo.IsMapEmailThread;
                        FamiliesLinkingRequested = importBeo.IsImportFamilyRelations;
                        IsOverlay = !importBeo.IsAppend;
                        MatterId  = importBeo.MatterId;
                    }
                }
                break;

            case 2:     // DCB
            case 8:     // eDocs
                var profileBeo = Utils.SmartXmlDeserializer(activeJob.BootParameters.ToString()) as ProfileBEO;
                if (null != profileBeo)
                {
                    JobName     = profileBeo.ImportJobName;
                    JobTypeName = profileBeo.ImportTypeName;
                    if (profileBeo.Locations != null && profileBeo.Locations.Any())     // DCB
                    {
                        SourcePath = profileBeo.Locations.First();
                        ThreadsLinkingRequested  = profileBeo.IsMapEmailThread;
                        FamiliesLinkingRequested = profileBeo.IsImportFamilyRelations;
                    }
                    else if (profileBeo.FileLocations != null && profileBeo.FileLocations.Any())     //EDOCS
                    {
                        SourcePath = profileBeo.FileLocations[0].Path;
                        ThreadsLinkingRequested  = true;
                        FamiliesLinkingRequested = true;
                    }
                    if (profileBeo.DatasetDetails != null && profileBeo.DatasetDetails.Matter != null)
                    {
                        _matterId = profileBeo.DatasetDetails.Matter.FolderID;
                    }
                    IsOverlay = !profileBeo.IsAppend;
                }
                break;
            }
        }
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(NearDuplicationJobBEO));
                _nearDuplicationBootParameter = xmlStream.Deserialize(stream) as NearDuplicationJobBEO;
                if (_nearDuplicationBootParameter == null) return;
                JobName = _nearDuplicationBootParameter.JobName;
                JobTypeName = "Near Duplication";
            }
        }
Exemplo n.º 6
0
        private string ConstructBillingReportNotificationMessage(ActiveJob job, Director.JobStatus jobStatus)
        {
            var billingReportParams = (BillingReportParams)
                                      XmlUtility.DeserializeObject(job.BootParameters.ToString(),
                                                                   typeof(BillingReportParams));

            var downloadHandler = String.Format(DownloadHandlerURL,
                                                HttpUtility.UrlEncode(billingReportParams.TargetFolder));
            var notificationSubMessage = String.Format(Notifications.BillingReportGenerated,
                                                       downloadHandler);

            return((jobStatus == Director.JobStatus.Completed)?
                   notificationSubMessage : String.Empty);
        }
Exemplo n.º 7
0
        /// <summary>
        /// This method is responsible to construct the Notification subject and Notification Body for the message to be delivered
        /// </summary>
        /// <param name="job"></param>
        /// <param name="jobStatus"></param>
        /// <param name="notificationMessageBeo"></param>
        /// <param name="message"></param>
        private static void ConstructBulkTagNotification(ActiveJob job, Director.JobStatus jobStatus,
                                                         NotificationMessageBEO notificationMessageBeo, JobBusinessEntity jobDetails, string notificationMessage)
        {
            var stream         = new StringReader(job.Beo.BootParameters);
            var xmlStream      = new XmlSerializer(typeof(BulkTagJobBusinessEntity));
            var bootParameters = xmlStream.Deserialize(stream) as BulkTagJobBusinessEntity;

            stream.Close();

            var message = new StringBuilder();

            message.Append(string.IsNullOrEmpty(jobDetails.TypeName) ? string.Empty : " Type: ");
            message.Append(jobDetails.Visibility
                               ? jobDetails.TypeName
                               : jobDetails.TypeName.Replace("Job", "Task"));
            message.Append("<br/>");
            message.Append(jobDetails.Name);
            if (job.Beo != null)
            {
                message.Append(" Instance: ");
                message.Append(job.Beo.JobRunId);
            }
            message.Append("<br/>");
            message.Append("Folder: ");
            message.Append(jobDetails.FolderName);
            message.Append(" ");
            message.Append("<br/>");
            message.Append("Status: ");
            message.Append(notificationMessage);

            if (null != bootParameters)
            {
                var tagLog = RVWTagBO.GetTagLog(Convert.ToInt32(bootParameters.TagDetails.DatasetId), job.JobId);

                if (jobStatus == Director.JobStatus.Completed)
                {
                    notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                    if (tagLog != null)
                    {
                        notificationMessageBeo.NotificationBody = ConstructNotificationBodyForReviewerBulkTag(job, bootParameters, tagLog, jobDetails);
                    }
                }
                else
                {
                    notificationMessageBeo.NotificationBody = notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                }
            }
            notificationMessageBeo.SendDefaultMessage = (jobStatus ==
                                                         Director.JobStatus.Completed);
        }
Exemplo n.º 8
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));
                bulkPrintServiceRequestBEO = xmlStream.Deserialize(stream) as BulkPrintServiceRequestBEO;
                if (bulkPrintServiceRequestBEO != null)
                {
                    JobName = bulkPrintServiceRequestBEO.Name;
                    JobTypeName = "Print Job";
                }
            }
        }
Exemplo n.º 9
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));
                bulkPrintServiceRequestBEO = xmlStream.Deserialize(stream) as BulkPrintServiceRequestBEO;
                if (bulkPrintServiceRequestBEO != null)
                {
                    JobName     = bulkPrintServiceRequestBEO.Name;
                    JobTypeName = "Print Job";
                }
            }
        }
Exemplo n.º 10
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BackupRestoreProfileBEO));
                BackupRestoreProfileBEO backupProfileBEO = xmlStream.Deserialize(stream) as BackupRestoreProfileBEO;
                if (null != backupProfileBEO)
                {
                    MatterId = Convert.ToInt64(backupProfileBEO.MatterId);
                    //RestoreCollectionName = reIndex.MatterDetails.RestoreCollectionName;
                }
            }
        }
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BackupRestoreProfileBEO));
                BackupRestoreProfileBEO backupProfileBEO = xmlStream.Deserialize(stream) as BackupRestoreProfileBEO;
                if (null != backupProfileBEO)
                {
                    MatterId = Convert.ToInt64(backupProfileBEO.MatterId);
                    //RestoreCollectionName = reIndex.MatterDetails.RestoreCollectionName;                
                }
            }
        }
        /// <summary>
        ///     Sets the pipeline type specific parameters.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream     = new XmlSerializer(typeof(ProductionDetailsBEO));
                var productionBeo = xmlStream.Deserialize(stream) as ProductionDetailsBEO;
                if (null != productionBeo)
                {
                    JobName     = productionBeo.Profile.ProductionJobName;
                    JobTypeName = "Production Job";
                    MatterId    = productionBeo.MatterId;
                }
            }
        }
Exemplo n.º 13
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(NearDuplicationJobBEO));
                _nearDuplicationBootParameter = xmlStream.Deserialize(stream) as NearDuplicationJobBEO;
                if (_nearDuplicationBootParameter == null)
                {
                    return;
                }
                JobName     = _nearDuplicationBootParameter.JobName;
                JobTypeName = "Near Duplication";
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Generate part of notification message common to all events during bulk tagging
        /// </summary>
        /// <param name="bulkTagRecord"></param>
        /// <param name="notificationMessage"></param>
        private static void GenerateGeneralNotificationDetailsForReviewerBulkTagJob
            (ActiveJob job, BulkTagJobBusinessEntity bulkTagJobBeo, StringBuilder notificationMessage, JobBusinessEntity jobBeo)
        {
            notificationMessage.Append(Row);
            notificationMessage.Append(Column);
            notificationMessage.Append(HtmlBold);
            notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageStartTime));
            notificationMessage.Append(HtmlCloseBold);

            notificationMessage.Append(HttpUtility.HtmlEncode(jobBeo.JobScheduleStartDate.ConvertToUserTime()));

            notificationMessage.Append(CloseColumn);
            notificationMessage.Append(CloseRow);
            notificationMessage.Append(Row);
            notificationMessage.Append(Column);
            notificationMessage.Append(HtmlBold);
            notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageEndTime));
            notificationMessage.Append(HtmlCloseBold);

            notificationMessage.Append(HttpUtility.HtmlEncode(jobBeo.JobCompletedDate.ConvertToUserTime()));

            notificationMessage.Append(CloseColumn);
            notificationMessage.Append(CloseRow);
            notificationMessage.Append(Row);
            notificationMessage.Append(Column);
            notificationMessage.Append(HtmlBold);
            notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageLocation));
            notificationMessage.Append(HtmlCloseBold);


            notificationMessage.Append(HttpUtility.HtmlEncode(GetTaggingLocation(bulkTagJobBeo)));


            notificationMessage.Append(CloseColumn);
            notificationMessage.Append(CloseRow);

            notificationMessage.Append(Row);
            notificationMessage.Append(Column);
            notificationMessage.Append(HtmlBold);
            notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageTagName));
            notificationMessage.Append(HtmlCloseBold);

            notificationMessage.Append(HttpUtility.HtmlEncode(bulkTagJobBeo.TagDetails.Name));

            notificationMessage.Append(CloseColumn);
            notificationMessage.Append(CloseRow);
        }
        /// <summary>
        ///     Sets the pipeline type specific parameters.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof (ProductionDetailsBEO));
                var productionBeo = xmlStream.Deserialize(stream) as ProductionDetailsBEO;
                if (null != productionBeo)
                {
                    JobName = productionBeo.Profile.ProductionJobName;
                    JobTypeName = "Production Job";
                    MatterId = productionBeo.MatterId;
                }
            }
   
        }
Exemplo n.º 16
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            LawSyncBEO jobParameter=null;
            base.SetPipelineTypeSpecificParameters(activeJob);
            switch (JobTypeId)
            {
                case 40:
                    jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(LawSyncBEO));
                    break;
                case 41:
                {
                    var reprocessJobParameter = (ConversionReprocessJobBeo)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(ConversionReprocessJobBeo));

                    var baseConfig = ReconversionDAO.GetJobConfigInfo(Convert.ToInt32(reprocessJobParameter.OrginialJobId));
                    jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(baseConfig.BootParameters, typeof(LawSyncBEO));
                }
                    break;
            }
            if (jobParameter == null) return;
            MatterId = jobParameter.MatterId;
            SyncImage = jobParameter.IsProduceImage;
            LawCaseId = jobParameter.LawCaseId;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Constructs the notification message for conversion results export.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        /// <returns>notification message for conversion results export job</returns>
        private static string ConstructNotificationMessageForConversionResultsExport(ActiveJob activeJob)
        {
            var stream    = new StringReader(activeJob.Beo.BootParameters);
            var xmlStream = new XmlSerializer(typeof(ConversionResultsExportJobParam));
            var conversionResultsExportJobParameters = xmlStream.Deserialize(stream) as ConversionResultsExportJobParam;

            var stringBuilder = new StringBuilder();

            stringBuilder.Append(ConversionResultsExportTitleOpenDiv);
            if (conversionResultsExportJobParameters != null)
            {
                stringBuilder.Append(ConversionResultsExportFilePathOpenDiv);
                stringBuilder.Append(conversionResultsExportJobParameters.TargetFileName);
                stringBuilder.Append(ConversionResultsExportFilePathCloseDiv);
            }
            stringBuilder.Append(ConversionResultsImageTag);
            stringBuilder.Append(ConversionResultsDownloadLinkOpenAnchor);
            stringBuilder.Append(ConversionResultsExportDownloadHandler +
                                 activeJob.JobId.ToString(CultureInfo.InvariantCulture));
            stringBuilder.Append(ConversionResultsDownloadLinkText);
            stringBuilder.Append(ConversionResultsDownLoadLinkCloseAnchor);
            return(stringBuilder.ToString());
        }
Exemplo n.º 18
0
 /// <summary>
 /// Construct Notification message for Export AnalysisSet Documents
 /// </summary>
 /// <param name="activeJob"></param>
 /// <returns></returns>
 private static string ConstructNotificationMessageForExportAnalysisSetDocuments(ActiveJob activeJob)
 {
     try
     {
         var stringBuilder = new StringBuilder();
         var documentQuery = (DocumentQuery)XmlUtility.DeserializeObject(activeJob.Beo.BootParameters, typeof(DocumentQuery));
         var dataset       = DataSetBO.GetDataSetDetailForDataSetId(documentQuery.DatasetId);
         var jobInfo       = JobMgmtBO.GetJobDetails(activeJob.JobId.ToString(CultureInfo.InvariantCulture));
         var filePath      = string.Format("{0}\\{1}{2}", dataset.CompressedFileExtractionLocation, jobInfo.Name, ".csv");
         if (!string.IsNullOrEmpty(filePath))
         {
             stringBuilder.Append(ConversionResultsExportFilePathOpenDiv);
             stringBuilder.Append(filePath);
             stringBuilder.Append(ConversionResultsExportFilePathCloseDiv);
         }
         stringBuilder.Append(AnalysissetDocumentsResultsImageTag);
         stringBuilder.Append(ConversionResultsDownloadLinkOpenAnchor);
         stringBuilder.Append(ConversionResultsExportDownloadHandler +
                              activeJob.JobId.ToString(CultureInfo.InvariantCulture));
         stringBuilder.Append(AnalysissetDocumentsResultsDownloadLinkText);
         stringBuilder.Append(ConversionResultsDownLoadLinkCloseAnchor);
         return(stringBuilder.ToString());
     }
     catch (Exception ex)
     {
         ex.Trace().Swallow();
     }
     return(string.Empty);
 }
Exemplo n.º 19
0
        private static string ConstructNotificationBodyForReviewerBulkTag
            (ActiveJob activeJob, BulkTagJobBusinessEntity bulkTagJobBeo, TagLogBEO tagLogBeo, JobBusinessEntity jobBeo)
        {
            //Add notification message to be sent
            var notificationMessage = new StringBuilder();

            notificationMessage.Append(Table);

            if (bulkTagJobBeo.IsOperationTagging)
            {
                notificationMessage.Append(Row);
                notificationMessage.Append(Header);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageHeadingForTagging));
                notificationMessage.Append(CloseHeader);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTagging));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);

                GenerateGeneralNotificationDetailsForReviewerBulkTagJob(activeJob, bulkTagJobBeo, notificationMessage, jobBeo);

                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.DocumentTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsAlreadyTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.AlreadyTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsFailed));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.FailedTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
            }
            else
            {
                notificationMessage.Append(Row);
                notificationMessage.Append(Header);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageHeadingForUntagging));
                notificationMessage.Append(CloseHeader);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntagging));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);

                GenerateGeneralNotificationDetailsForReviewerBulkTagJob(activeJob, bulkTagJobBeo, notificationMessage, jobBeo);

                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntaggingDocumentsUnTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.DocumentTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntaggingDocumentsNotUntagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(
                        (tagLogBeo.FailedTag + tagLogBeo.AlreadyTag).ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
            }

            notificationMessage.Append(CloseTable);
            return(notificationMessage.ToString());
        }
        private string ConstructBillingReportNotificationMessage(ActiveJob job,Director.JobStatus jobStatus)
        {
            var billingReportParams = (BillingReportParams)
                                       XmlUtility.DeserializeObject(job.BootParameters.ToString(),
                                       typeof(BillingReportParams));
            
            var downloadHandler = String.Format(DownloadHandlerURL,
               HttpUtility.UrlEncode(billingReportParams.TargetFolder));
            var notificationSubMessage = String.Format(Notifications.BillingReportGenerated,
                downloadHandler);

            return (jobStatus == Director.JobStatus.Completed )?
               notificationSubMessage : String.Empty;
        }
        /// <summary>
        /// This method is responsible to construct the Notification subject and Notification Body for the message to be delivered
        /// </summary>
        /// <param name="job"></param>
        /// <param name="jobStatus"></param>
        /// <param name="notificationMessageBeo"></param>
        /// <param name="message"></param>
        private static void ConstructBulkTagNotification(ActiveJob job, Director.JobStatus jobStatus,
            NotificationMessageBEO notificationMessageBeo, JobBusinessEntity jobDetails, string notificationMessage)
        {
            var stream = new StringReader(job.Beo.BootParameters);
            var xmlStream = new XmlSerializer(typeof(BulkTagJobBusinessEntity));
            var bootParameters = xmlStream.Deserialize(stream) as BulkTagJobBusinessEntity;
            stream.Close();

            var message = new StringBuilder();
            message.Append(string.IsNullOrEmpty(jobDetails.TypeName) ? string.Empty : " Type: ");
            message.Append(jobDetails.Visibility
                               ? jobDetails.TypeName
                               : jobDetails.TypeName.Replace("Job", "Task"));
            message.Append("<br/>");
            message.Append(jobDetails.Name);
            if (job.Beo != null)
            {
                message.Append(" Instance: ");
                message.Append(job.Beo.JobRunId);
            }
            message.Append("<br/>");
            message.Append("Folder: ");
            message.Append(jobDetails.FolderName);
            message.Append(" ");
            message.Append("<br/>");
            message.Append("Status: ");
            message.Append(notificationMessage);

            if (null != bootParameters)
            {
                var tagLog = RVWTagBO.GetTagLog(Convert.ToInt32(bootParameters.TagDetails.DatasetId), job.JobId);               

                if (jobStatus == Director.JobStatus.Completed)
                {
                    notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                    if (tagLog != null)
                    {
                        notificationMessageBeo.NotificationBody = ConstructNotificationBodyForReviewerBulkTag(job, bootParameters, tagLog, jobDetails);
                    }
                }
                else
                {
                    notificationMessageBeo.NotificationBody = notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                }
            }
            notificationMessageBeo.SendDefaultMessage = (jobStatus ==
                                                         Director.JobStatus.Completed);
        }
      private static string ConstructNotificationBodyForReviewerBulkTag
          (ActiveJob activeJob, BulkTagJobBusinessEntity bulkTagJobBeo, TagLogBEO tagLogBeo, JobBusinessEntity jobBeo)
        {
            //Add notification message to be sent
            var notificationMessage = new StringBuilder();
            notificationMessage.Append(Table);

            if (bulkTagJobBeo.IsOperationTagging)
            {
                notificationMessage.Append(Row);
                notificationMessage.Append(Header);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageHeadingForTagging));
                notificationMessage.Append(CloseHeader);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTagging));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);

                GenerateGeneralNotificationDetailsForReviewerBulkTagJob(activeJob, bulkTagJobBeo, notificationMessage, jobBeo);

                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.DocumentTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsAlreadyTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.AlreadyTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForTaggingDocumentsFailed));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.FailedTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
            }
            else
            {
                notificationMessage.Append(Row);
                notificationMessage.Append(Header);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageHeadingForUntagging));
                notificationMessage.Append(CloseHeader);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntagging));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);

                GenerateGeneralNotificationDetailsForReviewerBulkTagJob(activeJob, bulkTagJobBeo, notificationMessage, jobBeo);

                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntaggingDocumentsUnTagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(tagLogBeo.DocumentTag.ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
                notificationMessage.Append(Row);
                notificationMessage.Append(Column);
                notificationMessage.Append(HtmlBold);
                notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageForUntaggingDocumentsNotUntagged));
                notificationMessage.Append(HtmlCloseBold);
                notificationMessage.Append(
                    HttpUtility.HtmlEncode(
                        (tagLogBeo.FailedTag + tagLogBeo.AlreadyTag).ToString(CultureInfo.InvariantCulture)));
                notificationMessage.Append(CloseColumn);
                notificationMessage.Append(CloseRow);
            }

            notificationMessage.Append(CloseTable);
            return notificationMessage.ToString();
        }
Exemplo n.º 23
0
        internal void SendNotifications(ActiveJob job, Director.JobStatus jobStatus, string notificationMessage)
        {
            if (DebugMode)
            {
                return;
            }
            try
            {
                if (null != job)
                {
                    JobBusinessEntity jobDetails = null;
                    var jobBusinessEntity        = JobMgmtBO.GetJobDetails(job.JobId.ToString());
                    var userName = jobBusinessEntity.CreatedBy;
                    jobDetails = job.BusinessEntity;
                    var userBusinessEntity = UserBO.GetUser(userName);

                    #region Construct the notification message object

                    NotificationMessageBEO notificationMessageBeo = null;
                    try
                    {
                        notificationMessageBeo = new NotificationMessageBEO
                        {
                            NotificationId    = job.Beo.JobNotificationId,
                            CreatedByUserGuid = userBusinessEntity.UserGUID,
                            CreatedByUserName =
                                (userBusinessEntity.DomainName.Equals(@"N/A"))
                                                                 ? userBusinessEntity.UserId
                                                                 : userBusinessEntity.DomainName + @"\" +
                                userBusinessEntity.UserId,
                            SubscriptionTypeName = jobDetails.TypeName,
                            FolderId             = jobDetails.FolderID
                        };
                    }
                    catch
                    {
                        Tracer.Error("Unable to construct notification message for Job Id: {0}", job.JobId);
                    }

                    #endregion

                    #region Call Notification API

                    if (null != jobDetails && null != notificationMessageBeo &&
                        ((0 != notificationMessageBeo.NotificationId ||
                          !string.IsNullOrEmpty(notificationMessageBeo.SubscriptionTypeName)) &&
                         !string.IsNullOrEmpty(notificationMessageBeo.CreatedByUserGuid)))
                    {
                        #region Construct notification message

                        var message = new StringBuilder();
                        message.Append(string.IsNullOrEmpty(jobDetails.TypeName) ? string.Empty : " Type: ");
                        message.Append(jobDetails.Visibility
                                           ? jobDetails.TypeName
                                           : jobDetails.TypeName.Replace("Job", "Task"));
                        message.Append("<br/>");
                        message.Append(jobDetails.Name);
                        if (job.Beo != null)
                        {
                            message.Append(" Instance: ");
                            message.Append(job.Beo.JobRunId);
                        }
                        message.Append("<br/>");
                        message.Append("Folder: ");
                        message.Append(jobDetails.FolderName);
                        message.Append(" ");
                        message.Append("<br/>");
                        message.Append("Status: ");
                        message.Append(notificationMessage);

                        #region Job type specific custom message

                        try
                        {
                            switch (job.JobTypeId)
                            {
                            case 14:     // Load File Job custom message as per FSD.
                            {
                                var stream         = new StringReader(job.Beo.BootParameters);
                                var xmlStream      = new XmlSerializer(typeof(ImportBEO));
                                var bootParameters = xmlStream.Deserialize(stream) as ImportBEO;
                                stream.Close();

                                if (null != bootParameters &&
                                    string.IsNullOrEmpty(bootParameters.NotificationMessage))
                                {
                                    if (bootParameters.IsAppend)
                                    {
                                        if (jobStatus == Director.JobStatus.Completed)
                                        {
                                            message.Append(NotificationMessageCustomLoadFileAppendSuccessMessage);
                                            message.Append(jobDetails.FolderName);
                                            message.Append(NotificationMessageCustomLoadFileAppendMessagePart2);
                                            message.Append(job.JobId.ToString());
                                        }
                                        else
                                        {
                                            message.Append(NotificationMessageCustomLoadFileAppendFailureMessage);
                                            message.Append(jobDetails.FolderName);
                                            message.Append(NotificationMessageCustomLoadFileAppendMessagePart2);
                                            message.Append(job.JobId.ToString());
                                        }
                                    }
                                    else
                                    {
                                        if (jobStatus == Director.JobStatus.Completed)
                                        {
                                            message.Append(
                                                NotificationMessageCustomLoadFileOverlaySuccessMessagePart1);
                                            message.Append(jobDetails.FolderName);
                                            message.Append(
                                                NotificationMessageCustomLoadFileOverlaySuccessMessagePart2);
                                            message.Append(job.JobId.ToString());
                                        }
                                        else
                                        {
                                            message.Append(
                                                NotificationMessageCustomLoadFileOverlayFailureMessagePart1);
                                            message.Append(jobDetails.FolderName);
                                            message.Append(
                                                NotificationMessageCustomLoadFileOverlayFailureMessagePart2);
                                            message.Append(job.JobId.ToString());
                                            message.Append(
                                                NotificationMessageCustomLoadFileOverlayFailureMessagePart3);
                                        }
                                    }
                                }
                            }
                                notificationMessageBeo.SendDefaultMessage = (jobStatus ==
                                                                             Director.JobStatus.Completed);
                                break;

                            case 16:     // Reviewer bulk tag job custom message as per FSD.
                                ConstructBulkTagNotification(job, jobStatus, notificationMessageBeo, jobBusinessEntity, notificationMessage);
                                break;

                            case 38:
                                message.Append(jobStatus == Director.JobStatus.Completed
                                                       ? ConstructNotificationMessageForConversionResultsExport(job)
                                                       : NotificationMessageCustomConversionResultsExportError);
                                break;

                            case 54:
                                if (jobStatus == Director.JobStatus.Completed)
                                {
                                    message.Append(ConstructNotificationMessageForExportAnalysisSetDocuments(job));
                                }
                                break;

                            case BillingReportJobTypeId:

                                message.Append(ConstructBillingReportNotificationMessage(job, jobStatus));
                                break;
                            }
                        }
                        catch
                        {
                            Tracer.Error("Unable to set custom notification message for Job Id:{0}", job.JobId);
                        }

                        #endregion

                        if (job.JobTypeId != 16)
                        {
                            notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                            notificationMessageBeo.NotificationBody    = message.ToString();
                        }


                        #endregion

                        #region Send notification message by invoking notifications API

                        try
                        {
                            if (!string.IsNullOrEmpty(notificationMessageBeo.NotificationBody))
                            {
                                NotificationBO.SendNotificationMessage(notificationMessageBeo);
                            }
                        }
                        catch
                        {
                            Tracer.Error("Unable to send notification message for Job Id: {0}", job.JobId);
                        }

                        #endregion
                        if (job.JobTypeId == 14 || job.JobTypeId == 16) // Load File Import
                        {
                            return;                                     //For Load File Import- Custom message will be sent by default notification message.
                        }
                        if (jobStatus == Director.JobStatus.Completed && job.Beo.JobNotificationId > 0)
                        {
                            var customNotify = new NotificationMessageBEO
                            {
                                NotificationId     = job.Beo.JobNotificationId,
                                SendDefaultMessage = true,
                                CreatedByUserGuid  = userBusinessEntity.UserGUID
                            };

                            NotificationBO.SendNotificationMessage(customNotify);
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                ex.AddUsrMsg("Unable to send notification message.").Trace().Swallow();
            }
        }
        /// <summary>
        /// Constructs the notification message for conversion results export.
        /// </summary>
        /// <param name="activeJob">The active job.</param>
        /// <returns>notification message for conversion results export job</returns>
        private static string ConstructNotificationMessageForConversionResultsExport(ActiveJob activeJob)
        {
            var stream = new StringReader(activeJob.Beo.BootParameters);
            var xmlStream = new XmlSerializer(typeof(ConversionResultsExportJobParam));
            var conversionResultsExportJobParameters = xmlStream.Deserialize(stream) as ConversionResultsExportJobParam;

            var stringBuilder = new StringBuilder();
            stringBuilder.Append(ConversionResultsExportTitleOpenDiv);
            if (conversionResultsExportJobParameters != null)
            {
                stringBuilder.Append(ConversionResultsExportFilePathOpenDiv);
                stringBuilder.Append(conversionResultsExportJobParameters.TargetFileName);
                stringBuilder.Append(ConversionResultsExportFilePathCloseDiv);
            }
            stringBuilder.Append(ConversionResultsImageTag);
            stringBuilder.Append(ConversionResultsDownloadLinkOpenAnchor);
            stringBuilder.Append(ConversionResultsExportDownloadHandler +
                                 activeJob.JobId.ToString(CultureInfo.InvariantCulture));
            stringBuilder.Append(ConversionResultsDownloadLinkText);
            stringBuilder.Append(ConversionResultsDownLoadLinkCloseAnchor);
            return stringBuilder.ToString();
        }
      /// <summary>
      /// Generate part of notification message common to all events during bulk tagging
      /// </summary>
      /// <param name="bulkTagRecord"></param>
      /// <param name="notificationMessage"></param>
      private static void GenerateGeneralNotificationDetailsForReviewerBulkTagJob
          (ActiveJob job, BulkTagJobBusinessEntity bulkTagJobBeo, StringBuilder notificationMessage, JobBusinessEntity jobBeo)
      {
          notificationMessage.Append(Row);
          notificationMessage.Append(Column);
          notificationMessage.Append(HtmlBold);
          notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageStartTime));
          notificationMessage.Append(HtmlCloseBold);

          notificationMessage.Append(HttpUtility.HtmlEncode(jobBeo.JobScheduleStartDate.ConvertToUserTime()));

          notificationMessage.Append(CloseColumn);
          notificationMessage.Append(CloseRow);
          notificationMessage.Append(Row);
          notificationMessage.Append(Column);
          notificationMessage.Append(HtmlBold);
          notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageEndTime));
          notificationMessage.Append(HtmlCloseBold);

          notificationMessage.Append(HttpUtility.HtmlEncode(jobBeo.JobCompletedDate.ConvertToUserTime()));

          notificationMessage.Append(CloseColumn);
          notificationMessage.Append(CloseRow);
          notificationMessage.Append(Row);
          notificationMessage.Append(Column);
          notificationMessage.Append(HtmlBold);
          notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageLocation));
          notificationMessage.Append(HtmlCloseBold);


          notificationMessage.Append(HttpUtility.HtmlEncode(GetTaggingLocation(bulkTagJobBeo)));


          notificationMessage.Append(CloseColumn);
          notificationMessage.Append(CloseRow);

          notificationMessage.Append(Row);
          notificationMessage.Append(Column);
          notificationMessage.Append(HtmlBold);
          notificationMessage.Append(HttpUtility.HtmlEncode(NotificationMessageTagName));
          notificationMessage.Append(HtmlCloseBold);

          notificationMessage.Append(HttpUtility.HtmlEncode(bulkTagJobBeo.TagDetails.Name));

          notificationMessage.Append(CloseColumn);
          notificationMessage.Append(CloseRow);
      }
Exemplo n.º 26
0
 internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
 {
     base.SetPipelineTypeSpecificParameters(activeJob);
     _jobBootParameter = activeJob.BootParameters.ToString();
 }
 /// <summary>
 /// Construct Notification message for Export AnalysisSet Documents
 /// </summary>
 /// <param name="activeJob"></param>
 /// <returns></returns>
 private static string ConstructNotificationMessageForExportAnalysisSetDocuments(ActiveJob activeJob)
 {
     try
     {
         var stringBuilder = new StringBuilder();
         var documentQuery = (DocumentQuery)XmlUtility.DeserializeObject(activeJob.Beo.BootParameters, typeof(DocumentQuery));
         var dataset= DataSetBO.GetDataSetDetailForDataSetId(documentQuery.DatasetId);
         var jobInfo = JobMgmtBO.GetJobDetails(activeJob.JobId.ToString(CultureInfo.InvariantCulture));
         var filePath = string.Format("{0}\\{1}{2}", dataset.CompressedFileExtractionLocation, jobInfo.Name, ".csv");
         if (!string.IsNullOrEmpty(filePath))
         {
             stringBuilder.Append(ConversionResultsExportFilePathOpenDiv);
             stringBuilder.Append(filePath);
             stringBuilder.Append(ConversionResultsExportFilePathCloseDiv);
         }
         stringBuilder.Append(AnalysissetDocumentsResultsImageTag);
         stringBuilder.Append(ConversionResultsDownloadLinkOpenAnchor);
         stringBuilder.Append(ConversionResultsExportDownloadHandler +
                              activeJob.JobId.ToString(CultureInfo.InvariantCulture));
         stringBuilder.Append(AnalysissetDocumentsResultsDownloadLinkText);
         stringBuilder.Append(ConversionResultsDownLoadLinkCloseAnchor);
         return stringBuilder.ToString();
     }
     catch (Exception ex)
     {
         ex.Trace().Swallow();
     }
     return string.Empty;
 }
 internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
 {
     base.SetPipelineTypeSpecificParameters(activeJob);
     _jobBootParameter = activeJob.BootParameters.ToString();
 }
        internal void SendNotifications(ActiveJob job, Director.JobStatus jobStatus, string notificationMessage)
        {
            if (DebugMode) return;
            try
            {
                if (null != job)
                {
                    JobBusinessEntity jobDetails = null;
                    var jobBusinessEntity = JobMgmtBO.GetJobDetails(job.JobId.ToString());
                    var userName = jobBusinessEntity.CreatedBy;
                    jobDetails = job.BusinessEntity;
                    var userBusinessEntity = UserBO.GetUser(userName);

                    #region Construct the notification message object

                    NotificationMessageBEO notificationMessageBeo = null;
                    try
                    {

                        notificationMessageBeo = new NotificationMessageBEO
                                                     {
                                                         NotificationId = job.Beo.JobNotificationId,
                                                         CreatedByUserGuid = userBusinessEntity.UserGUID,
                                                         CreatedByUserName =
                                                             (userBusinessEntity.DomainName.Equals(@"N/A"))
                                                                 ? userBusinessEntity.UserId
                                                                 : userBusinessEntity.DomainName + @"\" +
                                                                   userBusinessEntity.UserId,
                                                         SubscriptionTypeName = jobDetails.TypeName,
                                                         FolderId = jobDetails.FolderID
                                                     };
                    }
                    catch
                    {
                        Tracer.Error("Unable to construct notification message for Job Id: {0}", job.JobId);
                    }

                    #endregion

                    #region Call Notification API

                    if (null != jobDetails && null != notificationMessageBeo &&
                        ((0 != notificationMessageBeo.NotificationId ||
                          !string.IsNullOrEmpty(notificationMessageBeo.SubscriptionTypeName)) &&
                         !string.IsNullOrEmpty(notificationMessageBeo.CreatedByUserGuid)))
                    {
                        #region Construct notification message

                        var message = new StringBuilder();
                        message.Append(string.IsNullOrEmpty(jobDetails.TypeName) ? string.Empty : " Type: ");
                        message.Append(jobDetails.Visibility
                                           ? jobDetails.TypeName
                                           : jobDetails.TypeName.Replace("Job", "Task"));
                        message.Append("<br/>");
                        message.Append(jobDetails.Name);
                        if (job.Beo != null)
                        {
                            message.Append(" Instance: ");
                            message.Append(job.Beo.JobRunId);
                        }
                        message.Append("<br/>");
                        message.Append("Folder: ");
                        message.Append(jobDetails.FolderName);
                        message.Append(" ");
                        message.Append("<br/>");
                        message.Append("Status: ");
                        message.Append(notificationMessage);

                        #region Job type specific custom message

                        try
                        {
                            switch (job.JobTypeId)
                            {
                                case 14: // Load File Job custom message as per FSD.
                                    {
                                        var stream = new StringReader(job.Beo.BootParameters);
                                        var xmlStream = new XmlSerializer(typeof(ImportBEO));
                                        var bootParameters = xmlStream.Deserialize(stream) as ImportBEO;
                                        stream.Close();

                                        if (null != bootParameters &&
                                            string.IsNullOrEmpty(bootParameters.NotificationMessage))
                                        {
                                            if (bootParameters.IsAppend)
                                            {
                                                if (jobStatus == Director.JobStatus.Completed)
                                                {
                                                    message.Append(NotificationMessageCustomLoadFileAppendSuccessMessage);
                                                    message.Append(jobDetails.FolderName);
                                                    message.Append(NotificationMessageCustomLoadFileAppendMessagePart2);
                                                    message.Append(job.JobId.ToString());
                                                }
                                                else
                                                {
                                                    message.Append(NotificationMessageCustomLoadFileAppendFailureMessage);
                                                    message.Append(jobDetails.FolderName);
                                                    message.Append(NotificationMessageCustomLoadFileAppendMessagePart2);
                                                    message.Append(job.JobId.ToString());
                                                }
                                            }
                                            else
                                            {
                                                if (jobStatus == Director.JobStatus.Completed)
                                                {
                                                    message.Append(
                                                        NotificationMessageCustomLoadFileOverlaySuccessMessagePart1);
                                                    message.Append(jobDetails.FolderName);
                                                    message.Append(
                                                        NotificationMessageCustomLoadFileOverlaySuccessMessagePart2);
                                                    message.Append(job.JobId.ToString());
                                                }
                                                else
                                                {
                                                    message.Append(
                                                        NotificationMessageCustomLoadFileOverlayFailureMessagePart1);
                                                    message.Append(jobDetails.FolderName);
                                                    message.Append(
                                                        NotificationMessageCustomLoadFileOverlayFailureMessagePart2);
                                                    message.Append(job.JobId.ToString());
                                                    message.Append(
                                                        NotificationMessageCustomLoadFileOverlayFailureMessagePart3);
                                                }
                                            }
                                        }
                                    }
                                    notificationMessageBeo.SendDefaultMessage = (jobStatus ==
                                                                                 Director.JobStatus.Completed);
                                    break;
                                case 16: // Reviewer bulk tag job custom message as per FSD.
                                    ConstructBulkTagNotification(job, jobStatus, notificationMessageBeo, jobBusinessEntity,notificationMessage);
                                    break;
                                case 38:
                                    message.Append(jobStatus == Director.JobStatus.Completed
                                                       ? ConstructNotificationMessageForConversionResultsExport(job)
                                                       : NotificationMessageCustomConversionResultsExportError);
                                    break;
                                case 54:
                                    if (jobStatus == Director.JobStatus.Completed)
                                    {
                                        message.Append(ConstructNotificationMessageForExportAnalysisSetDocuments(job));
                                    }
                                    break;
                                case BillingReportJobTypeId:
                                    
                                    message.Append(ConstructBillingReportNotificationMessage(job,jobStatus));
                                    break;
                            }
                        }
                        catch
                        {
                            Tracer.Error("Unable to set custom notification message for Job Id:{0}", job.JobId);
                        }

                        #endregion

                        if (job.JobTypeId != 16)
                        {
                            notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                            notificationMessageBeo.NotificationBody = message.ToString();
                        }


                        #endregion

                        #region Send notification message by invoking notifications API

                        try
                        {
                            if (!string.IsNullOrEmpty(notificationMessageBeo.NotificationBody))
                                NotificationBO.SendNotificationMessage(notificationMessageBeo);
                        }
                        catch
                        {
                            Tracer.Error("Unable to send notification message for Job Id: {0}", job.JobId);
                        }

                        #endregion
                        if (job.JobTypeId == 14 || job.JobTypeId == 16)  // Load File Import
                            return; //For Load File Import- Custom message will be sent by default notification message.  
                        if (jobStatus == Director.JobStatus.Completed && job.Beo.JobNotificationId > 0)
                        {
                            var customNotify = new NotificationMessageBEO
                                {
                                    NotificationId = job.Beo.JobNotificationId,
                                    SendDefaultMessage = true,
                                    CreatedByUserGuid = userBusinessEntity.UserGUID
                                };

                            NotificationBO.SendNotificationMessage(customNotify);
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                ex.AddUsrMsg("Unable to send notification message.").Trace().Swallow();
            }
        }