예제 #1
0
        public ActionResult Save(int id, FormCollection formCollection)
        {
            var taskInfo       = TheTaskInfoCollectionFactory.Parse(formCollection["taskInfo"]);
            var transitionInfo = TheTransitionInfoCollectionFactory.Parse(formCollection["transitionInfo"]);

            var ids = taskInfo.Tasks.Select(task => task.Id).ToList();


            ThePointService.DeletePoints(ids);
            TheWorkflowConfigService.RemoveTasks(id);
            TheWorkflowConfigService.RemoveTransitions(id);


            foreach (var task in taskInfo.Tasks)
            {
                var props = new Dictionary <string, object>
                {
                    { "Name", task.Name },
                    { "Id", new Guid(task.Id) },
                    { "Description", task.Description },
                    { "IsStartTask", task.IsStartTask },
                };

                foreach (var item in task.CustomProperties)
                {
                    props.Add(item.Key, item.Value);
                }

                ThePointService.AddPoint(task.Id, task.Top, task.Left);
                TheWorkflowConfigService.AddTask(id, task.AssemblyQualifiedTypeName, props);
            }

            foreach (var trans in transitionInfo.Transitions)
            {
                TheWorkflowConfigService.AddTransition(id, trans.Source, trans.Target, trans.Transition);
            }

            return(View("Close"));
        }
        protected void SaveButtonClick(object sender, EventArgs e)
        {
            var taskInfo       = TheTaskInfoCollectionFactory.Parse(Tasks.Value);
            var transitionInfo = TheTransitionInfoCollectionFactory.Parse(Transitions.Value);

            var ids = taskInfo.Tasks.Select(task => task.Id).ToList();

            ThePointService.DeletePoints(ids);
            TheWorkflowConfigService.RemoveTasks(_workflowId);
            TheWorkflowConfigService.RemoveTransitions(_workflowId);

            foreach (var task in taskInfo.Tasks)
            {
                var props = new Dictionary <string, object>
                {
                    { "Name", task.Name },
                    { "Id", new Guid(task.Id) },
                    { "Description", task.Description },
                    { "IsStartTask", task.IsStartTask },
                };

                foreach (var item in task.CustomProperties)
                {
                    props.Add(item.Key, item.Value);
                }

                ThePointService.AddPoint(task.Id, task.Top, task.Left);
                TheWorkflowConfigService.AddTask(_workflowId, task.AssemblyQualifiedTypeName, props);
            }

            foreach (var trans in transitionInfo.Transitions)
            {
                TheWorkflowConfigService.AddTransition(_workflowId, trans.Source, trans.Target, trans.Transition);
            }

            CloseWindowLiteral.Visible = true;
        }