private static void Update(LayerData l, bool deep = false) { if (Query("Select * From MapLayer Where ID = " + l.ID).Rows.Count > 0) { NonQuery("Update MapLayer Set Name = '" + l.Name + "', Map = " + l.Map + ", [Order] = " + l.Order + " Where ID = " + l.ID); } else { NonQuery("INSERT INTO MapLayer (ID, Name, Map, [Order]) VALUES (" + l.ID + ",'" + l.Name + "', " + l.Map + ", " + l.Order + ")"); } if (deep) { foreach (TileData tile in l.Tiles) { Update(tile); } } }
public static void Delete(LayerData layer) { NonQuery("Delete From LayerTile Where Layer = " + layer.ID); NonQuery("Delete From MapLayer Where ID = " + layer.ID); }