We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using ScheduleAppointmentMapping with resources

Thread ID:

Created:

Updated:

Platform:

Replies:

146684 Aug 14,2019 01:17 AM UTC Aug 20,2019 02:52 PM UTC WPF 6
loading
Tags: SfSchedule
Eiad Al-khanshour
Asked On August 14, 2019 01:17 AM UTC

I have a database with employee and their appointments (Each appointment has one parent user, and each user may have many appointments), and these classes are located in a shared (.NET Standard) library. How can I bind Schedule.ItemsSource to my business objects and use the employee class as resources (How can I use the ScheduleAppointmentMapping to set my controls).

Best Regards

Kanniyappan Panneer Selvam [Syncfusion]
Replied On August 14, 2019 01:50 PM UTC

Hi Eiad Al-khanshour, 
 
Thanks for contacting syncfusion support. 
  
We have checked query  How can I bind Schedule.ItemsSource to my business objects and use the employee class as resources” at our end. We have facing an issues in SfSchedule while preparing the sample for your requirement. So, currently we have logged the bug report ”Null reference exception occurred in SfSchedule when ScheduleType set to Month” and we will provide a patch with sample on August 22nd, 2019. 
  
Regards, 
Kanniyappan P 


Eiad Al-khanshour
Replied On August 14, 2019 11:46 PM UTC

Thank you for the great efforts from your side....

I've got the same problem even in DAY VIEW, whenever I use my business object Employee as resource and set the Resource property in SfSchedule. However, I've managed to solve the exception issue by binding the ScheduleResourceTypeCollection property to a collection of Employee, and use a converter to change the collection into a ResourceType and Resource objects.... but here i could not found a sutable way to expose resource in my Appointment object without refrencing the your WPF library.

Waiting for your solution.... Best Regards

Jagadeesan Pichaimuthu [Syncfusion]
Replied On August 15, 2019 10:08 AM UTC

Hi Eiad Al-khanshour 
 
Thanks for your update. 
   
We have prepared sample as per your requirement “How can I bind Schedule.ItemsSource to my business objects and use the employee class as resources”. Please find the code snippet and sample for your reference. As stated in previous update we are facing issue with Month view type and we will provide fix for the same on 22/08/2019. 
 
Code Snippet: 
scheduleResourceTypeCollection.Add(new ResourceType() {  TypeName = " Employee " });
            ScheduleAppointmentModel appointment1 = new ScheduleAppointmentModel()
            {
                StartTime = DateTime.Now.AddHours(5),
                EndTime = DateTime.Now.AddHours(6),
                SubjectMapping = "Johny's Appointment",
            };
            appointment1.Resources.Add(new MappedResource() { MappedTypeName = "Employee", MappedResourceName = "Johny", MappedDisplayName = "Johny" });
 
  

            ScheduleAppointmentModel appointment2 = new ScheduleAppointmentModel()
            {
                StartTime = DateTime.Now.AddHours(6),
                EndTime = DateTime.Now.AddHours(7),
                SubjectMapping = "Neal's Appointment"
            };
 
  
            appointment2.Resources.Add(new MappedResource() { MappedTypeName = " Employee ", MappedResourceName = "Neal", MappedDisplayName = "Neal" }); 
  
            ScheduleAppointmentModel appointment3 = new ScheduleAppointmentModel()
            {
                StartTime = DateTime.Now.AddDays(2).AddHours(7),
                EndTime = DateTime.Now.AddDays(2).AddHours(8),
                SubjectMapping = "Peter's Appointment"
            };
 
  
            appointment3.Resources.Add(new MappedResource() { MappedTypeName = " Employee ", MappedResourceName = "Peter", MappedDisplayName = "Peter" }); 
  

            scheduleAppointmentCollection.Add(appointment1);
            scheduleAppointmentCollection.Add(appointment2);
            scheduleAppointmentCollection.Add(appointment3);
 
  

            ScheduleResourceTypeCollection[0].ResourceCollection.Add(appointment1.Resources[0]);
            ScheduleResourceTypeCollection[0].ResourceCollection.Add(appointment2.Resources[0]);
            ScheduleResourceTypeCollection[0].ResourceCollection.Add(appointment3.Resources[0]);
 
 
 
 
Please try above solution and let us know if it is helpful. 
 
Regards, 
Jagadeesan 


Eiad Al-khanshour
Replied On August 15, 2019 11:44 PM UTC

Thank you for the quick respond...

Every thing work fine now in all views.... It was not clear to me that I've to use TypeNameMapping and DisplayNameMapping for the properties of Employee object. However, the sample has a bit small note, the view model class has some platform UI code (ResourceType), and I prefer to use converter to convert the resource (Employee) collection to  a resource type collection..... I've attached a small sample for that..


Best regards and million thanks...

Attachment: SfSchedule_da5061c8.zip

Jagadeesan Pichaimuthu [Syncfusion]
Replied On August 19, 2019 01:00 PM UTC

Hi Eiad Al-khanshour 
 
Thanks for your update.   
 
Currently we are validating your query with provided sample and we will update more details on 20/08/2019. 
 
Regards, 
Jagadeesan 


Kanniyappan Panneer Selvam [Syncfusion]
Replied On August 20, 2019 02:52 PM UTC

Hi Eiad Al-khanshour, 
 
Thanks for your patience. 
 
We checked your query “Use of TypeNameMapping and DisplayNameMapping at our end. TypeNameMapping property represents the mapping of schedule appointment of multiple users (John, Neal) from the Employee class. DisplayNameMapping  property represents the display name of  the scheduled appointment of the resources from the Employee class e.g(Dr Johny, Dr Neal). Please find the screenshot below. 
 
Screenshot: 
 
 
 
If we misunderstood your requirement, please provide more information regarding the requirement. It would be more helpful to proceed further. 
 
Regards, 
Kanniyappan P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon