Example #1
0
 public void SetSchemeTags(string schemeCode, IEnumerable <string> tags)
 {
     using (var connection = new SqlConnection(ConnectionString))
     {
         WorkflowScheme.SetSchemeTags(connection, schemeCode, tags, _runtime.Builder);
     }
 }
Example #2
0
 public List <string> GetInlinedSchemeCodes()
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         return(WorkflowScheme.GetInlinedSchemeCodes(connection));
     }
 }
Example #3
0
 public void SaveScheme(string schemaCode, bool canBeInlined, List <string> inlinedSchemes, string scheme,
                        List <string> tags)
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         WorkflowScheme wfScheme = WorkflowScheme.SelectByKey(connection, schemaCode);
         if (wfScheme == null)
         {
             wfScheme = new WorkflowScheme
             {
                 Code           = schemaCode,
                 Scheme         = scheme,
                 CanBeInlined   = canBeInlined,
                 InlinedSchemes = inlinedSchemes.Any()
                     ? JsonConvert.SerializeObject(inlinedSchemes)
                     : null,
                 Tags = TagHelper.ToTagStringForDatabase(tags)
             };
             wfScheme.Insert(connection);
         }
         else
         {
             wfScheme.Scheme         = scheme;
             wfScheme.CanBeInlined   = canBeInlined;
             wfScheme.InlinedSchemes = inlinedSchemes.Any() ? JsonConvert.SerializeObject(inlinedSchemes) : null;
             wfScheme.Tags           = TagHelper.ToTagStringForDatabase(tags);
             wfScheme.Update(connection);
         }
     }
 }
Example #4
0
 public List <string> GetRelatedByInliningSchemeCodes(string schemeCode)
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         return(WorkflowScheme.GetRelatedSchemeCodes(connection, schemeCode));
     }
 }
Example #5
0
 public List <string> SearchSchemesByTags(IEnumerable <string> tags)
 {
     using (var connection = new SqlConnection(ConnectionString))
     {
         return(WorkflowScheme.GetSchemeCodesByTags(connection, tags));
     }
 }
Example #6
0
        public XElement GetScheme(string code)
        {
            var            dbcoll = Store.GetCollection <WorkflowScheme>(MongoDBConstants.WorkflowSchemeCollectionName);
            WorkflowScheme scheme = dbcoll.FindOne(Query <WorkflowScheme> .Where(c => c.Code == code));

            if (scheme == null || string.IsNullOrEmpty(scheme.Scheme))
            {
                throw new SchemeNotFoundException();
            }

            return(XElement.Parse(scheme.Scheme));
        }
        public XElement GetScheme(string code)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                WorkflowScheme scheme = WorkflowScheme.SelectByKey(connection, code);
                if (scheme == null || string.IsNullOrEmpty(scheme.Scheme))
                {
                    throw new SchemeNotFoundException();
                }

                return(XElement.Parse(scheme.Scheme));
            }
        }
Example #8
0
        public XElement GetScheme(string code)
        {
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                WorkflowScheme scheme = WorkflowScheme.SelectByKey(connection, code);
                if (scheme == null || string.IsNullOrEmpty(scheme.Scheme))
                {
                    throw SchemeNotFoundException.Create(code, SchemeLocation.WorkflowProcessScheme);
                }

                return(XElement.Parse(scheme.Scheme));
            }
        }
 public void SaveScheme(string schemaCode, string scheme)
 {
     using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString))
     {
         WorkflowScheme wfScheme = WorkflowScheme.SelectByKey(connection, schemaCode);
         if (wfScheme == null)
         {
             wfScheme        = new WorkflowScheme();
             wfScheme.Code   = schemaCode;
             wfScheme.Scheme = scheme;
             wfScheme.Insert(connection);
         }
         else
         {
             wfScheme.Scheme = scheme;
             wfScheme.Update(connection);
         }
     }
 }
Example #10
0
        public void SaveScheme(string schemaCode, string scheme)
        {
            var            dbcoll   = Store.GetCollection <WorkflowScheme>(MongoDBConstants.WorkflowSchemeCollectionName);
            WorkflowScheme wfScheme = dbcoll.FindOne(Query <WorkflowScheme> .Where(c => c.Code == schemaCode));

            if (wfScheme == null)
            {
                wfScheme        = new WorkflowScheme();
                wfScheme.Id     = schemaCode;
                wfScheme.Code   = schemaCode;
                wfScheme.Scheme = scheme;
                dbcoll.Insert(wfScheme);
            }
            else
            {
                wfScheme.Scheme = scheme;
                dbcoll.Save(wfScheme);
            }
        }
