Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello,
                                    I've my custom business object as an appointment which includes a custom resource obejct inhereted from BindingList<T>. My idea is to add the resource object as a custom field to my appointment and work with a custom appointment form. However the result for my custom field "Resource" is always null.
                                    I've done this with another object from my business object which is inheretd from IEdtibaleObject and this works fine.

                                    Some information:
                                    1. I have the CustomFieldMappings done via my schedulerStorage - Appointments
                                    2. The code of my custom appointment form

                                    public class MyAppointmentFormController : AppointmentFormController
                                    {

                                            public CTerminartItem Terminart { get { return (CTerminartItem)EditedAppointmentCopy.CustomFields["Terminart"]; } set { EditedAppointmentCopy.CustomFields["Terminart"] = value; } }
                                            public CResList Ressourcen { get { return (CResList)EditedAppointmentCopy.CustomFields["Ressourcen"]; } set { EditedAppointmentCopy.CustomFields["Ressourcen"] = value; } }
                                            public string CustomStatus { get { return (string)EditedAppointmentCopy.CustomFields["CustomStatus"]; } set { EditedAppointmentCopy.CustomFields["CustomStatus"] = value; } }

                                            CTerminartItem SourceTerminart { get { return (CTerminartItem)SourceAppointment.CustomFields["Terminart"]; } set { SourceAppointment.CustomFields["Terminart"] = value; } }
                                            CResList SourceRessourcen { get { return (CResList)SourceAppointment.CustomFields["Ressourcen"]; } set { SourceAppointment.CustomFields["Ressourcen"] = value; } }
                                            string SourceCustomStatus { get { return (string)SourceAppointment.CustomFields["CustomStatus"]; } set { SourceAppointment.CustomFields["CustomStatus"] = value; } }

                                         public MyAppointmentFormController(SchedulerControl control, Appointment apt) : base(control, apt) {
                                         }

                                         public override bool IsAppointmentChanged()
                                            {
                                              if(base.IsAppointmentChanged())
                                                   return true;
                                                   return SourceTerminart != Terminart ||
                                                              SourceRessourcen != Ressourcen ||
                                                        SourceCustomStatus != CustomStatus;
                                         }

                                         protected override void ApplyCustomFieldsValues()
                                            {
                                              SourceTerminart = Terminart;
                                          SourceRessourcen = Ressourcen;
                                              SourceCustomStatus = CustomStatus;
                                         }
                                    }
                                    3. Codeof the AppointmentsInserted event

                                    foreach (Appointment apt in e.Objects)
                                    {
                                         CTerminItem createTerminViaApt = apt.GetSourceObject(schedulerStorage1) as CTerminItem;
                                            //CTerminItem createTerminViaApt = apt.GetRow(schedulerStorage1) as CTerminItem;
                                    ...

                                    At the moment I'm really struggling and I need some assistance.

                                    Thanks in advance,
                                    Chris.

                                0

                                Hello Chris,

                                Unfortunately, there's no built-in functionality to handle the BindingList<T> as custom field data source.
                                I can only suggest that you refer to the AK12443 KB article (How to bind the XtraScheduler with multi-resource appointments to XPO), for an example of persisting the ResourceIDs collection as XML data to be accessed by XtraScheduler methods.

                                Please let me know whether this makes sense.

                                Thank you,
                                Alex.

                                0

                                Hello Alex,
                                this covers the same topic. I have my custom objects which represent appointments, resources and some additional information.

                                1) Resources
                                Do you recommend to map the ressource via the Appointment.Ressources and not with a custom field? Due to the fact that I have my custom objects I don't want to use XPO. Do you have a sample for this topic without XPO?

                                2) Additional appointment information
                                I want to add not only custom objects to an appointment (via custom fields) but also objects which represent a collection or list. Is that possible?

                                Thanks,
                                Chris

                                0

                                Hello Chris,

                                Unfortunately, there's no built-in functionality to handle custom Resource objects in shared resources mode. The Appointment.ResourceIDs property only contains a collection of unique resource identifiers.
                                However, to extend the Appointment item with your custom properties, you can create an Appointment class descendant and support the IAppointmentFactory interface.
                                For a reference, see this documentation topic: XtraScheduler IAppointmentFactory.
                                Does this approach meet your needs?

                                Thank you,
                                Alex.

                                0

                                Hello Alex,
                                at the moment I did not use the IAppointmentFactory interface for my custom appointment but it is still possible to attach my additional information ( a) IEditableObject b) BindingList<T> ) in a custom appointment form. When I close the form I can get the custom objects via:
                                       private void schedulerStorage1_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
                                        {
                                            foreach (Appointment apt in e.Objects)
                                            {
                                                createTerminViaApt = apt.GetRow(schedulerStorage1) as CTerminItem; -> Here I get the IEditableObject back to my structure
                                                createTerminViaApt.Ressourcen = apt.CustomFields["Resources"] as CResList; -> Here the BindingList
                                           ...
                                Now I can work with my data access obejct to bring the information to a database - everything works fine. But I have some problems with existing appointments which already have the custom information in their data structure. In this code:

                                        private void schedulerControl1_EditAppointmentFormShowing(object sender, AppointmentFormEventArgs e)
                                        {
                                            Appointment apt = e.Appointment;

                                ...only the IEditableObject is in proper style assigned. The BindingList is not.

                                So my question is: Am I on the right path? What is the best way / approach?

                                Thanks in advance,
                                Chris.

                                0

                                Hello Christoph,

                                I'm sorry to disappoint you, but there's no capability to handle the BindingList<T> as a custom field data source.
                                So, in this case the problem occurs because the BindingList<T> collection cannot be serialized and de-serialized to a custom field in the appropriate manner.
                                We're sorry for the inconvenience.

                                Thank you,
                                Alex.

                                0

                                Hello Alex,
                                so that was the wrong way - nothing doing! On this account I need a new way to solve my issues. Now, you know a lot about my custom objects. Do you have another idea about to work with my objects in an appointment? Should I use the Resources of the Storage component? Are the XPOs a way?
                                At the moment I'm really struggling and I need some assistance.
                                Thanks in advance,
                                Chris.

                                0

                                Hello Christoph,

                                If you need to serialize a subset of additional properties along with the Appointment, you can define a number of appointment custom fields, and then fill them with data.
                                So, according to your scenario, you might need to put each BindingList<T> item to a separate custom field, and then collect all custom fields data to create a collection, when it's necessary.

                                Please let me know whether this makes sense.

                                Thank you,
                                Alex.

                                0

                                Hello Alex,
                                thanks for your support and your patience with me, but at the moment I'm confused and my head is spinning. So, for clarification maybe it's helpful to sum up the information.
                                I have my object model like this (simplified): [MyAppointmentList]->[MyAppointmentItem]->[MyResourceList]->[MyResourceItem]
                                The serialization (create/update/delete) with my database is done within my model. The scheduler control should "only" display the information and return changes to the model. The bridge between the model [MyAppointmentItem] and the SchedulerSuite is a BindingSource. Due the fact that I have additional information in my object model I've created a custom appointment form by using the EditAppointmentFormShowing event. The additional fields in my [MyAppointmentItem] are added via custom fields in the appointment form. Within the event
                                private void schedulerStorage1_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
                                        {
                                            foreach (Appointment apt in e.Objects)
                                            {
                                                createTerminViaApt = apt.GetRow(schedulerStorage1) as CAppointmentItem;

                                I get access to this information - everything works fine. So now I want to add multiple [MyResourceItem] to [MyAppointmentItem]. I become desperate with worry whenever I try to work with this additional structure.

                                Thanks in advance four your support,
                                Chris.

                                0

                                Hello Christoph,

                                Thanks for the feedback. I believe I understand your goal.
                                Actually, since you are successfully obtaining and modifying the particular CAppointmentItem property of BindingList type via the Appointment.GetRow method, you might not define a custom mapping to hold the BindingList collection, as a part of the Appointment item.
                                That is, each time you need to access the custom resources collection, you can simply obtain the data source row, and then work directly with your business objects infrastructure.
                                At this point, there shouldn't be any problem when utilizing this approach. Please let me know if you're still experiencing any difficulty, or I wasn't clear enough. I'll do my best to assist you.

                                Thank you,
                                Alex.

                                0

                                Hello Alex,

                                now I've played a couple of days with my integration and it looks like that I'am out of the woods. So, I can dig deeper in the world of the XtraScheduler (fetching possiblities, authorization, ...).

                                Thanks for your good guidance
                                Chris

                                0

                                Hello Chris,

                                Thanks for the response. I am glad that my assistance was helpful.
                                You are always welcome to update this thread in case of any related problem.

                                Thank you,
                                Alex.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners