Go Back   kirupaForum > Development > Server-Side (PHP, SQL, ASP.NET, etc.)

Reply
 
Thread Tools Display Modes
Old 11-24-2009, 06:47 PM   #1
imagined
Code Remixer
 
imagined's Avatar
Availability on AppointmentCalendar class

I'm setting up with class with availability dates and times. So if there is a date and time that the user is unavailable, it won't be possible to make an appointment during that period.

The user should be able to set specific dates and times he won't be available, on times he had previously set to be available. For example, let say he's available every Monday from 8am-5pm, but there is this specific Monday he won't be, so he enters that specific date and it has precedence over the Availability. So for that I setup the following table:

Unavailability table with the following fields
  • id int not null auto_increment primary key
  • userid int not null
  • UnavailableStartDateTime datetime not null
  • UnavailableEndDateTime datetime not null

The user should be able to set normal schedules available dates and times. The user should be able to set something like
Available Every Monday from 8am - 5pm
Available Every Tuesday from 9am - 6pm
Available Every Wednesday from 8am - 12pm

So I setup the the Availability table with the following fields
  • id int not null auto_increment primary key
  • userid int not null
  • AvailableDay text (to enter Monday or Tuesday)
  • AvailableTimeStart time
  • AvailableTimeEnd time

Any suggestions?

__________________
"You are playing a very dangerous game"
"Change always is"

CodeRemix
TutorialRemix
iPhonePaperStudio

Last edited by imagined; 11-24-2009 at 06:58 PM..
imagined is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-24-2009, 06:59 PM   #2
jwilliam
Call me Rooster Cogburn.
Looks okay, but I'd probably drop the AvailableDay column in Availability. It's not really necessary because you can get that information from your timestamp TimeStart. As for "normal schedules" I'd probably make a column call "recurring" or something like that. Then you could store a value in it like "none," "weekly," "monthly," etc... I've been at work for 9 hours so this is all completely off the top of my head
jwilliam is offline   Reply With Quote
Old 11-24-2009, 07:12 PM   #3
imagined
Code Remixer
 
imagined's Avatar
Quote:
Originally Posted by jwilliam View Post
I've been at work for 9 hours so this is all completely off the top of my head
Thanks for still taking the time to offer good advice.

Quote:
Originally Posted by jwilliam View Post
As for "normal schedules" I'd probably make a column call "recurring" or something like that. Then you could store a value in it like "none," "weekly," "monthly," etc...
But timestamp doesn't store SPECIFIC dates?

So if the user enters Monday and "Mon" gets stored on the Day column. When the method is looping through the days and makes a check like date('D') == Mon, then sets that day as available.

I don't know maybe I'm wrong.

__________________
"You are playing a very dangerous game"
"Change always is"

CodeRemix
TutorialRemix
iPhonePaperStudio
imagined is offline   Reply With Quote
Old 11-25-2009, 10:52 AM   #4
jwilliam
Call me Rooster Cogburn.
I just noticed you're using the TIME type. You could probably just ignore everything I said before Your table should work fine... the only thing is it doesn't account for specific availabilities. In other words, if I said I'm only available "November 25th, 2011 @ 8AM thru November 25th, 2011 @ 1PM," your table couldn't describe that. It may not need to though...
jwilliam is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:02 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com