public static void Dequeue(LoginUser loginUser, int ticketID, int userID)
        {
            TicketQueueItem item = TicketQueue.GetTicketQueueItem(loginUser, ticketID, userID);

            if (item != null)
            {
                item.Delete();
                item.Collection.Save();
            }
        }
        public static int GetLastPosition(LoginUser loginUser, int userID)
        {
            TicketQueue queue = new TicketQueue(loginUser);

            using (SqlCommand command = new SqlCommand())
            {
                command.CommandText = "SELECT MAX(Position) FROM TicketQueue WHERE (UserID = @UserID)";
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@UserID", userID);
                object result = queue.ExecuteScalar(command);
                return(result == DBNull.Value ? -1 : (int)result);
            }
        }
Beispiel #3
0
        public static TicketQueueItem GetTicketQueueItem(LoginUser loginUser, int ticketQueueID)
        {
            TicketQueue ticketQueue = new TicketQueue(loginUser);

            ticketQueue.LoadByTicketQueueID(ticketQueueID);
            if (ticketQueue.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(ticketQueue[0]);
            }
        }
        public static TicketQueueItem GetTicketQueueItem(LoginUser loginUser, int ticketID, int userID)
        {
            TicketQueue queue = new TicketQueue(loginUser);

            using (SqlCommand command = new SqlCommand())
            {
                command.CommandText = @"SELECT * FROM TicketQueue WHERE (UserID = @UserID) AND (TicketID = @TicketID)";
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@TicketID", ticketID);
                command.Parameters.AddWithValue("@UserID", userID);
                queue.Fill(command);
            }
            if (queue.IsEmpty)
            {
                return(null);
            }
            return(queue[0]);
        }
        public static void RepositionTickets(LoginUser loginUser, int userID, int[] ticketIDs)
        {
            TicketQueue queue = new TicketQueue(loginUser);

            queue.LoadByUser(userID);
            List <int> list = new List <int>(ticketIDs);

            foreach (TicketQueueItem item in queue)
            {
                item.Position = item.Position + 10000;
            }

            foreach (TicketQueueItem item in queue)
            {
                item.Position = list.IndexOf(item.TicketQueueID);
            }

            queue.Save();
        }
Beispiel #6
0
 public TicketQueueItem(DataRow row, TicketQueue ticketQueue) : base(row, ticketQueue)
 {
     _ticketQueue = ticketQueue;
 }