Imports System
Imports DayPilot.Web.Ui.Events

Partial Public Class CustomBusinessHours
	Inherits System.Web.UI.Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

	End Sub
	Protected Sub DayPilotCalendar1_BeforeCellRender(ByVal sender As Object, ByVal e As BeforeCellRenderEventArgs)
		If e.Start.Hour >= 9 AndAlso e.Start.Hour < 12 Then
			e.BackgroundColor = "#FFF2CC" ' shift #1
		ElseIf e.Start.Hour >= 12 AndAlso e.Start.Hour < 15 Then
			e.BackgroundColor = "#FFD9CC" ' shift #2
		ElseIf e.Start.Hour >= 15 AndAlso e.Start.Hour < 18 Then
			e.BackgroundColor = "#F2FFCC" ' shift #3
		End If


		' Turning Saturday and Sunday into business days
'        
'        if ((e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday)
'            || (e.Start.Hour >= 9 && e.Start.Hour < 18))
'        {
'            e.IsBusiness = true;
'        }
'         

		' or you can change just IsBusiness and you will get the color automatically
'        
'        if (e.Start.Hour >= 10 && e.Start.Hour < 12)
'            e.IsBusiness = true;
'        else if (e.Start.Hour >= 14 && e.Start.Hour < 16)
'            e.IsBusiness = true;
'        else
'            e.IsBusiness = false;
'         

	End Sub
End Class
