C# .NET - problem - Asked By Priyanka on 01-Sep-10 04:42 AM

 I am making software for hotel but i am in some problem....the problem is how can it be recognized that room is booked or not ...
for example when the user select room no if it is booked it will show msg box that room is booked ..
plz give me some idea how it can be done.......
Anand Malli replied to Priyanka on 01-Sep-10 04:45 AM
Hi Dvarkin,

you database or rather table in database needs one flag which will decide this room is booked,so on your booking page as soon as anyone checks-in or book the room you make this flag to true (1 for bit field)

now just change your code on booking page,instead of direct allocating the rooms,you first check for this room with the flag so if that flag is true it means its been allocated and it is no more available,so show the message ti user...thats it

are you confused with how to code or with the idea how to do it??

let me know
thxs

Priyanka replied to Anand Malli on 01-Sep-10 05:04 AM
Are you saying that there will be one more column in the database in which there will be detail about the room is booked or not.
can you give me some idea with example that how it will search for that....
Anand Malli replied to Priyanka on 01-Sep-10 05:10 AM
Yeah you got me right,say you table is like following of room_master

Room_master
----------------
ID    roomId   isBooked
-------------------------
1     1     0
2     2     0
3     3     1
4     4     1

above you can see room with id 1 and 2 are available and 3 and 4 are allocated so before allocating the room just check with the roomId like following

SELECT isBooked FROM Room_Master WHERE RoomId=@RoomId

so this will give you flaged value for perticuler room which you are trying to book

let me know
thxs