Ejemplo n.º 1
0
        public void SaveScheme(string schemeCode, Guid schemeId, XElement scheme, IDictionary <string, object> parameters)
        {
            var definingParameters     = SerializeParameters(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                var oldSchemes = WorkflowProcessScheme.Select(connection, schemeCode, definingParametersHash, true);
                if (oldSchemes.Count() > 0)
                {
                    foreach (var oldScheme in oldSchemes)
                    {
                        if (oldScheme.DefiningParameters == definingParameters)
                        {
                            throw new SchemeAlredyExistsException();
                        }
                    }
                }

                var newProcessScheme = new WorkflowProcessScheme
                {
                    Id = schemeId,
                    DefiningParameters     = definingParameters,
                    DefiningParametersHash = definingParametersHash,
                    Scheme     = scheme.ToString(),
                    SchemeCode = schemeCode
                };

                newProcessScheme.Insert(connection);
                WorkflowProcessScheme.Commit(connection);
            }
        }
Ejemplo n.º 2
0
 public void SetSchemeIsObsolete(string schemeCode)
 {
     using (OracleConnection connection = new OracleConnection(ConnectionString))
     {
         WorkflowProcessScheme.SetObsolete(connection, schemeCode);
         WorkflowProcessScheme.Commit(connection);
     }
 }
Ejemplo n.º 3
0
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = SerializeParameters(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                WorkflowProcessScheme.SetObsolete(connection, schemeCode, definingParametersHash);
                WorkflowProcessScheme.Commit(connection);
            }
        }
Ejemplo n.º 4
0
        public void SaveScheme(SchemeDefinition <XElement> scheme)
        {
            var definingParameters     = scheme.DefiningParameters;
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                var oldSchemes = WorkflowProcessScheme.Select(connection, scheme.SchemeCode, scheme.DefiningParameters,
                                                              scheme.IsObsolete, scheme.RootSchemeId);

                if (oldSchemes.Any())
                {
                    foreach (var oldScheme in oldSchemes)
                    {
                        if (oldScheme.DefiningParameters == definingParameters)
                        {
                            throw new SchemeAlredyExistsException();
                        }
                    }
                }

                var newProcessScheme = new WorkflowProcessScheme
                {
                    Id = scheme.Id,
                    DefiningParameters     = definingParameters,
                    DefiningParametersHash = definingParametersHash,
                    Scheme             = scheme.Scheme.ToString(),
                    SchemeCode         = scheme.SchemeCode,
                    RootSchemeCode     = scheme.RootSchemeCode,
                    RootSchemeId       = scheme.RootSchemeId,
                    AllowedActivities  = JsonSerializer.SerializeToString(scheme.AllowedActivities),
                    StartingTransition = scheme.StartingTransition
                };

                newProcessScheme.Insert(connection);
                WorkflowProcessScheme.Commit(connection);
            }
        }