Exemplo n.º 1
0
        public static TicketHistory GetTicketHistory(IDatabaseProvider db, int id)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            TicketsHistoryTableAdapter tableAdapter = db.DB.TicketsHistoryTableAdapter;

            PeygirDatabaseDataSet.TicketsHistoryDataTable rows = tableAdapter.GetDataByID(id);

            if (rows.Count == 1)
            {
                // Found.
                TicketHistory ticketsHistory = new TicketHistory(rows[0]);
                return(ticketsHistory);
            }

            // Not found.
            return(null);
        }
Exemplo n.º 2
0
        public static TicketHistory[] GetTicketsHistory(IDatabaseProvider db)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            TicketsHistoryTableAdapter tableAdapter = db.DB.TicketsHistoryTableAdapter;

            PeygirDatabaseDataSet.TicketsHistoryDataTable rows = tableAdapter.GetData();

            // Create list.
            List <TicketHistory> ticketsHistory = new List <TicketHistory>();

            foreach (var row in rows)
            {
                // Add.
                TicketHistory ticketHistory = new TicketHistory(row);
                ticketsHistory.Add(ticketHistory);
            }

            return(ticketsHistory.ToArray());
        }