Appointment Slots every Ten mins for Gym

NOVATROOP77 256 Reputation points
2021-09-29T12:17:53.86+00:00

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?.

https://dotnetfiddle.net/

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"));
    }

}
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
696 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,262 questions
{count} votes

1 answer

Sort by: Oldest
  1. NOVATROOP77 256 Reputation points
    2021-09-29T22:48:14.237+00:00

    Well hes not been updating his front page on his github with that !

    0 comments No comments