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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Scheduler in Resource View

Thread ID:

Created:

Updated:

Platform:

Replies:

120542 Sep 24,2015 03:25 PM UTC Sep 25,2015 09:36 AM UTC ASP.NET MVC 1
loading
Tags: Schedule
saravanan
Asked On September 24, 2015 03:25 PM UTC


Hi,
       I have two tables Resources and Booking.

      Resource Table has the following fields.

      Id       Name

      1         Discussion Room
      2         Learning Room

     and the booking table is used to book an appointment. The fields for the booking table are as follows.

    BookingId    ResourceId     Start time          End time          

     I need to get the resource from the resource table and bind it to schedule control like.


                          Discussion Room            Learning Room

12.00 AM      


1.00 AM


2.00 AM


3.00 AM

    when book an appointment,  i need to get the resourceid and persist in the booking table.

    Could give me the  sample source for this scenario.


Thanks
Saravanan .T



      


   


Sarath Kumar P K [Syncfusion]
Replied On September 25, 2015 09:36 AM UTC

Hi Saravanan,

Thanks for contacting Syncfusion support.

We have prepared a schedule sample to meet your requirement which can be downloaded from the following location.
http://www.syncfusion.com/downloads/support/forum/120542/ze/ScheduleMultipleResource1236107123

In the above sample we have used two database table, named Booking for appointments and Resources for resource data. We bind those data value in schedule as shown in the following code example:
<code>
[index.cshtml]

@(Html.EJ().Schedule("Schedule1")

     .Width("100%")

     .Height("525px")

         .Resources(res => { res.Field("ResourceId").Title("Owner").Name("Owners").AllowMultiple(true).ResourceSettings(flds => flds.Datasource(ds => ds.URL("/Home/GetResources")).Text("Text").Id("Id").Color("Color")).Add(); })     //Bind the resource data value to schedule

            .Group(gr =>

            {

                gr.Resources(ViewBag.Resources);

            })

     .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor("UrlAdaptor"))   //Bind the appointments data to get and also perform CRUD operation

     .Id("BookingId")

     .StartTime("StartTime")

     .EndTime("EndTime")

     .ResourceFields("ResourceId")            //Bind the appointmentSetting field for resource to process the resource value

     .StartTimeZone("StartTimeZone")

     .EndTimeZone("EndTimeZone"))
)

[HomeController.cs]

        public JsonResult GetData()          //Method to get the appointments data

        {

            IEnumerable data = new ScheduleDataDataContext().Bookings.Take(100);

            return Json(data, JsonRequestBehavior.AllowGet);

        }


        public JsonResult GetResources()      //Method to get the resources data

        {

            IEnumerable data = new ScheduleDataDataContext().Resources.Take(100);

            return Json(data, JsonRequestBehavior.AllowGet);
        }
</code>


Regards,
Sarath Kumar P K

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.

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

;