Example #11
0
        /// <summary>
        /// 将WorkflowScheme表中的Scheme的XML转换为XElement
        /// 将指定流程转换为XElement
        /// </summary>
        /// <param name="processName">流程名,如:SimpleWF</param>
        /// <param name="schemeId">没有用</param>
        /// <param name="parameters">没用用,但必须要有值</param>
        /// <returns></returns>
        public XElement Generate(string processName, Guid schemeId, IDictionary <string, IEnumerable <object> > parameters)
        {
            if (parameters.Count > 0)
            {
                throw new InvalidOperationException("Parameters not supported");
            }
            // 返回如:SimpleWF
            string         code           = (!this.TemplateTypeMapping.ContainsKey(processName.ToLower())) ? processName : this.TemplateTypeMapping[processName.ToLower()];
            WorkflowScheme workflowScheme = null;

            using (WorkflowPersistenceModelDataContext workflowPersistenceModelDataContext = base.CreateContext())
            {
                workflowScheme = workflowPersistenceModelDataContext.WorkflowSchemes.FirstOrDefault((WorkflowScheme ws) => ws.Code == code);
            }
            if (workflowScheme == null)
            {
                throw new InvalidOperationException(string.Format("Scheme with Code={0} not found", code));
            }
            return(XElement.Parse(workflowScheme.Scheme));
        }
        public void SaveScheme(string code, string scheme)
        {
            WorkflowScheme wfScheme;

            using (var context = CreateContext())
            {
                wfScheme = context.WorkflowSchemes.FirstOrDefault(ws => ws.Code == code);
                if (wfScheme == null)
                {
                    wfScheme        = new WorkflowScheme();
                    wfScheme.Code   = code;
                    wfScheme.Scheme = scheme;
                    context.WorkflowSchemes.InsertOnSubmit(wfScheme);
                }
                else
                {
                    wfScheme.Scheme = scheme;
                }
                context.SubmitChanges();
            }
        }
Example #13
0
        public XElement Generate(string schemeCode, Guid schemeId, IDictionary <string, object> parameters)
        {
            if (parameters.Count > 0)
            {
                throw new InvalidOperationException("Parameters not supported");
            }

            var            code   = !TemplateTypeMapping.ContainsKey(schemeCode.ToLower()) ? schemeCode : TemplateTypeMapping[schemeCode.ToLower()];
            WorkflowScheme scheme = null;

            using (var context = CreateContext())
            {
                scheme = context.WorkflowSchemes.FirstOrDefault(ws => ws.Code == code);
            }

            if (scheme == null)
            {
                throw new InvalidOperationException(string.Format("Scheme with Code={0} not found", code));
            }

            return(XElement.Parse(scheme.Scheme));
        }
        public XElement Generate(string processName, Guid schemeId, IDictionary <string, object> parameters)
        {
            if (parameters.Count > 0)
            {
                throw new InvalidOperationException("Parameters not supported");
            }

            var            code   = !TemplateTypeMapping.ContainsKey(processName.ToLower()) ? processName : TemplateTypeMapping[processName.ToLower()];
            WorkflowScheme scheme = null;

            using (var session = Store.OpenSession())
            {
                scheme = session.Load <WorkflowScheme>(code);
            }

            if (scheme == null)
            {
                throw new InvalidOperationException(string.Format("Scheme with Code={0} not found", code));
            }

            return(XElement.Parse(scheme.Scheme));
        }
Example #15
0
        public XElement Generate(string schemeCode, Guid schemeId, IDictionary <string, object> parameters)
        {
            if (parameters.Count > 0)
            {
                throw new InvalidOperationException("Parameters not supported");
            }

            var            code   = !TemplateTypeMapping.ContainsKey(schemeCode.ToLower()) ? schemeCode : TemplateTypeMapping[schemeCode.ToLower()];
            WorkflowScheme scheme = null;
            var            dbcoll = Store.GetCollection <WorkflowScheme>(MongoDBConstants.WorkflowSchemeCollectionName);

            {
                scheme = dbcoll.FindOne(Query <WorkflowScheme> .Where(c => c.Code == code));
            }

            if (scheme == null)
            {
                throw new InvalidOperationException(string.Format("Scheme with Code={0} not found", code));
            }

            return(XElement.Parse(scheme.Scheme));
        }
        public void SaveScheme(string schemeCode, string scheme)
        {
            using (var session = Store.OpenSession())
            {
                var wfscheme =
                    session.Query <WorkflowScheme>().Where(wps => wps.Code == schemeCode).FirstOrDefault();

                if (wfscheme == null)
                {
                    wfscheme = new WorkflowScheme()
                    {
                        Code   = schemeCode,
                        Scheme = scheme
                    };
                    session.Store(wfscheme);
                }
                else
                {
                    wfscheme.Scheme = scheme;
                }

                session.SaveChanges();
            }
        }
 partial void DeleteWorkflowScheme(WorkflowScheme instance);
 partial void UpdateWorkflowScheme(WorkflowScheme instance);
 partial void InsertWorkflowScheme(WorkflowScheme instance);