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 async Task <ImportMetadata> UpdateImportMetadataAsync(ImportMetadata metadata) { using (var cn = new SqlConnection(dbOptions.ConnectionString)) { var grid = await cn.QueryMultipleAsync( Sql.UpdateImportMetadata, new { id = metadata.Id, sourceId = metadata.SourceId, type = metadata.Type, structure = metadata.StructureJson, constraints = ResourceConstraintTable.From(metadata), user = user.UUID, groups = GroupMembership.From(user), admin = user.IsAdmin }, commandType : CommandType.StoredProcedure, commandTimeout : dbOptions.DefaultTimeout ); var updated = DbReader.Read(grid); return(updated); } }
public async Task <AdminConcept> UpdateAsync(AdminConcept c) { using (var cn = new SqlConnection(opts.ConnectionString)) { await cn.OpenAsync(); var grid = await cn.QueryMultipleAsync( Sql.Update, new { id = c.Id, universalId = c.UniversalId?.ToString(), parentId = c.ParentId, rootId = c.RootId, externalId = c.ExternalId, externalParentId = c.ExternalParentId, isPatientCountAutoCalculated = c.IsPatientCountAutoCalculated, isNumeric = c.IsNumeric, isParent = c.IsParent, isRoot = c.IsRoot, isSpecializable = c.IsSpecializable, sqlSetId = c.SqlSetId, sqlSetWhere = c.SqlSetWhere, sqlFieldNumeric = c.SqlFieldNumeric, uiDisplayName = c.UiDisplayName, uiDisplayText = c.UiDisplayText, uiDisplaySubtext = c.UiDisplaySubtext, uiDisplayUnits = c.UiDisplayUnits, uiDisplayTooltip = c.UiDisplayTooltip, uiDisplayPatientCount = c.UiDisplayPatientCount, uiNumericDefaultText = c.UiNumericDefaultText, constraints = ResourceConstraintTable.From(c), specializationGroups = ConceptSpecializationGroupTable.From(c), user = user.UUID }, commandType : CommandType.StoredProcedure, commandTimeout : opts.DefaultTimeout ); return(AdminConceptReader.Read(grid)); } }
public async Task <ImportMetadata> CreateImportMetadataAsync(ImportMetadata metadata) { using (var cn = new SqlConnection(dbOptions.ConnectionString)) { var grid = await cn.QueryMultipleAsync( Sql.CreateImportMetadata, new { sourceId = metadata.SourceId, type = metadata.Type, structure = metadata.StructureJson, constraints = ResourceConstraintTable.From(metadata), user = user.UUID }, commandType : CommandType.StoredProcedure, commandTimeout : dbOptions.DefaultTimeout ); var created = DbReader.Read(grid); return(created); } }