Beispiel #1
0
        public async Task <IActionResult> Remove([FromBody] DequeuePosition item)
        {
            if (item is null || item.ServiceType == ServiceType.none)
            {
                return(new BadRequestResult());
            }

            DequeuePositionResult result = await _queueService.RemoveFromQueue(item);

            if (result is null)
            {
                return(new NoContentResult());
            }

            var notification = new QueueNotification
            {
                StationNumber = item.StationNumber,
                UserNumber    = result.CustomerNumberInQueue
            };

            try
            {
                string groupName = item.ServiceType.ToString();
                await _hubContext.Clients.Group(groupName).SendQueueNotificationToGroup(notification);
            }
            catch (Exception)
            {
            }

            return(new OkObjectResult(result));
        }
        public Task <DequeuePositionResult> GetDequeuePositionPharmacy(DequeuePosition position)
        {
            var top = pharmacyQueueMock.First;

            pharmacyQueueMock.Remove(top);

            DequeuePositionResult result = new DequeuePositionResult()
            {
                CustomerID = top.Value.CustomerID, CustomerNumberInQueue = top.Value.CustomerNumberInQueue
            };

            return(Task.FromResult(result));
        }
Beispiel #3
0
        async void ExecuteCallNextCommandAsync()
        {
            try
            {
                DequeuePosition dequeuePosition = new DequeuePosition()
                {
                    ServiceType = Model.StationServiceType, StationNumber = Model.StationNumber
                };

                DequeuePositionResult result = await http.CallNextInQueueAsync(dequeuePosition);

                if (result == null)
                {
                    dialog.ShowMessage("There are no client wating for treatment");
                    return;
                }

                DequeueModel.CustomerId   = result.CustomerID;
                DequeueModel.QueueuNumber = result.CustomerNumberInQueue;

                // Send last client as a treatment report
                if (DequeueModel.CustomerId > 0)
                {
                    CustomerTreatment treatment = new CustomerTreatment()
                    {
                        CustomerId         = DequeueModel.CustomerId,
                        TreatingEmployeeId = Model.EmployeeId,
                        DateOfTreatment    = DateTime.Now
                    };
                    await http.SendTreatmentReportAsync(treatment);
                }
            }
            catch (Exception e)
            {
                dialog.ShowMessage(e.Message);
            }
        }