public BindableCollection<Server.Entitys.TicketItem> QueuePriority { get; set; } = new BindableCollection<Server.Entitys.TicketItem>(); //Основная очередь #endregion #region EventHandler private void Cashier_PropertyChanged(object sender, PropertyChangedEventArgs e) { var сashier = sender as Сashier; if (сashier != null) { if (e.PropertyName == "CurrentTicket") { try { if (сashier.CurrentTicket != null) //добавить элемент к списку { var ticket = new TicketItem { CashierId = сashier.Id, CashierName = сashier.CurrentTicket.Cashbox.ToString(), TicketName = $"{сashier.CurrentTicket.Prefix}{сashier.CurrentTicket.NumberElement:000}", }; var ticketPrefix = ticket.TicketName.Substring(0, 1); var ticketNumber = ticket.TicketName.Substring(1, 3); var formatStr = $"Талон {ticketPrefix} {ticketNumber} Касса {ticket.CashierName}"; _model.SoundQueue.AddItem(new SoundTemplate(formatStr)); FillTable(ticket, TableMain); сashier.CurrentTicket.StartProcessingTime = DateTime.Now; //_logger.Info(сashier.CurrentTicket.ToString()); } else //удалить элемент из списка { сashier.PreviousTicket.EndProcessingTime = DateTime.Now; ClearTable(сashier.Id, TableMain); //LOG var ticket = сashier.PreviousTicket; var logDict= new Dictionary<string, object> { {"CashierNumber", ticket.Cashbox?.ToString() ?? "неизвестный кассир" }, {"TicketNumber", ticket.Prefix + ticket.NumberElement.ToString("000")}, {"DateAdded2Queue", ticket.AddedTime}, {"StartDateProcessing", ticket.StartProcessingTime}, {"EndDateProcessing", ticket.EndProcessingTime} }; _logger.LogEventContext(logDict); } } catch (Exception ex) { _logger.Error($"ServerModel/Cashier_PropertyChanged= {ex.Message}"); } } } }
/// <summary> /// Заполнить главное табло /// </summary> private void FillTable(TicketItem item, IList<TicketItem> list1) { list1.Add(item); }