Solved

How to perform an Automatic Time-Picker at Runtime with connection to Database.

Posted on 2004-10-12
8
200 Views
Last Modified: 2010-05-18
Hello,

Good day to everybody,

My problem is that i need to make reservations for Conferences / Meetings that are to be held in our Board room.  The criteria i have been given are ;

1.  No meetings/conferences are to be within the same time in the same board room.

2.  No meetings/conferences should be less than to 2 hours within the same board room.

3.  Meetings/Conferences are to be done withtin 9:00 a.m.  to 17:00, if beyond this time lapse, additional rate of 25% is automatically charged for every hour exceeding 17:00

4.  Board Room 1 , named Calypso hold meetings with 25 people and Board Room 2, named Atlantis hold meetings with 100 people.

My Aim ---> In the form i would prefer to click on a ComboBox or {any better suggested idea from you} that will automatically read from the Database ( MSAcccess 2000 )  and display ONLY slots of available time that i can reserve.  { Example, It's something like MSOutlook Calendar, that gives the blue line for time slot already taken .... }.

Also i would like to have another ComboBox { or any other idea you suggest } for me to view all existing reservations made so far with a range set ( i.e. if i want to see reservations for next month only, i just select it from the ranage ).

The program need to allow me to print at the same time.

Finally, i have been able to design and program the rest of the stuff, it's this part only that is giving me lots of headache.

Any idea will be most welcomed.

Thank you all.
Sally.


0
Comment
Question by:salimdeath
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:Corey2
ID: 12291275
Are you only handling one selected date at a time or a week etc.?

Corey
0
 

Author Comment

by:salimdeath
ID: 12291398
Thanks for replying Corey.

There are situations where i have to make reservations for conferences that will be held in 2 months time and at times it happened that i am asked if any room is available the next day.

Sorry for missing this important information.

Sally

0
 
LVL 13

Expert Comment

by:Corey2
ID: 12291717
I would create a class that would hold the information

date
start
end
BlockedBefore
BlockedAfter
Duration
Room
Guests

the class would handle keeping the duration and endtime in sinc and the guests and the room and so on

I would then create a datetimepicker object on the form.
read up on this here
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsDateTimePickerClassTopic.asp

you may need one for each room I haven't used it myself.

then when you quary your database create a collection of your new timeblock class for each block that is taken.  And if the datetime picker allows you to color in the apropriate fields.

Corey
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:salimdeath
ID: 12292002
Though i got the logic of what you are saying above, it sounds pretty difficult to put all these in terms of code.  

I have had a little exposure to vb.net ( only 3 months to now) and been to a course of 1 week only !  Have prior experience on Unix Programming { Bourne Shell  / C / Korn }, but it's like Sky and Earth difference.

Can you please show me what detail code do i need to use ?  The form name i am using is Reserve.vb and my Database name is RoomAlloc.mdb, and the table name for this particular requirement am planning to name it Reservation with attributes as follows;

1.  Reservation_ID { Primary Key }

2.  Room_Name ---> E.g. Calypso

3.  DateTime_Called --> E.g. 10/13/2004 @ 14:30

4.  DateTime_OfMeeting  --> E.g. Meeting to be held on 11/15/2004 @ 11:00

5.  Reserved_By ---> E.g. Ms. Jane Doe

6.  Payment_Type ---> E.g. P.Order / Cheque / CreditCard

7.  Reservaion_TakenBy ---> E.g. Sally or Nathalia, etc

I have other forms and tables.  This table need not have any  Relationships with other Tables in the database.

Thank you
Regards.
Sally


0
 
LVL 13

Accepted Solution

by:
Corey2 earned 500 total points
ID: 12300456
Unfortunately it isn't quite a walk in the park.
I could maybe give you a bit of instruction though.

Class Reservation

Private Res_ID As Integer
Private Room_Name As String
Private DateTime_Called As Date
Private DateTime_OfMeeting As Date
Private Reserved_By As String
Private Payment_Type As String
Private Reservation_TakenBy As String
Private Confirmed As Boolean

Private Res_ID As Integer
Private Room_Name As String
Private DateTime_Called As Date
Private DateTime_OfMeeting As Date
Private Reserved_By As String
Private Payment_Type As String
Private Reservation_TakenBy As String
Private Confirmed As Boolean



Public Sub SetRes_ID(ByRef ResID As Integer)

If ResID = 0 Then
  Res_ID = CreateNewResID 'some function that would generate
                                          'a unique ID
Else
  Res_ID = ResID
End If

End Sub

Public Property Get GetRes_ID() As Integer
   GetRes_ID = Res_ID
End Property

Public Sub SetDateTime_OfMeeting(ByRef DateTime As String)
   
    Dim Holder As Variant
    Dim I As Variant
    Holder = Split(DateTime, "@", -1, vbTextCompare)
   
    DateTime_OfMeeting = (Trim((Holder(0)))) & " " & (Trim(Holder(1)))
     

End Sub

Public Property Get Get2hrBefore() As Date
    Dim TwoHours As Date
    TwoHours = "02:00"
    Get2hrBefore = DateTime_OfMeeting - TwoHours
End Property

Public Property Get Get2hrAfter() As Date
    Dim TwoHours As Date
    TwoHours = "02:00"
    Get2hrAfter = DateTime_OfMeeting + TwoHours
End Property

End Class

'here is a sub you can run to demonstrate how the class will work

Sub test()

Dim TestClass As Reservation
Set TestClass = New Reservation

TestClass.SetRes_ID 1234
MsgBox TestClass.GetRes_ID

TestClass.SetDateTime_OfMeeting ("10/13/04 @ 12:20")

MsgBox TestClass.Get2hrBefore

MsgBox TestClass.Get2hrAfter

End Sub

I hope this helps
Corey


0
 
LVL 13

Expert Comment

by:Corey2
ID: 12300462
Oh yeah change any variants to objects I was screwing around with it in VBA

Corey
0
 

Author Comment

by:salimdeath
ID: 12301497
Hi Corey,

Thanks for replying.  You are right in what you said, it's not that easy to be done overnight.  I have been with this Module for the past 10 days, and my boss is chasing me.  They expect everything to be done within hours !!! I lack experience in this new programming language, got to admit it.

I am going to work on the codes you gave me right now.  It's 11:20 p.m. here and will be trying to work on it till 2:00 a.m.  If there's anything that goes wrong i will let you know tomorrow in the office.

Many many many thanks for all you did.  I will revert back to you soon.

My kind regards.
Sally.
0
 

Author Comment

by:salimdeath
ID: 12405171
Greetings Corey,

Sorry for the late reply.

I was on sick leave for a few days, things are geting back to normal.

I worked on part of the codes, though i could not not make it work as planned above, but this gave me new insight and new directions.

Part of it is working fine with some modfications, and for the rest i am still working on it.

You strongly deserve the 500 points and i wouldn't like to delay furthermore this post.

Thank you again Corey.

If i need your help again, how can i contact you ?

My kind regards.
Sally


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error handling in asp.net site 5 34
VB: Convert 2 dates to specific format 24 52
Import a txt file into a DataGridView and TextBox 20 52
Name Space error VS2015 1 24
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question