Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an appointment management system for Salon I have to show dates in dropdownlist from today to next 60 days And I have to show times from 09:00 Am to 09:30 PM with the interval of 30 mins When the user logs in the user can only see dates which are available for the appointment. When the user selects the available date from the first dropdownlist then in the time dropdownlist he should only see the time or the time slots which are available to book the appointment I have to check this from the database The user selects services which he wants then accordingly the time is stored in the database.

The services has time duration. And the duration varies to services. As you know the time taken in Salon for different services. The duration is stored in the database. And then time duration needs to be added with the selected time and it has to check whether that time slot is available or not if not than either he has to select another time or another date. My database table name is Appointments.
Posted
Updated 30-Oct-14 23:31pm
v2

So What Exactly you need?
A whole code?
What you have tried?
Follow this:-
Bind dropdown simply with a datatable that will have dates and other one with time
On selected Index Changed event write your logics.

This way you can handle dates:-
C#
var dtDate=new DataTable();

dtDate.Columns.Add("AppointmentDate",typeof(string));

for (var day = 0; day < 59; day++)
 {
   var drRow = dtDate.NewRow();
   drRow["AppointmentDate"] =  DateTime.Now.AddDays(day).ToString("MM/dd/yyyy");
   dtDate.Rows.Add(drRow);
 }
 
Share this answer
 
v3
Comments
Amit Jangid 31-Oct-14 5:49am    
Yes I want code. I didn't try anything because I am unable to do anything. I am out of ideas.
Ajith K Gatty 31-Oct-14 6:17am    
solution1 looks good. implement that.
Amit Jangid 31-Oct-14 6:28am    
How to do the date part? I am not getting that. I want to show dates in dropdownlist.
Arora_Ankit 31-Oct-14 6:49am    
declare a datatable
insert Today's Date
iterate a for loop from 1 to 60 and add that index in todays date to get required date insert that in datatable.
Then bind dropdown with that.
Amit Jangid 31-Oct-14 6:53am    
Can you please provide code? I am new to this technology.
This is the simplest way I have found to display the dates.

C#
protected void Page_Load(object sender, EventArgs e)
   {
       DropDownList1.Items.Add(DateTime.Now.ToShortDateString());
       for (int i = 1; i <= 60; i++)
       {
           DropDownList1.Items.Add(DateTime.Now.AddDays(i).ToShortDateString());
       }
   }
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900