Commit 7333c59e authored by Alexander Scharfenberg's avatar Alexander Scharfenberg
Browse files

changes to db and asset delete

parent 7c6ce7a4
......@@ -314,9 +314,12 @@ namespace Raumverwaltung_HMWK
{
var dynamicParameters = new DynamicParameters();
dynamicParameters.Add("id", building.BId);
//lösche erst alle Connections aus Room-User
string sql = "DELETE FROM Room_User WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.BuildingId=@id)";
//lösche alle Assets aus der Location
string sql = "DELETE FROM Asset WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.BuildingId=@id)";
cnn.Execute(sql, dynamicParameters);
//lösche alle Connections aus Room-User
string sql1 = "DELETE FROM Room_User WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.BuildingId=@id)";
cnn.Execute(sql1, dynamicParameters);
//lösche alle Räume aus allen Stockwerken
string sql2 = "DELETE FROM Room WHERE Id IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.BuildingId=@id)";
cnn.Execute(sql2, dynamicParameters);
......@@ -361,10 +364,12 @@ namespace Raumverwaltung_HMWK
{
var dynamicParameters = new DynamicParameters();
dynamicParameters.Add("floorId", floorId);
//lösche erst alle Connections aus Room-User
string sql = "Delete from Room_User WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.Id=@floorId)";
//lösche alle Assets aus der Location
string sql = "DELETE FROM Asset WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.Id=@floorId)";
cnn.Execute(sql, dynamicParameters);
//lösche alle Connections aus Room-User
string sql1 = "Delete from Room_User WHERE RId IN (SELECT r.Id FROM Room r JOIN Floor f on r.FloorId=f.Id WHERE f.Id=@floorId)";
cnn.Execute(sql1, dynamicParameters);
//lösche alle Räume aus dem Stockwerk
string sql2 = "Delete from Room where FloorId=@floorId";
cnn.Execute(sql2, dynamicParameters);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment