From 8ff1d0968ff3c4173b036398359ef62a356ad2b2 Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 26 Jun 2007 17:50:27 +0000 Subject: *Added support for reservations in OpenGridServices (mysql only for now) *SQL file coming soon (as soon as I can figure out how to get the --- .../OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs') diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs index d9a517d..4d6cf63 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs @@ -252,6 +252,33 @@ namespace OpenGrid.Framework.Data.MySQL return false; } + + public ReservationData GetReservationAtPoint(uint x, uint y) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?x"] = x.ToString(); + param["?y"] = y.ToString(); + System.Data.IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + ReservationData row = database.readReservationRow(reader); + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } } -- cgit v1.1