public TaskExecutionMessage Execute(TaskExecutionPayload payloadObj) { IEntityQueryManager entityQueryManager = new EntityQueryManager(); var draftId = entityQueryManager.GetSpecificIdByQuery(payloadObj.TenantId, "Product", payloadObj.Id, "DraftVersion"); var executionMessage = new TaskExecutionMessage(); if (draftId != null) { executionMessage.Message = TaskExecutionCode.AlreadyAdded; return(executionMessage); } var versionId = entityQueryManager.GetSpecificIdByQuery(payloadObj.TenantId, "Product", payloadObj.Id, "ActiveVersion"); var cloneId = entityQueryManager.SelectInsert("ProductVersion", payloadObj.TenantId, versionId, Guid.Empty); if (cloneId != Guid.Empty) { var updateStatus = entityQueryManager.UpdateSpecificField(payloadObj.TenantId, "Product", payloadObj.Id, "DraftVersion", cloneId.ToString()); executionMessage.Message = TaskExecutionCode.Redirect; executionMessage.Id = cloneId; return(executionMessage); } return(null); }
public TaskExecutionMessage Execute(TaskExecutionPayload payloadObj) { IManagerBatchItem batchItem = new ManagerBatchItem(); var status = batchItem.BatchItemUpdateNextRunTime(payloadObj.TenantId, payloadObj.Id); var executionMessage = new TaskExecutionMessage(); executionMessage.Message = TaskExecutionCode.Success; return(executionMessage); }
//need to create a layer from this portion.... TaskExecutionMessage ITaskManager.ExecuteTaskById(Guid tenantId, Guid entityId, string entityName, Guid userId, string taskName, JObject payload) { var taskEngine = new TaskEngine(); var executionPayload = new TaskExecutionPayload { Payload = payload, TenantId = tenantId, Id = entityId, EntityName = entityName, UserId = userId }; var value = taskEngine.GetValue(taskName, executionPayload); return(value); }
public TaskExecutionMessage GetValue(string className, TaskExecutionPayload payload) { var type = GetType(className); if (type == null) { throw new FieldAccessException(className + "not found"); } var myObject = Activator.CreateInstance(type); MethodInfo executeMethod = type.GetMethod("Execute"); if (executeMethod == null) { throw new FieldAccessException(className + "not found"); } var result = (TaskExecutionMessage)executeMethod.Invoke(myObject, new object[] { payload }); return(result); }