Ask yourself a quick question; if there are two records containing the same data should it matter which one is updated?
If you have two records with essentially the same room data:
---------------------------------------------------
hotel1 | NY | 2 | N | 100| 2008/08/08 | |
---------------------------------------------------
hotel1 | NY | 2 | N | 100| 2008/08/08 | |
You can assume that the hotel has two rooms and they are capable of being reserved by two different clients.
As far as your program is concerned the only difference between the two rooms is the position in the data file. It doesn't contain any information about the room number, whether there's a balcony or if it overlooks the beach or the carpark. The hotel deals with that side of things, the program doesn't have to.
Once you've booked one (it doesn't matter which) you have two unique rooms their difference coming from the booking customer ID.
Provided your data view in the client is a separate from the order of the records in the data file, it doesn't really matter which record you choose to update.
If you have two customers booking the same room at the same time you will need to make sure that the second doesn't overwrite the first (e.g. find all of the matching records and loop through them until you get a lock on one).
I'm going off on a tangent now, but there is another edge case to consider:
Say you have I identical rooms (where I > 1) of which J are booked (where J < I) and K are not (where K = I - K).
If you have L customers who had booked one of these rooms call up to cancel at the same time that M call up to book one. What happens if M > K but M < K + L?
In the best case, enough cancellations will go through that all of the new bookings succeed (and we may even have some left over) before we run out of rooms.
In the worst case all of the booking requests will go through before any of the cancellations. In the latter case you will have a number of users see that their book request failed because there weren't enough rooms, although the refreshed data (if you are refreshing ;) may well show that there are plenty of rooms available. In this case, the users can just resubmit the book request and the customers have a booked room and are happy.
If there weren't enough cancellations some unlucky customers are still going to be left without a room
[ March 10, 2008: Message edited by: Simon Hogg ]