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

Problem setting resources

1 Answer 55 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Gustavo
Top achievements
Rank 1
Gustavo asked on 04 Nov 2011, 02:51 PM
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);
            }
        }

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 09 Nov 2011, 07:19 PM
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
Tags
Scheduler
Asked by
Gustavo
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or