public static void Delete(int group_id) { if (!CanDelete(group_id)) { throw new AccessDeniedException(); } int IMGroupId = -1; using (IDataReader reader = DBGroup.GetGroup(group_id)) { if (reader.Read()) { if (reader["IMGroupId"] != DBNull.Value) { IMGroupId = (int)reader["IMGroupId"]; } } } using (DbTransaction tran = DbTransaction.Begin()) { DBGroup.Delete(group_id); if (IMGroupId > 0) { IMGroup.Delete(IMGroupId); } tran.Commit(); } }