public void DeleteGlobalParameters(string type, string name = null)
 {
     using (OracleConnection connection = new OracleConnection(ConnectionString))
     {
         WorkflowGlobalParameter.DeleteByTypeAndName(connection, type, name);
     }
 }
Beispiel #2
0
        public void SaveGlobalParameter <T>(string type, string name, T value)
        {
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault();

                if (parameter == null)
                {
                    parameter = new WorkflowGlobalParameter()
                    {
                        Id    = Guid.NewGuid(),
                        Type  = type,
                        Name  = name,
                        Value = JsonConvert.SerializeObject(value)
                    };

                    parameter.Insert(connection);
                }
                else
                {
                    parameter.Value = JsonConvert.SerializeObject(value);

                    parameter.Update(connection);
                }
            }
        }
        public List <T> LoadGlobalParameters <T>(string type)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                var parameters = WorkflowGlobalParameter.SelectByTypeAndName(connection, type);

                return(parameters.Select(p => JsonSerializer.DeserializeFromString <T>(p.Value)).ToList());
            }
        }
Beispiel #4
0
        public List <T> LoadGlobalParameters <T>(string type)
        {
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                var parameters = WorkflowGlobalParameter.SelectByTypeAndName(connection, type);

                return(parameters.Select(p => JsonConvert.DeserializeObject <T>(p.Value)).ToList());
            }
        }
        public T LoadGlobalParameter <T>(string type, string name)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault();

                if (parameter == null)
                {
                    return(default(T));
                }

                return(JsonSerializer.DeserializeFromString <T>(parameter.Value));
            }
        }
Beispiel #6
0
        public void SaveGlobalParameter <T>(string type, string name, T value)
        {
            using (var context = CreateContext())
            {
                var parameter = context.WorkflowGlobalParameters.FirstOrDefault(p => p.Type == type && p.Name == name);

                if (parameter == null)
                {
                    parameter = new WorkflowGlobalParameter
                    {
                        Id   = Guid.NewGuid(),
                        Type = type,
                        Name = name
                    };

                    context.WorkflowGlobalParameters.InsertOnSubmit(parameter);
                }

                parameter.Value = JsonSerializer.SerializeToString(value);

                context.SubmitChanges();
            }
        }
 partial void DeleteWorkflowGlobalParameter(WorkflowGlobalParameter instance);
 partial void InsertWorkflowGlobalParameter(WorkflowGlobalParameter instance);