Вопрос

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));


    }
Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top