Example #1
0
        async Task <AdminDatasetQuery> UpdateDynamicDatasetQueryAsync(AdminDatasetQuery query)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var grid = await cn.QueryMultipleAsync(
                    Sql.UpdateDynamic,
                    new
                {
                    id           = query.Id,
                    name         = query.Name,
                    catid        = query.CategoryId,
                    desc         = query.Description,
                    sql          = query.SqlStatement,
                    isEnc        = query.IsEncounterBased,
                    schema       = DynamicDatasetSchemaFieldSerde.Serialize(query.Schema),
                    sqlDate      = query.SqlFieldDate,
                    sqlValString = query.SqlFieldValueString,
                    sqlValNum    = query.SqlFieldValueNumeric,
                    tags         = DatasetQueryTagTable.From(query.Tags),
                    constraints  = ResourceConstraintTable.From(query),
                    user         = user.UUID
                },
                    commandType : CommandType.StoredProcedure,
                    commandTimeout : opts.DefaultTimeout);

                var updated = DbReader.Read(grid);
                return(updated);
            }
        }
Example #2
0
        async Task <AdminDatasetQuery> UpdateShapedDatasetQueryAsync(AdminDatasetQuery query)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var grid = await cn.QueryMultipleAsync(
                    Sql.Update,
                    new
                {
                    id          = query.Id,
                    uid         = query.UniversalId?.ToString(),
                    shape       = query.Shape,
                    name        = query.Name,
                    catid       = query.CategoryId,
                    desc        = query.Description,
                    sql         = query.SqlStatement,
                    tags        = DatasetQueryTagTable.From(query.Tags),
                    constraints = ResourceConstraintTable.From(query),
                    user        = user.UUID
                },
                    commandType : CommandType.StoredProcedure,
                    commandTimeout : opts.DefaultTimeout);

                var updated = DbReader.Read(grid);
                return(updated);
            }
        }