public async Task <IActionResult> Get([FromQuery] PagingRequestModel model)
        {
            var accountMicroService       = new AccountMicroService(_AppConfig.APIGatewayServer);
            var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer);

            var toDTO = new Func <WorkFlow, Task <WorkFlowDTO> >(async(entity) =>
            {
                var dto          = new WorkFlowDTO();
                dto.Id           = entity.Id;
                dto.Name         = entity.Name;
                dto.Description  = entity.Description;
                dto.Creator      = entity.Creator;
                dto.Modifier     = entity.Modifier;
                dto.CreatedTime  = entity.CreatedTime;
                dto.ModifiedTime = entity.ModifiedTime;

                await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) =>
                {
                    dto.CreatorName  = creatorName;
                    dto.ModifierName = modifierName;
                });
                return(await Task.FromResult(dto));
            });

            return(await _PagingRequest(model, toDTO));
        }
        public override async Task <IActionResult> Get(string id)
        {
            var accountMicroService       = new AccountMicroService(_AppConfig.APIGatewayServer);
            var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer);

            var toDTO = new Func <WorkFlow, Task <WorkFlowDTO> >(async(entity) =>
            {
                var dto          = new WorkFlowDTO();
                dto.Id           = entity.Id;
                dto.Name         = entity.Name;
                dto.Description  = entity.Description;
                dto.Creator      = entity.Creator;
                dto.Modifier     = entity.Modifier;
                dto.CreatedTime  = entity.CreatedTime;
                dto.ModifiedTime = entity.ModifiedTime;
                dto.ApplyOrgans  = entity.ApplyOrgans;
                var wfItems      = new List <WorkFlowItemDTO>();
                if (entity.WorkFlowItems != null && entity.WorkFlowItems.Count > 0)
                {
                    foreach (var it in entity.WorkFlowItems)
                    {
                        var wfitem           = new WorkFlowItemDTO();
                        wfitem.Id            = it.Id;
                        wfitem.Name          = it.Name;
                        wfitem.Description   = it.Description;
                        wfitem.CreatedTime   = it.CreatedTime;
                        wfitem.Creator       = it.Creator;
                        wfitem.ModifiedTime  = it.ModifiedTime;
                        wfitem.Modifier      = it.Modifier;
                        wfitem.FlowGrade     = it.FlowGrade;
                        wfitem.OperateRoles  = it.OperateRoles;
                        wfitem.SubWorkFlowId = it.SubWorkFlowId;
                        wfitem.AutoWorkFlow  = it.AutoWorkFlow;
                        wfItems.Add(wfitem);
                    }
                }
                dto.WorkFlowItems = wfItems.OrderBy(x => x.FlowGrade).ToList();

                await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) =>
                {
                    dto.CreatorName  = creatorName;
                    dto.ModifierName = modifierName;
                });

                return(await Task.FromResult(dto));
            });

            return(await _GetByIdRequest(id, toDTO));
        }
Ejemplo n.º 3
0
        public void SetWorkFlowTraceForm(WorkFlowFormViewModel workFlowFormVM, WorkFlowDTO workFlowBase)
        {
            workFlowFormVM.ProgressProcessList        = workFlowBase.ProgressProcessList;
            workFlowFormVM.TargetProcessListForCancel = workFlowBase.TargetProcessListForCancel;
            workFlowFormVM.AuthorizedProcessList      = workFlowBase.AuthorizedProcessList;

            if (workFlowFormVM.IsCondition)
            {
                workFlowFormVM.ListOfOptions =
                    _workFlowDataService
                    .GetWorkFlowProcessList(workFlowFormVM.ProcessTaskId)
                    .Where(x => x.ConditionId == workFlowFormVM.ProcessId)
                    .ToList();
            }
        }