Example #1
0
        public async Task <IActionResult> PrintPrioNo(int counterTypeId, bool isSpecial)
        {
            var connectionId = HttpContext.Request.Headers["Connection-Id"];

            var ticketNo = await _transService.PrintPrioNo(counterTypeId, isSpecial);

            var counter = await _counterRepo.Get(counterTypeId);

            if (counter == null)
            {
                throw new NullReferenceException("The counter is not found");
            }

            // look for the desktop device
            var device = await _devRepo.GetDesktop();

            if (device == null)
            {
                throw new NullReferenceException("The desktop device is not found");
            }

            if (string.IsNullOrWhiteSpace(ticketNo.Item1) ||
                string.IsNullOrWhiteSpace(ticketNo.Item2) ||
                ticketNo.Item3 == 0)
            {
                return(Ok());
            }

            // broadcasts the ticketNo to the ticketing app
            if (!string.IsNullOrEmpty(connectionId))
            {
                await _hubContext.Clients.Client(connectionId).TicketNo(ticketNo.Item1,
                                                                        ticketNo.Item2, ticketNo.Item3);
            }

            await BroadcastWaitingClients(counter.CounterNo);

            return(Ok());
        }
Example #2
0
        public async Task <IActionResult> GetCounterInfo(int counterId)
        {
            var counter = await _cRepo.Get(counterId);

            return(Ok(counter));
        }