Problem setting resources

2 posts, 0 answers
  1. Gustavo
    Gustavo avatar
    2 posts
    Member since:
    Oct 2011

    Posted 04 Nov 2011 Link to this post

    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



    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);
                }
            }
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 09 Nov 2011 Link to this post

    Hello Gustavo,

    I am not sure what causes this behavior. Could you please send us a support ticket with a sample containing the issue, attached to the message. Please make sure the sample is a runnable page, so we will be able to troubleshoot this behavior locally.

    Meanwhile you could take a look at the following KB article: RadScheduler Customizing the Advanced Template. It shows how the AdvancedForm of the Scheduler could be customized and contains scenarios like adding resources to the Scheduler, and showing them when the Advanced Edit/Insert Form is opened for an appointment.

    Kind regards,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top