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