在数据库中预订系统日期 [英] Booking system dates in database
问题描述
我需要一些帮助:
我正在设置一个预订系统(一种酒店预订),并且我已经插入了一个日期和支票将数据输入到数据库中,如何检查房间是否已预订?
I am setting up a booking system (kind of hotel booking) and I have inserted a check in date and a check out date into database, how do I go to check if a room is already booked?
我不知道如何管理数据库中已预订的日期。有没有人可以给我一个线索,这是如何工作的?也许在哪里可以找到更多的信息?
I have no clue how to manage the already booked days in the database. Is there anyone who can give me a clue how this works? And maybe where I can find more information?
推荐答案
嗯,我不太了解你的问题,但我的建议是给你添加一个状态字段,您可以在其中控制已预订项的当前状态。
Well, I didn't understand very well your question, but my suggestion is to you to add a state field, in which you can control the current state of the "booked" item. something like
- 可用
- 在维护下
- 被占用
或任何一些为您工作的州。
Or whatever bunch of states that work for you.
我用于这种情况的分析如下:
例如,您的房间目前预订了这些日期范围:
The analysis that I use to do for that case is as follows: Take for instance, your room is currently booked with these date range:
- 初始日期:2月8日
- 结束日期:2月14日
成功预订示例
- 初始日期:2月2日
-
结束日期: 2月6日
- Init Date: Feb 2
End Date: Feb 6
初始日期:2月15日
您应该检查预订是否满足以下条件:
You should check that the booking attempt satisfies these conditions:
- 预订初始日期和预订结束日期都不能在已预订的日期之内。
示例:
- 初始日期:2月2日
-
结束日期:2月10日ange(2月8日至14日))
- Init Date: Feb 2
End Date: Feb 10 (Inside the current range (Feb 8 to 14))
初始日期:2月12日(在当前范围内(2月8日至14日))
Init Date: Feb 12 (Inside the current range (Feb 8 to 14))
结束日期:2月27日
- 如果预订初始日期少于当前的初始日期,预订结束日期也应小于当前的初始日期
初始日期:2月2日
Init Date: Feb 2.
这篇关于在数据库中预订系统日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!