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); } }
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); } }
public static AdminDatasetQueryDTO AdminDatasetQueryDTO(this AdminDatasetQuery q) { if (q == null) { return(null); } return(new AdminDatasetQueryDTO { Id = q.Id, UniversalId = q.UniversalId?.ToString(), Shape = q.Shape, Name = q.Name, CategoryId = q.CategoryId, Description = q.Description, SqlStatement = q.SqlStatement, IsEncounterBased = q.IsEncounterBased, SqlFieldDate = q.SqlFieldDate, SqlFieldValueString = q.SqlFieldValueString, SqlFieldValueNumeric = q.SqlFieldValueNumeric, Schema = q.Schema, Created = q.Created, CreatedBy = q.CreatedBy, Updated = q.Updated, UpdatedBy = q.UpdatedBy, Tags = q.Tags, Constraints = q.Constraints }); }
public async Task <AdminDatasetQuery> UpdateDatasetQueryAsync(AdminDatasetQuery query) { if (query.Shape == Shape.Dynamic) { return(await UpdateDynamicDatasetQueryAsync(query)); } return(await UpdateShapedDatasetQueryAsync(query)); }
public static AdminDatasetQueryDTO AdminDatasetQueryDTO(this AdminDatasetQuery q) { if (q == null) { return(null); } return(new AdminDatasetQueryDTO { Id = q.Id, UniversalId = q.UniversalId?.ToString(), Shape = q.Shape, Name = q.Name, CategoryId = q.CategoryId, Description = q.Description, SqlStatement = q.SqlStatement, Created = q.Created, CreatedBy = q.CreatedBy, Updated = q.Updated, UpdatedBy = q.UpdatedBy, Tags = q.Tags, Constraints = q.Constraints }); }