Hi,
After having some fun with this question ( http://forums.daypilot.org/Topic.aspx/1426/daypilot-scheduler---is-this-possible ) i have holidays, weekends, and resources / lessons displaying as required and now need to display the booking data itself but having problems showing any bookings.
This is my GetRoomBookedData sub that i call when the navigator date is selected but nothing shows up:
Protected Sub GetRoomBookedData(ByVal start As DateTime)
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim currentDay As String = OPSDfunctions.ConvertDateFormat(start)
'set up the scheduler
DayPilotScheduler1.Days = "1"
DayPilotScheduler1.RowHeaderWidth = "160"
DayPilotScheduler1.DataStartField = "time_start"
DayPilotScheduler1.DataEndField = "time_end"
DayPilotScheduler1.DataTextField = "notes"
DayPilotScheduler1.DataValueField = "booking_id"
DayPilotScheduler1.HeaderFontSize = "8pt"
DayPilotScheduler1.HeaderHeight = "17"
DayPilotScheduler1.DataResourceField = "room_id"
DayPilotScheduler1.EventHeight = "40"
DayPilotScheduler1.ShowNonBusiness = "false"
DayPilotScheduler1.CellDuration = "60"
DayPilotScheduler1.BusinessBeginsHour = "0"
DayPilotScheduler1.BusinessEndsHour = "5"
DayPilotScheduler1.DataTagFields = "status,notes"
objConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("OPSDConnectionString").ConnectionString)
objCommand = New SqlCommand("SELECT tblrb_bookings.booking_id, tblrb_bookings.status, tblrb_bookings.room_id, tblrb_bookings.notes, tblrb_periods.time_start, tblrb_periods.time_end, tblrb_periods.bookable FROM tblrb_bookings INNER JOIN tblrb_rooms ON tblrb_bookings.room_id = tblrb_rooms.room_id INNER JOIN tblrb_periods ON tblrb_bookings.period_id = tblrb_periods.period_id WHERE (tblrb_bookings.booking_date = '" & currentDay & "') AND tblrb_periods.bookable = 1 ORDER BY tblrb_periods.time_start ASC", objConnection)
Try
objConnection.Open()
DayPilotScheduler1.DataSource = objCommand.ExecuteReader()
DayPilotScheduler1.DataBind()
DayPilotScheduler1.Update(CallBackUpdateType.Full)
Catch ex As Exception
'Inform of the error
Elmah.ErrorSignal.FromCurrentContext().Raise(ex)
Finally
objCommand.Dispose()
objConnection.Close()
objConnection.Dispose()
End Try
End Sub
I have stepped through this an now errors are thrown and running the query within SQL Server returns the correct data for the day in question. How do i ensure that the correct booking shows for the correct resource and the correct time.
These are the other thre Subs used.
Protected Sub DayPilotScheduler1_Command(sender As Object, e As DayPilot.Web.Ui.Events.CommandEventArgs)
Select Case e.Command
Case "navigate"
DayPilotScheduler1.StartDate = e.Data("start")
'Build the week bar
BuildNavBar(e.Data("start"))
'Load the resource data
LoadResources()
'Check Weekend
CheckWeekend(e.Data("start"))
'Check holiday
CheckHoliday(e.Data("start"))
'load booking data
GetRoomBookedData(e.Data("start"))
Exit Select
End Select
End Sub
Protected Sub DayPilotScheduler1_BeforeEventRender(sender As Object, e As BeforeEventRenderEventArgs)
Dim status As Integer = e.Tag("status")
Select Case status
Case 1 ' "timetabled"
'timetabled lesson
e.BackgroundColor = "#E68A73"
e.EventClickEnabled = False
e.EventDoubleClickEnabled = False
Case 2 '"staff"
'staff booked lesson
e.BackgroundColor = "#3082BF"
e.EventClickEnabled = False
e.EventDoubleClickEnabled = False
Case Else '"free"
'room is available to book.
e.BackgroundColor = "#FFFFFF"
e.InnerHTML = "<br /><br /><div style='text-align:center; vertical-align:middle;'><img src='../Content/icons/accept.png' alt='Click here to book' /> Book</div>"
End Select
End Sub
Protected Sub DayPilotScheduler1_BeforeCellRender(sender As Object, e As BeforeCellRenderEventArgs)
'Grey out all cells that are before today
If e.Start < DateTime.Today Then
If e.IsBusiness Then
e.BackgroundColor = "#D5D5C0"
End If
End If
End Sub
Any guideance would be much apreciated