This is a migrated thread and some comments may be shown as answers.

Appointment resources problem

2 Answers 69 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 22 Sep 2010, 02:07 AM
Hi there, I am encountering a couple of problems using the scheduler and am wondering if anyone can help.
The first one is that I cannot seem to get appointments to show up under their appropriate resources. Without resources, the scheduler displays the appointments fine. Here is the code, see if you can see what I'm doing wrong:

Initializing resources:
ResourceType resType = new ResourceType("Vehicle");
resType.ForeignKeyField = "VehicleID";
tripScheduler.ResourceTypes.Add(resType);
 
Vehicle[] vehicles = Vehicle.GetVehiclesForDate(DateTime.Parse(txtDate.Text));
foreach (Vehicle vehicle in vehicles)
   tripScheduler.Resources.Add(new Resource("Vehicle", vehicle.ID, vehicle.SummaryTextLong));

Initializing appointments:
Trip[] clientTrips_scheduled = Trip.GetTripsForDate(date, true);
DataTable scheduledTripsTable = new DataTable();
scheduledTripsTable.Columns.Add("ID");
scheduledTripsTable.Columns.Add("Title");
scheduledTripsTable.Columns.Add("Start");
scheduledTripsTable.Columns.Add("End");
scheduledTripsTable.Columns.Add("VehicleID");
DataRow row;
 
foreach (Trip trip in clientTrips_scheduled)
{
    row = scheduledTripsTable.NewRow();
    row["ID"] = trip.ID;
    row["Title"] = trip.Summary;
    row["Start"] = trip.Start;
    row["End"] = trip.End;
    row["VehicleID"] = trip.VehicleID;
 
    scheduledTripsTable.Rows.Add(row);
}
 
tripScheduler.DataSource = scheduledTripsTable;
tripScheduler.DataBind();

The scheduler markup (although I am doing all of the work in code-behind, here's the markup so you can see what I'm doing):
<telerik:RadScheduler ID="tripScheduler" runat="server" DataKeyField="ID" DataSubjectField="Title" DataStartField="Start" DataEndField="End" DisplayDeleteConfirmation="true" onappointmentcreated="tripScheduler_AppointmentCreated" CustomAttributeNames="VehicleID">
    <TimelineView UserSelectable="false" />
    <WeekView UserSelectable="false" />
    <MonthView UserSelectable="false" />
    <DayView UserSelectable="false" />
</telerik:RadScheduler>

Now I don't know what I'm doing wrong, I thought the foreign key field of "VehicleID" should allow appointments to be auto-assigned to their appropriate resources based on their "VehicleID" column value? Or do I need to do more than this?

Any help is greatly appreciated, sorry if I've missed something really obvious :)

The other problem is a very simple one - is it possible to assign separate start and end availability times for each resource? ie each Vehicle on my scheduler will have a shift start/end time, and I want this to be reflected on the scheduler.

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Sep 2010, 12:41 PM
Hello Ryan,

There might be a data type mismatch. In your scheduledTripsTable VehicleID is a string, so please make sure that when you create a new resource, vehicle.ID is also a string.


Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 28 Sep 2010, 01:09 AM
Thanks Peter, I have managed to get this working. Cheers!
Tags
Scheduler
Asked by
Ryan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or