0

Hi we are currently working on kendo UI Scheduler and wanting to make the scheduler real time using SignalR.

What we are trying to achieve is if 2 customers are viewing the scheduler at the same time and client 1 makes a booking the 2nd client will see that someone has booked that particular time slot so that double booking does not occur.

also if a client makes a booking on the scheduler then the admin will also see the booking in real time.

currently we have the scheduler inserting to the database with no problem, from there we want to broadcast the newly created booking to all others who are viewing the scheduler at that time.

  1. can this be done? if so any ideas.

i can supply code to what we have done upto now if need required.

my thoughts are to broadcast the new scheduler booking in the ActionScript method then broadcast the new booking to clients from there.

      public ActionResult Tasks_Create([DataSourceRequest]DataSourceRequest request, TaskViewModel task)
    {

        if (ModelState.IsValid)
        {
            using (var sampleDB = new SampleEntities())
                            {
                //Create a new Task entity and set its properties from the posted TaskViewModel
                var entity = new Task
                {
                    TaskID = task.TaskID,
                    Title = task.Title,
                    Start = task.Start,
                    End = task.End,
                    Description = task.Description,
                    RecurrenceRule = task.RecurrenceRule,
                    RecurrenceException = task.RecurrenceException,
                    RecurrenceID = task.RecurrenceID,
                    IsAllDay = task.IsAllDay,
                    OwnerID = task.OwnerID
                };
                sampleDB.Tasks.Add(entity);
                sampleDB.SaveChanges();
                task.TaskID = entity.TaskID;
            }
        }


(i was thinking to broadcast the new booking here using signalr ????)

       return Json(new[] { task }.ToDataSourceResult(request, ModelState));


    }
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
Costas Aletrari
  • 387
  • 5
  • 22

1 Answers1

1

Yes, it can be done (and broadcasting from your controller action is a reasonable approach). You'll probably want to create a group for people who are looking at the same data. Take a look at this section in the docs on how to call client hub methods from non-hub classes.

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
  • thankyou for your input, im a webforms developer and now getting more into mvc, signalr and kendoui. i've seen other coders trying to use kendo listview and grid while using signalr(ticker etcc). and i also noticed that most kendo widgets bind to the mvc controller the same way when using kendo ui for mvc. so its good news. Please correct me if im wrong with my thoughts. thankz again – Costas Aletrari Jan 30 '14 at 09:01
  • Most widgets get their data from the same Kendo DataSource type, so remote binding is the same; to clarify, when you broadcast the added entry, you'll need a client hub method which adds the broadcasted entry to the local data source manually using JavaScript (i.e. SignalR communication is not a built-in transport mode for Kendo DataSource). – Lars Höppner Jan 30 '14 at 09:13
  • So the entry gets inserted on every client that is viewing the scheduler. I thought I was going to broadcast the newly updated json to the client. ? – Costas Aletrari Jan 30 '14 at 21:57
  • you can either broadcast the data for the added item and add it directly, or you can simply notify the clients that the data has changed, and the client can in turn fetch the data using the dataSource.transport.read operation again – Lars Höppner Jan 30 '14 at 22:34
  • You have been a fantastic help to my thought process and I thank u for your time. – Costas Aletrari Jan 30 '14 at 23:28
  • Hi we have been trying to get the kendo scheduler working with signalr, are are able to successfully update the kendo console which now works realtime with the click of a timeslot. our trouble now is adding the event manually with javascript. here is our example – Costas Aletrari Feb 04 '14 at 01:38