Example #1
0
        private SqlCommand buildCmd(TicketDTO ticket)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.AddWithValue("ID", ticket.getID());
            cmd.Parameters.AddWithValue("ShowID", ticket.getShowID());
            cmd.Parameters.AddWithValue("Row", ticket.getRow());
            cmd.Parameters.AddWithValue("Col", ticket.getColumn());
            return(cmd);
        }
Example #2
0
        public TicketModel map(TicketDTO ticketdto)
        {
            TicketModel model = new TicketModel();

            model.setID(ticketdto.getID());
            model.setShowID(ticketdto.getShowID());
            model.setRow(ticketdto.getRow());
            model.setColumn(ticketdto.getColumn());

            return(model);
        }
Example #3
0
        public bool updateTicket(TicketDTO ticket)
        {
            SqlCommand cmd = buildCmd(ticket);

            cmd             = connectToDB(cmd);
            cmd.CommandText = "update Tickets set ShowID = @ShowID, Row = @Row, Col = @Col where ID=@ID";
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
            TicketDTO oldTicket = ticketsList.Find(tkt => tkt.getID() == ticket.getID());

            ticketsList.Remove(oldTicket);
            ticketsList.Add(ticket);
            return(true);
        }