private bool ShouldDisplayTicketTagList(Ticket ticket) { return ticket != null && ticket.Orders.Count == 0 && _applicationState.GetTicketTagGroups().Any(x => x.AskBeforeCreatingTicket && !ticket.IsTaggedWith(x.Name)); }
public bool TicketTagSelected(Ticket currentTicket, TicketTagGroup tagGroup) { SelectedTicket = currentTicket; IsFreeTagEditorVisible = tagGroup.FreeTagging; SelectedTicketTagData = tagGroup; List<TicketTag> ticketTags; if (IsFreeTagEditorVisible) { ticketTags = _cacheService.GetTicketTagGroupById(tagGroup.Id) .TicketTags.OrderBy(x => x.Name).ToList(); } else { ticketTags = _applicationState.GetTicketTagGroups().Where( x => x.Name == tagGroup.Name).SelectMany(x => x.TicketTags).ToList(); } ticketTags.Sort(new AlphanumComparator()); TicketTags.AddRange(ticketTags); if (SelectedTicket.IsTaggedWith(tagGroup.Name)) { if (TicketTags.Count == 1) { UpdateTicketTag(SelectedTicket, SelectedTicketTagData, TicketTag.Empty); return true; } if (!tagGroup.ForceValue) TicketTags.Add(TicketTag.Empty); } if (TicketTags.Count == 1 && !IsFreeTagEditorVisible) { UpdateTicketTag(SelectedTicket, SelectedTicketTagData, TicketTags[0]); return true; } RaisePropertyChanged(() => TagColumnCount); RaisePropertyChanged(() => IsFreeTagEditorVisible); RaisePropertyChanged(() => FilteredTextBoxType); return false; }