コード例 #1
0
        public ActionResult Index(int id)
        {
            var workflowConfig = TheWorkflowConfigService.GetConfiguration(id);

            var taskTypes = TheHelper.TypesImplementingInterface(typeof(IWorkflowTask));
            var tasks     = taskTypes.Select(taskType => TheWorkflowTaskFactory.CreateTask(taskType)).ToList();

            var adapter = new WorkflowTaskCollectionUiAdapter(tasks);


            var ids    = workflowConfig.Tasks.Select(task => task.Id.ToString()).ToList();
            var points = ThePointCollectionFactory.Create(ThePointService.GetPoints(ids));

            var instanceTasks = TheUiWorkflowTaskCollectionFactory.Create(workflowConfig.Tasks, points);

            var view = new WorkflowDesignViewModel
            {
                Id                 = id,
                GuidsJson          = TheHelper.JsSerializer.Serialize(TheGuidPool.CreateGuids(500)),
                TaskInfoJson       = TheHelper.JsSerializer.Serialize(adapter),
                AvailableTasks     = adapter.Tasks.Values,
                ConfigurationTasks = instanceTasks.UiTasks.Values,
                ConfigJson         = TheHelper.JsSerializer.Serialize(instanceTasks)
            };

            return(View(view));
        }
コード例 #2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var workflowConfig = TheWorkflowConfigService.GetConfiguration(_workflowId);

            var ids    = workflowConfig.Tasks.Select(task => task.Id.ToString()).ToList();
            var points = ThePointCollectionFactory.Create(ThePointService.GetPoints(ids));

            var tasks = TheUiWorkflowTaskCollectionFactory.Create(workflowConfig.Tasks, points);

            WorkflowConfigLiteral.Text = TheHelper.JsSerializer.Serialize(tasks);

            TaskInstanceRepeater.DataSource = tasks.UiTasks.Values;
            TaskInstanceRepeater.DataBind();

            TaskMessageLiteral.Visible = (tasks.UiTasks.Values.Count == 0);
        }