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

Help Resources not showing in DayView with GroupMode

1 Answer 79 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 24 Dec 2017, 09:44 PM

I am trying to bind resources to my appointments which has a field called ProviderId that provider id maps to a provider table, however the text is not showing 

01.private void BindScheduler()
02.       {
03.           try
04. 
05.           {
06.               SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource();
07.               AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();
08.               BindingSource _bindingsource = new BindingSource();
09.               
10.               ResourceMappingInfo _resource = new ResourceMappingInfo();
11.               appointmentMappingInfo.Start = "ApptDate";
12.               appointmentMappingInfo.End = "AppEnd";
13.               appointmentMappingInfo.Duration = "ApptLength";
14. 
15.               appointmentMappingInfo.UniqueId = "ID";
16. 
17.               appointmentMappingInfo.Location = "Location";
18. 
19.               appointmentMappingInfo.Summary = "THIS IS A TEST FOR SUMMARY";
20.               appointmentMappingInfo.Description = "NAME";
21. 
22.               dataSource.EventProvider.Mapping = appointmentMappingInfo;
23.               dataSource.EventProvider.DataSource = _bindingsource;
24. 
25.               _bindingsource.DataSource = SourceDal.getAppointments(monthCalendar1.SelectionRange.Start);
26. 
27.               appointmentMappingInfo.ResourceId = "ProviderID";
28. 
29. 
30. 
31.               BindingList<CustomResource> resources = new BindingList<CustomResource>();
32.               ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo();
33.                resourceMappingInfo.Name = "Name";
34.               resourceMappingInfo.Id = "Id";
35.               resources = SourceDal.GetProviders();
36.               dataSource.ResourceProvider.Mapping = resourceMappingInfo;
37.               dataSource.ResourceProvider.DataSource = resources;
38. 
39. 
40.           
41.               this.sourceNetAppointments.GroupType = GroupType.Resource;
42.                
43. 
44. 
45. 
46.               this.sourceNetAppointments.ElementProvider = new MyElementProvider(this.sourceNetAppointments);
47. 
48.               this.sourceNetAppointments.DataSource = dataSource;
49. 
50. 
51.           }
52.           catch (Exception ex)
53.           {
54. 
55.           }
56. 
57.       }

 

Here you can see my get providers call.

01.public BindingList<CustomResource> GetProviders()
02.     {
03.         BindingList<CustomResource> resources = new BindingList<CustomResource>();
04. 
05.         try
06.         {
07.             var q = from lookup in _sourceEntities.Providers
08.                     orderby lookup.FirstName
09.                     select new
10.                     {
11.                         Code = lookup.ID,
12.                         Description = lookup.FirstName.Trim() +  "" + lookup.LastName.Trim()
13.                     };
14. 
15.             if (q != null)
16.             {
17.                 Array.ForEach(q.ToArray(), l =>
18.                 {
19.                     for (int i = 0; i < 5; i++)
20.                     {
21.                         CustomResource resource = new CustomResource();
22.                         resource.Id = i + 1;
23.                         resource.Name = "Resource " + l.Description;
24.                         resources.Add(resource);
25.                     }
26.                 });
27.             }
28.         }
29.         catch (Exception ex)
30.         {
31.             throw new EntityContextException("GetProviders failed.", ex);
32.         }
33. 
34.         return resources;
35.     }

 

 

Here is the data is ment to print out for the appointments with ProviderID =1 

But they are not showing can someone help

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
david
Top achievements
Rank 1
answered on 24 Dec 2017, 09:45 PM

Sorry i forgot to include my  CustomResource Class

 

 

01.using System;
02.using System.Collections.Generic;
03.using System.ComponentModel;
04.using System.Linq;
05.using System.Text;
06.using System.Threading.Tasks;
07.using Telerik.WinControls.UI;
08. 
09.namespace WindowsFormsApplication1.Classes.Appointments
10.{
11.    public class CustomResource : INotifyPropertyChanged
12.    {
13.        private int id;
14.        private string name;
15.        public int Id
16.        {
17.            get
18.            {
19.                return this.id;
20.            }
21.            set
22.            {
23.                if (this.id != value)
24.                {
25.                    this.id = value;
26.                    this.OnPropertyChanged("Id");
27.                }
28.            }
29.        }
30. 
31.        
32.        public string Name
33.        {
34.            get
35.            {
36.                return this.name;
37.            }
38.            set
39.            {
40.                if (this.name != value)
41.                {
42.                    this.name = value;
43.                    this.OnPropertyChanged("Name");
44.                }
45.            }
46.        }
47.        public event PropertyChangedEventHandler PropertyChanged;
48.        protected virtual void OnPropertyChanged(string propertyName)
49.        {
50.            if (this.PropertyChanged != null)
51.            {
52.                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
53.            }
54.        }
55.    }
56.}
Tags
Scheduler and Reminder
Asked by
david
Top achievements
Rank 1
Answers by
david
Top achievements
Rank 1
Share this question
or