Ejemplo n.º 1
0
        public ActionResult WorkFlow(int taskId = 0)
        {
            var taskList = _workFlowService.GetTaskList();

            var actkiveTask = taskList.SingleOrDefault(x => x.Id == taskId);
            var mainProcess = _workFlowService.GetMainProcessList(taskId);

            var nextProcessList = _workFlowService.GetProcessList(taskId).Select(x => new NextProcess
            {
                MainProcessList = (mainProcess != null ? new SelectList(mainProcess, "Id", "Name") : null),
                Process         = x
            });

            WorkFlowViewModel workFlowViewModel = null;

            if (nextProcessList.Count() > 0)
            {
                workFlowViewModel = new WorkFlowViewModel
                {
                    ActiveTaskId    = taskId,
                    FirstProcessId  = (actkiveTask.StartingProcessId != null ? (int)actkiveTask.StartingProcessId : 0),
                    NextProcessList = nextProcessList
                };
            }
            else
            {
                workFlowViewModel = new WorkFlowViewModel
                {
                    ActiveTaskId    = taskId,
                    NextProcessList = null
                };
            }


            return(PartialView("_WorkFlowWorkbench", workFlowViewModel));
        }