示例#1
0
 public static ZanrDTO readerToZanrDTO(MySqlDataReader reader)
 {
     ZanrDTO zanr = new ZanrDTO();
     zanr.Id = reader.GetInt32("idZanr");
     zanr.Naziv = reader["nazivZanr"].ToString();
     return zanr;
 }
示例#2
0
 public int insert(ZanrDTO zanr)
 {
     if(zanr==null)
         return 0;
     MySqlConnection conn = ConnectionPool.checkOutConnection();
     MySqlCommand command = conn.CreateCommand();
     command.CommandText = insertQuerry;
     command.Parameters.AddWithValue("naziv", zanr.Naziv);
     command.ExecuteNonQuery();
     int id =(int) command.LastInsertedId;
     ConnectionPool.checkInConnection(conn);
     return id;
 }
示例#3
0
 public List<FilmDTO> getAllByZanr(ZanrDTO zanr)
 {
     MySqlConnection connection = ConnectionPool.checkOutConnection();
     MySqlCommand command = connection.CreateCommand();
     command.CommandText = getByZanrQuerry;
     command.Parameters.AddWithValue("idZanr", zanr.Id);
     MySqlDataReader reader = command.ExecuteReader();
     List<FilmDTO> lista = new List<FilmDTO>();
     while (reader.Read())
     {
         FilmDTO film = readerToFilmDTO(reader);
         film.Zanr = zanr;
         film.Status = MySqlStatusFilmDAO.readerToStatusFilmDTO(reader); ;
         film.Distributer = MySqlDistributerDAO.readerToDistributer(reader);
         lista.Add(film);
     }
     reader.Close();
     ConnectionPool.checkInConnection(connection);
     return lista;
 }