public void AddTask(TaskTypeEnum taskType, Dictionary<TaskParamsKey, string> parameters) { Logger.WriteInfo("AddTask " + taskType.ToString()); if (parameters != null && parameters.ContainsKey(TaskParamsKey.NextRunTime)) { BaseTask.AddNew(taskType, parameters, minStartDate: DateTime.Parse(parameters[TaskParamsKey.NextRunTime])); parameters.Remove(TaskParamsKey.NextRunTime); } else { BaseTask.AddNew(taskType, parameters); } }
private bool GetReportFromRequest(HttpRequest request, TaskTypeEnum taskTypeEnum, out ReportDTO reportReqDTO) { string errorMessage = null; reportReqDTO = null; APIRequestDTO requestDTO; try { if (!Library.GetDTOFromRequest(request, out requestDTO, taskTypeEnum.ToString(), ref errorMessage)) { Global.Log.Error(errorMessage); return(false); } reportReqDTO = (ReportDTO)requestDTO; Global.Log.DebugFormat("User ID: [{0}] reported Info for Task: [{1}]", reportReqDTO.UserID, reportReqDTO.TaskId); return(true); } catch (Exception ex) { Global.Log.Error(ex.Message); return(false); } }
public BaseTask CreateTask(TaskTypeEnum taskType) { _kernel.Rebind<IDatabaseFactory>().To<DatabaseFactory>().InSingletonScope(); switch (taskType) { case TaskTypeEnum.Notifications: return _kernel.Get<NotificationsTask>(); case TaskTypeEnum.AscGov: return _kernel.Get<AscGovTask>(); case TaskTypeEnum.HUDAppraiserLicense: return _kernel.Get<HUDAppraiserLicensesTask>(); case TaskTypeEnum.HUDAppraiserContactInfo: return _kernel.Get<HUDAppraiserContactInfoTask>(); case TaskTypeEnum.LicenseDailyUpdateByAscGov: return _kernel.Get<LicenseDailyUpdateByAscGov>(); case TaskTypeEnum.LicenseDailyUpdateByHUD: return _kernel.Get<LicenseDailyUpdateByHUD>(); case TaskTypeEnum.LicenseExpirationCheck: return _kernel.Get<LicenseExpirationCheck>(); case TaskTypeEnum.SendAppraiserOrderInvitationSMS: return _kernel.Get<SendAppraiserOrderInvitationSMS>(); case TaskTypeEnum.SendAppraiserOrderInvitationEmail: return _kernel.Get<SendAppraiserOrderInvitationEmail>(); case TaskTypeEnum.AssignmentAppraisersForOrder: return _kernel.Get<AssignmentAppraisersForOrder>(); case TaskTypeEnum.LOEGeneration: return _kernel.Get<LOEGenerationTask>(); case TaskTypeEnum.OrderPeriodicalNotification: return _kernel.Get<OrderPeriodicalNotificationTask>(); case TaskTypeEnum.AVMRequest: return _kernel.Get<AVMRequestTask>(); default: throw new NotSupportedException(taskType.ToString()); } }
/// <summary> /// Processes given object according to task type. /// It is expected that you use TranslateColumnsToExternal method before you process the task. /// The TranslateColumnsToExternal needs GetExternalObjectID and GetExternalDocumentID to be implemented. /// It traverses the given object and tries to translate foreign keys to match external (your) application. /// </summary> /// <param name="infoObj">Info object to process</param> /// <param name="translations">Translation helper object containing translations for given object</param> /// <param name="taskType">Type of task</param> /// <param name="dataType">Type of data</param> /// <param name="siteName">Name of site</param> /// <param name="errorMessage">Possible error message</param> /// <returns>Result of processing</returns> public override IntegrationProcessResultEnum ProcessInternalTaskAsync(GeneralizedInfo infoObj, TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName, out string errorMessage) { try { // If object is of 'user' type // You can also use following condition: (((BaseInfo)infoObj) is CMS.SiteProvider.UserInfo) if (infoObj.ObjectType == PredefinedObjectType.USER) { bool log = false; // Create simple message string message = "User with username '" + infoObj.ObjectCodeName + "' has been"; switch (taskType) { case TaskTypeEnum.CreateObject: log = true; message += " created."; break; case TaskTypeEnum.UpdateObject: log = true; message += " updated."; break; case TaskTypeEnum.DeleteObject: log = true; message += " deleted."; break; } if (log) { EventLogProvider eventLog = new EventLogProvider(); // Log the message eventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, ConnectorName, taskType.ToString(), 0, null, 0, null, null, message, 0, null); } } errorMessage = null; return(IntegrationProcessResultEnum.OK); } catch (Exception ex) { errorMessage = ex.Message; return(IntegrationProcessResultEnum.Error); } finally { // Clear translations cached during TranslateColumnsToExternal which internally calls GetExternalObjectID, GetExternalDocumentID // This call is optional but recommended in the case where eg. collision of code names can occur ClearInternalTranslations(); } }
/// <summary> /// Processes given document according to task type. /// It is expected that you use TranslateColumnsToExternal method before you process the task. /// The TranslateColumnsToExternal needs GetExternalObjectID and GetExternalDocumentID to be implemented. /// It traverses the given object and tries to translate foreign keys to match external (your) application. /// </summary> /// <param name="node">Document to process</param> /// <param name="translations">Translation helper object containing translations for given document</param> /// <param name="taskType">Type of task</param> /// <param name="dataType">Type of data</param> /// <param name="siteName">Name of site</param> /// <param name="errorMessage">Possible error message</param> /// <returns>Result of processing</returns> public override IntegrationProcessResultEnum ProcessInternalTaskAsync(TreeNode node, TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName, out string errorMessage) { try { bool log = false; // Create simple message string message = "Document named '" + node.NodeName + "' located at '" + node.NodeAliasPath + "' has been"; switch (taskType) { case TaskTypeEnum.CreateDocument: log = true; message += " created."; break; case TaskTypeEnum.UpdateDocument: log = true; message += " updated."; break; case TaskTypeEnum.DeleteDocument: log = true; message += " deleted."; break; } if (log) { EventLogProvider eventLog = new EventLogProvider(); // Log the message eventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, ConnectorName, taskType.ToString(), 0, null, node.NodeID, node.DocumentName, null, message, node.NodeSiteID, null); } errorMessage = null; return(IntegrationProcessResultEnum.OK); } catch (Exception ex) { errorMessage = ex.Message; return(IntegrationProcessResultEnum.Error); } finally { // Clear translations cached during TranslateColumnsToExternal which internally calls GetExternalObjectID, GetExternalDocumentID // This call is optional but recommended in the case where eg. collision of code names can occur ClearInternalTranslations(); } }
public void SendDataUpdateServiceFailureNotification(TaskTypeEnum taskTypeEnum) { string serviceName = string.Empty; string serviceFileName = string.Empty; switch (taskTypeEnum) { case TaskTypeEnum.AscGov: { serviceName = "ASC.GOV"; serviceFileName = "v_Export_All.txt"; break; } case TaskTypeEnum.HUDAppraiserContactInfo: { serviceName = "HUD.GOV"; serviceFileName = "APRSR-DATA.txt"; break; } case TaskTypeEnum.HUDAppraiserLicense: { serviceName = "HUD.GOV"; serviceFileName = "APRSR-LIC.txt"; break; } default: throw new ArgumentOutOfRangeException("Not supported type: " + taskTypeEnum.ToString()); } DateTime nextAttemptDateTime = DateTime.Now.Date.AddDays(1); Dictionary<string, string> replaceDictionary = new Dictionary<string, string>(); replaceDictionary.Add(Constants.EmailTemplateKeyWords.FailureFileName, serviceFileName); replaceDictionary.Add(Constants.EmailTemplateKeyWords.ServiceName, serviceName); replaceDictionary.Add(Constants.EmailTemplateKeyWords.NextAttemptDateTime, nextAttemptDateTime.ToString("MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture)); SendMailInternal(EmailTemplateType.DataUpdateFailureNotification, _configManager.DVSAdminEmails, replaceDictionary); }
/// <summary> /// Processes given document according to task type. /// It is expected that you use TranslateColumnsToExternal method before you process the task. /// The TranslateColumnsToExternal needs GetExternalObjectID and GetExternalDocumentID to be implemented. /// It traverses the given object and tries to translate foreign keys to match external (your) application. /// </summary> /// <param name="node">Document to process</param> /// <param name="translations">Translation helper object containing translations for given document</param> /// <param name="taskType">Type of task</param> /// <param name="dataType">Type of data</param> /// <param name="siteName">Name of site</param> /// <param name="errorMessage">Possible error message</param> /// <returns>Result of processing</returns> public override IntegrationProcessResultEnum ProcessInternalTaskAsync(TreeNode node, TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName, out string errorMessage) { try { bool log = false; // Create simple message string message = "Document named '" + node.NodeName + "' located at '" + node.NodeAliasPath + "' has been"; switch (taskType) { case TaskTypeEnum.CreateDocument: log = true; message += " created."; break; case TaskTypeEnum.UpdateDocument: log = true; message += " updated."; break; case TaskTypeEnum.DeleteDocument: log = true; message += " deleted."; break; } if (log) { EventLogProvider eventLog = new EventLogProvider(); // Log the message eventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, ConnectorName, taskType.ToString(), 0, null, node.NodeID, node.DocumentName, null, message, node.NodeSiteID, null); } errorMessage = null; return IntegrationProcessResultEnum.OK; } catch (Exception ex) { errorMessage = ex.Message; return IntegrationProcessResultEnum.Error; } finally { // Clear translations cached during TranslateColumnsToExternal which internally calls GetExternalObjectID, GetExternalDocumentID // This call is optional but recommended in the case where eg. collision of code names can occur ClearInternalTranslations(); } }
/// <summary> /// Processes given object according to task type. /// It is expected that you use TranslateColumnsToExternal method before you process the task. /// The TranslateColumnsToExternal needs GetExternalObjectID and GetExternalDocumentID to be implemented. /// It traverses the given object and tries to translate foreign keys to match external (your) application. /// </summary> /// <param name="infoObj">Info object to process</param> /// <param name="translations">Translation helper object containing translations for given object</param> /// <param name="taskType">Type of task</param> /// <param name="dataType">Type of data</param> /// <param name="siteName">Name of site</param> /// <param name="errorMessage">Possible error message</param> /// <returns>Result of processing</returns> public override IntegrationProcessResultEnum ProcessInternalTaskAsync(GeneralizedInfo infoObj, TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName, out string errorMessage) { try { // If object is of 'user' type // You can also use following condition: (((BaseInfo)infoObj) is CMS.SiteProvider.UserInfo) if (infoObj.ObjectType == PredefinedObjectType.USER) { bool log = false; // Create simple message string message = "User with username '" + infoObj.ObjectCodeName + "' has been"; switch (taskType) { case TaskTypeEnum.CreateObject: log = true; message += " created."; break; case TaskTypeEnum.UpdateObject: log = true; message += " updated."; break; case TaskTypeEnum.DeleteObject: log = true; message += " deleted."; break; } if (log) { EventLogProvider eventLog = new EventLogProvider(); // Log the message eventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, ConnectorName, taskType.ToString(), 0, null, 0, null, null, message, 0, null); } } errorMessage = null; return IntegrationProcessResultEnum.OK; } catch (Exception ex) { errorMessage = ex.Message; return IntegrationProcessResultEnum.Error; } finally { // Clear translations cached during TranslateColumnsToExternal which internally calls GetExternalObjectID, GetExternalDocumentID // This call is optional but recommended in the case where eg. collision of code names can occur ClearInternalTranslations(); } }