question

davidbuckley-4911 avatar image
0 Votes"
davidbuckley-4911 asked davidbuckley-4911 commented

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


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

dotnet-csharpdotnet-entity-framework-core
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Old Libary not updated for .net core

0 Votes 0 ·

The release notes indicate .NET Core

136298-time.png


0 Votes 0 ·
time.png (36.7 KiB)
Show more comments

1 Answer

davidbuckley-4911 avatar image
0 Votes"
davidbuckley-4911 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.