public bool CanVoidSelectedItems(IEnumerable <TicketItem> items) { if (!CanRemoveSelectedItems(items)) { return(false); } foreach (var item in items) { if (!TicketItems.Contains(item)) { return(false); } if (item.Voided) { return(false); } if (item.Gifted) { return(false); } if (!item.Locked) { return(false); } } return(true); }
public bool CanCancelSelectedItems(IEnumerable <TicketItem> items) { if (items.Count() == 0) { return(false); } foreach (var item in items) { if (!TicketItems.Contains(item)) { return(false); } if (item.Locked && !item.Gifted) { return(false); } } return(true); }
public IEnumerable <TicketItem> ExtractSelectedTicketItems(IEnumerable <TicketItem> selectedItems) { var newItems = new List <TicketItem>(); foreach (var selectedTicketItem in selectedItems) { Debug.Assert(selectedTicketItem.SelectedQuantity > 0); Debug.Assert(TicketItems.Contains(selectedTicketItem)); if (selectedTicketItem.SelectedQuantity >= selectedTicketItem.Quantity) { continue; } var newItem = CloneItem(selectedTicketItem); newItem.Quantity = selectedTicketItem.SelectedQuantity; selectedTicketItem.Quantity -= selectedTicketItem.SelectedQuantity; newItems.Add(newItem); } return(newItems); }