예제 #1
0
        private async Task <TaskResult> CreateOrderTaskActionAsync(int orderId, int taskId, int orderLineItemId)
        {
            if (await TaskRepository.AnyTaskActionAsync(taskId, orderLineItemId, TaskActionName))
            {
                return(new TaskResult
                {
                    ResultStatus = SmsTaskStatus.Success,
                    Message =
                        $"Order {orderId} LineItem {taskId}:{orderLineItemId} Task created before, do not need create it this time"
                });
            }

            var taskActionId = await TaskRepository.InsertTaskActionAsync(new OrderTaskAction
            {
                OrderId         = orderId,
                OrderTaskId     = taskId,
                OrderLineItemId = orderLineItemId,
                ActionName      = TaskActionName,
                InitData        = orderLineItemId.ToString(),
                Status          = SmsTaskStatus.New.ToString(),
                CreatedBy       = LogUserName,
                CreatedTime     = DateTime.Now,
                LastUpdatedBy   = LogUserName,
                LastUpdatedTime = DateTime.Now,
                ActionPath      = string.Empty
            });

            return(new TaskResult
            {
                ResultStatus = SmsTaskStatus.Success,
                Message = $"Order LineItem {orderId}:{orderLineItemId} {TaskActionName} Created:{taskActionId}"
            });
        }