Tutorial: ASP.NET Doctor Appointment Scheduling (C#, VB.NET, SQL Server)

This tutorial shows how to create a complex event calendar UI with day, week, and month views. Includes PHP sample code.
Jun 30, 2015
asp.net doctor appointment scheduling

Features

  • Public interface for patients
  • Doctor's interface for managing appointments
  • Manager's interface for scheduling shifts
  • Using pre-defined appointment slots
  • Appointment status: "free", "waiting", "confirmed"
  • SQL Server database
  • Visual Studio 2013
  • C# source code
  • VB.NET source code
  • Includes the trial version of DayPilot Pro for ASP.NET WebForms

Source code of the tutorial is available for download.

Example: Generating Custom Timeline to Display Doctor Shifts and Appointment Slots

asp.net doctor appointment scheduling manager hours

C#

private void LoadTimelineHours()
{

  DayPilotScheduler1.Scale = TimeScale.Manual;
  DayPilotScheduler1.Timeline.Clear();

  for (int i = 0; i < DayPilotScheduler1.Days; i++)
  {
      DateTime day = DayPilotScheduler1.StartDate.AddDays(i);

      for (int x = MorningShiftStarts; x < MorningShiftEnds; x++)
      {
          DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1));
      }
      for (int x = AfternoonShiftStarts; x < AfternoonShiftEnds; x++)
      {
          DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1));
      }

  }

  DayPilotScheduler1.TimeHeaders.Clear();
  DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Month));
  DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Day, "ddd d"));
  DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Hour, "ht"));

}

VB

Private Sub LoadTimelineHours()

  DayPilotScheduler1.Scale = TimeScale.Manual
  DayPilotScheduler1.Timeline.Clear()

  For i As Integer = 0 To DayPilotScheduler1.Days - 1
    Dim day As Date = DayPilotScheduler1.StartDate.AddDays(i)

    For x As Integer = MorningShiftStarts To MorningShiftEnds - 1
      DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1))
    Next x
    For x As Integer = AfternoonShiftStarts To AfternoonShiftEnds - 1
      DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1))
    Next x

  Next i

  DayPilotScheduler1.TimeHeaders.Clear()
  DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Month))
  DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Day, "ddd d"))
  DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Hour, "ht"))

End Sub