Exemplo n.º 1
0
        private void Save(FlowEngine flowEngine)
        {
            if (flowEngine.Attachment.Owner == -1)
            {
                throw new ArgumentException("Owner is null");
            }
            if (flowEngine.FlowState != FlowState.Finished)
            {
                FlowKey flowKey = new FlowKey()
                {
                    Owner = flowEngine.Attachment.Owner
                };
                if (!this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow.Add(flowKey, flowEngine);
                }
                else if (flowEngine.GetCurrent() == null)
                {
                    this.dicFlow.Remove(flowKey);
                }
                else if (this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow[flowKey] = flowEngine;
                }
            }
            string fileName = FlowManager.GetFlowFile(flowEngine.Attachment.Owner);

            FlowEngine.Save(fileName, flowEngine);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存模板
        /// </summary>
        /// <param name="template">模板名称</param>
        /// <param name="flowEngine">流程</param>
        /// <remarks>命名: TEMP_0001  TEMP_002</remarks>
        public void TemplateSave(string template, FlowEngine flowEngine)
        {
            string file      = this.GetTemplateFile(template);
            string directory = System.IO.Path.GetDirectoryName(file);

            if (!System.IO.Directory.Exists(directory))
            {
                System.IO.Directory.CreateDirectory(directory);
            }
            FlowEngine.Save(file, flowEngine);
        }