| | |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | db.Deleteable<Entity.BimfaceFileRelationLabel>().Where(x => x.RelationID == ID).ExecuteCommandHasChange(); |
| | | if (db.IsExistTable<Entity.BimfaceFileRelationLabel>()) |
| | | { |
| | | db.Deleteable<Entity.BimfaceFileRelationLabel>().Where(x => x.RelationID == ID).ExecuteCommandHasChange(); |
| | | } |
| | | db.CommitTran(); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除所有 |
| | | /// 删除自身 |
| | | /// 删除标签 |
| | | /// 删除BimfaceFile |
| | | /// 删除模型关联信息 |
| | | /// </summary> |
| | | public bool DeleteAll(long ID, long BimfaceFileID) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | //删除 Relation |
| | | var bol = db.Deleteable<Entity.BimfaceFileRelation>().Where(x => x.ID == ID).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | //删除 Relation 标签 |
| | | if (db.IsExistTable<Entity.BimfaceFileRelationLabel>()) |
| | | { |
| | | db.Deleteable<Entity.BimfaceFileRelationLabel>().Where(x => x.RelationID == ID).ExecuteCommandHasChange(); |
| | | } |
| | | //删除模型文件 |
| | | bol = db.Deleteable<Entity.BimfaceFile>().Where(x => x.ID == BimfaceFileID).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | //删除模型文件标签 |
| | | if (db.IsExistTable<Entity.BimfaceFileLabel>()) |
| | | { |
| | | db.Deleteable<Entity.BimfaceFileLabel>().Where(x => x.BimfaceFileID == BimfaceFileID).ExecuteCommandHasChange(); |
| | | } |
| | | |
| | | db.CommitTran(); |
| | | return true; |
| | | } |
| | | catch |
| | | { |
| | | db.RollbackTran(); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |