Example #1
0
        public PartialViewResult GetOutQueue(int Id)
        {
            _queueRepository.GetOut(Id, StatesClient.GetOut);

            Operation operation = _queueRepository.GetCountClientsInQueue(Id);

            string connectionId = _hub.GetConnectionIdByLogin(HttpContext.User.Identity.Name);
            var    context      = GlobalHost.ConnectionManager.GetHubContext <QueueHub>();

            if (!string.IsNullOrEmpty(connectionId))
            {
                context.Clients.Client(connectionId).enabledBtnInQueue();
            }
            ;
            context.Clients.All.changeCountClients(operation.CountClients, operation.Id);
            context.Clients.All.removeClientFromQueue(Id);


            Employee employee = _queueRepository.GetServicingEmployee(Id);

            if (employee != null && employee.EmployeeId > 0)
            {
                connectionId = _hub.GetConnectionIdByLogin(employee.Login);
                if (!string.IsNullOrEmpty(connectionId))
                {
                    context.Clients.Client(connectionId).addMessageEmployee("Клиент покинул очередь");
                }
                ;
            }
            ;

            return(PartialView("Label"));
        }