示例#1
0
 public void DeleteGlobalParameters(string type, string name = null)
 {
     using (MySqlConnection connection = new MySqlConnection(ConnectionString))
     {
         WorkflowGlobalParameter.DeleteByTypeAndName(connection, type, name);
     }
 }
示例#2
0
        public void SaveGlobalParameter <T>(string type, string name, T value)
        {
            using (var connection = new MySqlConnection(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);
                }
            }
        }
示例#3
0
        public List <T> LoadGlobalParameters <T>(string type)
        {
            using (MySqlConnection connection = new MySqlConnection(ConnectionString))
            {
                var parameters = WorkflowGlobalParameter.SelectByTypeAndName(connection, type);

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

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

                return JsonSerializer.DeserializeFromString<T>(parameter.Value);
            }

        }
示例#5
0
        public T LoadGlobalParameter <T>(string type, string name)
        {
            using (MySqlConnection connection = new MySqlConnection(ConnectionString))
            {
                var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault();

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

                return(JsonConvert.DeserializeObject <T>(parameter.Value));
            }
        }