public Ticket GetTicketbyId(long id) { string sql = "Select * from Ticket where id=@id"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("id", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); Ticket p = null; if (results != null && results.Tables[0].Rows.Count > 0) { p = DataSetParser.DataSetToTicket(results, 0); } return(p); }
public List <Ticket> GetAllTickets() { string sql = "Select * from Ticket"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); DataSet results = ExecuteSql(sql, parameters); List <Ticket> tickets = new List <Ticket>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Ticket p = DataSetParser.DataSetToTicket(results, x); tickets.Add(p); } } return(tickets); }