search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Customizable Hour Header and some other problems

Asked by OB
13 years ago.

Hi, I'm using the Calendar and Navigator from Day Pilot Demo 6.2 version in my web develepment and I get some problems as listed below:

1. I'm wondering whether I can use thenew improvement event - BeforeTimeHeaderRender to change/hide the hour header, for example Ihave the time slot from 8am-10am, 12.30pm-2.30pm, and Iwant tohide the 10am -2.30pm. I want to do so is because for what Ihad doneis set the 10am-2.30pm as non-business time in the beforeCellRender event, when I hard code the time then is still fine, but when I let it to check the blocked time slot from database, it took a terrible waiting time. Maybe you can help me to improve my coding if the hiding hour header function is not available yet:

Protected Sub dpc1_BeforeCellRender(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs) Handles dpc1.BeforeCellRender
Dim i As Integer = 0
For i = 0 To DBIntegrator.GetAllBlockedTimeSlot.Count - 1
Dim startHour As Integer = DBIntegrator.GetAllBlockedTimeSlot(i).StartHour
Dim startMinute As Integer = DBIntegrator.GetAllBlockedTimeSlot(i).StartMinute
Dim endHour As Integer = DBIntegrator.GetAllBlockedTimeSlot(i).EndHour
Dim endMinute As Integer = DBIntegrator.GetAllBlockedTimeSlot(i).EndMinute

If (e.Start.Hour = startHour And e.Start.Minute >= startMinute) Or _
(e.Start.Hour = endHour And e.Start.Minute < endMinute) Or _
(e.Start.Hour > startHour And e.Start.Hour < endHour) Then
e.IsBusiness = False
Exit For
Exit Sub
End If

Next

End Sub

Public Shared Function GetAllBlockedTimeSlot() As List(Of Blocked)
Dim blocked As New List(Of Blocked)

_conn = New OleDb.OleDbConnection(_connStr)
_cmd = New OleDb.OleDbCommand("Select * from tBlocked Where IsBlocked =?", _conn)
_cmd.Parameters.AddWithValue("IsBlocked", True)

_conn.Open()
_reader = _cmd.ExecuteReader

While _reader.Read
Dim allTime As New Blocked
allTime.ID = _reader.Item("TimeSlotID")
allTime.StartHour = _reader.Item("StartHour")
allTime.StartMinute = _reader.Item("StartMinute")
allTime.EndHour = _reader.Item("EndHour")
allTime.EndMinute = _reader.Item("EndMinute")
allTime.IsBlocked = _reader.Item("IsBlocked")

blocked.Add(allTime)
End While

_reader.Close()
_conn.Close()

Return blocked

End Function

2. The Calendar selected date is always refresh back to the current date. I need it to stay at the date which I'm editing the event. Is it able to do that?

Thank you for your support^^

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.