public static int[] Read(TicketAssociation childID, TicketModel destinationTicket, TicketModel sourceTicket) { if (destinationTicket.Connection != sourceTicket.Connection) { throw new Exception("tickets must come from the same connection"); } string query = String.Empty; switch (childID) { case TicketAssociation.QueueUsers: query = $"SELECT TicketQueue.UserID " + $"FROM TicketQueue WITH (NOLOCK) " + $"JOIN Users WITH (NOLOCK) on Users.userid = TicketQueue.userid " + $"LEFT JOIN TicketQueue TicketQueue2 WITH(NOLOCK) on TicketQueue2.userid = TicketQueue.userid and TicketQueue2.ticketid = {destinationTicket.TicketID} " + $"WHERE TicketQueue.ticketid ={sourceTicket.TicketID} and TicketQueue2.TicketQueueID IS NULL and MarkDeleted =0"; break; case TicketAssociation.Relationships1: query = $"SELECT TicketRelationshipID FROM TicketRelationships WITH(NOLOCK) WHERE Ticket1ID={sourceTicket.TicketID} AND Ticket2ID <> {destinationTicket.TicketID}"; break; case TicketAssociation.Relationships2: query = $"SELECT TicketRelationshipID FROM TicketRelationships WITH(NOLOCK) WHERE Ticket2ID={sourceTicket.TicketID} and Ticket1ID={destinationTicket.TicketID}"; break; } return(sourceTicket.ExecuteQuery <int>(query).ToArray()); }
public void ChangeTicketType(int index) { // associate dropdown index with ticket type TicketAssociation ticketAssociation = null; for (int i = 0; i < ticketAssociations.Count; i++) { if (ticketAssociations[i].listIndex == index) { ticketAssociation = ticketAssociations[i]; break; } } if (ticketAssociation == null) { Debug.LogError("No Ticket Association was Found."); } // collect all the tickets that were stored printRoomController.CollectTicketsFromPrinter(printer); // update the ticket type printer.Ticket = ticketAssociation.ticketType; }
private void InitializeTicketDropDown() { ArcadeStatus arcadeStatus = ArcadeManager.ReadArcadeStatus(); ticketAssociations = new List <TicketAssociation>(); int index = 0; // add the none option TicketAssociation ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.None, "None", "Sprites/Currency/Tickets/NoTicket"); ticketAssociations.Add(ticketAssociation); index++; // cabinet tickets if (arcadeStatus.DebugStatus.IsActive) { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.DebugTicket, "Debug Ticket", "Sprites/Currency/Tickets/DebugTicket"); ticketAssociations.Add(ticketAssociation); index++; } // ... // Copy the above for each cabinet ticket // ... if (arcadeStatus.QMGStatus.IsActive) { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.QMGTicket, "Mystery Ticket", "Sprites/Currency/Tickets/QMGTicket"); ticketAssociations.Add(ticketAssociation); index++; } if (arcadeStatus.KNGStatus.IsActive) { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.KNGTicket, "Banana Ticket", "Sprites/Currency/Tickets/KNGTicket"); ticketAssociations.Add(ticketAssociation); index++; } if (arcadeStatus.BRDStatus.IsActive) { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.BRDTicket, "Magic Ticket", "Sprites/Currency/Tickets/BRDTicket"); ticketAssociations.Add(ticketAssociation); index++; } if (arcadeStatus.SNKStatus.IsActive) { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.SNKTicket, "Snake Ticket", "Sprites/Currency/Tickets/SNKTicket"); ticketAssociations.Add(ticketAssociation); index++; } // prize tickets if (true) // figure out condition upon which players can print prize tickets { ticketAssociation = new TicketAssociation(index, TicketPrinter.TicketType.PrizeTicket, "Prize Ticket", "Sprites/Currency/Tickets/PrizeTicket"); ticketAssociations.Add(ticketAssociation); index++; } List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); TicketAssociation selection = null; for (int i = 0; i < ticketAssociations.Count; i++) { // construct options TicketAssociation curr = ticketAssociations[i]; options.Add(new Dropdown.OptionData(curr.label, GameOperations.LoadSpriteFromPath(curr.imagePath))); // find the one that matches our ticket type if (curr.ticketType == printer.Ticket) { selection = curr; } } // set the list of options ticketDropdown.options = options; // set to the current type ticketDropdown.SetValueWithoutNotify(selection.listIndex); ticketDropdown.RefreshShownValue(); }