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. Image for the cookie policy date
close icon

Appointments with multiple resources

Is it possible to assign an appointment to multiple resources, and if so how is that possible, i've tried leaving the resource id blank and comma separated on my objects and neither currently displays on the resources?

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team September 22, 2017 07:24 AM UTC

 
Thank you for contacting Syncfusion support. 
 
Yes, it is possible to assign multiple resources for a single appointment and for the same we have prepared the below sample for your reference. In the sample db, Meeting appointment will be assigned to 3 resources and it will render in Schedule as shown below. Kindly view the below video demo which will demonstrate the single appointment creation for multiple resources and for this scenario AllowMultiple field should be set to true. 
 
<Code> 
<ej:Schedule ID="Schedule1" ClientIDMode="Static" Height="525px" Width="100%" CurrentDate="5/5/2014" runat="server" DataSourceID="SqlDataSource1">    
    <Group Resources="Owners"/> 
<Resources> 
    <ej:Resources Field="OwnerId" Name="Owners" Title="Owner" AllowMultiple="true"> 
        <ResourceSettings Color="color" Id="id" Text="text"></ResourceSettings> 
    </ej:Resources> 
</Resources> 
     <AppointmentSettings ApplyTimeOffset="false" Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule" ResourceFields="OwnerId"/> 
</ej:Schedule> 
</Code> 
 
 
 
 
 
Note: Even though single appointment is created for 3 resources, db will store the appointment for each resource separately as showm above. 
 
Regards, 
Karthigeyan 




FG Frederik Gysel June 20, 2018 11:59 AM UTC

Hi,

How is the INSERT statement executed 3 times when working with CRUD?

Thank you
Frederik


VS Velmurugan S Syncfusion Team June 21, 2018 01:14 PM UTC

Hi Frederik, 
 
We would like to inform you that, we need to implement a loop to save/insert the created single appointment for multiple resources in the data base table. For example, if you are assigning an appointment for 3 resources, Scheduler will create and send 3 appointment object to the Server Side control method and within that method (ex: CrudResult) we need to include one for loop and save all the three appointment objects in database. Please refer to the following code example to save singe appointment for multiple resources. 
        [WebMethod] 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static List<ScheduleAppointment> CrudResult(List<ScheduleAppointment> added, List<ScheduleAppointment> changed, List<ScheduleAppointment> deleted) 
        { 
            ScheduleDataDataContext db = new ScheduleDataDataContext(); 
            int intMax = db.ScheduleAppointments.ToList().Count > 0 ? db.ScheduleAppointments.ToList().Max(p => p.Id) : 0; 
            if (added != null && added.Count > 0) 
            { 
                for (int i = 0; i < added.Count; i++) 
                { 
                    intMax = db.ScheduleAppointments.ToList().Count > 0 ? db.ScheduleAppointments.ToList().Max(p => p.Id) : 0; 
                    var value = added[i]; 
                    DateTime startTime = Convert.ToDateTime(value.StartTime); 
                    DateTime endTime = Convert.ToDateTime(value.EndTime); 
                    ScheduleAppointment appoint = new ScheduleAppointment(); 
                    appoint.Id = intMax + 1; 
                    appoint.Subject = value.Subject; 
                    appoint.StartTime = startTime; 
                    appoint.EndTime = endTime; 
                    appoint.AllDay = value.AllDay; 
                    appoint.Recurrence = value.Recurrence; 
                    appoint.RecurrenceRule = value.RecurrenceRule; 
                    appoint.OwnerId = value.OwnerId; 
                    db.ScheduleAppointments.InsertOnSubmit(appoint); 
                    db.SubmitChanges(); 
                }                 
            } 
            ---------------------- 
            ---------------------- 
            ---------------------- 
           return db.ScheduleAppointments.ToList(); 
        } 
 
 
We have prepared the Schedule CRUD sample with the above code example and using local database, which can be downloaded from the following location. 
 
Kindly try with the above sample and let us know if you need any further assistance on this. 
Regards,
Velmurugan    


Loader.
Live Chat Icon For mobile
Up arrow icon