protected void btnSave_Click(object sender, EventArgs e) { lblError.Text = string.Empty; lblSave.Text = string.Empty; lblMessage.Text = string.Empty; lblMessage.Visible = false; lblError.Visible = false; lblSave.Visible = false; try { using (TransactionScope scope = new TransactionScope()) { ApplicationConfigurationManager.UpdateAppConfigStatus(); ApplicationConfiguration objAppConfig = new ApplicationConfiguration(); objAppConfig.PrimaryProducerCommissionPercent = Convert.ToDecimal(txtPrimeryProducer.Text); objAppConfig.SecondaryProducerCommissionPercent = Convert.ToDecimal(txtSecondaryProducer.Text); objAppConfig.EmailNotificationSite1 = txtEmailSite1.Text.Trim(); objAppConfig.EmailNotificationSite2 = txtEmailSite2.Text.Trim(); objAppConfig.EmailNotificationSite3 = txtEmailSite3.Text.Trim(); objAppConfig.Status = 1; ApplicationConfigurationManager.Save(objAppConfig); fillRecord(); lblSave.Text = "Record Saved."; lblSave.Visible = true; scope.Complete(); } } catch (Exception ex) { lblError.Text = "Record Not Saved."; lblError.Visible = true; } }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { base.BeginWork(); #region Assert conditions BootParameters.ShouldNotBe(null); BootParameters.ShouldBeTypeOf <string>(); PipelineId.ShouldNotBeEmpty(); #endregion try { if (!Int32.TryParse(ApplicationConfigurationManager.GetValue(MBulkTaggingWindowSize), out _mWindowSize)) { _mWindowSize = MDefaultWindowSize; } DoBeginWork(BootParameters); } catch (Exception ex) { LogMessage(true, string.Format("Error in TagStartupWorker - Exception: {0}", ex.ToUserString())); ReportToDirector(ex); ex.Trace().Swallow(); } }
/// <summary> /// Initializes the configuration items. /// </summary> private void InitializeConfigurationItems() { // default values if reading from configuration fails. this avoids job from failing. m_OutputBatchSize = 100; m_PipelineBatchSize = 100; try { // this can't have a default value. m_DecryptionKey = ApplicationConfigurationManager.GetValue("EncryptionKey", "Data Security"); } catch (Exception ex) { ex.AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_DecryptionKeyUnavailable).Trace().Swallow(); } try { int.TryParse(ApplicationConfigurationManager.GetValue("EDocsOutputBatchSize", "Imports"), out m_OutputBatchSize); uint.TryParse(ApplicationConfigurationManager.GetValue("EDocsPipelineBatchSize", "Imports"), out m_PipelineBatchSize); } catch (Exception ex) { ex.AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_ConfigurationUnavailable).Trace().Swallow(); } }
protected override void BeginWork() { base.BeginWork(); _maxParallelThread = Convert.ToInt32(ApplicationConfigurationManager.GetValue("NumberOfMaxParallelism", "Export")); _exportLoadJobDetailBeo = Utils.SmartXmlDeserializer(BootParameters) as ExportLoadJobDetailBEO; _dataset = DataSetBO.GetDatasetDetailsWithMatterInfo(Convert.ToInt64(_exportLoadJobDetailBeo.DatasetId), _exportLoadJobDetailBeo.MatterId); }
/// <summary> /// Gives the configuration value for a key and sub application /// </summary> /// <param name="key"></param> /// <param name="subapplication"></param> /// <returns></returns> private static string GetConfigurationValue(string key, string subapplication) { string result = null; result = ApplicationConfigurationManager.GetValue(key, subapplication); result = StringUtility.IsNullOrWhiteSpace(result) ? string.Empty : result; return(result); }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { BootParameters.ShouldNotBe(null); base.BeginWork(); _jobParameter = (CategorizeInfo)XmlUtility.DeserializeObject(BootParameters, typeof(CategorizeInfo)); _batchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("UpdateFieldsBatchSize", "AnalyticsProject")); _projectInfo = AnalyticsProject.Get(_jobParameter.MatterId.ToString(CultureInfo.InvariantCulture), _jobParameter.DatasetId.ToString(CultureInfo.InvariantCulture), _jobParameter.ProjectId.ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// To get the batch size for law import /// </summary> private int GetMessageBatchSize() { try { return(Convert.ToInt32(ApplicationConfigurationManager.GetValue("LawPipelineBatchSize", "Imports"))); } catch (Exception) { Tracer.Error("Law Import: Failed to set message batch size for job run id {0}", PipelineId); return(0); } }
/// <summary> /// To get the batch size for law import /// </summary> private static int GetMessageBatchSize() { try { return(Convert.ToInt32(ApplicationConfigurationManager.GetValue("LawPipelineBatchSize", "Imports"))); } catch (Exception ex) { ex.Trace().Swallow(); return(100); } }
protected override void BeginWork() { base.BeginWork(); var hostId = ServerConnectivity.GetHostIPAddress(); _redactitPushUrl = CmgServiceConfigBO.GetServiceConfigurationsforConfig (hostId, External.DataAccess.Constants.SystemConfigurationService, Constants.QueueServerUrl); _redactitTimeout = ApplicationConfigurationManager.GetValue(Constants.RedactItTimeout, Constants.NearNativeViewerSection); var baseServiceUri = new Uri(CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.WcfHostUrl)); var lawServiceUri = new Uri(baseServiceUri, Constants.LawSyncConversionCallBackMethod); _redactitCallbackUrl = lawServiceUri.OriginalString; _vaultManager = EVUnityContainer.Resolve <IDocumentVaultManager>(Constants.DocumentVaultManager); }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { BootParameters.ShouldNotBe(null); base.BeginWork(); _jobParameter = (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo)); _dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture)); _analyticProject = new AnalyticsProject(); _totalDocumentCount = _analyticProject.GetProjectDocumentsCount(Convert.ToInt64(_jobParameter.MatterId, CultureInfo.CurrentCulture), _jobParameter.ProjectCollectionId); _batchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("UpdateFieldsBatchSize", "AnalyticsProject")); _projectFieldId = AnalyticsProject.GetProjectFieldId(_jobParameter.MatterId, _dataset.CollectionId); }
/// <summary> /// Shutdown method will be called at end of the job /// </summary> /// <param name="jobParameters">Job Business Object</param> protected override void Shutdown(CompareSavedSearchResultsJobBEO jobParameters) { try { long reportId = 0; _encoder = _encodingType.Equals(Constants.UniCode, StringComparison.CurrentCultureIgnoreCase) ? (Encoding) new UnicodeEncoding() : new UTF8Encoding(); if (_fileType.Equals(Constants.FileTypeCsv, StringComparison.CurrentCultureIgnoreCase)) { //Writing generated report to Db reportId = SearchResultsBO.SaveExportResults(_searchResultsProperty.SearchResultId, _encoder.GetBytes(_reportString.ToString()), true, _fileType, _userEntityOfJobOwner.UserGUID); _reportString = null; } #region Notification section //Getting Job detail detail var jobBeo = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture)); if (jobBeo.NotificationId > 0) { string defaultMessage; defaultMessage = _isJobFailed ? string.Format(Constants.FailureNotificationMessage, _searchResultsProperty.SearchResultsName) : string.Format(Constants.CompareReportMessage, _searchResultsProperty.SearchResultsName, ApplicationConfigurationManager.GetValue(Constants.ReportHandlerUrl) , Constants.CompareReport, _searchResultsProperty.SearchResultId, _fileType, reportId, _searchResultsProperty.DocumentQuery.QueryObject.DatasetId); CustomNotificationMessage = defaultMessage; } #endregion Notification section } catch (EVException ex) { WriteToEventViewer(ex, GetType(), MethodBase.GetCurrentMethod().Name, jobParameters.JobId, jobParameters.JobRunId); HandleJobException(null, ErrorCodes.ProblemInShutDown); } catch (Exception ex) { // Handle exception LogMessage(ex, GetType(), MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, jobParameters.JobId, jobParameters.JobRunId); HandleJobException(ex, ErrorCodes.ProblemInShutDown); } }
/// <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); } }
private void OpenDCBWithCreds() { //Adding one more empty pair to handle the case where user passes credentials for the //unsecured dcbs DcbOpticonJobBEO.DcbCredentialList.Add(Convert.ToString((char)174)); //If it is a secured dcb foreach (var usernamepasswordpair in DcbOpticonJobBEO.DcbCredentialList) { if (usernamepasswordpair == null) { continue; } var uidpwd = usernamepasswordpair.Split(new[] { (char)174 }); var login = uidpwd[0]; var password = (uidpwd.Length > 1) ? uidpwd[1] : ""; if (!string.IsNullOrEmpty(password)) { password = ApplicationConfigurationManager.Decrypt(password, ApplicationConfigurationManager.GetValue(UNPWEncryption, UNPWDataSecurity)); } try { Tracer.Debug("DcbSlicer: Opening secured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath); DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, login, password); DcbCredentials = new DcbCredentials { Login = login, Password = password }; return; } catch (Dcb2EvException ex) { if (ex.ErrorCode != (int)DcbFacadeErrorCodes.AccessDenied) { throw; } ex.Trace().Swallow(); } } var message = String.Format("Tried all login/password pairs for {0} and none worked", DcbOpticonJobBEO.DcbSourcePath); throw new Dcb2EvException(message, (int)DcbFacadeErrorCodes.AccessDenied); }
protected override void BeginWork() { base.BeginWork(); try { var strFileParserBatchSize = ApplicationConfigurationManager.GetValue("FileParserBatchSize", "Imports", false); if (!String.IsNullOrEmpty(strFileParserBatchSize)) { fileParserBatchSize = int.Parse(strFileParserBatchSize); } fileIoHelper = new FileIOHelper(); // function that's called when a batch of documents are available. fileIoHelper.BatchOfDocumentsAvailable += Send; profileBEO = DocumentImportHelper.GetProfileBeo(BootParameters); #region Check for minimum required information. // Check if minimum required information, dataset details and matter details available. if (profileBEO.DatasetDetails == null) { throw new EVException().AddResMsg( ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable); } if (profileBEO.DatasetDetails.Matter == null) { throw new EVException().AddResMsg( ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable); } #endregion Check for minimum required information //TODO: Search Engine Replacement - Search Sub System - Create Seed Directory, if required } catch (Exception ex) { LogMessage(false, "Failed on initialize values. " + ex.ToUserString()); ReportToDirector(ex); throw; } }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { BootParameters.ShouldNotBe(null); base.BeginWork(); _jobParameter = (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo)); _analyticProject = new AnalyticsProject(); _dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture)); _totalDocumentCount = _analyticProject.GetSelectedDocumentsCount(_dataset.CollectionId, _jobParameter, WorkAssignment.JobId); //Update job log initial state var jobSummaryKeyValuePairs = new EVKeyValuePairs(); JobMgmtBO.UpdateJobResult(WorkAssignment.JobId, 0, _totalDocumentCount, jobSummaryKeyValuePairs); _documentBachSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectJobBatchSize", "AnalyticsProject")); _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId; IncreaseProcessedDocumentsCount(_totalDocumentCount); }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { BootParameters.ShouldNotBe(null); base.BeginWork(); _jobParameter = (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo)); _analyticProject = new AnalyticsProject(); _dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture)); _projectFieldId = AnalyticsProject.GetProjectFieldId(_jobParameter.MatterId, _dataset.CollectionId); _documentBachSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectJobBatchSize", "AnalyticsProject")); _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId; if (!_jobParameter.IsAddAdditionalDocuments || !string.IsNullOrEmpty(_jobIds)) { return; } _jobIds = GetIncludeJobIds(); }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { BootParameters.ShouldNotBe(null); base.BeginWork(); _jobParameter = (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo)); _analyticProject = new AnalyticsProject(); _documentBachSize = Convert.ToInt32( ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectInSubSystemJobBatchSize", "AnalyticsProject")); _dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture)); _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId; _totalDocumentCount = _analyticProject.GetProjectDocumentsCountByTaskId( Convert.ToInt64(_jobParameter.MatterId, CultureInfo.CurrentCulture), _jobParameter.ProjectCollectionId, _jobParameter.PrimarySystemJobId); //Update job log initial state var jobSummaryKeyValuePairs = new EVKeyValuePairs(); JobMgmtBO.UpdateJobResult(WorkAssignment.JobId, 0, _totalDocumentCount, jobSummaryKeyValuePairs); if (_jobParameter.IsRerunJob || _jobParameter.IsAddAdditionalDocuments) //Rerun job or Add additional documents- need get to get existing IndexId ,if already created { _indexId = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId, _dataset.CollectionId, _jobParameter.ProjectCollectionId, false); } if (string.IsNullOrEmpty(_indexId)) { _indexId = "idx-" + Guid.NewGuid().ToString().ToLowerInvariant(); _analyticProject.InsertIndexId(_jobParameter.MatterId, WorkAssignment.JobId, _dataset.CollectionId, _jobParameter.ProjectCollectionId, _indexId); } AnalyticsProject.CreateAnalyticalIndex(_jobParameter.MatterId, WorkAssignment.JobId, _indexId); //Create Index in Spark SVM.. IncreaseProcessedDocumentsCount(_totalDocumentCount); }
/// <summary> /// Before job shuts down, shall update job next run /// </summary> /// <param name="jobParameters">Job Business Object</param> protected override void Shutdown(SaveSearchResultsJobBEO jobParameters) { jobParameters.ShouldNotBe(null); LogMessage(Constants.ShutdownLogMessage, false, LogCategory.Job, null); var additionalDetails = new List <KeyValuePair <string, string> >(); var aditionalDetail = new KeyValuePair <string, string>(Constants.SearchDescription, _searchResultsProperty.SearchResultsDescription); additionalDetails.Add(aditionalDetail); aditionalDetail = new KeyValuePair <string, string>(Constants.SearchQuery, jobParameters.DocumentQuery.QueryObject.DisplayQuery); additionalDetails.Add(aditionalDetail); aditionalDetail = new KeyValuePair <string, string>(Constants.NoOfDocuments, _dcnList.Count.ToString(CultureInfo.InvariantCulture)); additionalDetails.Add(aditionalDetail); aditionalDetail = new KeyValuePair <string, string>(Constants.DocumentControlNumberList, string.Join(",", _dcnList.ToArray())); additionalDetails.Add(aditionalDetail); #region Notification section //Getting Job detail detail var jobBeo = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture)); if (jobBeo.NotificationId > 0) { string defaultMessage; var nameEndIndex = jobBeo.Name.LastIndexOf(Constants.JobDateSeparator, StringComparison.Ordinal); var savedSearchResultName = nameEndIndex >= 0 ? jobBeo.Name.Substring(0, nameEndIndex) : jobBeo.Name; defaultMessage = string.Format(Constants.SuccessNotificationMessage, HttpUtility.HtmlEncode(savedSearchResultName), ApplicationConfigurationManager.GetValue(Constants.SaveSearchResultUrl)); CustomNotificationMessage = defaultMessage; } #endregion }
/// <summary> /// Initializes Job BEO /// </summary> /// <param name="jobId">Alert Job Identifier</param> /// <param name="jobRunId">Alert Job Run Identifier</param> /// <param name="bootParameters">Boot parameters</param> /// <param name="createdByGuid">Alert Job created by Guid</param> /// <returns>Alert Job Business Entity</returns> protected override SearchAlertsJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdByGuid) { try { // Set Job level properties to Alert Job business entity object. m_SearchAlertsJobBeo.JobId = jobId; m_SearchAlertsJobBeo.JobRunId = jobRunId; m_SearchAlertsJobBeo.JobTypeName = Constants.LOG_SOURCE; m_SearchAlertsJobBeo.BootParameters = bootParameters; m_SearchAlertsJobBeo.JobName = Constants.LOG_SOURCE; m_UserBusinessEntity = UserBO.GetUserUsingGuid(createdByGuid); m_SearchAlertsJobBeo.JobScheduleCreatedBy = (m_UserBusinessEntity.DomainName.Equals(Constants.NA)) ? m_UserBusinessEntity.UserId : m_UserBusinessEntity.DomainName + Constants.BackSlash + m_UserBusinessEntity.UserId; // job start time need to be reduced by an offset to calculate start time // That's because at the beginning, Scheduler increments the start time by an offset for next run. var jobStartTimeoffsetFinal = Constants.INTEGER_INITIALIZE_VALUE; var jobStartTimeoffset = ApplicationConfigurationManager.GetValue(Constants.JOB_START_TIME_OFFSET); Int32.TryParse(jobStartTimeoffset, out jobStartTimeoffsetFinal); m_SearchAlertsJobBeo.JobScheduleNextRunDate = m_Helper.GetSearchAlertJobRunStartTime(m_SearchAlertsJobBeo.JobId).AddHours(jobStartTimeoffsetFinal); } catch (EVException ex) { HandleEVException(ex, MethodBase.GetCurrentMethod().Name, null); var jobException = new EVJobException(ex.GetErrorCode(), ex, JobLogInfo); throw (jobException); } catch (Exception ex) { // Handle exception in initialize LogMessage(ex.Message, MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, null); var jobException = new EVJobException(ErrorCodes.ProblemInJobInitialization, ex, JobLogInfo); throw (jobException); } // return Alert Job Business Entity return(m_SearchAlertsJobBeo); }
public void Initialize() { // initialize dictionary appSettingsDictionary = new Dictionary <string, string>(); // initialize array stubFileNames = new[] { "2.txt", "3.txt", "1.txt" }; // ConfigurationWrapper mock configurationWrapperMock = new Mock <IConfigurationWrapper>(MockBehavior.Strict); configurationWrapperMock.Setup(x => x[It.IsAny <string>()]) .Returns((string key) => appSettingsDictionary.ContainsKey(key) ? appSettingsDictionary[key] : (string)null); // ApplicationWrapper mock applicationWrapperMock = new Mock <IApplicationWrapper>(MockBehavior.Strict); applicationWrapperMock.Setup(x => x.StartupPath).Returns(applicationStartupPath); // DirectoryWrapper mock directoryWrapperMock = new Mock <IDirectoryWrapper>(MockBehavior.Strict); // new ApplicationConfigurationManager applicationConfigurationManager = new ApplicationConfigurationManager(configurationWrapperMock.Object, applicationWrapperMock.Object, directoryWrapperMock.Object); }
private void fillRecord() { var predicate = PredicateBuilder.True <CRM.Data.Entities.ApplicationConfiguration>(); predicate = predicate.And(config => config.Status == 1); objAppConfig = ApplicationConfigurationManager.GetPredicate(predicate); if (objAppConfig != null && objAppConfig.Count > 0) { txtEmailSite1.Text = objAppConfig[0].EmailNotificationSite1 == null ? string.Empty : objAppConfig[0].EmailNotificationSite1.ToString(); txtEmailSite2.Text = objAppConfig[0].EmailNotificationSite2 == null ? string.Empty : objAppConfig[0].EmailNotificationSite2.ToString(); txtEmailSite3.Text = objAppConfig[0].EmailNotificationSite3 == null ? string.Empty : objAppConfig[0].EmailNotificationSite3.ToString(); txtPrimeryProducer.Text = objAppConfig[0].PrimaryProducerCommissionPercent == null ? "0" : objAppConfig[0].PrimaryProducerCommissionPercent.ToString(); txtSecondaryProducer.Text = objAppConfig[0].SecondaryProducerCommissionPercent == null ? "0" : objAppConfig[0].SecondaryProducerCommissionPercent.ToString(); } else { txtEmailSite1.Text = string.Empty; txtEmailSite2.Text = string.Empty; txtEmailSite3.Text = string.Empty; txtPrimeryProducer.Text = "0"; txtSecondaryProducer.Text = "0"; } }
private void SetMessageBatchSize(ImportBEO jobParameter) { try { if (jobParameter != null) { if (jobParameter.IsAppend) { m_BatchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("LoadFileBatchSize", "Imports")); } else { m_BatchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("LoadFileOverlayBatchSize", "Imports")); } } } catch (Exception) { Tracer.Error("Load File Parser: Failed to set message batch size for job run id {0}", PipelineId); } }
protected override void BeginWork() { base.BeginWork(); _bootParameter = BootParameters; _maxParallelThread = Convert.ToInt32(ApplicationConfigurationManager.GetValue("NumberOfMaxParallelism", "Export")); }
/// <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 CompareSavedSearchResultsJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy) { try { LogMessage(Constants.InitializationStartMessage, GetType(), Constants.InitializeMethodFullName, EventLogEntryType.Information, jobId, jobRunId); //using job framework Logging LogMessage(Constants.InitializationStartMessage, false, LogCategory.Job, null); try { // Set level of logging _fileType = (ApplicationConfigurationManager.GetValue(Constants.RequiredFileType)); _encodingType = (ApplicationConfigurationManager.GetValue(Constants.RequiredEncoding)); _xslFilePathForComparisonReport = (CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.XslFilePathForComparisonReport)); LogMessage(Constants.InitializationDoneForConfigurableItemMessage, false, LogCategory.Job, null); LogMessage(Constants.InitializationDoneForConfigurableItemMessage, GetType(), Constants.InitializeMethodFullName, EventLogEntryType.Information, jobId, jobRunId); } catch { _isJobFailed = true; LogMessage(Constants.InitializationDoneForConfigurableItemErrorMessage, true, LogCategory.Job, null); LogMessage(Constants.InitializationDoneForConfigurableItemErrorMessage, GetType(), Constants.InitializeMethodFullName, EventLogEntryType.Information, jobId, jobRunId); } //Constructing Search Results property Beo from passed boot paramter _searchResultsProperty = (SearchResultsPropertiesDataContract) XmlUtility.DeserializeObject(bootParameters, typeof(SearchResultsPropertiesDataContract)); //Initialize the JobBEO object _jobBeo.JobName = string.Format("Compare Job - {0} at {1}", _searchResultsProperty.SearchResultsName, DateTime.UtcNow.ConvertToUserTime()); _jobBeo.JobDescription = _searchResultsProperty.SearchResultsDescription; _jobBeo.FileType = _fileType; _jobBeo.JobTypeName = Constants.JobTypeName; _jobBeo.JobId = jobId; _jobBeo.JobRunId = jobRunId; // Obtain User BEO of job owner -> will be used for audit log purpose _userEntityOfJobOwner = UserBO.GetUserUsingGuid(createdBy); _jobBeo.JobScheduleCreatedBy = (_userEntityOfJobOwner.DomainName.Equals("N/A")) ? _userEntityOfJobOwner.UserId : _userEntityOfJobOwner.DomainName + "\\" + _userEntityOfJobOwner.UserId; } catch (EVException ex) { _isJobFailed = true; WriteToEventViewer(ex, GetType(), MethodBase.GetCurrentMethod().Name, jobId, jobRunId); HandleJobException(null, ErrorCodes.ProblemInJobInitialization); } catch (Exception ex) { _isJobFailed = true; // Handle exception in initialize LogMessage(ex, GetType(), MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, jobId, jobRunId); HandleJobException(ex, ErrorCodes.ProblemInJobInitialization); } return(_jobBeo); }
/// <summary> /// Does atomic 1)Gets document links2) Generate xml 3) Update xml file to database. /// </summary> /// <param name="task">ConvertDCBLinkTaskBusinessEntityObject</param> /// <param name="jobParameters">Job business entity</param> /// <returns></returns> protected override bool DoAtomicWork(SendDocumentLinksToCaseMapTaskBusinessEntity Task, BaseJobBEO jobParameters) { var StatusFlag = true; // Function return status. try { EvLog.WriteEntry( Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Start, EventLogEntryType.Information); var xml = string.Empty; var taskEntity = (SendDocumentLinksToCaseMapTaskBusinessEntity) XmlUtility.DeserializeObject(jobParameters.BootParameters, typeof(SendDocumentLinksToCaseMapTaskBusinessEntity)); switch (taskEntity.CaseMapSource) { case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.SearchResults: { var documentLinks = new List <DocumentLinkBEO>(); if (taskEntity.DocumentLinkTasks.DocumentSelectionMode == DocumentLinksTaskEntity.SelectionMode.UseSelection && taskEntity.DocumentLinkTasks.DocumentIdList != null) { documentLinks.AddRange(taskEntity.DocumentLinkTasks.DocumentIdList.Select(documentId => getDocumentLink(taskEntity.DocumentLinkTasks.SearchContext.MatterId, taskEntity.DocumentLinkTasks.SearchContext.CollectionId, documentId, taskEntity.DocumentLinkTasks.BaseLink, DocumentBO.GetDCNNumber(taskEntity.DocumentLinkTasks.SearchContext.MatterId, taskEntity.DocumentLinkTasks.SearchContext.CollectionId, documentId, jobParameters.JobScheduleCreatedBy ) ))); } else { var documentQueryEntity = new DocumentQueryEntity { QueryObject = new SearchQueryEntity { ReviewsetId = taskEntity.DocumentLinkTasks.SearchContext.ReviewsetId, DatasetId = Convert.ToInt32(taskEntity.DocumentLinkTasks.SearchContext.DatasetId), MatterId = Convert.ToInt32(taskEntity.DocumentLinkTasks.SearchContext.MatterId), IsConceptSearchEnabled = taskEntity.DocumentLinkTasks.SearchContext.EnableConceptSearch } }; documentQueryEntity.QueryObject.QueryList.Add( new Query(taskEntity.DocumentLinkTasks.SearchContext.Query)); documentQueryEntity.SortFields.Add(new Sort { SortBy = Constants.Relevance }); documentQueryEntity.IgnoreDocumentSnippet = true; documentQueryEntity.TransactionName = "SendDocumentLinksToCaseMap - DoAtomicWork"; var searchResults = JobSearchHandler.GetAllDocuments(documentQueryEntity, false); if (taskEntity.DocumentLinkTasks.DocumentIdList != null && taskEntity.DocumentLinkTasks.DocumentIdList.Count > 0) { documentLinks = searchResults.ResultDocuments.Where( x => taskEntity.DocumentLinkTasks.DocumentIdList.Find( y => string.Compare(x.DocumentID, y, true) == 0) == null). Select( z => getDocumentLink(z.MatterID.ToString(), z.CollectionID, z.DocumentID, taskEntity.DocumentLinkTasks.BaseLink, z.DocumentControlNumber) ).ToList(); } else { searchResults.ResultDocuments.SafeForEach(d => documentLinks.Add( getDocumentLink(d.MatterID.ToString(), d.CollectionID, d.DocumentID, taskEntity.DocumentLinkTasks.BaseLink, d.DocumentControlNumber))); } } fileType = ApplicationConfigurationManager.GetValue(Constants.SearchResultsFileType); xml = DocumentFactBusinessObject.GenerateDocumentLinksXml(documentLinks, jobParameters.JobScheduleCreatedBy); break; } case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.DocumentViewer: { var documentFactLinks = taskEntity.DocumentFactLinks; fileType = ApplicationConfigurationManager.GetValue(Constants.DocumentViewerFileType); xml = DocumentFactBusinessObject.GenerateDocumentFactXml(documentFactLinks, jobParameters.JobScheduleCreatedBy); break; } case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.NearNative: { var documentFactLinks = taskEntity.DocumentFactLinks; fileType = ApplicationConfigurationManager.GetValue(Constants.NearNativeFileType); xml = DocumentFactBusinessObject.GenerateDocumentFactXml(documentFactLinks, jobParameters.JobScheduleCreatedBy); break; } } // Perform Atomic Task var encoding = new UTF8Encoding(); var content = encoding.GetBytes(xml); var nameBuilder = new StringBuilder(); nameBuilder.Append(Constants.TaskName); nameBuilder.Append(Constants.OnDate); nameBuilder.Append(startedTime.ConvertToUserTime()); var requestName = nameBuilder.ToString(); nameBuilder = new StringBuilder(); nameBuilder.Append(Constants.TaskName); nameBuilder.Append(Constants.RequestByUser); nameBuilder.Append(jobParameters.JobScheduleCreatedBy); nameBuilder.Append(Constants.OnDate); nameBuilder.Append(startedTime.ConvertToUserTime()); requestDescription = nameBuilder.ToString(); conversionId = CaseMapDAO.SaveConversionResults(jobParameters.JobRunId, requestName, requestDescription, content, fileType, createdByUserGuid); StatusFlag = true; EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId, Constants.Event_Job_DoAtomicWork_Success, EventLogEntryType.Information); } catch (EVTaskException ex) { isJobFailed = true; EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); LogException(TaskLogInfo, ex, LogCategory.Task, ErrorCodes.ProblemInDoAtomicWork, string.Empty); } catch (Exception ex) { isJobFailed = true; // Handle exception in Generate Tasks EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); LogException(TaskLogInfo, ex, LogCategory.Task, ErrorCodes.ProblemInDoAtomicWork, string.Empty); } return(StatusFlag); }
/// <summary> /// Gets the configuration values. /// </summary> /// <returns></returns> private void GetConfigurationValues() { _batchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("QueryBatchSize", "Reviewset")); Tracer.Info("Configuration values are initialized successfully."); }
/// <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.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_ShutDown, EventLogEntryType.Information); #region Notification section //get job details JobBusinessEntity jobDetails = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture)); if (jobDetails != null && jobDetails.NotificationId > 0) { string defaultMessage = string.Empty; defaultMessage = _isJobFailed ? string.Format(Constants.NotificationErrorMessageFormat, !string.IsNullOrEmpty(_requestDescription) ? _requestDescription : Constants.TaskName) : string.Format(Constants.NotificationSuccessMessageFormat, _requestDescription, _documentCount, ApplicationConfigurationManager.GetValue(Constants.CaseMapUrl), _conversionId.ToString()); CustomNotificationMessage = defaultMessage; } #endregion JobLogInfo.AddParameters(Constants.CreatedBy, jobParameters.JobScheduleCreatedBy); JobLogInfo.AddParameters(Constants.DocumentIncludedInXml, Convert.ToString(_documentCount)); JobLogInfo.AddParameters(Constants.TaskStartTime, Convert.ToString(startedTime)); JobLogInfo.AddParameters(Constants.TaskEndTime, Convert.ToString(DateTime.UtcNow)); } catch (EVJobException ex) { EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); throw; } catch (Exception ex) { _isJobFailed = true; // Handle exception in Generate Tasks EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); EVJobException jobException = new EVJobException(ErrorCodes.DoAtomicError, ex); JobLogInfo.AddParameters(Constants.JobRunId, jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture)); jobException.LogMessge = JobLogInfo; throw (jobException); } }
/// <summary> /// Does atomic 1)Gets DCB document 2) Generate xml 3) Update xml file to database. /// </summary> /// <param name="task">ConvertDCBLinkTaskBusinessEntityObject</param> /// <param name="jobParameters">Job business entity</param> /// <returns></returns> protected override bool DoAtomicWork(ConvertDCBLinkTaskBusinessEntityObject task, BaseJobBEO jobParameters) { bool StatusFlag = true;// Function return status. try { EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Start, EventLogEntryType.Information); // Perform Atomic Task DCBLinkCollectionBEO dcbLinks = new DCBLinkCollectionBEO(); DCBLinkBEO dcbLink; ReviewerSearchResults searchResults = null; if (_documentCount > 0) { DocumentQueryEntity documentQueryEntity = GetDocumentQueryEntity(task.DatasetId.ToString(CultureInfo.InvariantCulture), _query, _documentCount.ToString(CultureInfo.InvariantCulture)); documentQueryEntity.TransactionName = "ConvertDCBLinksToCaseMap - DoAtomicWork"; searchResults = JobSearchHandler.GetSearchResults(documentQueryEntity); } List <DCBLinkBEO> linkList = new List <DCBLinkBEO>(); string uuid = string.Empty; int count = 0; foreach (DocumentResult document in searchResults.ResultDocuments) { dcbLink = new DCBLinkBEO(); DocumentIdentifierBEO docIdentifier = new DocumentIdentifierBEO(document.MatterID.ToString(CultureInfo.InvariantCulture), document.CollectionID, document.DocumentID); if (count == 0) { uuid = docIdentifier.UniqueIdentifier.Replace(docIdentifier.DocumentId, string.Empty); } dcbLink.NewDocumentId = docIdentifier.DocumentId; List <FieldResult> fieldValues = document.Fields.Where(f => System.String.Compare(f.Name, EVSystemFields.DcbId, System.StringComparison.OrdinalIgnoreCase) == 0).ToList(); dcbLink.OldDocumentId = fieldValues.Any() ? fieldValues.First().Value.Replace("[", "(").Replace("]", ")") : string.Empty; linkList.Add(dcbLink); dcbLink.CollectionId = docIdentifier.CollectionId; dcbLink.DCN = docIdentifier.DCN; if (docIdentifier.MatterId != null) { dcbLink.MatterId = long.Parse(docIdentifier.MatterId); } count++; } linkList.SafeForEach(l => dcbLinks.Links.Add(l)); dcbLinks.UrlApplicationLink = task.LinkBackUrl; string xml = DocumentFactBusinessObject.GenerateDcbLinksXml(dcbLinks, uuid); UTF8Encoding encoding = new UTF8Encoding(); byte[] content = encoding.GetBytes(xml); StringBuilder nameBuilder = new StringBuilder(); nameBuilder.Append(Constants.TaskName); nameBuilder.Append(Constants.OnDate); nameBuilder.Append(startedTime.ConvertToUserTime()); string requestName = nameBuilder.ToString(); nameBuilder = new StringBuilder(); nameBuilder.Append(Constants.TaskName); _requestDescription = nameBuilder.ToString(); string fileType = ApplicationConfigurationManager.GetValue(Constants.FileType); _conversionId = CaseMapDAO.SaveConversionResults(jobParameters.JobRunId, requestName, _requestDescription, content, fileType, _createdByUserGuid); StatusFlag = true; EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Success, EventLogEntryType.Information); TaskLogInfo.AddParameters(Constants.DataSetName, task.DatasetName); } catch (EVTaskException ex) { _isJobFailed = true; EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); throw; } catch (Exception ex) { _isJobFailed = true; // Handle exception in Generate Tasks EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error); EVTaskException jobException = new EVTaskException(ErrorCodes.DoAtomicError, ex); TaskLogInfo.StackTrace = ex.Message + Constants.LineBreak + ex.StackTrace; TaskLogInfo.AddParameters(Constants.DataSetId, task.DatasetId.ToString(CultureInfo.InvariantCulture)); TaskLogInfo.AddParameters(Constants.DataSetName, task.DatasetName); TaskLogInfo.TaskKey = Constants.DataSetName + ":" + task.DatasetName; jobException.LogMessge = TaskLogInfo; throw (jobException); } return(StatusFlag); }
protected override void BeginWork() { base.BeginWork(); m_BatchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("TagBatchSize", "Reviewset")); }