CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2012
    Posts
    5

    Reservation/Tee Time Service

    Hey guys
    I am starting a project and I am trying to figure out the best way for a tee time service. The times will be from 7:00 to night time every ten minutes with a possible 4 spots per time. I am trying to figure out if I should create times for every date, because the program will be available 365 days a year and all these times. So 7:00, 7:10, 7:20, 7:30 etc.. People will be able to book 1,2,3, or 4 players then another person can search for available spots.

    Any thoughts or opinions on this is greatly appreciated!

  2. #2
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Talking Re: Reservation/Tee Time Service

    Did you write anything ?.please so what you have done .

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Reservation/Tee Time Service

    This is a very basic sample to get you started :

    Code:
    Private Sub Command1_Click()
        Dim currentTime As Variant
        Dim message As String
        
        currentTime = Time
        
        If currentTime > #2:00:00 AM# And currentTime <= #1:00:00 PM# Then
            message = "Good Morning"
        ElseIf currentTime > #1:00:00 PM# And currentTime <= #6:00:00 PM# Then
            message = "Good Afternoon"
        Else
            message = "Good Evening"
        End If
            
        MsgBox message
    End Sub

  4. #4
    Join Date
    Mar 2012
    Posts
    5

    Re: Reservation/Tee Time Service

    I have just started to begin the login and database for the project. I am now trying to figure out if I should create every date and time in the database. Or more of something like a array of tee times. I am not sure what would be the best way.

  5. #5
    Join Date
    Jan 2012
    Posts
    5

    Re: Reservation/Tee Time Service

    Seems you are asking what is the best way to structure your reservations database table?

    The way I would structure it is like this: (the way I think you are describing it)

    Date .................................Time ................................Player 1.......................Player 2................................Player 3.......................................... Player 4
    17th March 2012.............. 07:00
    17th March 2012.............. 07:10
    17th March 2012.............. 07:20
    ..................
    etc.,
    ...................
    18th March 2012.............. 07:00
    18th March 2012.............. 07:10
    18th March 2012..............07:20


    The fields Date and Time are date/time DataType
    The fields Player 1 to Player 4 are text fields for the name of the player.
    The field can be left blank for a free slop of filled with some the text such as "Available"

    I think your query is that this structure is flat and the date repeats quite often which goes against one of the principles of good database design (think it is called "redundency?" maybe "repetition").

    Database design is always a compromise and in this case I think the above is the best way to do it.

    There are about 65 tee times a day so you will end up with a table with 23,000 records for a full year which is tiny.
    Last edited by Wario; March 17th, 2012 at 11:06 AM.

  6. #6
    Join Date
    Mar 2012
    Posts
    5

    Re: Reservation/Tee Time Service

    @Wario Yes that is how I was thinking of creating it, so you believe that is the best way. I was also only thinking about storing the reserved times but that is where I didn't think it would be as good as the one you mentioned.

    Now with that will I have to create each day or I was thinking about creating a loop to create a new day over one ends to keep a year in the database.

    Thanks for your response.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Reservation/Tee Time Service

    You probably don't want 23K Records. Much easier to create two tables. Maybe a MASTER to store the relationship between the two.

    Once you have the time slots divided (0-32 per day?) it's not too hard to store each as a flag for RESERVED, OPEN, or N/A for whatever reason)

    Then the player table can have a field for each day (for the SEASON?). Put the Slot# value into that, and store it easily.

    Think about database design. Good design goes a long way.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Mar 2012
    Posts
    5

    Re: Reservation/Tee Time Service

    Hey dglienna thanks for replying, I would not like to have 23k records, because its going to add up. When you say create a master table, what should I have in that table? The times would be 6:30-6:00 at night and year around because of courses in the south that are opened year around. During each time up to 4 different players can reserve a time, so I can is that what I am having in the master table?

    Thanks for your response, I am just trying to figure out exactly what your saying.

  9. #9
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Reservation/Tee Time Service

    Set it up on paper.

    All the times/courses on one chart

    Now, create a table of TEETIMES()

    Use the TIME/COURSE along with the PLAYER#

    Now, one byte can show -1/0/+1 or Booked, Open, or CLOSED FOR REPAIR

    BookTeeTime() can look in all three tables, to see if there's something available, and then book a reservation, all at once!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    Join Date
    Mar 2012
    Posts
    5

    Re: Reservation/Tee Time Service

    Okay, maybe I am getting confused here or something, but how would this eliminate all the records anyways? When I create the tables won't I still have to create all the dates?
    So far I have a database for customer information, tee times with fields (reservationID, Course, date, time, player_1, player_2, player_3, player_4).

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Reservation/Tee Time Service

    If TeeTime were just a NUMBER, you could just have a daily log. It wouldn't mean anything by itself, except linked fields to the other tables.

    You're pretty close, it sounds like. Think about it. It's almost impossible to change something once it's in production...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured