[DataEventHandler(tableStr(UserInfo), DataEventType::Updating)] public static void UserInfo_onUpdating(Common sender, DataEventArgs e) { BatchJob batch; UserInfo ui; str adminUserId = "Admin"; Common newRecord = sender; Common oldRecord = sender.orig(); ui = newRecord; int tableId = tableName2Id("UserInfo"); int enableFieldId = fieldName2Id(tableId, "enable"); if(newRecord.(enableFieldId) != oldRecord.(enableFieldId)) { if(ui.enable != true) { while select forupdate batch where batch.ExecutingBy == ui.id { ttsbegin; batch.ExecutingBy = adminUserId; batch.update(); ttscommit; } } } } [DataEventHandler(tableStr(UserInfo), DataEventType::Deleting)] public static void UserInfo_onDeleting(Common sender, DataEventArgs e) { BatchJob batch; UserInfo ui = sender; str adminUserId = "Admin"; while select forupdate batch where batch.ExecutingBy == ui.id { ttsbegin; batch.ExecutingBy = adminUserId; batch.update(); ttscommit; } }