Well hes not been updating his front page on his github with that !
Appointment Slots every Ten mins for Gym
I need to have a booking system that allows for ten mins slots so far I have a .net fiddle that gets me the slots.
But what I need is the ability to If slot 08:30 is occupied Student B that arrives goes into 08:40 slot of Exercise 1 which Is Bikes once Student A is finished he goes onto Exercise 2 which is weights could be 10:10 is his next slot because the 10:00 appointment is already booked or occupied.
The function so produce clean slots every hour for the students to filter into ?
I want the system to be as flexible as possible without requirement of having a calendar table or something similar.
The time slots should be between 09:00 and 17:00 but could be extended if a busy season?.
contents of above.
using System;
public class Constants
{
public enum WorkOutType
{
Bikes=1,
Weights=2,
Run=3
}
}
public class WorkOutAppointments
{
public int Id {get;set;}
public DateTime Slot {get;set;}
public int Type {get;set;}
public int StudentId {get;set;}
}
public class Student
{
public int Id {get;set;}
public string FirstName {get;set;}
public string LastName {get;set;}
}
public class Program
{
public static void Main()
{
int durationOfSession = 10;
int gapBetweenSessions = 0;
DateTime start = DateTime.Today.AddHours(8);
DateTime end = DateTime.Today.AddHours(18);
for (DateTime appointment = start; appointment < end; appointment = appointment.AddMinutes(durationOfSession + gapBetweenSessions))
{
Console.WriteLine(appointment.ToString("HH:mm"));
}
}
}`
Possible c# method.
public void GenAppointments(DateTime date,int duration)
{
int durationOfSession = 60;
int gapBetweenSessions = 10;
DateTime start = DateTime.Today.AddHours(8);
DateTime end = DateTime.Today.AddHours(18);
for (DateTime appointment = start; appointment < end; appointment = appointment.AddMinutes(durationOfSession + gapBetweenSessions))
{
Console.WriteLine(appointment.ToString("HH:mm"));
}
}