Hi all,
We are testing the scheduler control to incorporate it in one of our projects but we are having a problem similar to the one posted in the thread below.
http://www.telerik.com/community/forums/wpf/scheduler/how-to-set-resource-as-selected-in-combobox.aspx
When we load the appointment information, the drop-down of the resource is not set to the correct value. For example, we have an operatory resource that the user assigns in the appointment. We are able to set that and save in the database but when we open the appointment detail the resource is not set.
We tried the solution presented by peter in the thread above but it does not apply to our case because we use the Telerik Appointment class. I am putting the code we are using below. Any ideas?
Thanks
We are testing the scheduler control to incorporate it in one of our projects but we are having a problem similar to the one posted in the thread below.
http://www.telerik.com/
When we load the appointment information, the drop-down of the resource is not set to the correct value. For example, we have an operatory resource that the user assigns in the appointment. We are able to set that and save in the database but when we open the appointment detail the resource is not set.
We tried the solution presented by peter in the thread above but it does not apply to our case because we use the Telerik Appointment class. I am putting the code we are using below. Any ideas?
Thanks
public
override
System.Collections.Generic.IEnumerable<Appointment>
GetAppointments(RadScheduler owner)
{
var events = _messageService.GetEvents();
IEnumerable<Appointment> appts = events !=
null
? Mapper.Map<IList<EventDTO>, IEnumerable<Appointment>>(events) :
new
List<Appointment>();
int
index = 0;
appts.ToList().ForEach(
delegate
(Appointment appt) {
appt.Owner = owner;
appt.RecurrenceState =
appt.RecurrenceParentID !=
null
?
RecurrenceState.Exception :
!
string
.IsNullOrEmpty(appt.RecurrenceRule) ?
RecurrenceState.Master :
RecurrenceState.NotRecurring;
LoadResources(owner, appt, events[index]);
index++;
});
return
appts;
}
private
void
LoadResources(RadScheduler owner, Appointment appt, EventDTO eventDTO)
{
if
(eventDTO.Professional.HasValue)
{
Resource professional = GetResourcesByType(owner,
"Professional"
).FirstOrDefault(r => Convert.ToInt64(r.Key) == eventDTO.Professional);
if
(professional !=
null
)
appt.Resources.Add(professional);
}
if
(eventDTO.Operatory.HasValue)
{
Resource operatory = GetResourcesByType(owner,
"Operatory"
).FirstOrDefault(r => Convert.ToInt64(r.Key) == eventDTO.Operatory);
if
(operatory !=
null
)
appt.Resources.Add(operatory);
}
}