Exemplo n.º 1
0
        public async Task <JsonResult> ListDocuments(DTParameters param)
        {
            var list = _documentService.GetAllDocument(param);

            var listDocument = list.Data;

            if (listDocument != null && listDocument.Any())
            {
                foreach (var document in listDocument)
                {
                    if (document.DocumentCategory.Code == 1)
                    {
                        var workFlow = (await _workFlowExecutorService.GetEntryStatesAsync(document.LastVersionId.ToString()))
                                       .Result.FirstOrDefault()?.Contract?.WorkFlowId;
                        if (workFlow != null)
                        {
                            document.CurrentStateName = (await _workFlowExecutorService.GetEntryStateAsync(document.LastVersionId.ToString(),
                                                                                                           workFlow)).Result.State.Name;
                            document.ListNextState = (await _workFlowExecutorService.GetNextStatesForEntryAsync(
                                                          document.LastVersionId.ToString(), workFlow)).Result.ToList();
                        }
                    }
                }
            }

            return(Json(list, SerializerSettings));
        }
 public async Task <JsonResult> GetEntryStates([Required] string entryId)
 => await JsonAsync(_workFlowExecutorService.GetEntryStatesAsync(entryId));