Пример #1
0
 public void SaveScheme(string schemaCode, bool canBeInlined, List <string> inlinedSchemes, string scheme)
 {
     using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString))
     {
         var wfScheme = WorkflowScheme.SelectByKey(connection, schemaCode);
         if (wfScheme == null)
         {
             wfScheme = new WorkflowScheme
             {
                 Code           = schemaCode,
                 Scheme         = scheme,
                 CanBeInlined   = canBeInlined,
                 InlinedSchemes = inlinedSchemes.Any() ? JsonConvert.SerializeObject(inlinedSchemes) : null
             };
             wfScheme.Insert(connection);
         }
         else
         {
             wfScheme.Scheme         = scheme;
             wfScheme.CanBeInlined   = canBeInlined;
             wfScheme.InlinedSchemes = inlinedSchemes.Any() ? JsonConvert.SerializeObject(inlinedSchemes) : null;
             wfScheme.Update(connection);
         }
     }
 }
Пример #2
0
        public XElement GetScheme(string code)
        {
            using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString))
            {
                var 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);
         }
     }
 }