public string DeleteChanges(EntityRecord entityRecord, IDictionary<string, object> existingRecord) { var display = entityRecord.ToString(); var joinedKeyValue = "#" + entityRecord.JoinedKeysValues; if (display != joinedKeyValue) { display += " ({0})".Fill(joinedKeyValue); } return "Deleted " + display; }
public string CreateChanges(EntityRecord entityRecord) { var display = entityRecord.ToString(); var joinedKeyValue = "#" + entityRecord.JoinedKeysValues; if (display != joinedKeyValue) { display += " ({0})".Fill(joinedKeyValue); } return "Created " + display; }
public string DeleteChanges(EntityRecord entityRecord, IDictionary <string, object> existingRecord) { var display = entityRecord.ToString(); var joinedKeyValue = "#" + entityRecord.JoinedKeysValues; if (display != joinedKeyValue) { display += " ({0})".Fill(joinedKeyValue); } return("Deleted " + display); }
public string CreateChanges(EntityRecord entityRecord) { var display = entityRecord.ToString(); var joinedKeyValue = "#" + entityRecord.JoinedKeysValues; if (display != joinedKeyValue) { display += " ({0})".Fill(joinedKeyValue); } return("Created " + display); }
private void AccessDenied(AccessType accessType, EntityRecord record, EntityMemberInfo member = null) { if (!MustThrowOnDenied(accessType)) { return; } var msg = StringHelper.SafeFormat("Actions(s) [{0}] denied for record {1}, user {2}", accessType, record.ToString(), Context.User); if (member != null) { msg += "(Property " + member.MemberName + ")"; } var authEx = new AuthorizationException(msg, record.EntityInfo.EntityType, accessType, true, record.UserPermissions, this); throw authEx; }
private DbCommand CreateChangeCommand( EntityRecord entityRecord, EntityChangeType changeType, string keyValue, Func <string> changeDescriber = null) { if (changeType == EntityChangeType.Insert) { entityRecord.SetKeyValue(keyValue); } var cmd = DB.CreateCommand(_admin.ConnectionStringName); var changeEntity = _admin.ChangeEntity; var table = changeEntity.Table; var entityNameColumn = changeEntity["EntityName"].Column; var entityKeyColumn = changeEntity["EntityKey"].Column; var changeTypeColumn = changeEntity["ChangeType"].Column; var recordDisplayColumn = changeEntity["RecordDisplayName"].Column; var descriptionColumn = changeEntity["Description"].Column; var changedOnColumn = changeEntity["ChangedOn"].Column; var changedByColumn = changeEntity["ChangedBy"].Column; var sql = $@"INSERT INTO {table} ({entityNameColumn}, {entityKeyColumn}, {changeTypeColumn}, {recordDisplayColumn}, {descriptionColumn}, {changedOnColumn}, {changedByColumn}) VALUES (@0,@1,@2,@3,@4,@5,@6);"; cmd.AddParam(entityRecord.Entity.Name); cmd.AddParam(keyValue); cmd.AddParam(changeType); cmd.AddParam(entityRecord.ToString()); cmd.AddParam(changeDescriber == null ? null : changeDescriber()); cmd.AddParam(DateTime.UtcNow); cmd.AddParam(_user.CurrentUserName()); cmd.CommandText = sql; return(cmd); }
private DbCommand CreateChangeCommand( EntityRecord entityRecord, EntityChangeType changeType, string keyValue, Func<string> changeDescriber = null) { if(changeType == EntityChangeType.Insert) { entityRecord.SetKeyValue(keyValue); } var cmd = DB.CreateCommand(_admin.ConnectionStringName); var changeEntity = _admin.ChangeEntity; var table = changeEntity.Table; var entityNameColumn = changeEntity["EntityName"].Column; var entityKeyColumn = changeEntity["EntityKey"].Column; var changeTypeColumn = changeEntity["ChangeType"].Column; var recordDisplayColumn = changeEntity["RecordDisplayName"].Column; var descriptionColumn = changeEntity["Description"].Column; var changedOnColumn = changeEntity["ChangedOn"].Column; var changedByColumn = changeEntity["ChangedBy"].Column; var sql = $@"INSERT INTO {table} ({entityNameColumn}, {entityKeyColumn}, {changeTypeColumn}, {recordDisplayColumn}, {descriptionColumn}, {changedOnColumn}, {changedByColumn}) VALUES (@0,@1,@2,@3,@4,@5,@6);"; cmd.AddParam(entityRecord.Entity.Name); cmd.AddParam(keyValue); cmd.AddParam(changeType); cmd.AddParam(entityRecord.ToString()); cmd.AddParam(changeDescriber == null ? null : changeDescriber()); cmd.AddParam(DateTime.UtcNow); cmd.AddParam(_user.CurrentUserName()); cmd.CommandText = sql; return cmd; }